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
This commit is contained in:
Karol Sobczak 2011-01-10 11:18:52 +00:00 committed by Tim-Philipp Müller
parent b9af27719d
commit 0b4dfa685d

View file

@ -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);
}