Commit graph

559 commits

Author SHA1 Message Date
Xavier Claessens 71d9e33085 dash: Fallback to libxml2 subproject 2019-07-24 14:38:08 -04:00
Alex Ashley a11f7ed924 dashdemux: include both Period start and presentationTimeOffset in segment start
The start of each segment is relative to the Period start, minus
the presentation time offset.

As specified in section 5.3.9.6 of the MPEG DASH specification:
    The value of the @t attribute minus the value of the
    @presentationTimeOffset specifies the MPD start time of
    the first Segment in the series.

dashdemux was not taking account of presentationTimeOffset and in
some methods was not taking into account the Period start time.
This commit modifies the segment->start value to always be
relative to the MPD start time (zero for VOD,
availabilityStartTime for live streams). This makes all uses of
the segment list consistent.

Fixes #841
2019-06-01 21:25:33 +00:00
Thibault Saunier 47a49f3381 docs: Build documentation with hotdoc 2019-05-13 17:00:00 -04:00
Nicolas Dufresne 694d9dcde5 dashdemux: Always create the adapter
Worst case it will be empty. This fixes a crash when the base class
calls data_received() when the stream is neither is_isobmff or
has_isoff_ondemand_profile.

https://bugzilla.gnome.org/show_bug.cgi?id=796745
2018-08-16 15:59:42 -04:00
Nirbheek Chauhan b55dfb5313 Add feature options for almost all plugins
The only plugins remaining are those that haven't been ported to Meson
yet, and msdk. Also, the tests are still automagic.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 19:04:38 +05:30
Seungha Yang 9956f22537 dashdemux: Fix sync of updated manifest from previous one
_get_next_fragment_timestamp() returns relative timestamp to period start.
But gst_mpd_client_stream_seek() uses absolute MPD timeline.

https://bugzilla.gnome.org/show_bug.cgi?id=781183
2018-05-12 09:27:46 +02:00
Xavier Claessens 83d0623293 Meson: Generate pc file for all plugins in bad
https://bugzilla.gnome.org/show_bug.cgi?id=794568
2018-04-25 11:08:09 +01:00
Tim-Philipp Müller 79c13988e4 Fix code indentation 2018-04-22 18:27:37 +01:00
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