Fixed rounding error in avi frame rate calculation. Fixed avi fps calculation to account for the case where the user has integer frame rate selected.

This commit is contained in:
mjbudd77 2021-08-21 10:35:29 -04:00
parent c719058991
commit 5db7abf118
2 changed files with 5 additions and 4 deletions

View File

@ -43,6 +43,7 @@
#include "Qt/AviRecord.h"
#include "Qt/avi/gwavi.h"
#include "Qt/nes_shm.h"
#include "Qt/throttle.h"
#include "Qt/ConsoleWindow.h"
#include "Qt/ConsoleUtilities.h"
#include "Qt/fceuWrapper.h"
@ -519,7 +520,7 @@ int aviRecordOpenFile( const char *filepath )
{
delete gwavi; gwavi = NULL;
}
fps = ((double)FCEUI_GetDesiredFPS()) / 16777216.0;
fps = getBaseFrameRate();
g_config->getOption("SDL.Sound.Rate", &audioSampleRate);
@ -786,7 +787,7 @@ void AviRecordDiskThread_t::run(void)
setPriority( QThread::HighestPriority );
fps = ((double)FCEUI_GetDesiredFPS()) / 16777216.0;
fps = getBaseFrameRate();
avgAudioPerFrame = ( audioSampleRate / fps) + 1;

View File

@ -114,7 +114,7 @@ gwavi_t::open(const char *filename, unsigned int width, unsigned int height,
perror("gwavi_open: failed to open file for writing");
return -1;
}
usec = (unsigned int)(1000000.0 / fps);
usec = (unsigned int)((1000000.0 / fps)+0.50);
printf("FPS: %f %u\n", fps, usec );
/* set avi header */
@ -506,7 +506,7 @@ gwavi_t::set_framerate(double fps)
{
unsigned int usec;
usec = (unsigned int)(1000000.0 / fps);
usec = (unsigned int)((1000000.0 / fps)+0.50);
stream_header_v.time_scale = usec;
stream_header_v.data_rate = 1000000;