[FFmpeg-devel] ffplay: fix order of operations for sdl audio open

Marton Balint cus at passwd.hu
Sun Oct 2 00:30:41 CEST 2011

On Sat, 1 Oct 2011, Michael Niedermayer wrote:

> On Sat, Oct 01, 2011 at 09:41:00PM +0200, Marton Balint wrote:
>> Hi,
>> The patch in the subject (3715e675) seems broken in some ways:
>>  - The sample rate / channel count sanity check is not against the
>>    actually used sample rate / channel count.
>>  - Avctx->request_channels can affect the number of the channels,
>>    therefore downmixing of 5.1 audio to stereo (default for ffplay)
>>    currently does not work because of the patch.
>> Isn't the aac decoder should be fixed instead of ffplay to return
>> the proper number of channels after calling avcodec_open2?
> The aac decoder in this bug has incorrect extradata that lists a wrong
> channel number, i saw no way it could detect this easily.
> my reasoning that lead to the commited fix was that av_find_stream_info()
> figured out the correct channel number by decoding the first frame
> and the requent_channel value should be passed to it.

How request_channels should be passed to av_find_stream_info? Via options?

> If this is done it should be more reliable than trusting the decoder
> before it saw the first frame
> if you want to try or have a better idea:
> rtsp://media2.lsops.net/live/aljazeer_en_high.sdp

Perhaps another approach is if we apply my audio patch, which is capable 
of downmixing or multiplying the audio channels as they change during 
decoding, and then set the number of SDL channels to 2.

I set up a github repository, you can find the patches there:



More information about the ffmpeg-devel mailing list