[mythtv] AV-Sync problem
Ed W
lists at wildgooses.com
Thu Apr 23 19:23:13 UTC 2009
David Wong wrote:
> I tried MythTV standard decoder and xv-blit renderer.
> It hits a longer time before audio buffer starting to underrun.
>
> I further look into the stream using my home-brew TS demuxer.
> Video and Audio PES packets are almost 2 seconds apart
>
> See attached log.
> PID 141 is video, PID 142 is audio
> PTS rate should be 90000 per second.
>
> I checked the libmythtv code. It seems directly sending audio data to buffer via AddAudioData(),
> whenever avformatdecoder hit an audio frame. But video has it own output thread and queue.
> I have perception that with this architecture, the AV-Sync is very rely on the tight distance
> between video and audio packet.
>
> It is better that both Video and Audio have their own output buffer,
> each data chunk entry in each buffer should associated with time stamp.
> Video and audio are then sent out when time reached.
> At start of clip, there may be video without corresponding audio.
> Then just send out video first and then start to send out audio when at
> appropriate time.
>
I *think* this is an issue I see on UK DVB on any black scenes - I had
presumed that the gap between video and audio was getting too large (but
still acceptable). I haven't had a chance to debug this in any detail
though
Also have you checked that it's not the audio buffer which is
overflowing rather than the video? I think the choppiness may be due to
the lag in refilling the audio buffer once it's decided that it's
desynced - ie it's a bit circular and one effect drives the other?
Good luck
Ed W
More information about the mythtv-dev
mailing list