id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc,mlocked 5265,AVSync problem with certain BBC programmes,jackanddougal@…,Isaac Richards,"Since changing the video card in my machine to one that actually supports interlaced-output (connected directly to a TV via an VGA->RGB-Scart lead), I attempted to use XvMC as the software decoding was too slow to generate the full resolution display (only a 800MHz PIII:)). This all appeared to be good except for certain BBC programmes (generally the high budget dramas and the like) which have very bad audio/video sync issues, including stuttering, pauses etc. In fact, when I set the recording to start 5 minutes early, the content before the programme is fine, but as soon as the programme starts (within frames) the problem occurs. After many hours looking at the decoder, playback and audio playback loops, and adding addititional logging in these areas, I determined that the root cause is that these programmes have multiple audio streams in them, #1 (the main stereo feed) one running typically 260ms behind the video stream, #2 (audio description) ruinning around 700ms ahead of the video stream. The problem is that the 'lastapts' value is set whenever either audio stream is decoded (so it swings by around 1000ms total) which confuses the playback code. The solution is to only set 'lastapts' when you are actually decoding the audio stream that is playing. A patch is attached (based on 0.21-fixes) to do this. I don't know why this only effects XvMC rather than the software decoders, but I suspect it is due to having a limited number of XvMC frame buffers available. This problem has existed ever since the 'properly support multiple audio streams' change went in at 4281, so it may well account for the large number of NVIDIA users on the web complaining about choppy playback with SDTV content. Cheers Daniel ",patch,closed,critical,0.22,Video Playback,0.21-fixes,high,fixed,easy,,0