Commit graph

580 commits

Author SHA1 Message Date
Thiago Santos
d617139ee7 dashdemux: reuse seeking function to reduce repeated code
Instead of writing a seek routine, just use the mpdparser function.

Also remove function that is not needed anymore
2015-05-13 13:35:14 -03:00
Thiago Santos
57a2105a31 dashdemux: refactor segment iteration for better performance
Segments are now stored with their repeat counts instead of spanding
them to multiple segments. This caused advancing to the next segment
using a single index to have to iterate over the whole list every time.

This commit addresses this by storing both the segment index as well
as the repeat index and makes advancing to next segment just an
increment of the repeat or the segment index.
2015-05-13 13:35:14 -03:00
Thiago Santos
6344f86e44 dashdemux: improve mpd parsing for repeated segment entries
Use a single segment to represent it internally to avoid using too
much memory. This has the drawback of issuing a linear search to
find the correct segment to play but this can be fixed by using
binary searches or caching the current position and just looking
for the next one.

https://bugzilla.gnome.org/show_bug.cgi?id=748369
2015-05-13 13:35:14 -03:00
Sebastian Dröge
0cd3938345 adaptivedemux: Allow subclasses to override how a new manifest would be downloaded 2015-04-23 17:47:18 +02:00
Yujin Lee
218a89fcd9 dashdemux: enable playback of content with text streams
There is a playback error when trying to play a content that
has 'application' mimeType. This commit prevents an exception from
setup text streams.

https://bugzilla.gnome.org/show_bug.cgi?id=747525
2015-04-13 09:24:53 -03:00
Jun Xie
9e6198d9ef dashdemux: set default @startNumber and also avoid wrong overwrite
Set default @startNumber to 1, if @startNumber is missing at all level.
Also avoid incorrect overwriting inherited value.

https://bugzilla.gnome.org/show_bug.cgi?id=746347
2015-03-24 16:35:59 -03:00
xixi
5a1ed14c3c dashdemux: fetch wrong segment at the end of Period
Fix check for end of Period time to avoid trying
to fetch a segment that doesn't exist

https://bugzilla.gnome.org/show_bug.cgi?id=746038
2015-03-15 12:02:58 +00:00
Jan Schmidt
f150cf2d2e Remove a bunch of silly ';;' typos at the end of lines 2015-03-12 01:33:03 +11:00
Mathieu Duponchelle
bd70c73a8a dashdemux: implement get_presentation_offset.
To account for presentationTimeOffset as per section 7.2.1 .

https://bugzilla.gnome.org/show_bug.cgi?id=745455
2015-03-10 15:17:37 +01:00
Mathieu Duponchelle
793b4bca93 gstmpdparser: Really set the default value for startNumber.
+ The specs ask for a default of 1, the current code only did
 set a default when the field was present.

https://bugzilla.gnome.org/show_bug.cgi?id=745455
2015-03-10 15:17:37 +01:00
Thiago Santos
81b555838a dashdemux: protect against malformed isombff format
Be more careful around malformed mpds that announce using
isombff profile but actually are regular mpds
2015-02-18 08:19:59 -03:00
Thiago Santos
a48a361256 dashdemux: depracate bandwidth-usage in favor of bitrate-limit
Bitrate-limit is already available in the baseclass and, even though
the bandwidth-usage name is better, hls and mss already used
bitrate-limit. This patch deprecates the bandwidth-usage and maps
it to the baseclass bitrate-limite.
2015-02-17 11:12:42 -03:00
Mathieu Duponchelle
7ca6d9634a dashdemux: Fix handling of live streams with timeshift buffers.
By implementing get_live_seek_range.

As shown by :

gst-validate-1.0 playbin \
uri=http://dev-iplatforms.kw.bbc.co.uk/dash/news24-avc3/news24.php

This patch handles live seeking, by setting a live seek range
comprised between now - timeShiftBufferDepth and now.

The inteersting thing with this stream is that one can actually
ask fragments up to availabilityStartTime, but it seems quite clear
in the spec that content is only guaranteed to exist up to
timeShiftBufferDepth.

One can test live seeking this way :

gst-validate-1.0 playbin \
uri=http://dev-iplatforms.kw.bbc.co.uk/dash/news24-avc3/news24.php \
--set-scenario seek_back.scenario

with scenario being:

description, seek=true
seek, playback-time=position+5.0, start="position-600.0",
flags=accurate+flush

This example will play the stream, wait for five seconds, then seek back
to a position 10 minutes earlier.

https://bugzilla.gnome.org/show_bug.cgi?id=744362
2015-02-12 22:47:26 +01:00
Thiago Santos
cb94de5d2f dashdemux: set proper stream type to streams
strncmp returns 0 when it compares equal and not a
boolean
2015-02-12 11:16:25 -03:00
Thiago Santos
85bb450a44 dashdemux: use audio_%02u and video_%02u names for pads
Instead of using the default ghostpad%u naming. The audio_/video_
names are more common in demuxers
2015-01-26 18:03:40 -03:00
Sebastian Dröge
80e02cbdf9 Constify some static arrays everywhere 2015-01-21 10:18:50 +01:00
Thiago Santos
229a15b393 adaptivedemux: refactor chunk downloading flow
Add more power to the chunk_received function (renamed to data_received)
and also to the fragment_finish function.

The data_received function must parse/decrypt the data if necessary and
also push it using the new push_buffer function that is exposed now. The
default implementation gets data from the stream adapter (all available)
and pushes it.

The fragment_finish function must also advance the fragment. The default
implementation only advances the fragment.

This allows the subsegment handling in dashdemux to continuously download
the same file from the server instead of stopping at every subsegment
boundary and starting a new request
2015-01-19 15:30:04 -03:00
Thiago Santos
3b920131f0 dashdemux: add log message about segment time information
For debugging purposes
2015-01-19 08:37:59 -03:00
Sebastian Dröge
cd3930969a dashdemux: Fix compiler warning with clang
gstdashdemux.c:1330:13: error: implicit conversion from enumeration type 'enum _GstAdaptiveDemuxFlowReturn' to different enumeration type
      'GstFlowReturn' [-Werror,-Wenum-conversion]
      ret = GST_ADAPTIVE_DEMUX_FLOW_SUBSEGMENT_END;
          ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2015-01-19 11:23:52 +01:00
David Waring
6dca8f5cce dashdemux: Fix detection for the end of segment.
The segment start time is calculated as the offset into the current segment.
The old condition to detect the end of period (i.e. segment start time >
period start + period duration) failed when the period start was not 0 since
the segment start time does not take the period start time into account.
Fix this detection by only comparing the segment start to the period duration.

https://bugzilla.gnome.org/show_bug.cgi?id=733369
2015-01-16 17:07:22 -03:00
Thiago Santos
fb760a563c dashdemux: remove unused segment attribute
It was never used, only initialized
2015-01-16 17:07:22 -03:00
Thiago Santos
3055bb331a dashdemux: implement ISOBMFF profile handling
The ISOBMFF profile allows definind subsegments in a segment. At those
subsegment boundaries the client can switch from one representation to
another as they have aligned indexes.

To handle those the 'sidx' index is parsed from the stream and the
entries point to pts/offset of the samples in the stream. Knowing that
the entries are aligned in the different representation allows the client
to switch mid fragment. In this profile a single fragment is used per
representation and the subsegments are contained in this fragment.

To notify the superclass about the subsegment boundary the chunk_received
function returns a special flow return that indicates that. In this case,
the super class will check if a more suitable bitrate is available and will
change to the same subsegment in this new representation.

It also requires special handling of the position in the stream as the
fragment advancing is now done by incrementing the index of the subsegment.
It will only advance to the next fragment once all subsegments have been
downloaded.

https://bugzilla.gnome.org/show_bug.cgi?id=741248
2015-01-16 17:07:05 -03:00
Thiago Santos
f5b98f24c2 dashdemux: parse the sidx index from isobmff streams
Allows dashdemux to identify the subsegments in the stream and
switch bitrates when needed
2015-01-16 15:00:11 -03:00
Thiago Santos
b40e5decb2 dashdemux: check for profiles
Check for available profiles to enable certain features for
dash playback. For now we check for the ISOFF On Demand 2011 profile.
2015-01-16 15:00:11 -03:00
Thiago Santos
afc392c47b dashdemux: do not try to ref null pointer
Playlists might be missing the availability start time, so check for
it before trying to ref the object
2014-12-29 11:39:22 -03:00
Thiago Santos
a862ba4b45 dashdemux: run gst-indent on mpdparser
Run gst-indent on mpdparser to have it stop complaining on every
commit
2014-12-29 11:39:22 -03:00
David Waring
1c0c6b6f48 dashdemux: Change period when setting by period id.
Make gst_mpd_client_set_period_id set the current period index when it finds a
period with a matching period id.

https://bugzilla.gnome.org/show_bug.cgi?id=741322
2014-12-10 16:22:31 -03:00
David Waring
b03acbf584 dashdemux: Find current segment in the streams that have just been setup
Using demux->streams will just skip the whole loop as demux->streams will
always be NULL at that point

https://bugzilla.gnome.org/show_bug.cgi?id=741285
2014-12-09 21:08:10 -03:00
Thiago Santos
f48fa7e763 dashdemux: fix double unref of object
the datetime is already released by the end of the function
2014-12-02 15:52:54 -03:00
David Waring
95c3fdc193 dashdemux: Find the current period in a live stream
Start from the correct period on a live stream

https://bugzilla.gnome.org/show_bug.cgi?id=737421
2014-12-02 14:22:09 -03:00
David Waring
306ca0cdf6 dashdemux: Fix period selection for live streams
Fix period selection and properly error out when update cannot be done

https://bugzilla.gnome.org/show_bug.cgi?id=725298
2014-12-02 13:24:52 -03:00
Thiago Santos
f04d351cd9 dashdemux: replace the streams with the new mpd client's streams
Otherwise it won't update with the new segment info from the playlist
update
2014-11-30 21:56:25 -03:00
Thiago Santos
28d66ea589 dashdemux: when updating the manifest, set the uri
This will allow dashdemux to create the correct full path URIs to
continue downloading fragments
2014-11-30 21:56:25 -03:00
Thiago Santos
58a1b0d058 dashdemux: port to adaptive demux 2014-11-30 21:56:25 -03:00
Matthieu Bouron
1d733eacf7 dashdemux: do not override last known stream error
https://bugzilla.gnome.org/show_bug.cgi?id=736141
2014-11-07 19:52:00 -03:00
Thiago Santos
39ba21619e dashdemux: make sure flushes have the same seqnum as the seek event
They are part of the same operation and should preserve the seqnum
2014-11-07 19:16:47 -03:00
Thiago Santos
e60bdc553c dashdemux: simplify seek to eos handling
Remove redundant flush stop pushing and remove a goto to make
the code flow simpler
2014-11-07 19:09:15 -03:00
Matthieu Bouron
5ae991095d dashdemux: send missing FLUSH_STOP/EOS when no seeking period is found
https://bugzilla.gnome.org/show_bug.cgi?id=736800
2014-11-07 19:02:02 -03:00
Tim-Philipp Müller
f216b7bb11 Sprinkle some G_PARAM_DEPRECATED and #ifndef GST_REMOVE_DEPRECATED 2014-11-02 17:19:34 +00:00
Brendan Long
9b94f29261 dash: Remove obsolete README.
https://bugzilla.gnome.org/show_bug.cgi?id=738848
2014-10-23 10:26:54 +02:00
David Waring
29f1f4533e dash: Use GstUri to join URIs 2014-09-29 12:22:19 +03:00
Matthieu Bouron
22c7559152 dashdemux: mark first buffer as discont after restarting a download task
Mark first buffer as discont after restarting a download task, so
downstream can reset its state to properly handle the new fragment.

Related issue: https://bugzilla.gnome.org/show_bug.cgi?id=736318

https://bugzilla.gnome.org/show_bug.cgi?id=736319
2014-09-24 13:30:20 -03:00
Thiago Santos
2273c15f15 dashdemux: push a time segment when restarting streaming
This should inform demuxers/decoders downstream that the stream is
about to start from a new position and they should flush accordingly

https://bugzilla.gnome.org/show_bug.cgi?id=736319
2014-09-24 12:35:37 -03:00
George Kiagiadakis
55032ae5fe dashdemux: synchronize with the download loop thread to signal it to continue
If EOS or ERROR happens before the download loop thread has reached its
g_cond_wait() call, then the g_cond_signal doesn't have any effect and
the download loop thread stucks later.

https://bugzilla.gnome.org/show_bug.cgi?id=735663
2014-09-18 13:38:25 -03:00
Thiago Santos
24c99712a8 dashdemux: fix clearing of eos state in pads
The internal pad still keeps its EOS flag and event as it can be assigned
after the flush-start/stop pair is sent. The EOS is assigned from the streaming
thread so this is racy.

To be sure to clear it, it has to be done after setting the source to READY to
be sure that its streaming thread isn't running.

https://bugzilla.gnome.org/show_bug.cgi?id=736012
2014-09-18 12:14:30 -03:00
Sebastian Dröge
1ce7d89868 dash: Actually retry 3 times as advertised instead of 2 2014-09-15 11:59:49 +03:00
Matthieu Bouron
4ed7c7919a dashdemux: improve position detection when a download restart
Query other src pads before falling back to the position of the last
known pushed segment (which can be far ahead in time).

https://bugzilla.gnome.org/show_bug.cgi?id=736421
2014-09-11 18:25:19 -03:00
Sebastian Dröge
51a9e13bf2 dashdemux: Don't send flush events to deactivated pads
https://bugzilla.gnome.org/show_bug.cgi?id=736012
2014-09-04 18:21:25 +03:00
Tim-Philipp Müller
334a71506c dashdemux: fix abort in error code path with newer glib
Don't forget to unlock mpd client again when erroring out.
Fixes abort when g_mutex_clear() is called on a locked mutex.
2014-08-21 16:25:55 +01:00
Thiago Santos
1cabb3b5a5 dashdemux: unref pad reference when removing internal source in error
Avoids leaking the pad in error situations
2014-08-19 17:17:33 -03:00
Thiago Santos
4afa05e567 dashdemux: read language from ContentComponent node as a fallback
If the language is not specified in the AdaptationSet, use the ContentComponent
node to get it. We only get it if there is only a single ContentComponent as
it doesn't seem clear on what to do if there are multiple entries

https://bugzilla.gnome.org/show_bug.cgi?id=732237
2014-08-19 16:02:52 -03:00
Matthieu Bouron
82fdb3aefc dashdemux: push language code tag
Language code tag is retrieved from the AdaptationSet language
property.

https://bugzilla.gnome.org/show_bug.cgi?id=732237
2014-08-19 15:34:01 -03:00
George Kiagiadakis
ea90ceac01 dashdemux: support downloading segments in reverse order
When a seek with a negative rate is requested, find the target
segment where gstsegment.stop belongs in and then download from
this segment backwards until the first segment.

This allows proper reverse playback.
2014-08-07 16:52:37 +03:00
Thiago Santos
24815a5feb dashdemux: return the error to the source immediately to stop faster
When flushing, this will prevent dashdemux from trying to download more
fragments or more chunks of the same fragment before stopping.

Also improves the error handling to not transform everything non-ok into
an error.

https://bugzilla.gnome.org/show_bug.cgi?id=734014
2014-08-01 10:37:15 -03:00
Sebastian Dröge
ae679506b1 dashdemux: Always use the redirect target to resolve relative URIs
But redownload the playlists from the original URI if it's not
a permanent redirect.
2014-05-28 12:47:51 +02:00
Thiago Santos
16d969b945 dashdemux: mpdparser: properly unref gstdatetime
Avoid leaking the GstDateTime instances when summing dates

CID #1212143
2014-05-13 11:22:58 -03:00
Thiago Santos
288e8d5c0e dashdemux: mpdparser: avoid double free of segment timeline node
The parsing function already frees the old value (if any), avoid a double
free by not freeing it before calling the function without setting the
pointer to NULL

Coverity ID: 1212178
2014-05-13 10:45:29 -03:00
Thiago Santos
64bea0252b dashdemux: mpdparser: avoid double free
The _parse_url function already frees the previous pointer, avoid
freeing it before without setting to null or we have a double free.

