summaryrefslogtreecommitdiff
path: root/libavfilter/avcodec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-12-12 17:42:58 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-12 17:46:05 +0100
commit02b238186a23d61859d9be8ca9356052f0216220 (patch)
treecfc2302049f37962654d530d99759d8af7d96789 /libavfilter/avcodec.c
parent0f236345fb4619312281bd2ce736e9327eb9321d (diff)
avfilter_get_audio_buffer_ref_from_frame: check that layout and channels match if they are set
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/avcodec.c')
-rw-r--r--libavfilter/avcodec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index 705cf80ca5..2533bd8f67 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -93,10 +93,16 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame
int perms)
{
AVFilterBufferRef *samplesref;
+ int64_t layout = av_frame_get_channel_layout(frame);
if(av_frame_get_channels(frame) > 8) // libavfilter does not suport more than 8 channels FIXME, remove once libavfilter is fixed
return NULL;
+ if (layout && av_get_channel_layout_nb_channels(layout) != av_frame_get_channels(frame)) {
+ av_log(0, AV_LOG_ERROR, "Layout indicates a differnt number of channels than actually present\n");
+ return NULL;
+ }
+
samplesref = avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], perms,
frame->nb_samples, frame->format,
av_frame_get_channel_layout(frame));