Skip to content

Commit 956b4f2

Browse files
committed
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.
1 parent 2fe9124 commit 956b4f2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

mythtv/libs/libmythtv/mythplayer.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,19 +1909,21 @@ void MythPlayer::AVSync(VideoFrame *buffer, bool limit_delay)
19091909
avsync_delay = 90000;
19101910
avsync_avg = (avsync_delay + (avsync_avg * 3)) / 4;
19111911

1912+
int avsync_used = avsync_avg;
1913+
if (labs(avsync_used) > labs(avsync_delay))
1914+
avsync_used = avsync_delay;
1915+
19121916
/* If the audio time codes and video diverge, shift
19131917
the video by one interlaced field (1/2 frame) */
19141918
if (!lastsync)
19151919
{
1916-
if (avsync_avg > frame_interval * 3 / 2)
1920+
if (avsync_used > refreshrate)
19171921
{
19181922
avsync_adjustment += refreshrate;
1919-
lastsync = true;
19201923
}
1921-
else if (avsync_avg < 0 - frame_interval * 3 / 2)
1924+
else if (avsync_used < 0 - refreshrate)
19221925
{
19231926
avsync_adjustment -= refreshrate;
1924-
lastsync = true;
19251927
}
19261928
}
19271929
else
@@ -1932,6 +1934,10 @@ void MythPlayer::AVSync(VideoFrame *buffer, bool limit_delay)
19321934
ResetAVSync();
19331935
}
19341936
}
1937+
else
1938+
{
1939+
VERBOSE(VB_PLAYBACK+VB_TIMESTAMP, LOC + QString("A/V no sync proc ns:%1").arg(normal_speed));
1940+
}
19351941
}
19361942

19371943
void MythPlayer::RefreshPauseFrame(void)

0 commit comments

Comments
 (0)