Coverity ID: 1212181
Coverity ID: 1212180
Coverity ID: 1212179
2014-05-13 10:13:37 -03:00
Edward Hervey
651a4ae2e7 dash: Don't leak GstActiveStream
CID #1212142
2014-05-13 13:52:48 +02:00
Thiago Santos
4c59f7df4c dashdemux: initialize the mutex and cond for fragment download 2014-05-12 16:27:37 -03:00
Thiago Santos
21b1d37023 dashdemux: remove unused stream uridownloader
The uridownloader for the stream fragments isn't used anymore.
2014-05-11 15:26:45 -03:00
Thiago Santos
a5b3ba09b8 dashdemux: deprecate max-buffering-time property
It is not used as dashdemux doesn't have a internal buffer
for fragments anymore
2014-05-07 01:00:50 -03:00
Thiago Santos
e9638fe3fd dashdemux: removing old unused code
The 'catch up mode' isn't needed anymore since dashdemux
is downloading and pushing from the same thread
2014-05-07 01:00:49 -03:00
Thiago Santos
5df2edf80c dashdemux: remember to set starting fragment to new fragments 2014-05-07 01:00:49 -03:00
Thiago Santos
733c7c0f16 dashdemux: handle a few more error cases
related to missing plugins, bad URI and a lockup on dealing with
errors from the source.
2014-05-07 01:00:49 -03:00
Thiago Santos
173c353716 dashdemux: Only set timestamp to the first buffer of fragments
Setting it to the other parts of the fragment is slightly wrong
and misleading as it isn't accurate enough.
2014-05-07 01:00:49 -03:00
Thiago Santos
f09dd7e7a5 dashdemux: handle error messages from the sources
Set up a message handling function to be able to catch errors
from the source element and signal the cond to allow the download
loop to retry the download.
2014-05-07 01:00:49 -03:00
Thiago Santos
15952dcd8e dashdemux: check for errors between downloads
To abort earlier in case of failures
2014-05-07 01:00:49 -03:00
Thiago Santos
b5998a4c3b dashdemux: Always accept the latency configure event
Upstream or internal elements are irrelevant and we should
always succeed.
2014-05-07 01:00:49 -03:00
Thiago Santos
d6671e73a6 dashdemux: measure download rate just like hlsdemux
new bitrate = (old bitrate + (last fragment bitrate * 3)) / 4
2014-05-07 01:00:49 -03:00
Thiago Santos
bed3d66605 dashdemux: remove uridownloader from fragments download
Instead, use a source element linked to a ghostpad to provide
smaller buffers and more granular control for downstream
buffering elements while also reducing startup latency
2014-05-07 01:00:49 -03:00
Sebastian Dröge
bb8227e279 dashdemux: Update for uri downloader API changes 2014-05-05 09:41:51 +02:00
Sebastian Dröge
f910ffb637 dashdemux: Update for URI downloader API changes
And include the MPD file as referer in requests, and make sure
to set refresh=TRUE when updating the MPD.
2014-05-02 10:39:22 +02:00
Vincent Penquerc'h
2e940ba253 dashdemux: do not ignore failure to register typefinder
Coverity 1139629
2014-04-10 17:52:02 +01:00
Vincent Penquerc'h
2dd898793e dashdemux: fix time leak
Coverity 1147016
2014-04-10 17:48:03 +01:00
Vincent Penquerc'h
59654c68ee dashdemux: remove dead code and variable
A recent commit made stream not able to be NULL, ending up with
a flag being always set to FALSE when it matters.

Coverity 1146968, 1147012
2014-04-10 17:46:32 +01:00
Wim Taymans
6c014f7e36 mpdparse: only add location when node existed
Actually return FALSE when the location node was non-existing
Only add the location node when it existed
2014-04-03 11:48:07 +02:00
Matthieu Bouron
820685409e dashdemux: use correct print format for gint64
https://bugzilla.gnome.org/show_bug.cgi?id=727385
2014-03-31 14:50:17 +02:00
Sebastian Dröge
b47a4faf5f ext: Use Codec/Demuxer/Adaptive for the adaptive streaming demuxers 2014-02-23 00:11:04 +01:00
Chris Bass
6342d225bf dashdemux: ensure segments aren't fetched before they're available
Incorrect time scaling in gst_dash_demux_wait_for_fragment_to_be_available()
means that media segments are fetched before their availablity time. This
patch fixes this.

https://bugzilla.gnome.org/show_bug.cgi?id=724875
2014-02-22 16:29:13 +01:00
Chris Bass
462c04cade dashdemux: initialise demux->last_manifest_update
demux->last_manifest_update is not initialised at startup, with the
effect that live manifests are reloaded immediately after the download
loop begins. This patch fixes this.

https://bugzilla.gnome.org/show_bug.cgi?id=724790
2014-02-20 20:26:25 +01:00
Sebastian Dröge
48ba499ed2 dashdemux: Download MPD with compression, the fragments without 2014-02-12 13:10:50 +01:00
Sebastian Dröge
3a5abc233d ext: Update for GstUriDownloader API changes 2014-02-11 14:18:32 +01:00
Thiago Santos
3d2f3bcf62 dashdemux: remove unnecessary variable
Instead of using 2 indexes that were actually the same, use only
one. Saves a variable.
2014-01-09 09:13:48 -03:00
Thiago Santos
cea909b877 dashdemux: fix seeking when the mpd uses a segment template
Remove the dashdemux seeking function to use the one implemented
in mpdparser as it is more complete. This also makes dashdemux not
crash when seeking on streams that use segment templates.
2014-01-09 09:11:23 -03:00
Thiago Santos
da329b44a4 dashdemux: remove stream loop thread
Download and push from the same task, makes code a lot simpler
to maintain. Also pushing from separate threads avoids deadlocking
when gst_pad_push blocks due to downstream queues being full.
2013-12-24 17:07:52 -03:00
Thiago Santos
d353d229b1 dash: detect EOS when segments are generated by template
Use the Period duration do know when to end the stream
2013-12-24 17:07:52 -03:00
Thiago Santos
5b1eda95eb dashdemux: do not try to access buffer after losing the ref
For obvious reasons
2013-12-24 17:07:52 -03:00
Thiago Santos
be54766975 dashdemux: use a separate GstUriDownloader per stream
Avoids one download having to wait for another to finish
before starting
2013-12-24 17:07:52 -03:00
Thiago Santos
f33c52377f dashdemux: store GstActiveStream to avoid getting it every time
GstActiveStream is used everywhere to operate on the MPD client,
better store it in the GstDashDemuxStream to avoid getting it
everytime
2013-12-24 17:07:52 -03:00
Thiago Santos
7c6ccda3ec dashdemux: simplify locking for streams
Use a single lock for all streams instead of having separate locks.
This makes maintenance easier and at most points we would need
a single lock before iterating on all streams data. So not much
is gained from individual locks.
2013-12-24 17:07:51 -03:00
Thiago Santos
a2583e54d1 dashdemux: fix multiple period mpd playback
Make dash playlists with multiple periods work again by waiting
to switch the periods when all streams have reached the end of
the current period. The stream_loop is responsible for advancing
the period, but the download loops will already start downloading
data for the next period as soon as possible.
2013-12-24 17:07:51 -03:00
Thiago Santos
1483b59c6b dashdemux: add combine flows function
Use a flow combination function to decide the result from the
stream_loop
2013-12-24 17:07:51 -03:00
Thiago Santos
6611d14eed dashdemux: handle multiple languages
Handle multiple languages by using the not-linked return to stop
the download task for that stream. It can be reactivated when
a reconfigure event is received. Stopping the unused streams is
relevant to save network bandwidth
2013-12-24 17:07:51 -03:00
Thiago Santos
31e4ba0094 dashdemux: Use 1 download task per stream
Instead of having a single download task for all streams, this
commit makes each stream have its own download loop, allowing
parallel download of fragments.
2013-12-24 17:07:51 -03:00
Thiago Santos
3bd66d17fc dashdemux: refactor fragment fetching into smaller functions
Makes it easier to maintain and extend. This is a first step into
adding multi language support to dashdemux
2013-12-24 17:07:51 -03:00
Thiago Santos
1d2de4a034 dashdemux: run gst-indent
Lots of indentation issues making it very annoying to commit
because of the indent hook. Fix this for once.
2013-12-24 17:07:51 -03:00
Thiago Santos
08636f3bab dashdemux: expose all streams
always expose all streams instead of only exposing one of each type.

