Skip to content

Commit

Permalink
Playback: AvSync2 fix fast forward/rewind
Browse files Browse the repository at this point in the history
Fast forward and rewind were not handling frame timing correctly so that
they were dropping frames, resulting in no frames displayed in some cases.

(cherry picked from commit 4089bf1)
  • Loading branch information
bennettpeter committed Mar 10, 2019
1 parent 042c180 commit 90468ec
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -2212,6 +2212,12 @@ void MythPlayer::AVSync2(VideoFrame *buffer)

now = QDateTime::currentDateTimeUtc();
unow = now.toMSecsSinceEpoch() * 1000;

if (!normal_speed || FlagIsSet(kMusicChoice))
{
framedue = unow + frame_interval;
break;
}
// first time or after a seek - setup of rtcbase
if (rtcbase == 0)
{
Expand Down Expand Up @@ -2249,10 +2255,10 @@ void MythPlayer::AVSync2(VideoFrame *buffer)
lateness = unow - framedue;
dropframe = false;
if (lateness > 30000)
dropframe = !FlagIsSet(kMusicChoice) && numdroppedframes < 10;
dropframe = numdroppedframes < 10;

if (lateness <= 30000 && prior_audiotimecode > 0
&& prior_videotimecode > 0 && normal_speed && !FlagIsSet(kMusicChoice))
&& prior_videotimecode > 0)
{
// Get video in sync with audio
audio_adjustment = prior_audiotimecode - prior_videotimecode;
Expand All @@ -2279,8 +2285,7 @@ void MythPlayer::AVSync2(VideoFrame *buffer)
pause_audio = true;
}
// sanity check - reset rtcbase if time codes have gone crazy.
if ((lateness > AVSYNC_MAX_LATE || lateness < - AVSYNC_MAX_LATE)
&& !FlagIsSet(kMusicChoice))
if ((lateness > AVSYNC_MAX_LATE || lateness < - AVSYNC_MAX_LATE))
{
framedue = 0;
rtcbase = 0;
Expand Down

0 comments on commit 90468ec

Please sign in to comment.