Commit graph

54 commits

Author SHA1 Message Date
Florin Apostol
9ccd541980 mpdparser: renamed gst_mpd_client_get_next_segment_availability_end_time to gst_mpd_client_get_next_segment_availability_start_time
The function actually returns the segment availability start time (as defined by the standard).
That is at the end of the segment, but it is called availability start time.

Availability end time is something else (the time when the segment is no longer
available on the server). The function name was misleading.

https://bugzilla.gnome.org/show_bug.cgi?id=757655
2016-02-09 16:49:37 -03:00
Florin Apostol
25c89b12d6 mpdparser: tests: added unit test for getting segment availability when segment timeline is used
https://bugzilla.gnome.org/show_bug.cgi?id=757655
2016-02-09 16:35:44 -03:00
Thiago Santos
cfcba7bc0f tests: dash: fix dash tests after index fix
8e788f2845 broke one of the
dash mpd tests. This updates and fixes it.
2016-02-01 14:36:48 -03:00
Florin Apostol
b2e689890f dashdemux: improve validation of UTCtiming element
gst_mpdparser_parse_utctiming_node does not validate the parsed values completely. The following scenarios are incorrectly accepted:
- elements with no schemeIdUri property should be rejected
- elements with unrecognized UTCTiming scheme should be rejected
- elements with empty values should be rejected

The last one triggers a division by 0 in gst_dash_demux_poll_clock_drift:
clock_drift->selected_url = clock_drift->selected_url % g_strv_length (urls);
because it urls is a valid pointer to an empty array.

https://bugzilla.gnome.org/show_bug.cgi?id=759547
2015-12-16 17:19:50 +01:00
Sebastian Dröge
a878d6e67e dash: Fix unit test after moving of framerates to RepresentationBaseType 2015-12-08 09:53:11 +02:00
Florin Apostol
9a7bf5fbf1 mpdparser: remove gst_mpd_client_check_time_position
https://bugzilla.gnome.org/show_bug.cgi?id=758593
2015-11-24 10:01:58 -03:00
Florin Apostol
c681c33d10 mpdparser: tests: added test for fraction of seconds in availabilityStartTime
https://bugzilla.gnome.org/show_bug.cgi?id=758410
2015-11-23 11:54:37 -03:00
Florin Apostol
ef84f294c0 mpdparser: remove unused functions gst_mpdparser_get_chunk_by_index and gst_mpdparser_find_segment_by_index
https://bugzilla.gnome.org/show_bug.cgi?id=758233
2015-11-19 15:53:30 -03:00
Sebastian Dröge
87b5ad0dfc mpdparser: Also allow '/' in RepresentationID
Used by http://www.bok.net/dash/tears_of_steel/cleartext/stream.mpd

https://bugzilla.gnome.org/show_bug.cgi?id=757903
2015-11-18 19:17:29 +02:00
Florin Apostol
b095026945 mpdparser: tests: added test for gst_mpd_client_get_last_fragment_timestamp_end
The timestamp for last fragment is incorrectly retrieved if segment templates
are used.

https://bugzilla.gnome.org/show_bug.cgi?id=758188
2015-11-18 09:50:26 +02:00
Vincent Penquerc'h
2f8efd1ce3 tests: add a test for MPD file duration parsing
https://bugzilla.gnome.org/show_bug.cgi?id=752336
2015-11-02 11:36:12 +00:00
Vincent Penquerc'h
e48e68416c mpdparser: make durations unsigned where appropriate
The standard does not seem to make any particular explicit not
implicit reference to the signedness of durations, and the code
does not rely on such, nor on the negativity of the -1 value
that's used as a placeholder when a duration property is not
present in the XML.

https://bugzilla.gnome.org/show_bug.cgi?id=750847
2015-10-30 16:29:46 +00:00
Florin Apostol
d6e805a283 dashdemux: inherit bitstreamSwitching from Period to AdaptationSet
https://bugzilla.gnome.org/show_bug.cgi?id=752340
2015-10-30 15:58:36 +00:00
Florin Apostol
590df23cb1 dashdemux: unit testing reproducing inherited segment duration overflow
unit test reproducing https://bugzilla.gnome.org/show_bug.cgi?id=751832
2015-10-30 15:05:28 +00:00
Florin Apostol
013655d886 dashdemux: inherited segment URLs are ignored if they are defined again in a lower SegmentList
According to the standard:
"SegmentBase, SegmentTemplate and SegmentList shall inherit
attributes and elements from the same element on a higher level.
If the same attribute or element is present on both levels,
the one on the lower level shall take precedence over the one
on the higher level."

gst_mpdparser_parse_segment_list_node will now discard any inherited
segment URLs if the parsed element defines some too.