This is more aligned with gstreamer's way of working. Allows the user
to select the stream that it wants to use by linking its pad and leaving
the unused ones as unlinked.
2013-12-24 17:07:51 -03:00
Greg Rutz
6819d1a206 dashdemux: Improve if cause readability
Fixed up the error-handling code when downloading fragments.
Modifed the error-handling code to use positive logic when
testing for cancellation of the download loop.

https://bugzilla.gnome.org/show_bug.cgi?id=701404
2013-10-03 09:15:37 -03:00
Thiago Santos
b8dd95e219 dashdemux: actually return true on latency query
Do not forget to set the return for latency query
2013-10-03 09:15:37 -03:00
Alex Ashley
42fd04ce48 dashdemux: stop fetching live fragments that don't yet exist
There is an issue for live streams where download_loop will keep
downloading segments until it gets a 404 error for a segment
that has not yet been published. This is a problem because this
request for a segment that doesn't exist will propagate all the
way back to the origin server(s). This means that dashdemux causes
extra load on the origin server(s) for segments that aren't yet
available.

This patch uses availabilityStartTime, period
and the host's idea of UTC to decide if a fragment is available to
be requested from an HTTP server and filter out requests for fragments
that are not yet available.

https://bugzilla.gnome.org/show_bug.cgi?id=701404
2013-10-03 09:15:37 -03:00
Sebastian Dröge
fef9ef6a8e dash/smoothstreaming: Remove unused debug category with the same name
It caused static linking to fail.
2013-09-19 20:09:59 +02:00
Josep Torra
47c35ee52e dashdemux: Fix warnings when building in OS X Snow Leopard
gstdashdemux.c:1753: warning: format '%llu' expects type 'long long unsigned int', but argument 8 has type 'long unsigned int'
gstdashdemux.c:2224: warning: format '%llu' expects type 'long long unsigned int', but argument 9 has type 'guint64'
gstdashdemux.c:2224: warning: format '%llu' expects type 'long long unsigned int', but argument 10 has type 'guint64'
2013-08-30 21:52:35 +02:00
Josep Torra
0b54b0568d dashdemux: Fix warnings when building in OS X Snow Leopard
gstmpdparser.h:530: warning: type qualifiers ignored on function return type
gstmpdparser.c:4177: warning: type qualifiers ignored on function return type
2013-08-30 21:36:19 +02:00
Chris Bass
7f21226956 dashdemux: offset segment numbers by startNumber
For SegmentTemplate elements containing a startNumber attribute, the
`number' member of GstMediaSegments should be offset by the value of
startNumber; however, this is not currently the case. As a result, the
first URI(s) requested by the download loop will be wrong.

This commit ensures that segment numbers will be offset by startNumber
when one is present in a SegmentTemplate element.

https://bugzilla.gnome.org/show_bug.cgi?id=705661
2013-08-16 11:15:47 -03:00
Chris Bass
19a45554bf dashdemux: remove incorrect timestamp scaling.
When using a SegmentTemplate element, the timestamps of the buffers
output by dashdemux are incorrect, causing problems downstream.

The reason is that GstMediaSegment start times are calculated (in
gst_mpdparser_get_chunk_by_index) by multiplying segment index by
segment duration and then scaling the result according the `timebase'
attribute from the MPD. However, the segment duration is already a
GstClockTime (i.e., it has already been scaled according to the timebase
from the MPD and converted to a nanosecond value), so multiplying it by
the segment index will give the correct timestamp without the need for
any further scaling.

https://bugzilla.gnome.org/show_bug.cgi?id=705679
2013-08-16 10:22:21 -03:00
Thiago Santos
2db211e243 dashdemux: use push_force when adding events to the dataqueue
This prevents deadlocks on startup on files that have only a very
large buffer for a stream and the queue is filled and will lock on
the eos event that is pushed after the buffer. As no buffers have yet
been pushed to other streams, the pipeline locks on preroll
2013-08-13 11:49:54 -03:00
Thiago Santos
ac07f8577b dashdemux: properly error out when manifest has no streams
Post an error message when the manifest is parsed and no valid streams
are found be activated and used.

Fixes #704308
2013-07-30 22:06:38 -03:00
Edward Hervey
97426a1caa all: Fix for GST_DISABLE_GST_DEBUG
Where applicable, remove methods that don't do anything different than
the default implementation.
2013-07-29 09:42:12 +02:00
Sebastian Dröge
493ee3383a dash: Add support for group-id in the stream-start event 2013-07-23 10:33:31 +02:00
Thiago Santos
ec630db32f dashdemux: fix typo in check_queue_full function
It should return True when the queue IS full

Fixes #704226
2013-07-15 10:05:59 -03:00
Thiago Santos
1472dd3d58 dashdemux: implement queue full check function
Checks if the queue is full according to max buffering time
set by the user

https://bugzilla.gnome.org/show_bug.cgi?id=701404
2013-07-09 01:18:54 -03:00
Thiago Santos
95c2638ba5 dashdemux: minor refactor
Split one very large function into 2 smaller but still large functions.

Also change the if conditions to positive checks to improve readability.
2013-07-09 00:47:07 -03:00
Thiago Santos
5a5e66ec90 dashdemux: handle live playback resync
During a live stream it is possible for dashdemux to lag behind on a
slow connection or to rush ahead of the connection os too fast.

For the first case it is necessary to jump some segments ahead to be able to
continue playback as old segments are usually deleted from the server.

For the later, dashdemux should wait a little before attempting another
download do give time to the server to produce a new segment
2013-07-08 23:40:14 -03:00
Thiago Santos
b316d8a677 dashdemux: fix template based segment generation
When using a template based segment list, do not try to
contruct a finite segment list for the limits of the available periods.

We might not know when the period ends (for live streams) and we can
always create the segment on demand when requested by dashdemux,
avoiding use of some memory and cpu when re-creating this list.
2013-07-08 23:39:49 -03:00
Thiago Santos
a8a355108a dashdemux: use more appropriate data structures for parsing
Replaces the 2 likely larger lists with more appropriate structures
to improve performance.

Replaces S nodes GList for a GQueue, this reduces latency to startup
because of traversing the list just append an element.

Replaces the processed media segments GList for a GPtrArray as it is
constantly acessed by index during playback.
2013-07-08 23:39:49 -03:00
Thiago Santos
b8fc98849a dashdemux: answer to latency queries
Set live if stream is live and also add to the max latency the
max internal buffering
2013-07-08 23:39:49 -03:00
Thiago Santos
9a38127467 dashdemux: prevent assertion when duration is unknown
Duration from segment being unknown is a issue from the MPD and not
a programming issue, so the assert isn't useful here. Instead check
and return an error code so the caller can fallback to alternatives
2013-07-03 19:11:45 -03:00
Thiago Santos
3030c25aed dashdemux: Fix event leak when parsing manifest fails
Always remember to unref the event before proceeding, in both success
and failure cases
2013-07-03 19:11:11 -03:00
Thiago Santos
788757dc1f dashdemux: various cleanups
Removing unused function, replacing // comments with /* */ and
replacing some GST_WARNING with GST_INFO/_DEBUG as they are meant
to be
2013-07-03 15:34:41 -03:00
Alex Ashley
5ad2a2d161 dashdemux: Change first fragment selection for live streams
When dashdemux selects its first fragment, it always selects the
first fragment listed in the manifest. For on-demand content,
this is the correct behaviour. However for live content, this
behaviour is undesirable because the first fragment listed in the
manifest might be some considerable time behind "now".

The commit uses the host's idea of UTC and tries to find the
oldest fragment that contains samples for this time of day.

