qtdemux: Reset adapter in more discontinuity cases
authorEdward Hervey <edward@centricular.com>
Fri, 14 Apr 2017 15:01:49 +0000 (17:01 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Mon, 17 Apr 2017 11:10:06 +0000 (13:10 +0200)
In push mode we process as much as possible in the adapter. When we receive
a DISCONT buffer which we can't match to an actual sample (based on the existing
sample table) and there is still data remaining in the incoming adapter,there is
one of two cases happening:
1) We are doing reverse playback, in which case we should flush out all pending
  data
2) We have leftover data from the previous incoming buffer... which we can't do
  anything about.

For the second case, make sure we flush out the remaining data so that we can start
parsing again from scratch.

https://bugzilla.gnome.org/show_bug.cgi?id=781319

gst/isomp4/qtdemux.c

index 6893388..3a271af 100644 (file)
@@ -6326,10 +6326,12 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
         }
       }
       if (!is_gap_input) {
+        GST_DEBUG_OBJECT (demux, "Resetting, actual DISCONT");
         /* Reset state if it's a real discont */
         demux->neededbytes = 16;
         demux->state = QTDEMUX_STATE_INITIAL;
         demux->offset = GST_BUFFER_OFFSET (inbuf);
+        gst_adapter_clear (demux->adapter);
       }
     }
     /* Reverse fragmented playback, need to flush all we have before