X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Favcodec.c;h=2533bd8f678719f6e809ec6afa30b15732972566;hb=b9d887c225466576ae80ef7f2b109e866ff137b2;hp=688f1b397aaeda68ea9862403f1c966856b60f0f;hpb=12fcc626d6ac5da5336f184c2c3f973cf00005f4;p=ffmpeg diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c index 688f1b397aa..2533bd8f678 100644 --- a/libavfilter/avcodec.c +++ b/libavfilter/avcodec.c @@ -92,8 +92,18 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame, int perms) { - AVFilterBufferRef *samplesref = - avfilter_get_audio_buffer_ref_from_arrays((uint8_t **)frame->data, frame->linesize[0], 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)); if (!samplesref)