Commit graph

509 commits

Author SHA1 Message Date
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
Sebastian Dröge
67778ac55e dashdemux: Handle current SIDX before current position in normal mode like in keyunit-only trick mode
Otherwise we'll get into an infinite loop here. Now this is still not
correct and will cause a clean error, but at least it won't hang forever
anymore.
2017-04-10 18:46:01 +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
Seungha Yang
41996ad9c0 dashdemux: Fix SEEK of multi-period On-Demand profile
For each period, media presentation is the relative to the
period-start time. So SIDX seek position should be target seek
position minus period-start. Also, if presentationTimeOffset
is defined, the value should be compensated

https://bugzilla.gnome.org/show_bug.cgi?id=780397
2017-04-09 10:54:01 +03:00
Luis de Bethencourt
2be93e47ec dashdemux: fix typo in implementation notes
s/enveloppe/envelope
2017-03-28 17:08:15 +02: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
0cc777b3b0 dashdemux: Don't use ABS() for calculating differences
We know which number is bigger.
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
Sebastian Dröge
ffa63c5933 dashdemux: Fix snap SIDX seeking and report if we're going outside the index
Instead of just going to the first or last fragment, report if we're
going outside the index. This should never happen unless there's a bug
or the stream is broken.

Allow some possibility for inaccuracies here though.
2017-03-21 20:38:09 +02:00
Sebastian Dröge
7e21168d4d dashdemux: Just reset SIDX parser if the index is invalid for the current segment
https://bugzilla.gnome.org/show_bug.cgi?id=780108
2017-03-16 12:35:40 +02:00
Sebastian Dröge
141f3b2f4d dashdemux: If a SIDX seek failed although we're in the correct segment, disable the SIDX usage for this segment
The SIDX apparently does not contain information about the current
segment, so better stop using it instead of using incorrect values.
2017-03-15 13:27:23 +02:00
Sebastian Dröge
b76a2200de dashdemux: Keep track of the PTS, not the SIDX index position between representations
There is no guarantee that the index positions are the same between
representations, and assuming this easily causes us to get into invalid
index positions.
2017-03-15 13:27:23 +02:00
Sebastian Dröge
b84f530a9a dashdemux: When clearing the sidx parser, reset all state
And especially don't keep entry count and index around, we have no
entries anymore after clearing.
2017-03-15 13:27:23 +02:00
Seungha Yang
644192aafe dashdemux: Drain buffer at the end of subfragment
Some of streams such as below have tailing boxes at the end of subfragment.
http://dash.akamaized.net/dash264/TestCases/1a/netflix/exMPD_BIP_TC1.mpd

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2017-03-15 13:27:23 +02:00
Seungha Yang
42a38b6498 dashdemux: Do not advace subfragment after pending SIDX seek done
If a MPD is On-Demand profile and no index described, demux will terminate
download loop after parsing inband SIDX with flow return custom-success.
At this moment, SIDX index is excat target position, but finish_fragment()
might cause re-advancing subfragment depending on MPD structure.

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2017-03-15 13:27:23 +02:00
Seungha Yang
b65e6db8d4 dashdemux: Reset SIDX related variables per fragment
SIDX's base offset (i.e., byte offset of SIDX + sidx.first_offset)
mostly vary as per fragment. Also, target SIDX index must be zero for the
new fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2017-03-15 13:27:23 +02:00
Seungha Yang
a599067786 dashdemux: Two depth seeking for On-Demand profile
Try to find fragment using MPD first, then do refinement to find
target subframgnet using SIDX if possible. Note that, if target fragment
was moved from the previously activated one, we should assume that
the last SIDX is invalid for new fragment.

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2017-03-15 13:27:23 +02:00
Seungha Yang
ad015ceef5 dashdemux: Exception handle in _sidx_seek()
If target seek position is outside of the range of sidx entries,
binary search returns NULL pointer.

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2017-03-15 13:27:23 +02:00
Sebastian Dröge
0dcb1e4ecc dashdemux: Add assertion for preventing of access after the end of the sidx entries array
Better crash cleanly here than reading some random numbers from memory.
2017-03-15 13:27:23 +02:00
Seungha Yang
a9c34fb9e3 dashdemux: Advance subfragment only if any exist
SIDX based playback is not restricted to SegmentBase, but it possible
with SegmentList/SegmentTemplate. In the latter case, each fragment
has its own SIDX box and might be subdivided into subfragment.
So, demux should not assume that the end of subfragment is the end
of stream. Moreover, should try advance subfragment only if there
are remaining subfragments.

