diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index a5e517bfef..c3f4cd65e1 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -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);