diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2015-12-01 00:22:36 -0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-12-01 00:22:44 -0300 |
commit | d55458135a8e0f0bd16703cfa84418612b9e7091 (patch) | |
tree | f39c68053cadee8c93ac004824b55fe127c97361 | |
parent | 763a7e5265f95002eb85bdf57b2899499cd2f04a (diff) |
wavparse: respect seqnum in seek events
Propagate the original seek seqnum to events originated from
seeking to make sure they have the same value
-rw-r--r-- | gst/wavparse/gstwavparse.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index f55b760db..87141eb19 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -378,12 +378,14 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event) gboolean update; GstSegment seeksegment = { 0, }; gint64 last_stop; + guint32 seqnum = 0; if (event) { GST_DEBUG_OBJECT (wav, "doing seek with event"); gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, &stop_type, &stop); + seqnum = gst_event_get_seqnum (event); /* no negative rates yet */ if (rate < 0.0) @@ -449,6 +451,7 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event) /* BYTE seek event */ event = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags, cur_type, cur, stop_type, stop); + gst_event_set_seqnum (event, seqnum); res = gst_pad_push_event (wav->sinkpad, event); } return res; @@ -464,9 +467,13 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event) * as it completes one iteration (and thus might block when the sink is * blocking in preroll). */ if (flush) { + GstEvent *fevent; GST_DEBUG_OBJECT (wav, "sending flush start"); - gst_pad_push_event (wav->sinkpad, gst_event_new_flush_start ()); - gst_pad_push_event (wav->srcpad, gst_event_new_flush_start ()); + + fevent = gst_event_new_flush_start (); + gst_event_set_seqnum (fevent, seqnum); + gst_pad_push_event (wav->sinkpad, gst_event_ref (fevent)); + gst_pad_push_event (wav->srcpad, fevent); } else { gst_pad_pause_task (wav->sinkpad); } @@ -545,10 +552,15 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event) /* prepare for streaming again */ if (flush) { + GstEvent *fevent; + /* if we sent a FLUSH_START, we now send a FLUSH_STOP */ GST_DEBUG_OBJECT (wav, "sending flush stop"); - gst_pad_push_event (wav->sinkpad, gst_event_new_flush_stop (TRUE)); - gst_pad_push_event (wav->srcpad, gst_event_new_flush_stop (TRUE)); + + fevent = gst_event_new_flush_stop (TRUE); + gst_event_set_seqnum (fevent, seqnum); + gst_pad_push_event (wav->sinkpad, gst_event_ref (fevent)); + gst_pad_push_event (wav->srcpad, fevent); } /* now we did the seek and can activate the new segment values */ @@ -569,6 +581,7 @@ gst_wavparse_perform_seek (GstWavParse * wav, GstEvent * event) if (wav->start_segment) gst_event_unref (wav->start_segment); wav->start_segment = gst_event_new_segment (&wav->segment); + gst_event_set_seqnum (wav->start_segment, seqnum); /* mark discont if we are going to stream from another position. */ if (last_stop != wav->segment.position) { |