gst/avi/gstavidemux.c: Work for truncated (unfinished download etc.) files. Fixes #160514.

Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_stream_index):
Work for truncated (unfinished download etc.) files. Fixes #160514.
This commit is contained in:
Ronald S. Bultje 2004-12-18 19:36:59 +00:00
parent 9d418cd3b9
commit a4bf155817
2 changed files with 21 additions and 4 deletions

View file

@ -1,3 +1,8 @@
2004-12-18 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/avi/gstavidemux.c: (gst_avi_demux_stream_index):
Work for truncated (unfinished download etc.) files. Fixes #160514.
2004-12-18 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsasink.c: (gst_alsa_sink_loop):

View file

@ -1198,17 +1198,29 @@ gst_avi_demux_stream_index (GstAviDemux * avi,
pos_before = gst_bytestream_tell (riff->bs);
/* skip movi
*
* FIXME:
* - we want to add error handling here so we can recover.
*/
if (pos_before + 8 > length) {
return TRUE;
} else {
guint8 *data;
if (gst_bytestream_peek_bytes (riff->bs, &data, 8) == 8) {
guint len = GST_READ_UINT32_LE (&data[4]);
if (pos_before + 8 + len >= length) {
GST_WARNING ("No index avail");
return TRUE;
}
}
}
/* hmm... */
if (!gst_riff_read_skip (riff))
return FALSE;
/* assure that we've got data left */
pos_after = gst_bytestream_tell (riff->bs);
if (pos_after + 8 > length) {
g_warning ("File said that it has an index, but there is no index data!");
GST_WARNING ("File said that it has an index, but there is no index data!");
goto end;
}