summaryrefslogtreecommitdiff
path: root/gst/mpegdemux
diff options
context:
space:
mode:
authorKarol Sobczak <napewnotrafi@gmail.com>2011-01-10 11:18:52 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2011-01-10 11:18:52 +0000
commit0b4dfa685d313f698c3b6b05d5f6894c20bfbc38 (patch)
tree55d16dc56e039265d703076e03c27092066597cc /gst/mpegdemux
parentb9af27719dcfd604480e07a1f8392cc4429328a9 (diff)
downloadgstreamer-plugins-bad-0b4dfa685d313f698c3b6b05d5f6894c20bfbc38.tar.gz
mpegtsdemux: fix re-syncing on invalid data after seek
Or possibly even at startup. If we couldn't find a sync within the first few bytes, we'd just push more data into the adapter but never discard any of the invalid data at the beginning, so would never be able to re-sync. https://bugzilla.gnome.org/show_bug.cgi?id=639063
Diffstat (limited to 'gst/mpegdemux')
-rw-r--r--gst/mpegdemux/mpegtspacketizer.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gst/mpegdemux/mpegtspacketizer.c b/gst/mpegdemux/mpegtspacketizer.c
index 70cf3d710..cbea99f9c 100644
--- a/gst/mpegdemux/mpegtspacketizer.c
+++ b/gst/mpegdemux/mpegtspacketizer.c
@@ -2107,9 +2107,13 @@ mpegts_try_discover_packet_size (MpegTSPacketizer * packetizer)
}
GST_DEBUG ("have packetsize detected: %d of %u bytes",
packetizer->know_packet_size, packetizer->packet_size);
- /* flush to sync byte */
- if (pos > 0)
+ if (pos > 0) {
+ /* flush to sync byte */
gst_adapter_flush (packetizer->adapter, pos);
+ } else if (!packetizer->know_packet_size) {
+ /* drop invalid data and move to the next possible packets */
+ gst_adapter_flush (packetizer->adapter, MPEGTS_MAX_PACKETSIZE);
+ }
g_free (dest);
}