https://bugzilla.gnome.org/show_bug.cgi?id=701509
2013-07-03 15:34:30 -03:00
Thiago Santos
5c480dfc13 dashdemux: only generate index segment uri if there is a template
Simple fix to avoid an assertion.
2013-07-03 10:23:45 -03:00
Greg Rutz
5920ee2777 dashdemux: Implement inheritance for certain MPD elements
According to the MPEG-DASH spec, certain elements (i.e.
SegmentBase, SegmentTemplate, and SegmentList) should inherit
attributes from the same elements in the containing AdaptationSet
or Period.

Updated the SegmentBase, SegmentTemplate, and SegmentList parsers
to properly inherit attributes from the corresponding elements in
AdaptationSet and/or Period.

https://bugzilla.gnome.org/show_bug.cgi?id=702677
2013-07-03 10:23:45 -03:00
Greg Rutz
5e0ed52880 dashdemux: Properly detect presence of xml attributes
Convert all xml attribute/content parsing functions to return a
boolean value indicating whether or not the attribute/content was
present.  We need this finer-grained control in order to properly
implement the inheritance policies described in the spec

Also fixed several memory leak conditions when handling errors in
the xml attribute/content parsing functions.

https://bugzilla.gnome.org/show_bug.cgi?id=702677
2013-07-03 10:23:45 -03:00
Thiago Santos
467b22c567 dashdemux: change debug message from warning to info
It isn't a warning/issue.
2013-07-03 10:23:45 -03:00
Thiago Santos
94c6497dfa dashdemux: protect from access to empty list data
Check if the list has elements before trying to access the last one
and causing a segfault
2013-07-03 10:23:45 -03:00
Thiago Santos
0a88daaf8e dashdemux: protect against failed header downloads
Avoids criticals when downloaded fragment is NULL
2013-07-03 10:23:45 -03:00
Olivier Crête
3f26bb9154 dashdemux: Handle case without an initialization segment
If no initialization segment is defined, then don't print a
critical or a warning, just ignore it.

https://bugzilla.gnome.org/show_bug.cgi?id=701961
2013-07-02 01:30:24 -03:00
Thiago Santos
4c89fab390 dash: save 1 or 2 string copies when getting fragment uris
Only create new string if required, saving maybe 1 or 2 str copies per
fragment.
2013-07-01 18:52:08 -03:00
Thiago Santos
aa1fe88a08 dashdemux: each fragment can have its own index
Return index URI/range to dashdemux from the mpdparser to be able
to download and deliver them downstream for playback.
2013-07-01 18:52:08 -03:00
Thiago Santos
d68fffc217 dashdemux: handle top-level index urls
Parse and provide access to top-level index segments if available.
dashdemux should push those whenever a header is pushed.

