Skip to content
Snippets Groups Projects
Commit 60b099c3 authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

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

parent 02abc905
No related branches found
No related tags found
No related merge requests found
...@@ -183,11 +183,17 @@ fail: ...@@ -183,11 +183,17 @@ fail:
static int get_audio_buffer(AVFrame *frame, int align) 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 planar = av_sample_fmt_is_planar(frame->format);
int planes = planar ? channels : 1; int planes;
int ret, i; 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); CHECK_CHANNELS_CONSISTENCY(frame);
if (!frame->linesize[0]) { if (!frame->linesize[0]) {
ret = av_samples_get_buffer_size(&frame->linesize[0], channels, ret = av_samples_get_buffer_size(&frame->linesize[0], channels,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment