rmdemux->have_group_id = FALSE;
rmdemux->group_id = G_MAXUINT;
rmdemux->flowcombiner = gst_flow_combiner_new ();
+ rmdemux->seek_seqnum = GST_SEQNUM_INVALID;
gst_rm_utils_run_tests ();
}
case GST_EVENT_SEEK:
{
gboolean running;
+ guint32 seqnum;
GST_LOG_OBJECT (rmdemux, "Event on src: SEEK");
+
+ seqnum = gst_event_get_seqnum (event);
+ if (seqnum == rmdemux->seek_seqnum) {
+ GST_LOG_OBJECT (pad,
+ "Drop duplicated SEEK event seqnum %" G_GUINT32_FORMAT, seqnum);
+ gst_event_unref (event);
+ break;
+ }
+
/* can't seek if we are not seekable, FIXME could pass the
* seek query upstream after converting it to bytes using
* the average bitrate of the stream. */
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gboolean update;
+ guint32 seqnum = GST_SEQNUM_INVALID;
+ GstEvent *fl_event;
if (event) {
GST_DEBUG_OBJECT (rmdemux, "seek with event");
+ seqnum = gst_event_get_seqnum (event);
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
/* first step is to unlock the streaming thread if it is
* blocked in a chain call, we do this by starting the flush. */
if (flush) {
- gst_pad_push_event (rmdemux->sinkpad, gst_event_new_flush_start ());
- gst_rmdemux_send_event (rmdemux, gst_event_new_flush_start ());
+ fl_event = gst_event_new_flush_start ();
+ if (seqnum != GST_SEQNUM_INVALID)
+ gst_event_set_seqnum (fl_event, seqnum);
+ gst_pad_push_event (rmdemux->sinkpad, fl_event);
+
+ fl_event = gst_event_new_flush_start ();
+ if (seqnum != GST_SEQNUM_INVALID)
+ gst_event_set_seqnum (fl_event, seqnum);
+ gst_rmdemux_send_event (rmdemux, fl_event);
} else {
gst_pad_pause_task (rmdemux->sinkpad);
}
ret = FALSE;
goto done;
}
+
+ rmdemux->seek_seqnum = seqnum;
}
GST_DEBUG_OBJECT (rmdemux, "segment positions set to %" GST_TIME_FORMAT "-%"
/* we need to stop flushing on the sinkpad as we're going to use it
* next. We can do this as we have the STREAM lock now. */
- gst_pad_push_event (rmdemux->sinkpad, gst_event_new_flush_stop (TRUE));
+ fl_event = gst_event_new_flush_stop (TRUE);
+ if (seqnum != GST_SEQNUM_INVALID)
+ gst_event_set_seqnum (fl_event, seqnum);
+ gst_pad_push_event (rmdemux->sinkpad, fl_event);
GST_LOG_OBJECT (rmdemux, "Pushed FLUSH_STOP event");
/* Reset the demuxer state */
rmdemux->state = RMDEMUX_STATE_DATA_PACKET;
- if (flush)
- gst_rmdemux_send_event (rmdemux, gst_event_new_flush_stop (TRUE));
+ if (flush) {
+ fl_event = gst_event_new_flush_stop (TRUE);
+ if (seqnum != GST_SEQNUM_INVALID)
+ gst_event_set_seqnum (fl_event, seqnum);
+ gst_rmdemux_send_event (rmdemux, fl_event);
+ }
/* must send newsegment event from streaming thread, so just set flag */
rmdemux->need_newsegment = TRUE;
/* notify start of new segment */
if (rmdemux->segment.flags & GST_SEEK_FLAG_SEGMENT) {
- gst_element_post_message (GST_ELEMENT_CAST (rmdemux),
+ GstMessage *msg =
gst_message_new_segment_start (GST_OBJECT_CAST (rmdemux),
- GST_FORMAT_TIME, rmdemux->segment.position));
+ GST_FORMAT_TIME, rmdemux->segment.position);
+ if (seqnum != GST_SEQNUM_INVALID)
+ gst_message_set_seqnum (msg, seqnum);
+ gst_element_post_message (GST_ELEMENT_CAST (rmdemux), msg);
}
/* restart our task since it might have been stopped when we did the
rmdemux->have_group_id = FALSE;
rmdemux->group_id = G_MAXUINT;
+
+ rmdemux->seek_seqnum = GST_SEQNUM_INVALID;
}
static GstStateChangeReturn