summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst/mpegtsdemux/mpegtspacketizer.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gst/mpegtsdemux/mpegtspacketizer.c b/gst/mpegtsdemux/mpegtspacketizer.c
index 6e5c654bd..70d1e6e02 100644
--- a/gst/mpegtsdemux/mpegtspacketizer.c
+++ b/gst/mpegtsdemux/mpegtspacketizer.c
@@ -933,9 +933,11 @@ mpegts_packetizer_next_packet (MpegTSPacketizer2 * packetizer,
GST_LOG ("Lost sync %d", packet_size);
- /* Find the 0x47 in the buffer */
- for (; sync_offset < priv->mapped_size; sync_offset++)
- if (priv->mapped[sync_offset] == 0x47)
+ /* Find the 0x47 in the buffer (and require at least 2 checks) */
+ for (; sync_offset < priv->mapped_size + 2 * packet_size; sync_offset++)
+ if (priv->mapped[sync_offset] == 0x47 &&
+ priv->mapped[sync_offset + packet_size] == 0x47 &&
+ priv->mapped[sync_offset + 2 * packet_size] == 0x47)
break;
/* Pop out the remaining data... */