baseparse: reset skip on segments and discontinuities
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Fri, 13 Mar 2015 11:08:25 +0000 (11:08 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 16 Mar 2015 12:53:50 +0000 (12:53 +0000)
Large scale skip is an optimization, and thus it is safer to
stop skipping than to continue. Clear skip on segments and
discontinuities, as these are points where it is possible that
the original idea of "bytes to skip" changes.

libs/gst/base/gstbaseparse.c

index 3ea05e9..435d2d1 100644 (file)
@@ -1134,6 +1134,7 @@ gst_base_parse_sink_event_default (GstBaseParse * parse, GstEvent * event)
       parse->priv->prev_dts = GST_CLOCK_TIME_NONE;
       parse->priv->discont = TRUE;
       parse->priv->seen_keyframe = FALSE;
+      parse->priv->skip = 0;
       break;
     }
 
@@ -2824,6 +2825,8 @@ gst_base_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
   GST_DEBUG_OBJECT (parent, "chain");
 
   /* early out for speed, if we need to skip */
+  if (buffer && GST_BUFFER_IS_DISCONT (buffer))
+    parse->priv->skip = 0;
   if (parse->priv->skip > 0) {
     gsize bsize = gst_buffer_get_size (buffer);
     GST_DEBUG ("Got %" G_GSIZE_FORMAT " buffer, need to skip %u", bsize,