Browse Source

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.2-rc1
Michael Niedermayer 11 years ago
parent
commit
60b099c371
1 changed files with 8 additions and 2 deletions
  1. +8
    -2
      libavutil/frame.c

+ 8
- 2
libavutil/frame.c 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,


Loading…
Cancel
Save