[MPlayer-dev-eng] [PATCH] Be more robust with corrupted RM files

Zuxy Meng zuxy.meng at gmail.com
Wed Feb 18 09:08:38 CET 2009


Hi,

2009/2/15 Zuxy Meng <zuxy.meng at gmail.com>:
> Hi,
>
> When playing a corrupted RM file with lots of zeros (downloaded from
> emule/bt etc) mplayer will most probably go into a very lengthy loop.
> The attached patch improves this by seeking to a known good position
> with the help of the index table.

I tried a few more clips and now thought that a bad len most probably
should be used anyway hence the updated patch. If nobody objects I'd
like to commit it tomorrow.

-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: libmpdemux/demux_real.c
===================================================================
--- libmpdemux/demux_real.c	??? 28624?
+++ libmpdemux/demux_real.c	??????
@@ -624,7 +624,15 @@
     if (len < 12){
 	mp_msg(MSGT_DEMUX, MSGL_V,"%08X: packet v%d len=%d  \n",(int)demuxer->filepos,(int)version,(int)len);
 	mp_msg(MSGT_DEMUX, MSGL_WARN,"bad packet len (%d)\n", len);
-	stream_skip(demuxer->stream, len);
+	if ((unsigned)demuxer->video->id < MAX_STREAMS) {
+	    if (priv->current_vpacket + 1 < priv->index_table_size[demuxer->video->id]) {
+		stream_seek(demuxer->stream, priv->index_table[demuxer->video->id][++priv->current_vpacket].offset);
+	    }
+	} else if ((unsigned)demuxer->audio->id < MAX_STREAMS) {
+	    if (priv->current_apacket + 1 < priv->index_table_size[demuxer->audio->id]) {
+		stream_seek(demuxer->stream, priv->index_table[demuxer->audio->id][++priv->current_apacket].offset);
+	    }
+	}
 	continue; //goto loop;
     }
 


More information about the MPlayer-dev-eng mailing list