From 9a7bf5fbf15cc5f3363dae15552f1bd87394f992 Mon Sep 17 00:00:00 2001 From: Florin Apostol Date: Tue, 24 Nov 2015 12:42:45 +0000 Subject: [PATCH] mpdparser: remove gst_mpd_client_check_time_position https://bugzilla.gnome.org/show_bug.cgi?id=758593 --- ext/dash/gstmpdparser.c | 63 --------------------------------- ext/dash/gstmpdparser.h | 1 - tests/check/elements/dash_mpd.c | 11 ------ 3 files changed, 75 deletions(-) diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index 686dead38b..dba966e34b 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -5747,69 +5747,6 @@ gst_mpd_client_get_next_segment_availability_end_time (GstMpdClient * client, return rv; } -gint -gst_mpd_client_check_time_position (GstMpdClient * client, - GstActiveStream * stream, GstClockTime ts, gint64 * diff) -{ - GDateTime *now = g_date_time_new_now_utc (); - GDateTime *start = - gst_date_time_to_g_date_time (client->mpd_node->availabilityStartTime); - GTimeSpan stream_now; - GTimeSpan ts_microseconds; - GstClockTime duration; - - g_return_val_if_fail (gst_mpd_client_is_live (client), 0); - - duration = gst_mpd_client_get_segment_duration (client, stream, NULL); - stream_now = g_date_time_difference (now, start); - g_date_time_unref (now); - g_date_time_unref (start); - - /* sum duration to check if the segment is fully ready */ - ts_microseconds = (ts + duration) / GST_USECOND; - - /* - * This functions checks if a given ts is in the 'available range' of - * a DASH presentation. This only makes sense for live streams, which - * are continuously adding new segments and removing old ones. - * - * Note: Both the client and the server should use UTC as a time reference. - * - * @ts is the time since the beginning of the stream and we need to find out - * if it is currently available. The server should be hosting segments - * - * * ---------------- ... --- * ----------- * ---- ... - * | - * | past(unavailable) | | available | future(unavailable yet) - * | - * * ---------------- ... --- * ----------- * ---- ... - * | | | - * availabilitStartTime | UTC now - * UTC now - timeShiftBufferDepth - * - * This function should return 0 if @ts is in the 'available' area, 1 for - * 'future' and '-1' for past and the corresponding distance to the - * 'available' area is set to @diff - * - * TODO untested with live presentations with multiple periods as no - * examples for it could be found/generated - */ - - if (ts_microseconds > stream_now) { - *diff = ts_microseconds - stream_now; - return 1; - } - if (client->mpd_node->timeShiftBufferDepth != -1 - && ts_microseconds < - stream_now - client->mpd_node->timeShiftBufferDepth) { - *diff = ts_microseconds - stream_now; - return -1; - } - - *diff = 0; - return 0; -} - gboolean gst_mpd_client_seek_to_time (GstMpdClient * client, GDateTime * time) { diff --git a/ext/dash/gstmpdparser.h b/ext/dash/gstmpdparser.h index 533492bcdd..cae192cf17 100644 --- a/ext/dash/gstmpdparser.h +++ b/ext/dash/gstmpdparser.h @@ -546,7 +546,6 @@ gboolean gst_mpd_client_get_next_header_index (GstMpdClient *client, gchar **uri 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); -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); gchar** gst_mpd_client_get_utc_timing_sources (GstMpdClient *client, guint methods, GstMPDUTCTimingType *selected_method); GstClockTime gst_mpd_parser_get_period_start_time (GstMpdClient *client); diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c index 64a8d97849..ceb5a9f64b 100644 --- a/tests/check/elements/dash_mpd.c +++ b/tests/check/elements/dash_mpd.c @@ -3845,8 +3845,6 @@ GST_START_TEST (dash_mpdparser_segments) GstDateTime *segmentEndTime; GstDateTime *gst_time; GDateTime *g_time; - GstClockTime ts; - gint64 diff; const gchar *xml = "" @@ -3968,15 +3966,6 @@ GST_START_TEST (dash_mpdparser_segments) gst_mpd_client_has_next_segment (mpdclient, activeStream, TRUE); assert_equals_int (hasNextSegment, 1); - /* check if stream at moment ts is available. - * timeShiftBufferDepth was not set, so it is considered infinite. - * All segments from the past must be available - */ - ts = 30 * GST_SECOND; - ret = gst_mpd_client_check_time_position (mpdclient, activeStream, ts, &diff); - assert_equals_int (ret, 0); - assert_equals_int64 (diff, 0); - gst_mpd_client_free (mpdclient); }