[MPlayer-dev-eng] [PATCH] use avcodec_decode_audio2

Uoti Urpala uoti.urpala at pp1.inet.fi
Tue Mar 20 15:00:57 CET 2007


On Tue, 2007-03-20 at 12:50 +0100, Reimar Döffinger wrote:
> Sorry, previous patch was only correct on the first loop iteration,
> attached one might actually be correct (though either is an
> improvement over the current situation with no checking at all).

The current situation should be safe since dec_audio.c guarantees that
maxlen >= minlen+sh_audio->audio_out_minsize. So decoders can safely
ignore maxlen if they set audio_out_minsize to a suitable value.

BTW does the avcodec_decode_audio2 interface() provide any way to know
how large an output buffer you should use if you want to make sure it
can hold a decoded packet? Or is AVCODEC_MAX_AUDIO_FRAME_SIZE still
meant to be used for that?

> Some testing would be welcome, since the function currently still
> requires the buffer to be at least AVCODEC_MAX_AUDIO_FRAME_SIZE bytes
> big whether the codec needs it or not it _might_ cause some regressions.

As explained above there should be no way for avcodec_decode_audio2 to
get called with less buffer space than AVCODEC_MAX_AUDIO_FRAME_SIZE
(unless some avcodec decoder now returns more data than that during an
earlier call, but in practice even that would mean the loop just
terminates because that amount of data would almost certainly be over
minlen).




More information about the MPlayer-dev-eng mailing list