X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavfilter%2Favcodec.c;h=688f1b397aaeda68ea9862403f1c966856b60f0f;hb=83ab46a57e4b8c647366bf81679891164e215a00;hp=2a173b2c91f288309b3ca35b6c6b0b92dfd5a2d0;hpb=6f5f7f705d10e639cf047be216a94de1e39a96e9;p=ffmpeg diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c index 2a173b2c91f..688f1b397aa 100644 --- a/libavfilter/avcodec.c +++ b/libavfilter/avcodec.c @@ -60,6 +60,11 @@ int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) case AVMEDIA_TYPE_AUDIO: dst->audio->sample_rate = src->sample_rate; dst->audio->channel_layout = src->channel_layout; + dst->audio->channels = src->channels; + if(src->channels < av_get_channel_layout_nb_channels(src->channel_layout)) { + av_log(NULL, AV_LOG_ERROR, "libavfilter does not support this channel layout\n"); + return AVERROR(EINVAL); + } break; default: return AVERROR(EINVAL); @@ -77,7 +82,10 @@ AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame frame->format); if (!picref) return NULL; - avfilter_copy_frame_props(picref, frame); + if (avfilter_copy_frame_props(picref, frame) < 0) { + picref->buf->data[0] = NULL; + avfilter_unref_bufferp(&picref); + } return picref; } @@ -90,7 +98,10 @@ AVFilterBufferRef *avfilter_get_audio_buffer_ref_from_frame(const AVFrame *frame av_frame_get_channel_layout(frame)); if (!samplesref) return NULL; - avfilter_copy_frame_props(samplesref, frame); + if (avfilter_copy_frame_props(samplesref, frame) < 0) { + samplesref->buf->data[0] = NULL; + avfilter_unref_bufferp(&samplesref); + } return samplesref; } @@ -151,6 +162,7 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src) dst->nb_samples = src->audio->nb_samples; av_frame_set_sample_rate (dst, src->audio->sample_rate); av_frame_set_channel_layout(dst, src->audio->channel_layout); + av_frame_set_channels (dst, src->audio->channels); break; default: return AVERROR(EINVAL);