Commit graph

247 commits

Author SHA1 Message Date
Thiago Santos
95a2786741 mpdparser: remove duplicate free of client data
https://bugzilla.gnome.org/show_bug.cgi?id=783028
2017-06-01 15:27:07 +02:00
Sebastian Dröge
db57a3b04f dashdemux: Rewrite ISOBMFF & SIDX handling
The previous code was handling both as separate steps and then tried to
combine the results, but this resulted in all kinds of bugs which showed
themselves as failures during seeking and offset tracking getting wrong.
This also showed itself with gst-validate on the sample stream.

The rewritten code now parses everything in one go and tracks the
current offset only once, and as a side effect simplifies the code a
lot.

Also added is detection of SIDX that point to other SIDX instead of
actual media segments, e.g. with this stream:
  http://dash.akamaized.net/dash264/TestCases/1a/sony/SNE_DASH_SD_CASE1A_REVISED.mpd
Support for this will have to be added at some point but that should
also be easier with the rewritten code.

https://bugzilla.gnome.org/show_bug.cgi?id=781233
2017-04-18 13:49:08 +02:00
Seungha Yang
68ac72431c mpdparser: Do sanity check of Segment Base Information only at Repesentation level
Spec 5.3.9.2 is saying about the existence of duration and SegmentTimeline
only for Representation level. Other level such as Period or AdaptationSet
might not have the attributes.

https://bugzilla.gnome.org/show_bug.cgi?id=780570
2017-04-15 18:33:41 -07:00
Seungha Yang
6167dab39e mpdparser: Allow inherit Segment{Base,Template} from Period
Similar to SegmentList, Representation can inherit Segment{Base,Template}
from Period

https://bugzilla.gnome.org/show_bug.cgi?id=780570
2017-04-15 18:33:41 -07:00
Edward Hervey
94fe5c690e mpdparser: Fix leak
The error: location takes care of freeing new_representation

CID #1405027
2017-04-12 10:54:23 +02:00
Edward Hervey
92ce999ca6 mpdparser: Run gst-indent 2017-04-12 10:54:05 +02:00
Jürgen Sachs
270f97611c dashdemux/mpdparser: Fix wrong false sanity check for manifests with nested SegmentTemplate nodes
https://bugzilla.gnome.org/show_bug.cgi?id=778237
2017-04-11 11:19:34 +03:00
Seungha Yang
a3a12d0978 mpdparser: Report error if Representation is invalid
Spec "5.3.5 Representation" is saying that
id and bandwidth attributes are mandatory fields.

https://bugzilla.gnome.org/show_bug.cgi?id=780569
2017-04-09 10:58:27 +03:00
Sebastian Dröge
b8b2946e03 dashdemux: In reverse playback mode, if seeking to the beginning of a fragment, start with the previous one instead
There's no point to start downloading a fragment just to output 1ns.
2017-03-22 12:06:33 +02:00
Sebastian Dröge
19eba961d2 dashdemux: Implement SNAP_NEAREST seeks 2017-03-21 20:38:09 +02:00
Sebastian Dröge
7778e8293a dashdemux: Only snap seeks forwards if the seek position does not happen to be the exact segment position 2017-03-21 20:38:09 +02:00
Sebastian Dröge
bcbf1f67f0 dashdemux: Use gst_mpdparser_get_segment_end_time() directly instead of calculating it again
It does the exact same calculations.
2017-03-21 20:38:09 +02:00
Sebastian Dröge
43d1dd3dad mpdparser: Refactor to get rid of one level of indentation in seeking code
Also go out of the segment searching loop once segment->start > ts.
We're not going to find any earlier segment anymore.
2017-03-21 20:38:09 +02:00
Matthew Waters
fd8d35298f Revert "adaptivedemux: answer duration queries for live streams"
Completely disabling duration reporting with live streams is not cool.

This reverts commit e1b68d9a65.

https://bugzilla.gnome.org/show_bug.cgi?id=753879
2017-03-14 16:50:30 +11:00
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