[mythtv] AVSync2 Refinements

Tim Pletcher pletchtd at gmail.com
Wed Dec 11 14:14:03 UTC 2019


On Tue, Dec 10, 2019 at 8:01 AM Mark Kendall <mark.kendall at gmail.com> wrote:

> On Tue, 10 Dec 2019 at 01:05, Tim Pletcher <pletchtd at gmail.com> wrote:
> >
> > I revised Mark's patch with the updates I discussed above and created
> ticket #13536.  The updated patch is attached there.
> >
> > Everything compiled fine for me and performance looked good in the
> limited testing I performed.
> >
>
> Tim
>
> I'm curious as to whether using the first version of your patch and
> retaining the last_fix value would, in theory at least, be better?
>
> i.e. use both gain and filtering
>
> Just about to test revised patch.
>
> Thanks and regards
> Mark
>
> 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.

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);

Thanks and kind regards,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20191211/0beac84e/attachment.htm>


More information about the mythtv-dev mailing list