[FFmpeg-devel] [PATCH 2/2] ffmpeg: check the result of finding encoder

Nicolas George george at nsup.org
Wed Mar 5 19:38:15 CET 2014


Le quintidi 15 ventôse, an CCXXII, tony_nie at realsil.com.cn a écrit :
> From: tony_nie <tony_nie at realsil.com.cn>
> 

Thanks for the patch.

> Fixes the segment fault error.

What segmentation fault error? Can you show a command line or configuration
that allows to trigger it or a track ticket number?

> Signed-off-by: tony_nie <tony_nie at realsil.com.cn>
> ---
>  ffmpeg_opt.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 7bd0817..086870b 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -1580,6 +1580,12 @@ static int read_ffserver_streams(OptionsContext *o, AVFormatContext *s, const ch
>          AVCodecContext *avctx;
>  
>          codec = avcodec_find_encoder(ic->streams[i]->codec->codec_id);

> +	if (!codec) {

> +            av_log(NULL, AV_LOG_ERROR, "Cannot find Encoder: %d\n",

ic->streams[i]->codec can serve as log context here.

> +                ic->streams[i]->codec->codec_id);

I suggest to use avcodec_get_name().

> +            return -1;
> +	}

There are tabs in two lines; tabs are forbidden in the source code.

> +
>          ost   = new_output_stream(o, s, codec->type, -1);
>          st    = ost->st;
>          avctx = st->codec;

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140305/f1c88d3c/attachment.asc>


More information about the ffmpeg-devel mailing list