[MPlayer-dev-eng] A/V sync problem with independent demuxers

Ross Finlayson finlayson at live.com
Sun Mar 2 17:22:47 CET 2003


I have found that MPlayer's internal A/V synchronization mechanism often 
does not work well for situations (such as RTP streaming) in which the 
audio and video demuxers are independent (i.e., are each fed from a 
different input stream, rather than both being tied to a single input 
stream).  In this case, the packets read for each demuxer (using 
"demux_fill_buffer()") are given the correct "pts" (presentation 
timestamp), but the rest of MPlayer often (but not always) fails to 
maintain A/V synchronization.

I have seen two different situations occur.  The first situation occurs 
when the user presses the space bar to pause the playout.  At this point 
the audio and video playout both stop immediately, as they should.  But 
after the user presses the space bar again to resume playing, video gets 
several seconds ahead of audio (i.e., "A-V:" is negative).  The length of 
the gap seems to correlate to the duration of the pause.  Thus, it seems 
that MPlayer's internal buffering is not handling pauses correctly.  One 
thing I noticed is that immediately after pressing the space bar to resume 
playback after the pause, MPlayer issues an unusual number of reads to the 
audio demuxer, before it resumes reading from the video demuxer.

The second situation is less repeatable.  Sometimes video goes into 'slow 
motion', and as a consequence gets several seconds *behind* audio (i.e., 
"A-V:" is positive).  In this case the A-V gap often keeps increasing over 
time.  While this is happening, the video demuxer is being read far less 
frequently than it should (which is why video is falling behind 
audio).  This happens most often at the start of playing a stream.

I have seen this problem happen when audio and video are MPEG-1 or 2 
elementary streams; I have not yet confirmed whether or not the same 
problem occurs with other codecs (but I suspect they probably do).

Could someone who's familiar with MPlayer's A/V synchronization mechanism 
take a look at how it deals with independent audio/video demuxers?

	Ross. 



More information about the MPlayer-dev-eng mailing list