av_frame_get_buffer: Do not fail when the channel layout is unknown
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 13 Jul 2013 18:58:18 +0000 (20:58 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 13 Jul 2013 19:09:20 +0000 (21:09 +0200)
Fixes handling of cases with unknown layouts but known channel counts

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/frame.c

index 7584ae3..3141dec 100644 (file)
@@ -223,7 +223,7 @@ int av_frame_get_buffer(AVFrame *frame, int align)
 
     if (frame->width > 0 && frame->height > 0)
         return get_video_buffer(frame, align);
-    else if (frame->nb_samples > 0 && frame->channel_layout)
+    else if (frame->nb_samples > 0 && (frame->channel_layout || frame->channels > 0))
         return get_audio_buffer(frame, align);
 
     return AVERROR(EINVAL);