mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
adaptivedemux: Implement GST_SEEK_TYPE_END usage for live
When dealing with live streams, we can't rely on GstSegment calculation since it uses the segment duration to calculate the absolute values. But since we are dealing with live *and* we know the ranges, we can compute the absolute seeking values using the range stop (i.e. "now") as the END position. Allows seeking back to "live" by using start_type:GST_SEEK_TYPE_END and start:0 https://bugzilla.gnome.org/show_bug.cgi?id=782228
This commit is contained in:
parent
0309b20098
commit
df60e12203
1 changed files with 22 additions and 0 deletions
|
@ -1502,6 +1502,7 @@ gst_adaptive_demux_handle_seek_event (GstAdaptiveDemux * demux, GstPad * pad,
|
|||
|
||||
if (gst_adaptive_demux_is_live (demux)) {
|
||||
gint64 range_start, range_stop;
|
||||
gboolean changed = FALSE;
|
||||
if (!gst_adaptive_demux_get_live_seek_range (demux, &range_start,
|
||||
&range_stop)) {
|
||||
GST_MANIFEST_UNLOCK (demux);
|
||||
|
@ -1510,6 +1511,18 @@ gst_adaptive_demux_handle_seek_event (GstAdaptiveDemux * demux, GstPad * pad,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/* Handle relative positioning for live streams (relative to the range_stop) */
|
||||
if (start_type == GST_SEEK_TYPE_END) {
|
||||
start = range_stop + start;
|
||||
start_type = GST_SEEK_TYPE_SET;
|
||||
changed = TRUE;
|
||||
}
|
||||
if (stop_type == GST_SEEK_TYPE_END) {
|
||||
stop = range_stop + stop;
|
||||
stop_type = GST_SEEK_TYPE_SET;
|
||||
changed = TRUE;
|
||||
}
|
||||
|
||||
if (!(flags & GST_SEEK_FLAG_ACCURATE)) {
|
||||
/* If the accurate flag is not set, we allow seeking before the start
|
||||
* to map to the start for live cases, since those can return a "moving
|
||||
|
@ -1523,6 +1536,7 @@ gst_adaptive_demux_handle_seek_event (GstAdaptiveDemux * demux, GstPad * pad,
|
|||
start = range_start;
|
||||
if (stop != GST_CLOCK_TIME_NONE)
|
||||
stop += dt;
|
||||
changed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1533,6 +1547,14 @@ gst_adaptive_demux_handle_seek_event (GstAdaptiveDemux * demux, GstPad * pad,
|
|||
gst_event_unref (event);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
gst_event_unref (event);
|
||||
event =
|
||||
gst_event_new_seek (rate, format, flags,
|
||||
start_type, start, stop_type, stop);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
seqnum = gst_event_get_seqnum (event);
|
||||
|
|
Loading…
Reference in a new issue