diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-11-27 10:52:26 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2013-11-27 10:52:26 +0100 |
commit | 60b099c37100d94e114cefefdd101af831287b9f (patch) | |
tree | e3c62b456f110f9d4240bd471279695ccf5ea471 /libavutil | |
parent | 02abc905cd9881d38ea81c60c6fbdb4b54d0611d (diff) | |
download | ffmpeg-60b099c37100d94e114cefefdd101af831287b9f.tar.gz |
get_audio_buffer: fix usage where channels are not set but layout is
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/frame.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c index 39e2a1313a..62a4a6d286 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -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, |