Commit graph

233 commits

Author SHA1 Message Date
Alex Ashley
e1b68d9a65 adaptivedemux: answer duration queries for live streams
For duration queries on live streams, adaptivedemux ignores the query.
The problem then is that the query is answered by the downstream
qtdemux element, with the duration of the currently passing fragment.

This commit changes the behaviour of adaptivedemux to answer the duration
queries for live streams, returning GST_CLOCK_TIME_NONE.

    https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-02 19:54:04 +02:00
Edward Hervey
5422728c7f mpdparser: Fix compilation with GST_DISABLE_GST_DEBUG 2017-01-16 14:33:05 +01:00
Sebastian Dröge
788bb67639 dashdemux: Don't declare variables inside the for loop header
This is a C99 feature.
2016-12-13 22:21:25 +02:00
Sebastian Dröge
eef53ef6ed dash: Fix stripping of space at the beginning/end of durations
The way how strchr() was called here, it could easily read after the end
of the string. Use g_ascii_isspace() instead.

Detected by asan in the unit test.
2016-11-27 12:20:11 +02:00
Sebastian Dröge
8d8661f1f8 mpdparser: Don't set variable just to overwrite it again later
We set it to TRUE here, but later we set it to TRUE again anyway if the
parsing actually succeeded at this point. Let's keep the second one.

CID 1374360.
2016-11-23 19:01:04 +02:00
Seungha Yang
37e13494ec mpdparser: Modify return of the function for loading external resources to void
gst_mpd_client_fetch_on_load_external_resources() never ever return
FALSE due to modified external xml loading functions.

https://bugzilla.gnome.org/show_bug.cgi?id=774463
2016-11-21 09:43:30 +02:00
Seungha Yang
3c31c47259 mpdparser: Handle invalid external xml link for SegmentList element
Ignore invalid xml link for SegmentList likewise external Period without error.

https://bugzilla.gnome.org/show_bug.cgi?id=774463
2016-11-21 09:43:30 +02:00
Seungha Yang
ae8759c33e mpdparser: Handle invalid external xml link for AdaptationSet element
Ignore invalid xml link for AdaptationSet likewise external Period without error.

https://bugzilla.gnome.org/show_bug.cgi?id=774463
2016-11-21 09:43:30 +02:00
Seungha Yang
e454694f0a mpdparser: Handle invalid external xml link for Period element
Section 5.3.3 in ISO/IEC 23009-1:2014 defines that invalid references
(e.g., invalide URI or cannot be resolved) specified by "@xlink:href" attribute
shall be removed. That means, we should play it without error,
and just ignore the corresponding element.
It's similar to "urn:mpeg:dash:resolve-to-zero:2013".

https://bugzilla.gnome.org/show_bug.cgi?id=774463
2016-11-21 09:43:30 +02:00
Seungha Yang
68e4f919a0 mpdparser: Support multiple Period elements in external xml
External xml could have empty, one or multiple top-level "Period" elements.
Because xml parser cannot parse the multiple top-level elements
(i.e., no root element), we need to wrap a xml in order to make root element.
See also ISO/IEC 23009-1:2014 5.3.2.2

https://bugzilla.gnome.org/show_bug.cgi?id=774357
2016-11-14 16:56:43 +02:00
Philippe Normand
0fbd2edaff mpdparser: wrap unmodified data in protection event
PlayReady being the one of the few DRM formats encoding its data with
base64 it was not consistent to have a special case for this. So the
base64 decoding operation now needs to be done by the protection event
consumer, if needed.

https://bugzilla.gnome.org/show_bug.cgi?id=774112
2016-11-14 11:50:13 +01:00
Philippe Normand
dd0c56b4a2 mpdparser: MS PlayReady ContentProtection parsing
The "pro" (PlayReady Object) element contents are now base64-decoded
and properly stored in Protection events.

https://bugzilla.gnome.org/show_bug.cgi?id=773936
2016-11-04 17:04:59 +02:00
Thiago Santos
a94eef9357 dash: do not use invalid stream duration
If it is is unknown, consider it infinite

https://bugzilla.gnome.org/show_bug.cgi?id=768460
2016-10-20 11:17:34 -03:00
Thiago Santos
6eef9971be dash: properly inherit segmentlist from period
Representation can inherit SegmentList from Period if none is available
from the AdaptationSet

https://bugzilla.gnome.org/show_bug.cgi?id=768460
2016-10-20 11:17:32 -03:00
Sebastian Dröge
4734b10c6f dashdemux: Add properties to select maximum allowed width/height and framerate
https://bugzilla.gnome.org/show_bug.cgi?id=770408
2016-08-26 18:12:23 +03:00
Alex Ashley
d9bcf4dbd9 dashdemux: include segment duration when calculating seek range
The gst_dash_demux_get_live_seek_range () function returns a stop value
that is beyond the available range. The functions
gst_mpd_client_check_time_position() and
gst_mpd_client_get_next_segment_availability_end_time() in
gstmpdparser.c include the segment duration when checking if a segment
is available. The gst_dash_demux_get_live_seek_range() function
in gstdashdemux.c ignores the segment duration.

According to the DASH specification, if maxSegmentDuration is not present,
then the maximum Segment duration is the maximum duration of any Segment
documented in the MPD.

https://bugzilla.gnome.org/show_bug.cgi?id=753751
2016-08-02 12:52:34 +01:00
Thiago Santos
aa7a3cb24f dash: strip lead/trailing whitespace from descriptortype attributes
The spec says it is xs:anyURI and leading and trailing whitespace
are to be ignored

