[FFmpeg-devel] ODML index and ticket #3531

Don Moir donmoir at comcast.net
Thu Apr 24 17:06:47 CEST 2014


----- Original Message ----- 
From: "Don Moir" <donmoir at comcast.net>
To: "FFmpeg development discussions and patches" <ffmpeg-devel at ffmpeg.org>
Sent: Thursday, April 24, 2014 12:14 AM
Subject: [FFmpeg-devel] ODML index and ticket #3531


> referring to avidec.c
>
> In read_braindead_odml_indx you have this to add index entries:
>
> ...
>            if (last_pos == pos || pos == base - 8)
>                avi->non_interleaved = 1;
>            if (last_pos != pos && (len || !ast->sample_size))
>                av_add_index_entry(st, pos, ast->cum_len, len, 0,
>                                   key ? AVINDEX_KEYFRAME : 0);
> ...
>
> for a video stream ast->sample_size is always zero it appears. In fact it is set to zero
>
> static int avi_read_header(AVFormatContext *s)
> {
>    ...
>            switch (tag1) {
>            case MKTAG('v', 'i', 'd', 's'):
>                codec_type = AVMEDIA_TYPE_VIDEO;
>
>                ast->sample_size = 0;
>                break;
>    ...
> }
>
> So it seems its a bug to check blindly for ast->sample_size == 0 (!ast->sample_size) in read_braindead_odml_indx.
>
> Seems sample_rate is only valid for audio streams.
>
> http://trac.ffmpeg.org/ticket/3531

If you look at ticket 3531, you will see that it creates over 11 million index entries for the file lake.avi. These appear to be 
completely bogus. The index ends up being larger than the file.

If I remove the check for !ast->sample_size and just check len, then you end with about 350 index entries and the file plays 
completely normal and opens in about 2 seconds. Without this, it can appear to be hung for a very long time.

Not sure if this is the correct thing to do though. Appears there is a lot of zero len values for the file.

 ...
            if (last_pos == pos || pos == base - 8)
                avi->non_interleaved = 1;
-            if (last_pos != pos && (len || !ast->sample_size))
+            if (last_pos != pos && len)
                av_add_index_entry(st, pos, ast->cum_len, len, 0,
                                   key ? AVINDEX_KEYFRAME : 0);
... 



More information about the ffmpeg-devel mailing list