[MPlayer-dev-eng] [PATCH] Be more robust with corrupted RM files
Zuxy Meng
zuxy.meng at gmail.com
Sun Feb 15 16:51:31 CET 2009
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.
--
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6
-------------- next part --------------
Index: libmpdemux/demux_real.c
===================================================================
--- libmpdemux/demux_real.c ??? 28585?
+++ libmpdemux/demux_real.c ??????
@@ -624,7 +624,18 @@
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 (!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);
+ }
+ }
+ } else
+ stream_skip(demuxer->stream, len);
continue; //goto loop;
}
More information about the MPlayer-dev-eng
mailing list