mpegtsdemux: Fix SEGMENT seqnum propagation
* If the seek was handled upstream, use that SEGMENT seqnum
* Use the proper invalid default value
diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c
index ee2460c..5180c2e 100644
--- a/gst/mpegtsdemux/mpegtsbase.c
+++ b/gst/mpegtsdemux/mpegtsbase.c
@@ -201,7 +201,7 @@
}
gst_segment_init (&base->segment, GST_FORMAT_UNDEFINED);
- base->last_seek_seqnum = (guint32) - 1;
+ base->last_seek_seqnum = GST_SEQNUM_INVALID;
base->mode = BASE_MODE_STREAMING;
base->seen_pat = FALSE;
@@ -1321,10 +1321,13 @@
if (base->segment.format == GST_FORMAT_TIME) {
base->packetizer->calculate_offset = FALSE;
base->packetizer->calculate_skew = TRUE;
+ /* Seek was handled upstream */
+ base->last_seek_seqnum = gst_event_get_seqnum (event);
} else {
base->packetizer->calculate_offset = TRUE;
base->packetizer->calculate_skew = FALSE;
}
+
res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event);
break;
case GST_EVENT_STREAM_START:
@@ -1583,6 +1586,10 @@
GST_DEBUG ("Pulling data from %" G_GUINT64_FORMAT, base->seek_offset);
+ if (G_UNLIKELY (base->last_seek_seqnum == GST_SEQNUM_INVALID)) {
+ /* No configured seek, set a valid seqnum */
+ base->last_seek_seqnum = gst_util_seqnum_next ();
+ }
ret = gst_pad_pull_range (base->sinkpad, base->seek_offset,
100 * base->packetsize, &buf);
if (G_UNLIKELY (ret != GST_FLOW_OK))
diff --git a/gst/mpegtsdemux/mpegtsbase.h b/gst/mpegtsdemux/mpegtsbase.h
index 0dd7859..80a454f 100644
--- a/gst/mpegtsdemux/mpegtsbase.h
+++ b/gst/mpegtsdemux/mpegtsbase.h
@@ -148,7 +148,7 @@
/* Upstream segment */
GstSegment segment;
- /* Last received seek event seqnum (default -1) */
+ /* Last received seek event seqnum (default GST_SEQNUM_INVALID) */
guint last_seek_seqnum;
/* Whether to parse private section or not */
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c
index 40f06e3..1e1c0ea 100644
--- a/gst/mpegtsdemux/tsdemux.c
+++ b/gst/mpegtsdemux/tsdemux.c
@@ -2471,7 +2471,7 @@
if (!demux->segment_event) {
demux->segment_event = gst_event_new_segment (&demux->segment);
- GST_EVENT_SEQNUM (demux->segment_event) = base->last_seek_seqnum;
+ gst_event_set_seqnum (demux->segment_event, base->last_seek_seqnum);
}
push_new_segment: