[mythtv] AVSync2 Refinements

Tim Pletcher pletchtd at gmail.com
Wed Dec 18 14:47:33 UTC 2019

> I've pushed an update to use 0.4 and 0.9.
> I'm not seeing any issues with regular video playback on intel
> (vaapi/software), nvidia (nvdec,vdpau,software) and Pi4.
> There are some issues - and I'll caveat these by saying I'm not sure
> whether they result from the recent avsync changes, from the long
> standing avsync2 code or other changes I've made recently.
> Firstly - playback of audio only files seems a little broken.
> Particularly MHEG/DVB radio and seeking. This may be related to a
> small fix I added for MHEG only streams - I need to check.
> Secondly - video only streams sometimes struggle to settle down at the
> start of playback - though I'm starting to wonder whether this is
> purely a Raspberry Pi issue.
> Thirdly - there is some very strange behaviour on OSX under certain
> conditions. Sometimes the video continually speeds up and slows down.
> Piotr reported this the other day and I can reproduce on my (very) old
> macbook. For me I only see it when using the inbuilt display and
> certain interlaced videos using double rate deinterlacing. If I
> connect to an external display, everything is fine. Due to the
> limitations of the macbook, I can't test heavily before I max it out -
> and frames are dropped naturally.
> The oddity with OSX internal displays is that they do not have a fixed
> refresh rate. Furthermore, vsync always falls back to busy wait - as
> there is no DRM. So the rendering code will not block in the same way
> when displaying a frame. I presume it will rate limit any refresh
> rates to the overall max for the display (presumably 60Hz) - but
> otherwise it doesn't appear to wait for OpenGL vsync (but it isn't
> tearing). I can't get my Christmas limited brain power around what
> might be happening. I should add that CPU load is low and OSX has no
> OpenGL performance monitors - so cannot check the GPU.
> Anyone have any ideas?
> Regards
> Mark
> Thank you Mark.

In the second and third cases you mention above, does the timestamp data
provide any clues as to what is occuring?

To provide better visibility of what is going on, I have been patching
mythplayer lib to also emit the lastfix value with the timestamp data when
I wish to troubleshoot.  I also hacked together this simple bash script
(attached) to parse the data into a comma delimited text file for easier
viewing of the data in a spreadsheet program.

I have been thinking about implementing a simple adaptive filtering /
control algorithm which would dynamically adjust the filtering coefficient
between an upper and lower bound based on the standard deviation of the
sync calculated over a shifting window of frames.  I believe the comments
from Mark S earlier in this thread also essentially propose an adaptive
filter approach but I need spend some time examining.  On the flip side, I
am hesitant to add complexity if not needed / really valuable.

If you send me some frontend log data with timestamps, I'd be happy to look
over in order to see if the data suggests these are control problems or
caused by something else.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20191218/8fe2c557/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mfe_parse.sh
Type: text/x-sh
Size: 1294 bytes
Desc: not available
URL: <http://lists.mythtv.org/pipermail/mythtv-dev/attachments/20191218/8fe2c557/attachment.bin>

More information about the mythtv-dev mailing list