[MPlayer-dev-eng] [PATCH] A/V sync improvement for TV streams

Laurent laurent.aml at gmail.com
Fri Oct 17 17:16:27 CEST 2008


Greetings,

I've been trying to get a correct A/V sync on TV streams using
immediatemode=0 (audio going through MPlayer).

Basically, my command is (under Windows, using tvi_dshow acquisition tuner):
  mplayer.exe -tv immediatemode=0 tv://1
Autosync is disabled. As far as I undestand it, autosync only correct
pts drift, which does not exist in my case. And from experience,
autosync is failing to sync the TV A/V, even with the patch I propose.


I encountered a number of issues which the proposed patches intend to fix.

Issue 1:
* pts_bytes, which gives the number of bytes read since the last pts,
is not computed correctly within the libmpdemux/demuxer.c file. It is
updated when buffers are filled, while it should be updated when they
are read.
With the proposed patch, the a_pts calculation, that relies on
sh_audio->pts_bytes in mplayer.c gets accurate.

Issue 2:
* the pts from the TV audio stream is not passed through the PCM
decoder (libmpcodecs/ad_pcm.c), and hence is lost and cannot be used
in mplayer.c for A/V sync. This is fixed by the second patch.

Issue 3:
* TV streams are particular because mplayer cannot read frames faster
than they are acquired. Eventually, you can get short of audio frames
to grab from the demuxer. This is usually not a problem as there are
still audio frames buffered in the audio pipe to the speakers (in
audio filters and audio output drivers), and new audio frames will be
available soon enough from the demuxer.
The proposed (3rd) patch just ensure that mplayer continues to make
its sync work as long as there is some audio frames to sync with in
the audio pipe.


I've seen that other people having issues with dvb a/v sync. These
patches might help them, as the use case seems similar.

Thanks,
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libmpdemux-demuxer-syncfix.patch
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20081017/131fbdbd/attachment.asc>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libmpcodecs-ad_pcm-syncfix.patch
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20081017/131fbdbd/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mplayer-syncfix.patch
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20081017/131fbdbd/attachment-0001.asc>


More information about the MPlayer-dev-eng mailing list