1
mirror of https://git.videolan.org/git/ffmpeg.git synced 2024-07-11 23:27:55 +02:00

get_audio_buffer: fix usage where channels are not set but layout is

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-11-27 10:52:26 +01:00
parent 02abc905cd
commit 60b099c371

View File

@ -183,11 +183,17 @@ fail:
static int get_audio_buffer(AVFrame *frame, int align)
{
int channels = frame->channels;
int channels;
int planar = av_sample_fmt_is_planar(frame->format);
int planes = planar ? channels : 1;
int planes;
int ret, i;
if (!frame->channels)
frame->channels = av_get_channel_layout_nb_channels(frame->channel_layout);
channels = frame->channels;
planes = planar ? channels : 1;
CHECK_CHANNELS_CONSISTENCY(frame);
if (!frame->linesize[0]) {
ret = av_samples_get_buffer_size(&frame->linesize[0], channels,