dashdemux: gst_dash_demux_get_live_seek_range returns positive values

https://bugzilla.gnome.org/show_bug.cgi?id=752374
This commit is contained in:
Florin Apostol 2015-11-20 19:38:03 +00:00 committed by Thiago Santos
parent 21dd771b69
commit 88e21e6089
2 changed files with 26 additions and 6 deletions

View file

@ -310,18 +310,33 @@ gst_dash_demux_get_live_seek_range (GstAdaptiveDemux * demux, gint64 * start,
gint64 * stop)
{
GstDashDemux *self = GST_DASH_DEMUX (demux);
GDateTime *now = gst_dash_demux_get_server_now_utc (self);
GDateTime *mstart =
gst_date_time_to_g_date_time (self->client->mpd_node->
availabilityStartTime);
GDateTime *now;
GDateTime *mstart;
GTimeSpan stream_now;
if (self->client->mpd_node->availabilityStartTime == NULL)
return FALSE;
now = gst_dash_demux_get_server_now_utc (self);
mstart =
gst_date_time_to_g_date_time (self->client->
mpd_node->availabilityStartTime);
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);
if (stream_now <= 0)
return FALSE;
*stop = stream_now * GST_USECOND;
if (self->client->mpd_node->timeShiftBufferDepth == GST_MPD_DURATION_NONE) {
*start = 0;
} else {
*start =
*stop - (self->client->mpd_node->timeShiftBufferDepth * GST_MSECOND);
if (*start < 0)
*start = 0;
}
return TRUE;
}

View file

@ -1524,6 +1524,11 @@ gst_adaptive_demux_src_query (GstPad * pad, GstObject * parent,
if (can_seek) {
if (gst_adaptive_demux_is_live (demux)) {
ret = gst_adaptive_demux_get_live_seek_range (demux, &start, &stop);
if (!ret) {
GST_MANIFEST_UNLOCK (demux);
GST_INFO_OBJECT (demux, "can't answer seeking query");
return FALSE;
}
} else {
duration = demux_class->get_duration (demux);
if (GST_CLOCK_TIME_IS_VALID (duration) && duration > 0)