diff --git a/libavcodec/utils.c b/libavcodec/utils.c index f441ca2a84..050f26e7b8 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -305,6 +305,9 @@ int avcodec_open(AVCodecContext *avctx, AVCodec *codec) { int ret; + if(avctx->codec) + return -1; + avctx->codec = codec; avctx->codec_id = codec->id; avctx->frame_number = 0;