[FFmpeg-devel] [PATCH] avcodec: Assert on codec->encode2 in encode_audio2
wm4
nfxjfg at googlemail.com
Thu Aug 27 12:45:07 CEST 2015
On Thu, 27 Aug 2015 12:40:30 +0200
lummax <luogpg at googlemail.com> wrote:
> Assert on `avctx->codec->encode2` to avoid a SEGFAULT on the subsequent
> function call.
> ---
> libavcodec/utils.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index 4da16ee..f51070c 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -1953,6 +1953,8 @@ int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
> }
> }
>
> + av_assert0(avctx->codec->encode2);
> +
> ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
> if (!ret) {
> if (*got_packet_ptr) {
When can this happen? Shouldn't it just return an error somewhere if
this is not an encoder?
More information about the ffmpeg-devel
mailing list