mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 22:16:22 +00:00
mpegtspacketizer: Look harder for next sync position
If ever we lose sync, we were just checking for the next 0x47 marker ... which might actually happen within a mpeg-ts packet. Instead check for 3 repeating 0x47 at the expected packet size interval, which the same logic we use when we initially look for the packet size.
This commit is contained in:
parent
c28acaa3c5
commit
3b60f88437
1 changed files with 5 additions and 3 deletions
|
@ -799,9 +799,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... */
|
||||
|
|
Loading…
Reference in a new issue