Commit graph

333 commits

Author SHA1 Message Date
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