[Mplayer-users] Re: Using -idx with divx4 causes error

Raphael Manfredi Raphael_Manfredi at pobox.com
Mon Aug 13 00:09:59 CEST 2001

Quoting mplayer-users at lists.sourceforge.net from ml.mplayer.users:
:I thought it's memory allocation problem, maybe glibc bug/limitation.
:It reallocates an array many times while building index, and if
:glibc doesn't handle it well, it is possible to run out of memory, so
:divx4 or something else will segfault.
:Before uploading teh file, try something!
:In aviheader.c, chaneg this line:
:      priv->idx_size+=1024; // +16kB
:      priv->idx_size+=65536; // +16kB
:And check it works or still sig11. (and tell me the results)

Well, actually, the bug was not there, but it helps to add 65536
since at the end, it now says:

AVI: Generated index table for 473494 chunks!

Actually, the PROPER fix is that the leading test is WRONG.  It must

	if(priv->idx_pos >= priv->idx_size){

i.e. *greater or equal*, not less or equal.

Thanks for having narrowed the debugging scope for me!


--- aviheader.c.orig	Mon Aug 13 00:09:41 2001
+++ aviheader.c	Mon Aug 13 00:08:10 2001
@@ -181,9 +181,10 @@
     if(stream_eof(demuxer->stream)) break;
     if(!id || avi_stream_id(id)==100) goto skip_chunk; // bad ID (or padding?)
-    if(priv->idx_pos<=priv->idx_size){
+    if(priv->idx_pos >= priv->idx_size){
 //      priv->idx_size+=32;
-      priv->idx_size+=1024; // +16kB
+//      priv->idx_size+=1024; // +16kB
+	  priv->idx_size+=65536; // +many more kB
       if(!priv->idx){priv->idx_pos=0; printf("Out of Memory\n"); break;} // error!

Mplayer-users mailing list
Mplayer-users at lists.sourceforge.net

More information about the MPlayer-users mailing list