subparse: Properly forward segment seqnum

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3913>
This commit is contained in:
Edward Hervey 2023-02-08 12:00:54 +01:00 committed by GStreamer Marge Bot
parent 1bab0ef2aa
commit 3d506a0978
2 changed files with 6 additions and 1 deletions

View file

@ -185,6 +185,7 @@ gst_sub_parse_init (GstSubParse * subparse)
subparse->strip_pango_markup = FALSE; subparse->strip_pango_markup = FALSE;
subparse->flushing = FALSE; subparse->flushing = FALSE;
gst_segment_init (&subparse->segment, GST_FORMAT_TIME); gst_segment_init (&subparse->segment, GST_FORMAT_TIME);
subparse->segment_seqnum = gst_util_seqnum_next ();
subparse->need_segment = TRUE; subparse->need_segment = TRUE;
subparse->encoding = g_strdup (DEFAULT_ENCODING); subparse->encoding = g_strdup (DEFAULT_ENCODING);
subparse->detected_encoding = NULL; subparse->detected_encoding = NULL;
@ -1625,10 +1626,12 @@ check_initial_events (GstSubParse * self)
/* Push newsegment if needed */ /* Push newsegment if needed */
if (self->need_segment) { if (self->need_segment) {
GstEvent *segment_event = gst_event_new_segment (&self->segment);
GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT, GST_LOG_OBJECT (self, "pushing newsegment event with %" GST_SEGMENT_FORMAT,
&self->segment); &self->segment);
gst_pad_push_event (self->srcpad, gst_event_new_segment (&self->segment)); gst_event_set_seqnum (segment_event, self->segment_seqnum);
gst_pad_push_event (self->srcpad, segment_event);
self->need_segment = FALSE; self->need_segment = FALSE;
} }
@ -1805,6 +1808,7 @@ gst_sub_parse_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
gst_event_copy_segment (event, &self->segment); gst_event_copy_segment (event, &self->segment);
GST_DEBUG_OBJECT (self, "newsegment (%s)", GST_DEBUG_OBJECT (self, "newsegment (%s)",
gst_format_get_name (self->segment.format)); gst_format_get_name (self->segment.format));
self->segment_seqnum = gst_event_get_seqnum (event);
/* if not time format, we'll either start with a 0 timestamp anyway or /* if not time format, we'll either start with a 0 timestamp anyway or
* it's following a seek in which case we'll have saved the requested * it's following a seek in which case we'll have saved the requested

View file

@ -75,6 +75,7 @@ struct _GstSubParse {
guint64 offset; guint64 offset;
/* Segment */ /* Segment */
guint32 segment_seqnum;
GstSegment segment; GstSegment segment;
gboolean need_segment; gboolean need_segment;