With additional fixes by Sebastian Dröge <sebastian@centricular.com>

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2017-03-14 19:15:28 +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
Nicolas Dufresne
e03e7e7574 dash/smoothstreaming: Use GST_PLUGIN_LIBTOOLFLAGS
Use the flags defined by configure script instead of always disabling
static plugins.
2017-03-08 20:04:23 -05:00
Wojciech Przybyl
8eb87ce5dc dashdemux: fix default suggestedPresentationDelay
When MPD@suggestedPresentationDelay is not present in the MPD,
dashdemux can provide default suggestedPresentationDelay. However
when applying default value of suggestedPresentationDelay, the value
should be subtracted from current time, not added to it. When streams
setup is performed and live point is calculated, we have to go to the
wall clock (current time) minus suggestedPresentationDelay, if we tried
to start with current time plus suggestedPresentationDelay, we would
be asking for future stream, which has not yet been recorded. Also
the value needs to be converted from ms to us.

https://bugzilla.gnome.org/show_bug.cgi?id=764726
2017-03-02 20:11:55 +02: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
Sebastian Dröge
ef70cd48c6 dashdemux: Fix potential NULL pointer dereference
CID 1399700
2017-02-28 15:53:10 +02:00
Seungha Yang
fe9d778fa3 dashdemux: Do pending seek when SIDX is found
Parsing SIDX box was allowed even if "indexRange" attribute does not appear
for On-Demand profile. However, actual seeking using SIDX index did not happen
since download loop keep working on.
To use SIDX index in that case, demux should try it in the next download loop.

https://bugzilla.gnome.org/show_bug.cgi?id=777394
2017-01-18 13:14:44 +02:00
WeiChungChang
c9fbf3459a dashdemux: Fix issue when manifest update sets slow start without passing necessary header & caps changes downstream
https://bugzilla.gnome.org/show_bug.cgi?id=777206
2017-01-18 13:13:15 +02:00
Edward Hervey
5422728c7f mpdparser: Fix compilation with GST_DISABLE_GST_DEBUG 2017-01-16 14:33:05 +01:00
Seungha Yang
72afd74ef4 dash: Include debug of gstisoff on dashdemux category
Move debug category of gstisoff from default to dashdemux

https://bugzilla.gnome.org/show_bug.cgi?id=776461
2016-12-24 08:22:10 +02:00
Seungha Yang
4523cff147 dashdemux: Add first_offset of sidx box to base offset
sidx has "first_offset" syntax which represents the distance in bytes
from anchor point to media fragment. If present, we should adjust
sidx_base_offset.

https://bugzilla.gnome.org/show_bug.cgi?id=776431
2016-12-23 12:16:10 +02:00
Seungha Yang
c0540fb773 dashdemux: Ensure sidx parsing when updating fragment info
Fix seek fail with On-Demand profile mpd which has no indexRange attribute

https://bugzilla.gnome.org/show_bug.cgi?id=776431
2016-12-23 12:16:10 +02:00
Seungha Yang
998c8ce246 dashdemux: Drain remaining buffer in adapter
Previous patch allows sidx box parsing from incoming buffers.
Since the incoming buffer boundary might be over sidx box,
there can be remaining buffer in isobmff parser adapter.

https://bugzilla.gnome.org/show_bug.cgi?id=776352
2016-12-22 14:12:58 +02:00
Seungha Yang
124e386da8 dashdemux: Always parsing sidx for On-Demand profile
The indexRange attribute is optional and if it's not present, we should
extract the sidx box from incoming buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2016-12-20 12:55:40 +02:00
Seungha Yang
dfa300cb6d dash: Split gst_isoff_sidx_parser_add_buffer() function
To parsing sidx box itself with isobmff parser,
split gst_isoff_sidx_parser_add_buffer() into two parts.

https://bugzilla.gnome.org/show_bug.cgi?id=776200
2016-12-20 12:55:40 +02: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
2b44392095 dashdemux: Fix leak in gst_dash_demux_stream_free
Free parsed moof and sync samples with _stream_free().

https://bugzilla.gnome.org/show_bug.cgi?id=774702
2016-11-19 12:01:20 +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
Nirbheek Chauhan
f790863755 Explicitly define float constants as float
With MSVC, this gives the following warning:

warning C4305: 'function': truncation from 'double' to 'gfloat'

Apparently, MSVC does not figure out what type to use for constants
based on the assignment. This warning is very spammy, so let's try to
fix it.
2016-10-27 23:06:26 +05:30