[FFmpeg-cvslog] ffmpeg: Check av_parser_change() for failure

Michael Niedermayer git at videolan.org
Mon Aug 24 17:45:26 CEST 2015


ffmpeg | branch: release/2.4 | Michael Niedermayer <michael at niedermayer.cc> | Fri Aug 21 03:02:55 2015 +0200| [3faf444010121374637c23109a0582fdb9e536bc] | committer: Michael Niedermayer

ffmpeg: Check av_parser_change() for failure

No testcase known

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit ac0ba6f233698f02ebb75b03242e94333dbe13d4)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3faf444010121374637c23109a0582fdb9e536bc
---

 ffmpeg.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index db8ada6..30f0be7 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1694,10 +1694,15 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
        && ost->enc_ctx->codec_id != AV_CODEC_ID_MPEG2VIDEO
        && ost->enc_ctx->codec_id != AV_CODEC_ID_VC1
        ) {
-        if (av_parser_change(ost->parser, ost->st->codec,
+        int ret = av_parser_change(ost->parser, ost->st->codec,
                              &opkt.data, &opkt.size,
                              pkt->data, pkt->size,
-                             pkt->flags & AV_PKT_FLAG_KEY)) {
+                             pkt->flags & AV_PKT_FLAG_KEY);
+        if (ret < 0) {
+            av_log(NULL, AV_LOG_FATAL, "av_parser_change failed\n");
+            exit_program(1);
+        }
+        if (ret) {
             opkt.buf = av_buffer_create(opkt.data, opkt.size, av_buffer_default_free, NULL, 0);
             if (!opkt.buf)
                 exit_program(1);



More information about the ffmpeg-cvslog mailing list