diff options
author | Edward Hervey <bilboed@bilboed.com> | 2009-10-18 15:50:39 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2009-10-18 16:15:08 +0200 |
commit | a6ed612f42d216ab61252a97bc0f0f941a2d063d (patch) | |
tree | e0732eb1bc99afab82ae4f127c1db7931318c34e | |
parent | 1936d6ed2662c125a1ebabfed65b154a8015524c (diff) |
avidemux: Ensure _calculate_durations_from_index only uses valid streams
-rw-r--r-- | gst/avi/gstavidemux.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c index 371c02ef2..5ce5bc279 100644 --- a/gst/avi/gstavidemux.c +++ b/gst/avi/gstavidemux.c @@ -2684,7 +2684,7 @@ gst_avi_demux_calculate_durations_from_index (GstAviDemux * avi) gst_riff_strh *strh; stream = &avi->stream[i]; - if (G_UNLIKELY (!stream || !(strh = stream->strh))) + if (G_UNLIKELY (!stream || !stream->idx_n || !(strh = stream->strh))) continue; /* get header duration for the stream */ @@ -2701,11 +2701,14 @@ gst_avi_demux_calculate_durations_from_index (GstAviDemux * avi) /* fall back to header info to calculate a duration */ duration = hduration; } + GST_INFO ("Setting duration of stream #%d to %" GST_TIME_FORMAT, + i, GST_TIME_ARGS (duration)); /* set duration for the stream */ stream->duration = duration; /* find total duration */ - if (total == GST_CLOCK_TIME_NONE || duration > total) + if (total == GST_CLOCK_TIME_NONE || + (GST_CLOCK_TIME_IS_VALID (duration) && duration > total)) total = duration; } |