matroskademux: Only search for the index entry once

This commit is contained in:
Sebastian Dröge 2009-05-11 18:21:13 +02:00
parent 4cb39bc723
commit a1fe742e80

View file

@ -2031,7 +2031,7 @@ static gboolean
gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
GstPad * pad, GstEvent * event) GstPad * pad, GstEvent * event)
{ {
GstMatroskaIndex *entry; GstMatroskaIndex *entry = NULL;
GstSeekFlags flags; GstSeekFlags flags;
GstSeekType cur_type, stop_type; GstSeekType cur_type, stop_type;
GstFormat format; GstFormat format;
@ -2063,7 +2063,9 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
/* check sanity before we start flushing and all that */ /* check sanity before we start flushing and all that */
if (cur_type == GST_SEEK_TYPE_SET) { if (cur_type == GST_SEEK_TYPE_SET) {
GST_OBJECT_LOCK (demux); GST_OBJECT_LOCK (demux);
if (!gst_matroskademux_do_index_seek (demux, track, cur, -1, FALSE)) { if ((entry =
gst_matroskademux_do_index_seek (demux, track, cur, -1,
FALSE)) == NULL) {
GST_DEBUG_OBJECT (demux, "No matching seek entry in index"); GST_DEBUG_OBJECT (demux, "No matching seek entry in index");
GST_OBJECT_UNLOCK (demux); GST_OBJECT_UNLOCK (demux);
return FALSE; return FALSE;
@ -2118,6 +2120,7 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
"New segment positions: %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT, "New segment positions: %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT,
GST_TIME_ARGS (segment_start), GST_TIME_ARGS (segment_stop)); GST_TIME_ARGS (segment_start), GST_TIME_ARGS (segment_stop));
if (entry == NULL)
entry = gst_matroskademux_do_index_seek (demux, track, segment_start, entry = gst_matroskademux_do_index_seek (demux, track, segment_start,
segment_stop, keyunit); segment_stop, keyunit);