mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 16:26:39 +00:00
adaptivedemux2: Fix early seeking
When seeking is handled by the collection posting thread, there is a possibility that some leftover data will be pushed by the stream thread. Properly detect and reject those early segments (and buffers) by comparing it to the main segment seqnum Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3914>
This commit is contained in:
parent
c98f5c2bf4
commit
39c8b060f4
1 changed files with 20 additions and 0 deletions
|
@ -504,6 +504,18 @@ _track_sink_chain_function (GstPad * pad, GstObject * parent,
|
|||
|
||||
TRACKS_LOCK (demux);
|
||||
|
||||
/* Discard buffers that are received outside of a valid segment. This can
|
||||
* happen if a flushing seek (which resets the track segment seqnums) was
|
||||
* received but the stream is still providing buffers before returning.
|
||||
*/
|
||||
if (track->input_segment_seqnum == GST_SEQNUM_INVALID) {
|
||||
GST_DEBUG_OBJECT (pad,
|
||||
"Dropping buffer because we do not have a valid input segment");
|
||||
gst_buffer_unref (buffer);
|
||||
TRACKS_UNLOCK (demux);
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
ts = GST_BUFFER_DTS_OR_PTS (buffer);
|
||||
|
||||
/* Buffers coming out of parsebin *should* always be timestamped (it's the
|
||||
|
@ -653,6 +665,14 @@ _track_sink_event_function (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
if (seg_seqnum != demux->priv->segment_seqnum) {
|
||||
GST_DEBUG_OBJECT (pad, "Ignoring non-current segment");
|
||||
gst_event_unref (event);
|
||||
TRACKS_UNLOCK (demux);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
track->input_segment_seqnum = seg_seqnum;
|
||||
gst_event_copy_segment (event, &track->input_segment);
|
||||
if (track->input_segment.rate >= 0)
|
||||
|
|
Loading…
Reference in a new issue