Commit graph

310 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
Sebastian Dröge
4f6ae1f48c adaptivedemux: Enable bitrate selection for trick mode streaming again
And scale the bitrate with the absolute rate (if it's bigger than 1.0) to get
to the real bitrate due to faster playback.

This allowed in my tests to play a stream with 10x speed without buffering as
the lowest bitrate is chosen, instead of staying/selecting the highest bitrate
and then buffering all the time.

It was previously disabled for not very well specified reasons, which seem to
be not valid anymore nowadays.
2016-08-25 19:52:37 +03:00
Sebastian Dröge
e786f737ae dashdemux: In KEY_UNITS trick mode, download all I-frames and not only IDR 2016-08-18 13:21:54 +03:00
Sebastian Dröge
02f688ee9d Revert "Revert "dashdemux: When doing SIDX seeking, return instead of overriding the timestamp with 0 from the MPD seeking method""
This reverts commit aea2c13fc1.
2016-08-11 12:11:22 +02:00
Sebastian Dröge
18e5e64b05 dashdemux: When doing chunked downloading on SIDX, clip requests on the SIDX entry boundaries
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
9c04d1e13c dashdemux: Collect average moof and first sync sample sizes
And always request those in the beginning so that ideally we get the moof and
the first sync sample all together with the first HTTP request.

https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
7f1f777b92 dashdemux: Download any sync-sample following the moof directly in key-units only mode
We don't have to do yet another additional request but can just download the
data directly.

Also unify the key-unit only mode buffer pushing and extract it into its own
function now that it became more complicated.

https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
f8eddabe29 dashdemux: If a fragment contains no sync samples, disable key-unit mode
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
cfad48ce5a dashdemux: Remember if for a stream we could do key-units only mode
This makes sure we don't even try going into that mode if we previously saw
that the stream does not have the suitable metadata.

https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
b936c00f51 dashdemux: Also allow key-unit only mode if (some) sample flags are given by trex but we can still find sync frames
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
47ef88f20e dashdemux: Use chunked downloading for the moof in KEY_UNITS mode
Allows us to reuse the HTTP connection and reduce latencies a lot.

https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
7b4fe1e02f dashdemux: Mark every first buffer of moov, sidx, moof and mdat as DISCONT in keyframe-only mode
We need to mark every first buffer of a key unit as discont, and also every
first buffer of a moov and moof. This ensures that qtdemux takes note of our
buffer offsets for each of those buffers instead of keeping track of them
itself from the first buffer. We need offsets to be consistent between moof
and mdat

https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
12c2415251 dashdemux: Only enable key-unit trick mode for video streams
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
9dd8789323 dashdemux: Only do keyframe-only playback if the corresponding seek flag is given
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
70bc183a52 dashdemux: Implement downloading of only sync samples
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
5b943135ac dashdemux: Store parsed moof and extract offsets of sync samples in it
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:55 +02:00
Sebastian Dröge
fff814bbe5 dashdemux: Implement parsing of moof box
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:54 +02:00
Sebastian Dröge
c4ad30d6b4 dashdemux: Store box fourccs in the header at a central place
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:54 +02:00
Sebastian Dröge
0b0a1a52d3 dashdemux: Implement parsing of ISOBMFF boxes
https://bugzilla.gnome.org/show_bug.cgi?id=741104
2016-08-11 11:56:54 +02:00
Edward Hervey
aea2c13fc1 Revert "dashdemux: When doing SIDX seeking, return instead of overriding the timestamp with 0 from the MPD seeking method"
This reverts commit 947656cfd2.

This makes all dash seeking tests fail. Needs more testing to fully understand
what's going wrong. Revert ok'd by Sebastian
2016-08-05 09:16:58 +02:00
Sebastian Dröge
947656cfd2 dashdemux: When doing SIDX seeking, return instead of overriding the timestamp with 0 from the MPD seeking method
We don't need to call the latter at all as we're definitely in this period and
the segment is selected via the SIDX.

This is especially important when doing SNAP seeks, as otherwise we would
always start from the beginning of the period (usually 0) again.
2016-08-04 15:10:02 +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
Sebastian Dröge
a7adb5cb60 dashdemux: Skip audio streams if TRICKMODE_NO_AUDIO is given in the seek event
We just don't expose pads for audio streams, or even download them.
2016-07-28 20:44:29 +03:00
Sebastian Dröge
269a8c5fdf dashdemux: Reset number of subtitle streams counter on reset() too
Otherwise we will continue increasing forever the number of subtitle streams
when reusing the element for another DASH manifest.
2016-07-28 11:17:15 +03:00