summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/dash/gstdashdemux.c25
-rw-r--r--ext/dash/gstmpdparser.c36
-rw-r--r--ext/dash/gstmpdparser.h1
3 files changed, 4 insertions, 58 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c
index b20234785..060f27427 100644
--- a/ext/dash/gstdashdemux.c
+++ b/ext/dash/gstdashdemux.c
@@ -591,30 +591,13 @@ gst_dash_demux_setup_streams (GstAdaptiveDemux * demux)
/* If stream is live, try to find the segment that
* is closest to current time */
if (gst_mpd_client_is_live (dashdemux->client)) {
- GList *iter;
- gint seg_idx;
+ GDateTime *gnow;
GST_DEBUG_OBJECT (demux, "Seeking to current time of day for live stream ");
- for (iter = demux->next_streams; iter; iter = g_list_next (iter)) {
- GstDashDemuxStream *stream = iter->data;
- GstActiveStream *active_stream = stream->active_stream;
-
- /* Get segment index corresponding to current time. */
- seg_idx =
- gst_mpd_client_get_segment_index_at_time (dashdemux->client,
- active_stream, now);
- if (seg_idx < 0) {
- GST_WARNING_OBJECT (demux,
- "Failed to find a segment that is available "
- "at this point in time for stream %d.", stream->index);
- seg_idx = 0;
- }
- GST_INFO_OBJECT (demux,
- "Segment index corresponding to current time for stream "
- "%d is %d.", stream->index, seg_idx);
- gst_mpd_client_set_segment_index (active_stream, seg_idx);
- }
+ gnow = gst_date_time_to_g_date_time (now);
+ gst_mpd_client_seek_to_time (dashdemux->client, gnow);
+ g_date_time_unref (gnow);
} else {
GST_DEBUG_OBJECT (demux, "Seeking to first segment for on-demand stream ");
diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c
index 5243b85a3..9b2015f89 100644
--- a/ext/dash/gstmpdparser.c
+++ b/ext/dash/gstmpdparser.c
@@ -3527,42 +3527,6 @@ gst_mpd_client_add_time_difference (GstDateTime * t1, gint64 usecs)
return rv;
}
-gint
-gst_mpd_client_get_segment_index_at_time (GstMpdClient * client,
- GstActiveStream * stream, const GstDateTime * time)
-{
- GstClockTime seg_duration;
- gint64 diff;
- GstDateTime *avail_start =
- gst_mpd_client_get_availability_start_time (client);
- GstStreamPeriod *stream_period = gst_mpdparser_get_stream_period (client);
-
- if (avail_start == NULL)
- return -1;
-
- if (stream_period && stream_period->period) {
- GstDateTime *t;
-
- t = gst_mpd_client_add_time_difference (avail_start,
- stream_period->period->start * 1000);
- gst_date_time_unref (avail_start);
- avail_start = t;
- }
- diff = gst_mpd_client_calculate_time_difference (avail_start, time);
- gst_date_time_unref (avail_start);
-
- if (diff < 0)
- return -2;
- if (diff > gst_mpd_client_get_media_presentation_duration (client))
- return -3;
-
- /* TODO: Assumes all fragments are roughly the same duration */
- seg_duration = gst_mpd_client_get_next_fragment_duration (client, stream);
- if (seg_duration == 0)
- return -1;
- return diff / seg_duration;
-}
-
static GstDateTime *
gst_mpd_client_get_availability_start_time (GstMpdClient * client)
{
diff --git a/ext/dash/gstmpdparser.h b/ext/dash/gstmpdparser.h
index 7298d3c88..98ac1b280 100644
--- a/ext/dash/gstmpdparser.h
+++ b/ext/dash/gstmpdparser.h
@@ -505,7 +505,6 @@ gboolean gst_mpd_client_is_live (GstMpdClient * client);
gboolean gst_mpd_client_stream_seek (GstMpdClient * client, GstActiveStream * stream, GstClockTime ts);
gboolean gst_mpd_client_seek_to_time (GstMpdClient * client, GDateTime * time);
GstDateTime *gst_mpd_client_add_time_difference (GstDateTime * t1, gint64 usecs);
-gint gst_mpd_client_get_segment_index_at_time (GstMpdClient *client, GstActiveStream * stream, const GstDateTime *time);
gint gst_mpd_client_check_time_position (GstMpdClient * client, GstActiveStream * stream, GstClockTime ts, gint64 * diff);
GstClockTime gst_mpd_parser_get_stream_presentation_offset (GstMpdClient *client, guint stream_idx);