[mythtv] AVSync2 Refinements

Mark Kendall mark.kendall at gmail.com
Wed Dec 11 14:21:04 UTC 2019

On Wed, 11 Dec 2019 at 14:14, Tim Pletcher <pletchtd at gmail.com> wrote:
> Hi Mark,
> I added the filter in with a second patch and posted on the ticket last evening.  I saw this was picked up and rolled into master just a bit ago.


Thanks again for looking at this.

Did you spot my comment in the commit re the change to 0.4 for
s_av_control_gain? Was that the correct call? :)

> If anyone is interested, I threw together a crude simulation to theoretically demonstrate the different control responses with the various control options (plot shown at: https://imgur.com/a/DDBxcQR).  On the the plot, the green line is the gain only implementation and the red line is the gain + filter implementation provided in the second patch revision. The control loop will settle in around the process mean which includes the jitter / noise so it may have a little zero offset but this should not be enough to be evident for the user.
> I have tested with 1280x720_59.94 & 1080i_29.97 live television content using both VAAPI and NVDEC with no issues thus far.
> During my morning commute today, I was thinking about the sync values displayed in the Playback Data window on the frontend.  Currently, we are showing the raw unfiltered sync measurements as calculated using the difference of the audio and the video timestamps.  In the presence of jitter, this can be misleading to the user on the true sync quality.  However, the current implementation does make it clearly evident that the sync measurement is highly variable.  As an alternative, we could consider showing the filtered value on which the sync control loop is acting which would be more representative of what the system is actually trying to control against.
> I think this would require changing line 1709 in mythplayer.cpp from this:
> avsync_avg = static_cast<int>(audio_adjustment * 1000);
> to this:
> avsync_avg = static_cast<int>(last_fix * 1000 / s_av_control_gain);

I think we should be showing the filtered value.


More information about the mythtv-dev mailing list