Commit graph

551 commits

Author SHA1 Message Date
Jun Xie
cbcc01173b dashdemux: parse xs:dateTime's timezone indicator
The lexical form of xs:dateTime is YYYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]
timezone indicator (+|-)hh:mm] needs to be parsed.

https://bugzilla.gnome.org/show_bug.cgi?id=791602
2017-12-18 14:07:36 +01:00
Jun Xie
77321f62dd dashdemux: fix coredump issue with external AdaptationSet
fix wrong AdaptationSet list iterator

https://bugzilla.gnome.org/show_bug.cgi?id=790812
2017-12-06 15:21:50 -05:00
Jun Xie
beb32ab37d dashdemux: remove duplicated code
remove duplicated code

https://bugzilla.gnome.org/show_bug.cgi?id=790895
2017-11-30 01:10:35 -08:00
Jun Xie
f31e91b7a1 dashdemux: fix memory leak
GPtrArray in GstActiveStream is leaked in some cases.
gst_mpdparser_free_active_stream shall be invoked to free GstActiveStream

https://bugzilla.gnome.org/show_bug.cgi?id=790899
2017-11-30 01:06:51 -08:00
Edward Hervey
2877aac9a5 dashdemux: Handle bitrate > 2**31
On very-high connection, we could quite well exceed that. Instead use
gint64 for max-bitrate.
2017-11-25 09:41:00 +01:00
Seungha Yang
7d06ecb3a4 isoff: Move isoff to gst-libs
Also rename unit test dash_isoff to isoff

https://bugzilla.gnome.org/show_bug.cgi?id=777825
2017-08-25 17:21:04 -07:00
Seungha Yang
a218a2a1af dashdemux: Add support webvtt subtitle stream
Enable exposing webvtt subtitle streams.

https://bugzilla.gnome.org/show_bug.cgi?id=784715
2017-07-18 09:40:18 +02:00
Thiago Santos
ead63a2686 dashdemux: update manifest streams correctly if pads aren't exposed
In some cases, it is possible that we need to update the manifest before
pads have been exposed at all. If there are no current pads, just expose
the next prepared streams. This doesn't handle the case where a manifest
update would happen while a live streams is changing periods, which is a
type of use case that we're unaware of real usages yet.

https://bugzilla.gnome.org/show_bug.cgi?id=783028
2017-07-13 07:42:58 +02:00
Edward Hervey
2b401de91c dashdemux: Implement a default presentation delay
Have a fallback presentation delay is great (if not present in the
manifest), having an actual default value is better.

https://bugzilla.gnome.org/show_bug.cgi?id=783244
2017-06-01 15:27:07 +02:00
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
Edward Hervey
34d8ddd92d dashdemux: Remove wrong assertion
This is wrong because:
* If the rate is negative we should check for the *previous* period
* adaptivedemux already does the proper checks before calling this
  method
2017-05-31 11:28:08 +02:00
Sebastian Dröge
be465a139b dashdemux: Use correct (sub) fragment start when clipping chunk size
If we didn't download anything yet, we shouldn't use fragment.start but
the start position of the current sidx entry.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
d5eee31918 dashdemux: Make sure to pass the next buffer after a seek with DISCONT flag
When we manually seek for skipping ahead in keyunit-only trickmode, we
have to enforce that ourselves as adaptivedemux does not know about the
seeks.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
d884ec2904 dashdemux: Ensure that we never ever download over the current SIDX entry
Even if downloading more than needed to try to get the moof and first
keyframe both together.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
71259d9ad4 dashdemux: Take SIDX entry timestamp/duration into account for keyunit-only mode
And not the whole segment's timestamp/duration
2017-05-18 19:04:57 +02:00
Sebastian Dröge
c3fd905f11 dashdemux: Reset parsing state correctly in various places 2017-05-18 19:04:57 +02:00
Sebastian Dröge
927c158303 dashdemux: Reset previous target_time when seeking 2017-05-18 19:04:57 +02:00
Sebastian Dröge
e2a6573c7d dashdemux: Smooth out skip distances in keyframe-only trick modes
This ensures smoother playback. It looks weird if we first do a big
jump, then play a couple of consecutive frames, just to again skip ahead
quite a bit because we ran late again.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
ddef518701 dashdemux: Take configure max bitrate/framerate into account for keyframe skipping
And by default only produce up to 10 fps.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
6a037a78de dashdemux: Try harder to not run into a loop over the same fragment over and over
While still making sure to not jump ahead one fragment further than
needed.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
ef8f194855 dashdemux: Add some debug output to the target time selection 2017-05-18 19:04:57 +02:00
Sebastian Dröge
6b6c7382c3 dashdemux: Use the current clock running time in addition to the QoS earliest time 2017-05-18 19:04:57 +02:00
Sebastian Dröge
133d1e86bd dashdemux: Download keyframes from the current position if we're far enough ahead
Far enough here means more than 500ms or 4 times the average keyframe
download time. There is no need to jump ahead by one average keyframe
download time in this case.

