diff options
author | Alex Ashley <bugzilla@ashley-family.net> | 2015-07-15 11:56:13 +0100 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-08-14 06:47:20 -0300 |
commit | 95c705ae8f48acb4504ac168b4a8c16d77cae8da (patch) | |
tree | fc871627905a503b603a442863351ee71cc881e5 /tests | |
parent | a7444ad8508ee37720365368ae353c6e4194eef9 (diff) | |
download | gstreamer-plugins-bad-95c705ae8f48acb4504ac168b4a8c16d77cae8da.tar.gz |
dashdemux: add support for UTCTiming elements for clock drift compensation
Unless the DASH client can compensate for the difference between its
clock and the clock used by the server, the client might request
fragments that either not yet on the server or fragments that have
already been expired from the server. This is an issue because these
requests can propagate all the way back to the origin
ISO/IEC 23009-1:2014/Amd 1 [PDAM1] defines a new UTCTiming element to allow
a DASH client to track the clock used by the server generating the
DASH stream. Multiple UTCTiming elements might be present, to indicate
support for multiple methods of UTC time gathering. Each element can
contain a white space separated list of URLs that can be contacted
to discover the UTC time from the server's perspective.
This commit provides parsing of UTCTiming elements, unit tests of this
parsing and a function to poll a time server. This function
supports the following methods:
urn:mpeg:dash:utc:ntp:2014
urn:mpeg:dash:utc:http-xsdate:2014
urn:mpeg:dash:utc:http-iso:2014
urn:mpeg:dash:utc:http-ntp:2014
The manifest update task is used to poll the clock time server,
to save having to create a new thread.
When choosing the starting fragment number and when waiting for a
fragment to become available, the difference between the server's idea
of UTC and the client's idea of UTC is taken into account. For example,
if the server's time is behind the client's idea of UTC, we wait for
longer before requesting a fragment
[PDAM1]: http://www.iso.org/iso/home/store/catalogue_tc/catalogue_detail.htm?csnumber=66068
dashdemux: support NTP time servers in UTCTiming elements
Use the gst_ntp_clock to support the use of an NTP server.
https://bugzilla.gnome.org/show_bug.cgi?id=752413
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/elements/dash_mpd.c | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/check/elements/dash_mpd.c b/tests/check/elements/dash_mpd.c index b1f776243..ee5b6cbbd 100644 --- a/tests/check/elements/dash_mpd.c +++ b/tests/check/elements/dash_mpd.c @@ -2268,6 +2268,62 @@ GST_START_TEST (dash_mpdparser_period_subset) GST_END_TEST; /* + * Test parsing UTCTiming elements + * + */ +GST_START_TEST (dash_mpdparser_utctiming) +{ + const gchar *xml = + "<?xml version=\"1.0\"?>" + "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\"" + " profiles=\"urn:mpeg:dash:profile:isoff-main:2011\">" + "<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:http-xsdate:2014\" value=\"http://time.akamai.com/?iso http://example.time/xsdate\"/>" + "<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:direct:2014\" value=\"2002-05-30T09:30:10Z \"/>" + "<UTCTiming schemeIdUri=\"urn:mpeg:dash:utc:ntp:2014\" value=\"0.europe.pool.ntp.org 1.europe.pool.ntp.org 2.europe.pool.ntp.org 3.europe.pool.ntp.org\"/>" + "</MPD>"; + gboolean ret; + GstMpdClient *mpdclient = gst_mpd_client_new (); + GstMPDUTCTimingType selected_method; + gchar **urls; + + ret = gst_mpd_parse (mpdclient, xml, (gint) strlen (xml)); + + assert_equals_int (ret, TRUE); + fail_if (mpdclient->mpd_node == NULL); + fail_if (mpdclient->mpd_node->UTCTiming == NULL); + assert_equals_int (g_list_length (mpdclient->mpd_node->UTCTiming), 3); + urls = + gst_mpd_client_get_utc_timing_sources (mpdclient, + GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE, &selected_method); + fail_if (urls == NULL); + assert_equals_int (selected_method, GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE); + assert_equals_int (g_strv_length (urls), 2); + assert_equals_string (urls[0], "http://time.akamai.com/?iso"); + assert_equals_string (urls[1], "http://example.time/xsdate"); + urls = + gst_mpd_client_get_utc_timing_sources (mpdclient, + GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE | GST_MPD_UTCTIMING_TYPE_HTTP_ISO, + &selected_method); + fail_if (urls == NULL); + assert_equals_int (selected_method, GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE); + urls = + gst_mpd_client_get_utc_timing_sources (mpdclient, + GST_MPD_UTCTIMING_TYPE_DIRECT, NULL); + fail_if (urls == NULL); + assert_equals_int (g_strv_length (urls), 1); + assert_equals_string (urls[0], "2002-05-30T09:30:10Z "); + urls = + gst_mpd_client_get_utc_timing_sources (mpdclient, + GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE | GST_MPD_UTCTIMING_TYPE_DIRECT, + &selected_method); + fail_if (urls == NULL); + assert_equals_int (selected_method, GST_MPD_UTCTIMING_TYPE_HTTP_XSDATE); + gst_mpd_client_free (mpdclient); +} + +GST_END_TEST; + +/* * Test parsing the type property: value "dynamic" * */ @@ -4333,6 +4389,7 @@ dash_suite (void) tcase_add_test (tc_simpleMPD, dash_mpdparser_period_adaptationSet_representation_segmentTemplate); tcase_add_test (tc_simpleMPD, dash_mpdparser_period_subset); + tcase_add_test (tc_simpleMPD, dash_mpdparser_utctiming); /* tests checking other possible values for attributes */ tcase_add_test (tc_simpleMPD, dash_mpdparser_type_dynamic); |