[MPlayer-dev-eng] [patch] fix premature end of audio playback

Jindrich Makovicka makovick at kmlinux.fjfi.cvut.cz
Sat Jan 7 15:28:21 CET 2006


Jindrich Makovicka wrote:
> Reimar Döffinger wrote:
> 
>>Hi,
>>On Thu, Dec 29, 2005 at 06:15:24PM +0100, Jindrich Makovicka wrote:
>>
>>
>>>this patch fixes $subj when playing through audio filters.
>>>
>>>The bug can be observed on http://voffka.com/archives/zp.avi
>>>
>>>  while(sh_audio->a_out_buffer_len<playsize &&
>>>-        (!d_audio->eof || sh_audio->a_in_buffer_len > 0)){
>>>+        (!d_audio->eof || sh_audio->a_in_buffer_len > 0 || sh_audio->a_buffer_len > 0)){
>>>    int ret=decode_audio(sh_audio,&sh_audio->a_out_buffer[sh_audio->a_out_buffer_len],
>>>        playsize-sh_audio->a_out_buffer_len,sh_audio->a_out_buffer_size-sh_audio->a_out_buffer_len);
>>>    if(ret<=0) { // EOF?
>>
>>
>>Hmmm... well, it doesn't really make sense to me. Why does the fact that
>>the _output_ buffer is not empty indicate that we must decode more data
>>(esp. since there shouldn't be anything to decode anymore).
> 
> 
> It indicates that there are still data to copy from a_buffer to
> a_out_buffer. These buffers do not need to be the same.
> 
> 
>>Also, the same condition is used in another place to detect when to
>>switch to the next fil for audio-only files, so it might be that even
>>this patch will still leave a bug in the audio-only case.
> 
> 
> Agree. There also is something in the Mikulas' patchset
> 
> http://urtax.ms.mff.cuni.cz/~mikulas/mplayer-patchset/cut-end-of-audio-file.diff
> 
> , but I didn't check it out yet, as I don't use mplayer for playing
> audio-only files at all.

That patch is actually outdated, as this issue has been partially fixed,
but checking of both buffers is necessary (new patch attached).
Otherwise the playback of the wav dumped from the above .avi is also cut
before the end.

Regards,
-- 
Jindrich Makovicka
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mplayer.c.diff
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060107/1fae92ff/attachment.txt>


More information about the MPlayer-dev-eng mailing list