https://bugzilla.gnome.org/show_bug.cgi?id=751832
2015-10-30 14:31:21 +00:00
Florin Apostol
dc04d3d261 dashdemux: tests: added test for multiple BaseURL entries
https://bugzilla.gnome.org/show_bug.cgi?id=757245
2015-10-30 13:00:53 +00:00
Florin Apostol
4632dbe3ae dashdemux: tests: added unit test for 6d1eda9391
Commit 6d1eda9391 fixed the period start
time scaling. This patch updates the unit tests to cover that scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=755105
2015-10-30 12:57:54 +00:00
Alex Ashley
c8ef39cac7 dashdemux: provide a default suggestedPresentationDelay
If MPD@suggestedPresentationDelay is not present in the manifest,
dashdemux selects the fragment closest to the most recently generated
fragment. This causes a playback issue because this choice does not allow
the DASH client to build up any buffer of downloaded fragments without
pausing playback. This is because by definition new fragments appear on
the server in real-time (e.g. if segment duration is 4 seconds, a new
fragment will appear on the server every 4 seconds). If the starting
playback position was n*segmentDuration seconds behind "now", the DASH
client could download up to 'n' fragments faster than realtime before it
reached the point where it needed to wait for fragments to appear on the
server.

The MPD@suggestedPresentationDelay attribute allows a content publisher
to provide a suggested starting position that is behind the current
"live" position.

If the MPD@suggestedPresentationDelay attribute is not present, provide
a suitable default value as a property of the dashdemux element. To
allow the default presentation delay to be specified either using
fragments or seconds, the property is a string that contains a number
and a unit (e.g. "10 seconds", "4 fragments", "2500ms").
2015-10-29 13:26:46 +00:00
Vincent Penquerc'h
7443f35249 dash_mpd: restrict segment template format strings to %0[0-9]*d as per spec
https://bugzilla.gnome.org/show_bug.cgi?id=751735
2015-10-29 12:04:31 +00:00
Florin Apostol
4eea6c3833 dashdemux: segment template parsing: added support for %d
Added support for %d in template identifier.
Added testcases for %d, %3d, %0-4d identifier formats.
2015-10-29 11:58:47 +00:00
Florin Apostol
933d367440 dashdemux: corrected parsing of segment templates
Corrected the parsing of a segment template string.
Added unit tests to test the segment template parsing.
All reported problems are now correctly handled.

https://bugzilla.gnome.org/show_bug.cgi?id=751735
2015-10-29 11:54:34 +00:00
Florin Apostol
566e84cec1 dashdemux: fixed crash when segment timeline list is greater than segment url list
When building the media segment list using a SegmentList node, the
gst_mpd_client_setup_representation function will iterate through the
list of S nodes and will expect to find a matching SegmentUrl node. If
one does not exist, the code made an illegal memory access.

https://bugzilla.gnome.org/show_bug.cgi?id=752496
2015-10-29 10:20:45 +00:00
Florin Apostol
84ff565c88 dashdemux: unit test for missing profiles 2015-10-29 10:20:45 +00:00
Florin Apostol
cdfec06092 dashdemux: parser rejects negative values for mediaPresentationDuration
https://bugzilla.gnome.org/show_bug.cgi?id=752326
2015-10-29 10:20:45 +00:00
Florin Apostol
7c2746f741 dashdemux: corrected parsing of negative values into unsigned data
https://bugzilla.gnome.org/show_bug.cgi?id=752429
2015-10-29 10:20:45 +00:00
Florin Apostol
c763d1e8fd dashdemux: parser rejects XMLs with negative period duration
https://bugzilla.gnome.org/show_bug.cgi?id=752329
2015-10-28 15:41:17 +00:00
Vincent Penquerc'h
60133b1472 mpdparser: check segment lists have either duration or timeline
And add error checking along the way.

Add duration where appropriate so unit tests still pass.

https://bugzilla.gnome.org/show_bug.cgi?id=751650
2015-10-28 15:34:29 +00:00
Vincent Penquerc'h
b8df6cc316 mpdparser: validate representation set identifier
It must have no whitespace, and must comply with RFC 1738 when
used to build a URL.

https://bugzilla.gnome.org/show_bug.cgi?id=750852
2015-10-28 15:11:50 +00:00
Florin Apostol
ebf2a00926 dashdemux: test: added unit test for presentation time offset
https://bugzilla.gnome.org/show_bug.cgi?id=752409
2015-10-02 17:09:50 +03:00
Sebastian Dröge
8169ee8372 dash: Fix unit test after internal API change 2015-09-26 10:50:19 +02:00
Sebastian Dröge
93d85bd361 dashdemux: Implement lazy-loading of external periods
https://bugzilla.gnome.org/show_bug.cgi?id=752230
2015-09-25 23:52:28 +02:00
Sebastian Dröge
c9f60db2d4 mpdparser: Don't consider period start times in periods with segment lists either
https://bugzilla.gnome.org/show_bug.cgi?id=754222
2015-09-14 19:53:18 +02:00
Sebastian Dröge
d9c45e918f mpdparser: Fix unit test that assumed that fragment timestamps should include the period start timestamp
https://bugzilla.gnome.org/show_bug.cgi?id=754222
2015-09-14 19:53:18 +02:00
Sebastian Dröge
551e7b97f3 dashdemux: Handle encoding specified in the <xml> element when dumping nodes
Previous patch did not handle the case where an encoding (e.g. UTF-8) is
specified in the <xml ?> element. Added an extra test for with and without
encoding.

