Ignore bogus index entries

Original commit message from CVS:
Ignore bogus index entries
Assume all audio frames are keyframes
This commit is contained in:
Wim Taymans 2002-06-13 18:17:23 +00:00
parent 514729bbba
commit 98ae5cb270

View file

@ -602,7 +602,7 @@ gst_avi_demux_strf_iavs (GstAviDemux *avi_demux)
static void static void
gst_avi_debug_entry (const gchar *prefix, gst_avi_index_entry *entry) gst_avi_debug_entry (const gchar *prefix, gst_avi_index_entry *entry)
{ {
GST_DEBUG (0, "%s: %05d %d %08llx %05d %08lld %08x %08x (%d) %08x", prefix, entry->index_nr, entry->stream_nr, GST_DEBUG (0, "%s: %05d %d %08llx %05d %14lld %08x %08x (%d) %08x", prefix, entry->index_nr, entry->stream_nr,
entry->bytes_before, entry->frames_before, entry->ts, entry->flags, entry->offset, entry->bytes_before, entry->frames_before, entry->ts, entry->flags, entry->offset,
entry->offset, entry->size); entry->offset, entry->size);
} }
@ -664,6 +664,11 @@ gst_avi_demux_parse_index (GstAviDemux *avi_demux,
GstFormat format; GstFormat format;
stream_nr = CHUNKID_TO_STREAMNR (entry[i].id); stream_nr = CHUNKID_TO_STREAMNR (entry[i].id);
if (stream_nr > avi_demux->num_streams || stream_nr < 0) {
avi_demux->index_entries[i].stream_nr = -1;
continue;
}
target->stream_nr = stream_nr; target->stream_nr = stream_nr;
stream = &avi_demux->stream[stream_nr]; stream = &avi_demux->stream[stream_nr];
@ -677,6 +682,9 @@ gst_avi_demux_parse_index (GstAviDemux *avi_demux,
format = GST_FORMAT_TIME; format = GST_FORMAT_TIME;
if (stream->strh.type == GST_RIFF_FCC_auds) { if (stream->strh.type == GST_RIFF_FCC_auds) {
/* all audio frames are keyframes */
target->flags |= GST_RIFF_IF_KEYFRAME;
gst_pad_convert (stream->pad, GST_FORMAT_BYTES, stream->total_bytes, gst_pad_convert (stream->pad, GST_FORMAT_BYTES, stream->total_bytes,
&format, &target->ts); &format, &target->ts);
} }