Skip to content
Browse files

Comments by Mark Spieth:

"Due to the fact that refresh rate is the fundamental output timing rate, not the input rate which can be anything. The av_sync adjustment needs to be with respect to the resfresh rate and not frame interval. However, no real proof that this is any better or worse but just IMO more logically correct and consistent."

"avsync_used is the minimum of the delayed estimate and the current value of avsync (with the delay from last vsync event included). This improves lock time as the smallest value is the better one to use just in case the instantaneous value deviates from the steady state. Also speeds up initial lock time as avdel is 0 initially."

Refs #7964.
  • Loading branch information...
1 parent 2fe9124 commit 956b4f277fa23d8d8fc98b82f0911da642b18305 @tralph tralph committed
Showing with 10 additions and 4 deletions.
  1. +10 −4 mythtv/libs/libmythtv/mythplayer.cpp
View
14 mythtv/libs/libmythtv/mythplayer.cpp
@@ -1909,19 +1909,21 @@ void MythPlayer::AVSync(VideoFrame *buffer, bool limit_delay)
avsync_delay = 90000;
avsync_avg = (avsync_delay + (avsync_avg * 3)) / 4;
+ int avsync_used = avsync_avg;
+ if (labs(avsync_used) > labs(avsync_delay))
+ avsync_used = avsync_delay;
+
/* If the audio time codes and video diverge, shift
the video by one interlaced field (1/2 frame) */
if (!lastsync)
{
- if (avsync_avg > frame_interval * 3 / 2)
+ if (avsync_used > refreshrate)
{
avsync_adjustment += refreshrate;
- lastsync = true;
}
- else if (avsync_avg < 0 - frame_interval * 3 / 2)
+ else if (avsync_used < 0 - refreshrate)
{
avsync_adjustment -= refreshrate;
- lastsync = true;
}
}
else
@@ -1932,6 +1934,10 @@ void MythPlayer::AVSync(VideoFrame *buffer, bool limit_delay)
ResetAVSync();
}
}
+ else
+ {
+ VERBOSE(VB_PLAYBACK+VB_TIMESTAMP, LOC + QString("A/V no sync proc ns:%1").arg(normal_speed));
+ }
}
void MythPlayer::RefreshPauseFrame(void)

0 comments on commit 956b4f2

Please sign in to comment.
Something went wrong with that request. Please try again.