mpdparser: remove gst_mpd_client_check_time_position
authorFlorin Apostol <florin.apostol@oregan.net>
Tue, 24 Nov 2015 12:42:45 +0000 (12:42 +0000)
committerThiago Santos <thiagoss@osg.samsung.com>
Tue, 24 Nov 2015 13:01:58 +0000 (10:01 -0300)
https://bugzilla.gnome.org/show_bug.cgi?id=758593

ext/dash/gstmpdparser.c
ext/dash/gstmpdparser.h
tests/check/elements/dash_mpd.c

index 686dead..dba966e 100644 (file)
@@ -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)
 {
index 533492b..cae192c 100644 (file)
@@ -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);
index 64a8d97..ceb5a9f 100644 (file)
@@ -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 =
       "<?xml version=\"1.0\"?>"
@@ -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);
 }