[FFmpeg-devel] [PATCH] Make RM demuxer behave better with -an option

Kostya kostya.shishkov
Mon Feb 2 20:19:06 CET 2009


The story so far:
 FFmpeg now has RV30, RV40 (my fault) and AAC (not my fault) support. When
trying to decode RV40+AAC RM file with -an option video decoder produces
a lot of garbage and may crash. As I've investigated, that happens because
with -an option specified RM demuxer begins to feed audio packets to video
decoder.

 With this patch demuxer resets the number of pending audio packets (so they
won't be demuxed) and skips them (syncing to the next packet header tends to
produce false positive matches somewhere inside packet data).
-------------- next part --------------
Index: libavformat/rmdec.c
===================================================================
--- libavformat/rmdec.c	(revision 16915)
+++ libavformat/rmdec.c	(working copy)
@@ -650,6 +650,12 @@
     if(  (st->discard >= AVDISCARD_NONKEY && !(*flags&2))
        || st->discard >= AVDISCARD_ALL){
         av_free_packet(pkt);
+        if(st->codec->codec_id == CODEC_ID_AAC && st->discard >= AVDISCARD_ALL){
+            int x;
+            for(x = 1; x < ast->sub_packet_cnt; x++)
+                url_fskip(pb, ast->sub_packet_lengths[x]);
+            rm->audio_pkt_cnt = 0;
+        }
         return -1;
     }
 



More information about the ffmpeg-devel mailing list