File tree 1 file changed +10
-6
lines changed
1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -325,8 +325,7 @@ class VpxPlayer : public MoviePlayer
325
325
vpx_codec_ctx_t codec{};
326
326
vpx_codec_iter_t iter = nullptr ;
327
327
328
- uint32_t convnumer;
329
- uint32_t convdenom;
328
+ double convrate;
330
329
331
330
uint64_t nsecsperframe;
332
331
uint64_t nextframetime;
@@ -398,15 +397,20 @@ class VpxPlayer : public MoviePlayer
398
397
if (numframes == 0 ) return false ;
399
398
fr.Seek (4 , FileReader::SeekCur);
400
399
401
- if (fpsdenominator > 1000 || fpsnumerator == 0 || fpsdenominator == 0 )
400
+ if (fpsnumerator == 0 || fpsdenominator == 0 )
402
401
{
403
402
// default to 30 fps if the header does not provide useful info.
404
403
fpsdenominator = 30 ;
405
404
fpsnumerator = 1 ;
406
405
}
407
406
408
- convnumer = 120 * fpsnumerator;
409
- convdenom = fpsdenominator * origframedelay;
407
+ if (origframedelay < 1 )
408
+ convrate = 0.0 ;
409
+ else
410
+ {
411
+ convrate = 120.0 * double (fpsnumerator);
412
+ convrate /= double (fpsdenominator) * double (origframedelay);
413
+ }
410
414
411
415
nsecsperframe = int64_t (fpsnumerator) * 1'000'000'000 / fpsdenominator;
412
416
nextframetime = 0 ;
@@ -577,7 +581,7 @@ class VpxPlayer : public MoviePlayer
577
581
if (framenum >= numframes) stop = true ;
578
582
579
583
bool nostopsound = (flags & NOSOUNDCUTOFF);
580
- int soundframe = convdenom ? Scale (framenum, convnumer, convdenom ) : framenum;
584
+ int soundframe = (convrate > 0.0 ) ? int (convrate * framenum ) : framenum;
581
585
if (soundframe > lastsoundframe)
582
586
{
583
587
if (soundtrack == -1 )
You can’t perform that action at this time.
0 commit comments