summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <mathieu.duponchelle@opencreed.com>2015-02-12 22:06:17 +0100
committerMathieu Duponchelle <mathieu.duponchelle@opencreed.com>2015-02-12 22:47:26 +0100
commit7ca6d9634a8df45e9ad28f572e36a8d5e697b413 (patch)
tree14de91ef4e87a8cfa944953abd2acbe08acf045f
parent6b864813cce885e8fb900041f73dcf4e5264d3db (diff)
dashdemux: Fix handling of live streams with timeshift buffers.
By implementing get_live_seek_range. As shown by : gst-validate-1.0 playbin \ uri=http://dev-iplatforms.kw.bbc.co.uk/dash/news24-avc3/news24.php This patch handles live seeking, by setting a live seek range comprised between now - timeShiftBufferDepth and now. The inteersting thing with this stream is that one can actually ask fragments up to availabilityStartTime, but it seems quite clear in the spec that content is only guaranteed to exist up to timeShiftBufferDepth. One can test live seeking this way : gst-validate-1.0 playbin \ uri=http://dev-iplatforms.kw.bbc.co.uk/dash/news24-avc3/news24.php \ --set-scenario seek_back.scenario with scenario being: description, seek=true seek, playback-time=position+5.0, start="position-600.0", flags=accurate+flush This example will play the stream, wait for five seconds, then seek back to a position 10 minutes earlier. https://bugzilla.gnome.org/show_bug.cgi?id=744362
-rw-r--r--ext/dash/gstdashdemux.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c
index 12f5d6069..fca120c1b 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -262,6 +262,25 @@ gst_dash_demux_dispose (GObject * obj)
G_OBJECT_CLASS (parent_class)->dispose (obj);
}
+static gboolean
+gst_dash_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start,
+ gint64 * stop)
+{
+ GstDashDemux *self = GST_DASH_DEMUX (demux);
+ GDateTime *now = g_date_time_new_now_utc ();
+ GDateTime *mstart =
+ gst_date_time_to_g_date_time (self->client->mpd_node->availabilityStartTime);
+ GTimeSpan stream_now;
+
+ stream_now = g_date_time_difference (now, mstart);
+ g_date_time_unref (now);
+ g_date_time_unref (mstart);
+ *stop = stream_now * GST_USECOND;
+
+ *start = *stop - (self->client->mpd_node->timeShiftBufferDepth * GST_MSECOND);
+ return TRUE;
+}
+
static void
gst_dash_demux_class_init (GstDashDemuxClass * klass)
{
@@ -338,6 +357,7 @@ gst_dash_demux_class_init (GstDashDemuxClass * klass)
gstadaptivedemux_class->stream_update_fragment_info =
gst_dash_demux_stream_update_fragment_info;
gstadaptivedemux_class->stream_free = gst_dash_demux_stream_free;
+ gstadaptivedemux_class->get_live_seek_range = gst_dash_demux_get_live_seek_range;
}
static void