[FFmpeg-devel] [PATCH]Do not ignore rm_assemble_video_frame() return codes

Carl Eugen Hoyos cehoyos at ag.or.at
Fri Jul 12 20:29:11 CEST 2013


Hi!

rm_assemble_video_frame() contains several checks that return error codes, but 
they are all ignored in the calling functions ff_rm_parse_packet() and 
rm_read_packet().
(I suspect rdt_parse_packet() misinterprets the return 
values, but this is unrelated.)
Attached patch should fix the passing of the error codes from 
rm_assemble_video_frame().

Please review, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 70ae809..acfde84 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -776,11 +776,13 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
                     int *seq, int flags, int64_t timestamp)
 {
     RMDemuxContext *rm = s->priv_data;
+    int ret;
 
     if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
         rm->current_stream= st->id;
-        if(rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq, &timestamp))
-            return -1; //got partial frame
+        ret = rm_assemble_video_frame(s, pb, rm, ast, pkt, len, seq, &timestamp);
+        if(ret)
+            return ret; //got partial frame or error
     } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
         if ((ast->deint_id == DEINT_ID_GENR) ||
             (ast->deint_id == DEINT_ID_INT4) ||
@@ -927,6 +929,8 @@ static int rm_read_packet(AVFormatContext *s, AVPacket *pkt)
 
             res = ff_rm_parse_packet (s, s->pb, st, st->priv_data, len, pkt,
                                       &seq, flags, timestamp);
+            if (res < -1)
+                return res;
             if((flags&2) && (seq&0x7F) == 1)
                 av_add_index_entry(st, pos, timestamp, 0, 0, AVINDEX_KEYFRAME);
             if (res)


More information about the ffmpeg-devel mailing list