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

tony_nie at realsil.com.cn tony_nie at realsil.com.cn
Wed Mar 5 03:28:42 CET 2014


From: tony_nie <tony_nie at realsil.com.cn>

Fixes the segment fault error.
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->codec_id);
+            return -1;
+	}
+
         ost   = new_output_stream(o, s, codec->type, -1);
         st    = ost->st;
         avctx = st->codec;
-- 
1.7.9.5



More information about the ffmpeg-devel mailing list