https://bugzilla.gnome.org/show_bug.cgi?id=753813
2015-08-19 21:33:47 +03:00
Alex Ashley
2ebebdbfbb dashdemux: replace xmlNodeDump with xmlNodeDumpOutput
When running on an STB, the function
gst_mpdparser_get_xml_node_as_string causes a segmentation fault. This
code works correctly on a Linux desktop.

Looking at the libxml documentation, the xmlNodeDump is deprecated.
Replacing the use of xmlNodeDump with xmlNodeDumpOutput fixes the
segfault on the STB and removes the use of the deprecated function.
2015-08-19 16:30:58 +03:00
Alex Ashley
95c705ae8f 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
2015-08-14 06:47:20 -03:00
Thiago Santos
9d431e605f tests: dash_mpd: add check for segmenttemplate inheritance
Checks if the values are properly inherited and overwriten
2015-08-01 16:11:07 -03:00
Thiago Santos
9c291904f5 tests: dash_mpd: add one more baseURL test
This other type of baseURL test was replaced by a more complex one,
better have both to keep both options working

Also adds another 2 variations of how baseURL can be generated

https://bugzilla.gnome.org/show_bug.cgi?id=752776
2015-08-01 16:11:01 -03:00
Florin Apostol
6ce65709bd dashdemux: tests: added duration format test
https://bugzilla.gnome.org/show_bug.cgi?id=752776
2015-08-01 16:10:55 -03:00
Florin Apostol
86c12c7357 dashdemux: tests: update unit test for baseURL
Update the unit test for baseURL to test that it is properly
resolved taking into account parent baseURL elements.

https://bugzilla.gnome.org/show_bug.cgi?id=752776
2015-08-01 11:52:26 -03:00
Sebastian Dröge
cd47556351 mpdparser: Fix some memory leaks in the MPD parser and unit test 2015-07-08 23:15:14 +03:00
Florin Apostol
d525d9c391 dashdemux: tests: added unit tests to test all functions
Added unit tests for all functions. Code coverage:
Overall coverage rate:
  lines......: 83.8% (1941 of 2316 lines)
  functions..: 100.0% (141 of 141 functions)
2015-07-08 23:15:14 +03:00
Florin Apostol
57042af9d6 dashdemux: tests: added indentation in xml strings to improve readability
https://bugzilla.gnome.org/show_bug.cgi?id=752027
2015-07-07 14:13:53 +03:00
Florin Apostol
397fa37093 dashdemux: tests: corrected code layout
deleted the empty line between gst_mpd_parse call and its check so that
the assert is next to the function it is testing

https://bugzilla.gnome.org/show_bug.cgi?id=752027
2015-07-07 14:01:03 +03:00
Florin Apostol
e2d1126391 dashdemux: corrected recognition of $$$ in segment templates
fixed recognition of $$ after a $ that ends an identifier, eg $Time$$$

https://bugzilla.gnome.org/show_bug.cgi?id=751682
2015-06-29 19:28:56 -03:00
Florin Apostol
87a4d523b9 tests: dashdemux: renamed functions
Renamed 2 testcase functions:
- dash_mpdparser_program_information
- dash_mpdparser_base_URL
2015-06-25 10:13:23 +02:00
Florin Apostol
b8cb37f04d tests: dashdemux: added explicit type conversions
flexelint (http://www.gimpel.com/html/flex.htm) static code analyser
complained about implicit conversions from unsigned to signed, so I added
explicit conversions.

Ideally, the size parameter of gst_mpd_parse function should be unsigned,
but I don't want to change the API.
2015-06-24 12:22:44 +02:00
Florin Apostol
d02f9d30af tests: dashdemux: corrected return type for duration_to_ms function
The duration_to_ms function converts a time specified by year, month, day,
hour, minute, second, millisecond to a millisecond value. Because all the
arguments are positive numbers, the result must also be positive.

This patch changes the returned value from a gint64 to a guint64 type.
2015-06-24 12:22:33 +02:00
Florin Apostol
d310a1edcf tests: dashdemux: added parsing of period element
Improved dash_mpd unit tests by adding new tests that parse the Period element.

Code coverage reported by lcov for dash/gstmpdparser.c is:
  lines......: 43.0% (985 of 2290 lines)
  functions..: 47.5% (67 of 141 functions)
2015-06-22 18:22:57 +02:00
Florin Apostol
05198e2df1 tests: dashdemux: extended MPD element test to test xml namespaces
Extended the dash_mpdparser_mpd testcase to also test parsing the xml
namespace attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=750863
2015-06-22 13:55:46 +02:00