Fixes #700489
2013-07-01 18:52:08 -03:00
Arthur Shipkowski
54d87f071c dashdemux: Fix critical error output when Initialization has no URL
Issue evinced by
http://yt-dash-mse-test.commondatastorage.googleapis.com/car-20120827-manifest.mpd
which produces output like ** (gst-launch-1.0:8060): CRITICAL **:
gst_mpdparser_get_initializationURL: assertion `InitializationURL->sourceURL
!= NULL' failed

https://bugzilla.gnome.org/show_bug.cgi?id=700489
2013-07-01 18:51:30 -03:00
Thiago Santos
d9c324c6c7 dashdemux: prevent crash by checking if the segment node is present
Do not try to access range data if there is no segment node
2013-07-01 14:35:02 -03:00
Thiago Santos
d0befd39f0 dash: use same debug category for dashdemux and the mpd parser
Makes debugging easier
2013-07-01 14:22:02 -03:00
Thiago Santos
4f17112392 dashdemux: add support for range based segments
Use the mediaRange information and pass it to the uridownloader
to correctly download only the segment ranges indicated in the
MPD

https://bugzilla.gnome.org/show_bug.cgi?id=702206
2013-07-01 14:22:01 -03:00
Greg Rutz
45111f2efe dashdemux: Cleanup memory allocation/deallocation
Ensure that g_free/xmlFree is used correctly based on how the
memory was allocated.

When deallocating GLists, there were many places that were using
g_list_foreach and g_list_free.  Converted these occurrences to
call g_list_free_full.

Add NULL checks to all xmlFree calls since the documentation does
not guarantee that passing NULL is safe

In places where we are strdup'ing memory allocated by libxml2,
changed those calls to use xmlMemStrdup().

There were several places where we were missing g_slice_free when
deallocating a top-level node structure.

https://bugzilla.gnome.org/show_bug.cgi?id=702837
2013-06-25 20:53:17 -03:00
Olivier Crête
5732c53c81 dashdemux: Make gst-indent happy 2013-06-10 18:01:09 -04:00
Arthur Shipkowski
3d50af3e4b dashdemux: Fix issue with get returning a value for max-buffering-time
It was not properly divided by GST_SECONDS. Also fix issue with
max-buffering-time being multiplied by GST_SECONDS every time the
property is retrieved.

https://bugzilla.gnome.org/show_bug.cgi?id=700487
2013-06-07 22:58:33 -03:00
Thiago Santos
d434f36245 dashdemux: send stream start event
Removes warnings about strict sticky events ordering
2013-05-17 21:23:55 -03:00
Olivier Crête
220f075423 dashdemux: Announce correct mpegts caps 2013-05-15 22:24:29 -04:00
Tim-Philipp Müller
0d7967e25e dashdemux: rename src template from src%d to src_%u 2013-05-08 23:17:08 +01:00
Thiago Santos
573a4d440c dash: remove superfluous files
Authors and license are at the top of the source files
2013-05-08 18:59:31 -03:00
Thiago Santos
919cb34fee dash: do not use deprecated glib mutex API 2013-05-08 18:14:46 -03:00
Thiago Santos
34e1b59eca dashdemux: fixing compiler warnings about print formats 2013-05-08 18:14:46 -03:00
Thiago Santos
9f190cdff7 dashdemux: port to 1.0 2013-05-08 18:14:46 -03:00
Thiago Santos
b338cc0d34 dashdemux: Fix another wrong assertion
Also adds a couple log messages for easier debugging
2013-05-08 18:14:46 -03:00
Thiago Santos
3472efda75 dashdemux: remove wrong asserts
Those asserts should be the contrary that they are. And also
the surround functions should already check that. Removing them.
2013-05-08 18:14:46 -03:00
Wim Taymans
665d59edba dashdemux: only start timestamp from 0 for live stream
We only want to adjust the timestamps so that they start from 0 for live
streams. Non-live streams already start from 0 and after a seek we actually want
to timestamp to be the position we seek to.
2013-05-08 18:14:45 -03:00
Wim Taymans
4f9f0b84cf dashdemux: make timestamps start from 0
Non-live streams should timestamp buffers with a running-time starting from
0. Since we already push a 0 -> -1 segment, bring the timestamps to 0
by subtracting the initial timestamp.
2013-05-08 18:14:45 -03:00
Wim Taymans
4ab58e0fb1 dashdemux: also send newsegment on startup 2013-05-08 18:14:45 -03:00
Wim Taymans
cfcaa23959 dashdemux: small cleanup 2013-05-08 18:14:43 -03:00
Thiago Santos
afccf149af dashdemux: live stream playback crashfix 2013-05-08 18:14:42 -03:00
Thiago Santos
d9baed8302 dash: mpdparser: do not cleanup xml lib too early
The xmlCleanupParser function seems to cleanup all statically
allocated libxml variables, making it unusable. We can't guarantee
that dashdemux won't need it anymore, so better not call it.
2013-05-08 18:14:42 -03:00
Thiago Santos
14feeb3ccb dashdemux: reimplementing live streams manifest updates
Manifest updates should be done periodically for live streams,
this patch makes the demuxer create a new manifest client for
the new version and transfers the stream position to the new
one, discarding the old one afterwards.
2013-05-08 18:14:42 -03:00
Thiago Santos
b01a3729c0 dash: mpdparser: allow periods without start time for live streams
Live streams can have undefined start times for the periods and
mpdparser can let that pass instead of erroring out
2013-05-08 18:14:41 -03:00
Thiago Santos
cff4498f7c dash: mpdparser: use guint64 for timestamps
The timestamps can be pretty big, so use guint64 for them
2013-05-08 18:14:41 -03:00
Thiago Santos
a53fd87508 dashdemux: mpd parsing: fix query parameter parsing
Try harder to detect URL parameters and split them to accomodate
the fragment url in the concat:

base-url + fragment-url + url-parameters
2013-05-08 18:14:41 -03:00
Thiago Santos
4ca530f2fe dashdemux: plug some leaks
Add some missing free/unrefs spotted by valgrind
2013-05-08 18:14:41 -03:00
Thiago Santos
c82606a600 dashdemux: remove unused mutexes 2013-05-08 18:14:41 -03:00
Thiago Santos
737d328bb5 dashdemux: properly reset stream status after a flush
The stream eos/end of period status must also be reset after a flushing
seek. This makes seeking after EOS work.
2013-05-08 18:14:41 -03:00
Andre Moreira Magalhaes (andrunko)
fbbf713e45 dashdemux: keep a list of streams periods
Keep a list of streams per period so that the download loop can keep
downloading while the stream loop is still pushing old period's data.
2013-05-08 18:14:41 -03:00
Andre Moreira Magalhaes (andrunko)
b9272dc0e6 dashdemux: Properly parse base uri from mpd. 2013-05-08 18:14:40 -03:00
Andre Moreira Magalhaes (andrunko)
6ecb58c4f8 dashdemux: Remove unused members. 2013-05-08 18:14:40 -03:00
Andre Moreira Magalhaes (andrunko)
497500dbfe dashdemux: Only send newsegment on seek. 2013-05-08 18:14:40 -03:00
Thiago Santos
3bc62ccc51 dashdemux: send segments that overwrite previous ones
This is only done for seeks, so it is fine
2013-05-08 18:14:40 -03:00
Andre Moreira Magalhaes (andrunko)
2b83b4410c dashdemux: switch bitrates without switching pads 2013-05-08 18:14:40 -03:00
Andre Moreira Magalhaes (andrunko)
11697b9968 dashdemux: Remove unusued method. 2013-05-08 18:14:40 -03:00
Andre Moreira Magalhaes (andrunko)
daea47d3f4 dashdemux: Set stream need_header after seek and has_data_queued to FALSE when flushing stream. 2013-05-08 18:14:40 -03:00
Thiago Santos
4a9d7f0a9f dashdemux: do not pause/start the stream loop on playing/paused changes
The demuxer shouldn't care about paused/playing, it should act the
same in both states
2013-05-08 18:14:39 -03:00
Thiago Santos
2fe509d50a dashdemux: remove property that isn't used anymore
Remove some pieces of code that are from an old property
that isn't used anymore
2013-05-08 18:14:39 -03:00
Thiago Santos
460542daaf dashdemux: add a downloadrate utility
A small struct that keeps a short history of fragment download bitrates
to have an average measure of N last fragments instead of using only
the last downloaded bitrate
2013-05-08 18:14:39 -03:00
Thiago Santos
28449ce7d1 dashdemux: sprinkling some more log 2013-05-08 18:14:39 -03:00
Thiago Santos
94dcb60127 dashdemux: change bitrates based on the stream bitrate
Do not use a global bitrate as the sizes of the fragments matter
when calculating the download rate as the connection setup time is
also being taken into the download duration, a smaller fragment
will have a lower bitrate than a larger one.

This avoids switching the bitrates for streams frequently because
of bitrate mismatches
2013-05-08 18:14:39 -03:00
Thiago Santos
770df6277a dashdemux: refactor to use the uridownloader lib instead of internal copy 2013-05-08 18:14:39 -03:00
Andre Moreira Magalhaes (andrunko)
5efedbff0a dashdemux: Make sure switch_pads won't leak any pad. 2013-05-08 18:14:39 -03:00
Andre Moreira Magalhaes (andrunko)
e92531c8f6 dashdemux: Properly stop download and stream tasks where appropriate. 2013-05-08 18:14:39 -03:00
Thiago Santos
288903a203 dashdemux: avoid an assertion when stopping the pipeline
Avoids asserting when dataqueues are setting to flushing due
to a pipeline stop during a pad switch.
2013-05-08 18:14:39 -03:00
Thiago Santos
83c0e1e25d dashdemux: download the next fragment with smaller timestamp
Instead of downloading 1 fragment per stream per download loop,
select the stream with the earlier timestamp and get a fragment
only for that one.

The old algorithm would lead to problems when the fragment durations
were too different for streams.
2013-05-08 18:14:39 -03:00
Thiago Santos
dbd6bde9d1 dashdemux: track segments in the demuxer
Use a GstSegment to track the current segment information in the
demuxer.
2013-05-08 18:14:38 -03:00
Thiago Santos
39924c60a1 dashdemux: remove buffering message emission from dashdemux
dashdemux shouldn't emit the buffering message as that can pause
the pipeline. It has no proper knowledge of the downstream buffering
status so it can pause the pipeline when it isn't necessary. It should
have an internal buffer for downloading the streams ahead of playback,
but that shouldn't make it able to stop the pipeline for buffering.

A particular case in which this is bad is when a pad switch happens
(changing bitrates for example), the new pads dashdemux creates
will get linked to demuxers and new queues will be created,
these queues are initially empty and dashdemux will quickly
drain its buffers by pushing them to those queues. So it
would have no more buffers internally and would emit a
buffering message with a low ratio, causing the pipeline
to pause when it wouldn't be necessary.
2013-05-08 18:14:35 -03:00
Thiago Santos
10b5d4d1cc dashdemux: removing unused code
Cleaning up by removing unused code and variables
2013-05-08 18:14:35 -03:00
Thiago Santos
0d9b5923af dashdemux: re-enable and fix adaptive switching
It is still unstable, but at least it works when the switches aren't
happening after every fragment
2013-05-08 18:14:34 -03:00
Thiago Santos
2d85107299 dashdemux: correctly signal EOS on manifest end
Put EOS on the streams queues after the last fragment from the
last period for each stream. This way we keep it serialized
with the buffers and it will work when streams have different
ending times
2013-05-08 18:14:34 -03:00
Thiago Santos
a19c689dfa dashdemux: detect end-of-period correctly
Detect end of period when there are no more buffers on any of the
streams
2013-05-08 18:14:34 -03:00
Thiago Santos
3a055ac2d1 dashdemux: Use the smallest queue value to define buffering state
The smallest queue should be used to prevent blocking the download
thread when a stream has too much data buffered, leaving the other
streams starving from fragments
2013-05-08 18:14:34 -03:00
Thiago Santos
9777fc5cb5 dash: fix parsing of streams to get correct fragment durations
Use the current stream base time instead of the 0th stream base time
to get default duration for fragments.
2013-05-08 18:14:34 -03:00
Thiago Santos
54542a6000 dashdemux: block waiting for buffers instead of busy wait
Make the streaming loop block waiting for buffers on the queues instead
of busy waiting eating cpu continuously on a queue length check
2013-05-08 18:14:34 -03:00
Thiago Santos
80c6973319 dashdemux: fix seeking on multiple streams
Each stream has its own durations and timestamps, the fragment number
is different for each stream when seeking, so the seek has to be done
for all streams, rather than on a single stream and propagated to
others
2013-05-08 18:14:34 -03:00
Thiago Santos
7330225ac8 dashdemux: Replace GQueue by GstDataQueue
GstDataQueue has proper locking and provides functions to limit the
size of the queue. Also has blocking calls that are useful to
our multithread scenario in Dash.
2013-05-08 18:14:34 -03:00
Thiago Santos
27b1abbda3 dashdemux: move the buffers queues to the streams
Store the buffers separately for each stream, this is clearer than
having a queue with a list of buffers. It also allows easier selection
of buffers to push in later refactors
2013-05-08 18:14:34 -03:00
Thiago Santos
1556d8cb03 dashdemux: refactor streams data to its own struct
Keeps code more organized and similar to what other demuxers
usually do
2013-05-08 18:14:33 -03:00
Thiago Santos
f46ba44e99 dash: do not try to print a pointer as a string 2013-05-08 18:14:33 -03:00
Thiago Santos
f27bb684f7 dashdemux: Remove timing code that delays pushing of fragments
Fragments should be pushed ASAP as downstream should be responsible for
doing the syncrhonization and proper buffering.

This has the great side effect of fixing most of the seeking A/V sync issues.
2013-05-08 18:14:33 -03:00
Thiago Santos
a1447a8ede dash: fixing build warnings
Also running through gst-indent
2013-05-08 18:14:33 -03:00
Louis-Francis Ratté-Boulianne
6acf2fba8f gstdashdemux: add need_header member to know whether the initialization fragment should be pushed 2013-05-08 18:14:33 -03:00
Louis-Francis Ratté-Boulianne
0bed9a6646 dashdemux: don't wait for the whole duration of a fragment when seeking 2013-05-08 18:14:33 -03:00
Louis-Francis Ratté-Boulianne
489d7a174c dashdemux: switch pads and send header file when a newsegment event is sent 2013-05-08 18:14:33 -03:00
Louis-Francis Ratté-Boulianne
04004cdf65 dashdemux: various fixes 2013-05-08 18:14:33 -03:00
David Corvoysier
c901f610c2 Applied gst-indent 2013-05-08 18:14:33 -03:00
David Corvoysier
582aa51fd6 Replaced URL pointing to obsolete Klagenfurt MPD by a new one 2013-05-08 18:14:33 -03:00
Gianluca Gennari
c988ee3a4b mpdparser: fix escape sequence in URL template resolving 2013-05-08 18:14:33 -03:00
Gianluca Gennari
470c860ffa mpdparser: do not switch pads when bitstreamSwitching = true 2013-05-08 18:14:32 -03:00
Gianluca Gennari
e0c55050e1 dashdemux: complete support for manifest file updates 2013-05-08 18:14:32 -03:00
Gianluca Gennari
7092a9c1ac dashdemux: add support for manifest file updates
- the MPD file is updated in the download loop (only if we have a "dynamic" MPD and minimumUpdatePeriod is valid);
- properly LOCK/UNLOCK the GstMpdClient;
2013-05-08 18:14:32 -03:00
Gianluca Gennari
7371b7997b dashdemux: new API to set/get segment index and period index
TODO: rework segment selection to support Representations or Adaptation Sets with segments not aligned
2013-05-08 18:14:32 -03:00
Gianluca Gennari
e7fad847bb dashdemux: new API to load the stream Period with a given index
this avoids to fiddle with stream internals in the code
2013-05-08 18:14:32 -03:00
Gianluca Gennari
9d43e33319 dashdemux: implement seeking across Periods 2013-05-08 18:14:32 -03:00
David Corvoysier
f7c6403432 Applied gst-indent 2013-05-08 18:14:32 -03:00
David Corvoysier
e323c099a0 By default, do not forward pad queries upstream, because it may have unforessen side-effects (forwarding the new 1.0 GST_CAPS query would prevent pad linking for instance) 2013-05-08 18:14:32 -03:00
Olivier Blin
d058a7f2b2 plugin: register as dashdemux instead of fragmented
This fixes conflicts with the HLS plugin, which is also named
fragmented.
When building its registry, gstreamer was picking one or the other
between hls and dashdemux.
2013-05-08 18:14:31 -03:00
Gianluca Gennari
895e804a86 dashdemux: check if we have received the MPD file in the proper way 2013-05-08 18:14:31 -03:00
Gianluca Gennari
8f13f246e0 mpdparser: silence warning 2013-05-08 18:14:31 -03:00
Olivier Blin
0b5eb519e7 dashdemux: fix printing buffering time and download rate/size
This was broken on armv7.
2013-05-08 18:14:31 -03:00
Olivier Blin
bd2784ffbb dashdemux: fix unused-but-set variable 2013-05-08 18:14:30 -03:00
Olivier Blin
cbebb01f23 dashdemux: use new gst_mpd_client_get_next_fragment_duration API
This fixes build that has been broken by commit
fb9aeac6552021b176a4c4bd07265e02a0b70e0f.

gst_mpd_client_get_target_duration has been removed, and
gst_mpd_client_get_next_fragment_duration should be used instead.
2013-05-08 18:14:29 -03:00
Gianluca Gennari
f728e424b2 dashdemux: remove FIXME comment
pad switching across multiple periods works perfectly fine now
and it is done only when there is a change in the CAPS
2013-05-08 18:14:29 -03:00
Gianluca Gennari
e96cc18ab9 dashdemux: send new-segment events to all pads 2013-05-08 18:14:27 -03:00
Gianluca Gennari
9387365fc9 dashdemux: reworked the API to retrieve fragment timestamp, fragment duration and media presentation duration
This was necessary to support variable-duration Fragments.

in the new API:
- gst_mpd_client_get_current_position returns the timestamp of the NEXT fragment to download;
- gst_mpd_client_get_next_fragment_duration returns the duration of the next fragment to download;
- gst_mpd_client_get_media_presentation_duration returns the mediaPresentationDuration from the MPD file;

also there is a new internal parser function:
- gst_mpd_client_get_segment_duration extracts the constant segment duration from the MPD file
(only used when there is no SegmentTimeline syntax element in the current representation)

In gst_mpd_client_get_next_fragment, we set the timestamp/duration of the fragment just downloaded
copying the values from the corresponding GstMediaSegment.

TODO: rework SEEKING to support seeking across different Periods.
2013-05-08 18:14:25 -03:00
Gianluca Gennari
dc5d7d258e dashdemux: use effective segment duration to reschedule the streaming task
do not assume segment duration is constant

Conflicts:

	ext/dash/gstdashdemux.c
2013-05-08 18:14:22 -03:00
Gianluca Gennari
cfcd9ffac6 dashdemux: reworked gst_dash_demux_get_buffering_time() to return the effective buffering time
do not assume the Fragment duration is constant
2013-05-08 18:14:16 -03:00
Gianluca Gennari
0abd777257 dashdemux: complete support for Media Presentations with several Periods
- Periods are played in sequence, from PeriodStart to PeriodEnd
- seamless switching from one Period to the next one works fine;
- the 'new-segment' generation is broken, so if we need to switch pads for a new Period there is a crash;
2013-05-08 18:14:10 -03:00
Gianluca Gennari
9d09e99ebe mpdparser: initial support for Media Presentations made of several Periods
- build a list of the available Periods with their start and duration time
- add the list of GstStreamPeriod in the GstMpdClient data struct
- remove cur_period from GstMpdClient and introduce an API to get the current GstStreamPeriod
- several API clean-ups
2013-05-08 18:14:10 -03:00
Olivier Blin
ba3bd1c69a mpdparser: support BaseURL for SegmentURL using mediaRange
This is used in big_buck_bunny_CappedVBR_Multirate_4s_0_AudioVideo_MainProfile.mpd
2013-05-08 18:14:10 -03:00
Olivier Blin
767a5ebed0 mpdparser: factorize adding range parameter to URL 2013-05-08 18:14:08 -03:00
Gianluca Gennari
53f383eff0 dashdemux: reworked caps detection
also reworked the API to extract audio/video parameters from the manifest file
(mimeType, width, height, rate, num channels)
2013-05-08 18:14:06 -03:00
Gianluca Gennari
fe05060044 dashdemux: do not send bogus duration messages when mediaPresentationDuration is unknown 2013-05-08 18:14:03 -03:00
Gianluca Gennari
fba69179e4 mpdparser: support SegmentTimeline syntax also for list-based media segment generation 2013-05-08 18:14:03 -03:00
Gianluca Gennari
362b5e9446 mpdparser: add support for SegmentTimeline syntax elements
build the list of segments to be played using the SegmentTimeline syntax, if present
bugfixes:
- for dynamic MPD files, when mediaPresentationDuration is not present use minimumUpdatePeriod instead
- do not add a spurious '$' when building an URL from a template like "$Bandwidth$/init.mp4v"
- introduce gst_mpd_client_add_media_segment() to avoid code duplication
2013-05-08 18:14:03 -03:00
David Corvoysier
41733d8296 Fixed wrong index in fragments 2013-05-08 18:14:03 -03:00
Gianluca Gennari
8e9ba056d7 mpdparser: fix memory leak in gst_mpd_client_get_next_fragment_set()
we have to free next_fragment_uri
2013-05-08 18:14:03 -03:00
David Corvoysier
cf0ab8e1f3 Removed unused function 2013-05-08 18:14:03 -03:00
David Corvoysier
84c8de8ab6 Seek event handling cleanup 2013-05-08 18:14:02 -03:00
Gianluca Gennari
b580ee8cd7 dashdemux: fix playing of single-segment media streams
other fixes:
- fixed a buffering bug: now we stop buffering when we reach the end of manifest
- now gst_mpd_client_get_target_duration() always returns a valid duration
(in case of single-segment streams, we return either Period duration or mediaPresentation duration)
TODO: support SegmentTimeline
2013-05-08 18:14:02 -03:00
Gianluca Gennari
5ade664680 uridownloader: deleted useless declaration of gst_uri_downloader_free() 2013-05-08 18:14:00 -03:00
Gianluca Gennari
122f10669f uridownloader: when possible, reuse existing element to download a new URI
previously a new element was allocated for each media segment, and it was never freed
2013-05-08 18:14:00 -03:00
Gianluca Gennari
5b830c3c91 dashdemux: unref caps in function need_add_header() 2013-05-08 18:13:58 -03:00
Gianluca Gennari
3726ff73ad dashdemux: fix extraction of SegmentTemplate->initialization in gst_mpd_client_get_next_header()
now the following MPD files are properly supported:

http://dash.edgesuite.net/adobe/hdworld_dash/HDWorld-1600.mpd
http://dash.edgesuite.net/adobe/hdworld_dash/HDWorld.mpd
2013-05-08 18:13:58 -03:00
Gianluca Gennari
cd84aaa9aa dashdemux: fix memory leak in gst_dash_demux_get_next_header() 2013-05-08 18:13:58 -03:00
David Corvoysier
95ee452625 We now only accept actual manifest files, and not any XML file 2013-05-08 18:13:58 -03:00
David Corvoysier
763f4c3fc3 Added a typefind helper for DASH: this commit should be reverted as soon as a proper patch has been submitted to gst-plugins-base 2013-05-08 18:13:57 -03:00
David Corvoysier
29c62f4780 Fixed state machine (again) 2013-05-08 18:13:57 -03:00
David Corvoysier
a7ad12e208 Code refactoring 2013-05-08 18:13:57 -03:00
David Corvoysier
f4756f7cb0 Fixed state machine 2013-05-08 18:13:57 -03:00
David Corvoysier
7f2207732b Improve consistency of the tasks shutdown code 2013-05-08 18:13:57 -03:00
David Corvoysier
28aaff747c Added missing g_list_free 2013-05-08 18:13:57 -03:00
David Corvoysier
30fece810f Do not answer to URI queries 2013-05-08 18:13:56 -03:00
David Corvoysier
0e2c3ffc0b Try queries upstream if we cannot process them 2013-05-08 18:13:56 -03:00
David Corvoysier
089daeba1b Renamed demux->next_stream in demux->next_push 2013-05-08 18:13:56 -03:00
David Corvoysier
943f4fa152 Inlined one-line utility funciton that was called only once 2013-05-08 18:13:56 -03:00
David Corvoysier
3cb7b12cbe Fixed regression after the introduction of the multi-screen support, preventing the pipeline from stopping properly 2013-05-08 18:13:56 -03:00
David Corvoysier
6f5d6f91ff Modified log level of shutdown message 2013-05-08 18:13:56 -03:00
David Corvoysier
90be873ee1 Comments: We don't select a single representation, but a representation for each stream Code: cleanup of gst_get_next_fragment (also renamed in gst_get_next_fragment_set) 2013-05-08 18:13:56 -03:00
David Corvoysier
d3c4c48923 Removed debug trace 2013-05-08 18:13:56 -03:00
David Corvoysier
6be9a30ad8 Added introduction and general design notes 2013-05-08 18:13:56 -03:00
David Corvoysier
35c04708ba Fixed wrong comment 2013-05-08 18:13:56 -03:00
David Corvoysier
6255b2762f Documented gst_dash_demux_download_loop 2013-05-08 18:13:55 -03:00
David Corvoysier
5b6bede189 Commented gst_dash_demux_stream_loop 2013-05-08 18:13:55 -03:00
David Corvoysier
b9d6796cb5 Commented needs_pad_switch 2013-05-08 18:13:55 -03:00
David Corvoysier
54fcbf89f1 Documented the representation switch mechanism 2013-05-08 18:13:55 -03:00
David Corvoysier
7764efb761 Replaced references to playlist (HLS) by references to manifest (DASH) 2013-05-08 18:13:55 -03:00
David Corvoysier
ad22e0da6d Renamed gst_dash_demux_switch_playlist to gst_dash_demux_select_representation and added comments 2013-05-08 18:13:55 -03:00
David Corvoysier
204ea9fc67 Removed obsolete comment 2013-05-08 18:13:55 -03:00
David Corvoysier
ae32818105 Applied gst-indent 2013-05-08 18:13:55 -03:00
David Corvoysier
28215b9e12 Updated README 2013-05-08 18:13:55 -03:00
Gianluca Gennari
b4057976be mpdparser: support MPD files with SegmentBase elements encoded inside a SegmentList element
also properly support MPD files without any Initialization segment
2013-05-08 18:13:55 -03:00
Gianluca Gennari
375634f669 mpdparser/dashdemux: fixed get_width, get_height, get_audio_rate, get_num_audio_channels API functions
the actual values now can be extracted also from the AdaptationSet element;
checking NULL structs for better robustness;
2013-05-08 18:13:55 -03:00
Gianluca Gennari
98a41f2c9e mpdparser: added support for single-segment streams with the URL encoded in the baseURL syntax element 2013-05-08 18:13:54 -03:00
Gianluca Gennari
779bf29879 mpdparser: added lang attribute to ProgramInformation node 2013-05-08 18:13:52 -03:00
Gianluca Gennari
94644fa82e mpdparser: added support for Accessibility, Role, Rating, Viewpoint elements to AdaptationSet node
those are DescriptorType elements, so they are just parsed and dumped for now;
2013-05-08 18:13:50 -03:00
Gianluca Gennari
416ea67979 mpdparser: support multiple ProgramInformation nodes
now we keep a list of ProgramInformation nodes for each Period node
2013-05-08 18:13:48 -03:00
Gianluca Gennari
dd198bc86d mpdparser: fixed parsing of SegmentList syntax element, and eliminated Represention node list from Period node
SegmentList nodes are allowed into Period, AdaptationSet or Representation nodes
and there is at most 1 element, so no need to keep a list;

Period nodes cannot have any Represention elements, as AdaptationSet nodes are mandatory;
this breaks compatibility with some legacy DASH test sequences.
2013-05-08 18:13:48 -03:00
Gianluca Gennari
8e3092661a mpdparser: fixed return with no value
gstmpdparser.c: In function ‘gst_mpdparser_get_list_and_nb_of_audio_language’:
gstmpdparser.c:2891: warning: ‘return’ with no value, in function returning non-void
2013-05-08 18:13:48 -03:00
Gianluca Gennari
7330bbfa7a mpdparser.c/.h: changed license from dual MIT/LGPL 2.0 to LGPL 2.1
uniformed licencinsing to the other libraries in the dashdemux project
2013-05-08 18:13:48 -03:00
hzakari
ec44485510 Optimize the two functions that return the number and the list of languages in a single function 2013-05-08 18:13:48 -03:00
Hamid ZAKARI
fab388c9fd Add the headers to the adaptationsets segments if any one of these changed representation 2013-05-08 18:13:46 -03:00
Hamid ZAKARI
713d02b81a Support Multi languages (need a decodebin2 patch) 2013-05-08 18:13:45 -03:00
Hamid ZAKARI
a4ac4a3117 Remove the "TODO" comment 2013-05-08 18:13:45 -03:00
David Corvoysier
3c937636ee Renamed LICENSE into COPYING 2013-05-08 18:13:44 -03:00
David Corvoysier
79dc12cc05 Updated authors 2013-05-08 18:13:44 -03:00
David Corvoysier
6fc0db0e0b Initial import of gstdashdemux sources 2013-05-08 18:13:43 -03:00