summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2011-09-30 18:54:04 +0100
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2011-10-03 11:15:16 +0200
commite4856a29653815c45913edb58f64bee86b05d83b (patch)
treede6600d44a89af74c6460aee6a080dee31ad88e1
parentfa3d6610833b4b92574a2ef8be870c93b527c5f1 (diff)
mpegtsdemux: fix scanning stopping too early
https://bugzilla.gnome.org/show_bug.cgi?id=648245
-rw-r--r--gst/mpegdemux/gstmpegtsdemux.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/gst/mpegdemux/gstmpegtsdemux.c b/gst/mpegdemux/gstmpegtsdemux.c
index 849cda0aa..b3b8249e6 100644
--- a/gst/mpegdemux/gstmpegtsdemux.c
+++ b/gst/mpegdemux/gstmpegtsdemux.c
@@ -2987,10 +2987,10 @@ gst_mpegts_demux_sync_scan (GstMpegTSDemux * demux, const guint8 * in_data,
guint size, guint * flush)
{
guint sync_count = 0;
- const guint8 *end_scan = in_data + size - demux->packetsize;
guint8 *ptr_data = (guint8 *) in_data;
guint packetsize =
(demux->packetsize ? demux->packetsize : MPEGTS_NORMAL_TS_PACKETSIZE);
+ const guint8 *end_scan = in_data + size - packetsize;
/* Check if the LUT table is big enough */
if (G_UNLIKELY (demux->sync_lut_len < (size / packetsize))) {
@@ -3007,18 +3007,14 @@ gst_mpegts_demux_sync_scan (GstMpegTSDemux * demux, const guint8 * in_data,
guint chance = is_mpegts_sync (ptr_data, end_scan, packetsize);
if (G_LIKELY (chance > 50)) {
/* skip paketsize bytes and try find next */
- guint8 *next_sync = ptr_data + packetsize;
- if (next_sync < end_scan) {
- demux->sync_lut[sync_count] = ptr_data;
- sync_count++;
- ptr_data += packetsize;
- } else
- goto done;
+ demux->sync_lut[sync_count] = ptr_data;
+ sync_count++;
+ ptr_data += packetsize;
} else {
ptr_data++;
}
}
-done:
+
if (G_UNLIKELY (!demux->packetsize))
gst_mpegts_demux_detect_packet_size (demux, sync_count);