https://bugzilla.gnome.org/show_bug.cgi?id=758064
2016-04-22 17:33:15 -03:00
Vincent Penquerc'h
8ac261841c mpdparser: clamp segment durations to each other and period end
5.3.2.1 in the spec.

https://bugzilla.gnome.org/show_bug.cgi?id=751792
2016-04-05 17:01:01 +01:00
Thiago Santos
38cc9070cd dashdemux: sync index and the selected chunk when seeking
Otherwise the chunk selected isn't matched to the index and
the timing will be different, causing it to actually start
from a different position
2016-02-26 17:31:44 -03:00
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
b96ea72b4f mpdparser: corrected getting segment availability
https://bugzilla.gnome.org/show_bug.cgi?id=757655
2016-02-09 16:35:44 -03:00
Thiago Santos
40faf9e09b dashdemux: implement snap seek handling
Handle snap seeking at the stream_seek method and let superclass
do the rest to support snap seeking

https://bugzilla.gnome.org/show_bug.cgi?id=759158
2016-02-04 14:09:35 -03:00
Thiago Santos
731ab94cc3 adaptivedemux: handle snap seeks
Adaptive demuxers need to start downloading from specific positions
(fragments) for every stream, this means that all streams can snap-seek
to a different position when requested. Snap seeking in this case will
be done in 2 steps:

1) do the snap seeking on the pad that received the seek event and
   get the final position

2) use this position to do a regular seek on the other streams to
   make sure they all start from the same position

More arguments were added to the stream_seek function, allowing better control
of how seeking is done. Knowing the flags and the playback direction allows
subclasses to handle snap-seeking.
And also adds a new return parameter to inform of the final
selected seeking position that is used to align the other streams.

https://bugzilla.gnome.org/show_bug.cgi?id=759158
2016-02-04 14:05:08 -03:00
John Chang
8e788f2845 mpdparser: Use RepresentationIndex instead of Initialization to get the URL of the RepresentationIndex
https://bugzilla.gnome.org/show_bug.cgi?id=760936
2016-01-22 17:45:26 +02:00
Florin Apostol
2918dff2e0 adaptivedemux: improved error message if availabilityStartTime is missing for a live stream
For a live mpd, if availabilityStartTime is missing, adaptive demux asserts
with: Unexpected critical/warning: gst_date_time_to_g_date_time: assertion
'datetime != NULL' failed.

This patch improves the error message to:
Unexpected critical/warning: gst_mpd_client_seek_to_time: assertion
'client->mpd_node->availabilityStartTime != NULL' failed

https://bugzilla.gnome.org/show_bug.cgi?id=757602
2016-01-18 15:12:07 -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
suhwang.kim
6cbaec7593 dashdemux: Suggestion for setting the framerate information.
Dashdemux has set the width and height information from MPD manifest.
Some embedded devices which are not insufficient H/W resources need more information such as framerate
to assign H/W resources. So I suggested that dashdemux also needs to set the framerate information from MDP manifest.

https://bugzilla.gnome.org/show_bug.cgi?id=758515
2015-12-08 09:51:02 +02:00
suhwang.kim
6d8dd482c4 dashdemux: maxFrameRate & minFrameRate should be in RepresentationBase.
According to the spec, they can be in AdaptationSet, Representation and SubRepresentation.
So They should be in RepresentationBase.

https://bugzilla.gnome.org/show_bug.cgi?id=758515
2015-12-08 09:51:02 +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
650b7b8fce mpdparser: added support for parsing fraction of seconds in dateTime fields
https://bugzilla.gnome.org/show_bug.cgi?id=758410
2015-11-23 11:54:37 -03:00
Thiago Santos
5be46607bb dashdemux: always set presentationTimeOffset
Set it for all types of segment lists (templates / lists / base)
and not only for templates.

https://bugzilla.gnome.org/show_bug.cgi?id=751529
2015-11-20 20:59:16 -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
Reynaldo H. Verdejo Pinochet
86ec812429 Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2015-11-18 16:05:42 -08: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
fb2d3abca8 dashdemux: fixed illegal memory access in gst_mpd_client_get_last_fragment_timestamp_end
https://bugzilla.gnome.org/show_bug.cgi?id=758188
2015-11-18 09:50:26 +02:00
Florin Apostol
19d604e92f dashdemux: remove unreachable code
The stream->cur_seg_template is set to the lowest available segment
template (representation or adaptation or period, in this order).
Because the template elements are inherited, the lowest template will
have all the elements the parents had, so there is no need to check the
parent for an element that is not found in the child (eg initialisation
or index).

https://bugzilla.gnome.org/show_bug.cgi?id=752714
2015-11-02 11:37:19 +00:00
Vincent Penquerc'h
045a03c14a mpdparser: add some checks to duration parsing
https://bugzilla.gnome.org/show_bug.cgi?id=752336
2015-11-02 11:36:12 +00:00
Florin Apostol
7dca9fb3f4 dashdemux: added duration format validation
https://bugzilla.gnome.org/show_bug.cgi?id=752336
2015-11-02 11:36:12 +00:00
Luis de Bethencourt
f28fad6e83 dashdemux: fix memory leak
Free new_mpd, allocated with g_slice_new(), before going out of scope in
goto error.

CID 1338050
2015-11-02 11:27:43 +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
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
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
Vincent Penquerc'h
5c8f702116 mpdparser: do not dereference profiles is absent
These are used to apply restrictions on what the MPD file may
use, so no profile means no restrictions.

Besides, nothing actually uses the profiles (yet) anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=750869
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