This makes playback smooth if the network is fast enough.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
4efa3185bb dashdemux: Fix sync sample selection based on target time in reverse playback mode 2017-05-18 19:04:57 +02:00
Sebastian Dröge
b3e2657ac1 dashdemux: Snap-seek for skipping ahead and use actual keyframe distance in the current fragment if applicable 2017-05-18 19:04:57 +02:00
Sebastian Dröge
b7f87e2518 dashdemux: Don't adjust for fragment duration twice when seeking ahead in KEYUNITS mode 2017-05-18 19:04:57 +02:00
Sebastian Dröge
5d09bc04a2 dashdemux: Add current fragment duration in reverse playback mode to the position
We play from the end of the fragment to the beginning, not from the
beginning backwards.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
9267b4a725 dashdemux: Never take more than the current fragment duration for estimations inside the fragment
Taking the average might give us from results.
2017-05-18 19:04:57 +02:00
Sebastian Dröge
df420cc21f dashdemux: Don't increase current position if we just downloaded the moof in KEYUNIT mode 2017-05-18 19:04:57 +02:00
Edward Hervey
245d73e516 dashdemux: Improve key-unit trick mode downloading
When dealing with key-unit trick mode downloads, the goal is to
provide the best "Quality of Experience". This is achieved by:
1) maximizing the number of frames displayed per second
2) avoiding "stalling" as much as possible (i.e. not downloading and
  decoding frames fast enough)

This implementation achives this by:
1) Knowing very precisely the current keyframe being download (i.e
  more accurate than at the fragment level which might contain more
  than one keyfram). This is the new "actual_position" variable
  introduced by this commit
2) Knowing the position of downstream (provided by QoS and stored
  in the adaptivedemuxstream qos_earliest_time variable)
3) Knowing how long it takes to request and fully download a keyframe
  (the average_download_time variable)

Taking those 3 variables into account, whenever a keyframe has been
pushed downstream we calculate a "target time" (target_time variable)
which is the ideal next keyframe time to request so that:
1) It will be requested/downloaded/demuxed/decoded in time to be
  displayed without being too late
2) It will not be too far ahead that it would cause too few frames
  per second to be displayed.

How far ahead we will request is inversily proportional to how close
the actual position (actual_position) is from the downstream
position (qos_earliest_time). The more is buffered between the source
and the sink, the "closer" the target time will be, and therefore
the more frames per seconds will be displayed (up to the limit
of keyframes_per_second * absolute_rate).
2017-05-18 19:04:57 +02:00
Edward Hervey
04224ad440 dashdemux: Store average download time
This will be used to bound the download rate when working in
keyframe-only trick mode
2017-05-18 19:04:57 +02:00
Sebastian Dröge
2379dc3f5b dashdemux: Collect keyunit distance and size statistics 2017-05-18 19:04:57 +02:00
Edward Hervey
d8d1fc8bc4 dashdemux: Disable bitrate switching in key-unit trick mode
This creates too much havoc for now
2017-05-18 19:04:57 +02:00
Edward Hervey
8f400c1343 dashdemux: Use new adaptivedemux trickmode macro
Reduces the lines of code, and makes it a bit more readable
2017-05-18 19:04:57 +02:00
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Seungha Yang
1c6cd54477 dashdemux: Initialize sidx_position to GST_CLOCK_TIME_NONE
If a manifest has non-zero presentation time offset
(i.e., earliest presentation time specified by sidx box is not zero),
the initial sidx position shouldn't be zero. Since we cannot define
exact sidx position until parsing sidx box, set the value to unknown.

https://bugzilla.gnome.org/show_bug.cgi?id=782693
2017-05-16 17:44:40 +03: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
Sebastian Dröge
e0e1db212f Revert "dashdemux: Fix issue when manifest update sets slow start without passing necessary header & caps changes downstream"
This reverts commit c9fbf3459a.

The representation ID comparision here was wrong and triggering always
if the ID did *not* change, causing needless redownloading of the
header. The sample stream provided in the bug does not exist anymore.
2017-04-12 20:11:16 +03:00
Thibault Saunier
78022a6e0c docs: Port all docstring to gtk-doc markdown 2017-04-12 12:57:57 -03: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
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