Commit 60b099c3 authored by Michael Niedermayer's avatar Michael Niedermayer

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

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 02abc905
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment