mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
tsdemux: handle seeks with no target (ie, keep current position)
Such seeks are used to change playback rate and we do not want to alter the position in that case, so we bypass the flush/seek logic, and set things up so a new segment is scheduled to be regenerated. https://bugzilla.gnome.org/show_bug.cgi?id=735100
This commit is contained in:
parent
68f57d20b9
commit
338bfe5e35
2 changed files with 32 additions and 13 deletions
|
@ -1410,15 +1410,17 @@ mpegts_base_handle_seek_event (MpegTSBase * base, GstPad * pad,
|
|||
GST_WARNING ("seeking failed %s", gst_flow_get_name (ret));
|
||||
else {
|
||||
GstEvent *new_seek;
|
||||
base->mode = BASE_MODE_SEEKING;
|
||||
|
||||
new_seek = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
|
||||
GST_SEEK_TYPE_SET, base->seek_offset, GST_SEEK_TYPE_NONE, -1);
|
||||
gst_event_set_seqnum (new_seek, GST_EVENT_SEQNUM (event));
|
||||
if (!gst_pad_push_event (base->sinkpad, new_seek))
|
||||
ret = GST_FLOW_ERROR;
|
||||
else
|
||||
base->last_seek_seqnum = GST_EVENT_SEQNUM (event);
|
||||
if (GST_CLOCK_TIME_IS_VALID (base->seek_offset)) {
|
||||
base->mode = BASE_MODE_SEEKING;
|
||||
new_seek = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
|
||||
GST_SEEK_TYPE_SET, base->seek_offset, GST_SEEK_TYPE_NONE, -1);
|
||||
gst_event_set_seqnum (new_seek, GST_EVENT_SEQNUM (event));
|
||||
if (!gst_pad_push_event (base->sinkpad, new_seek))
|
||||
ret = GST_FLOW_ERROR;
|
||||
else
|
||||
base->last_seek_seqnum = GST_EVENT_SEQNUM (event);
|
||||
}
|
||||
base->mode = BASE_MODE_PUSHING;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -800,12 +800,29 @@ gst_ts_demux_do_seek (MpegTSBase * base, GstEvent * event)
|
|||
/* configure the segment with the seek variables */
|
||||
GST_DEBUG_OBJECT (demux, "configuring seek");
|
||||
|
||||
start_offset =
|
||||
mpegts_packetizer_ts_to_offset (base->packetizer, MAX (0,
|
||||
start - SEEK_TIMESTAMP_OFFSET), demux->program->pcr_pid);
|
||||
if (start_type != GST_SEEK_TYPE_NONE) {
|
||||
start_offset =
|
||||
mpegts_packetizer_ts_to_offset (base->packetizer, MAX (0,
|
||||
start - SEEK_TIMESTAMP_OFFSET), demux->program->pcr_pid);
|
||||
|
||||
if (G_UNLIKELY (start_offset == -1)) {
|
||||
GST_WARNING ("Couldn't convert start position to an offset");
|
||||
if (G_UNLIKELY (start_offset == -1)) {
|
||||
GST_WARNING ("Couldn't convert start position to an offset");
|
||||
goto done;
|
||||
}
|
||||
} else {
|
||||
start_offset = GST_CLOCK_TIME_NONE;
|
||||
for (tmp = demux->program->stream_list; tmp; tmp = tmp->next) {
|
||||
TSDemuxStream *stream = tmp->data;
|
||||
|
||||
stream->need_newsegment = TRUE;
|
||||
}
|
||||
gst_segment_init (&demux->segment, GST_FORMAT_UNDEFINED);
|
||||
if (demux->segment_event) {
|
||||
gst_event_unref (demux->segment_event);
|
||||
demux->segment_event = NULL;
|
||||
}
|
||||
demux->rate = rate;
|
||||
res = GST_FLOW_OK;
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue