Commit graph

97 commits

Author SHA1 Message Date
Thiago Santos
e541ec7e63 mssdemux: replace unused parameter
The buffer parameter wasn't being used, it was only to signal if
a buffer was downloaded and advance to the next fragment in the
manifest.

Replace the buffer with a boolean that has the same effect and is
safer
2013-05-07 21:09:48 -03:00
Louis-Francis Ratté-Boulianne
00400a838b mssdemux: avoid streaming to fail when download is cancelled
When download was failing repeatedly, it was causing streaming to fail even though it was cancelled on purpose (stopping tasks).
2013-05-07 21:09:48 -03:00
Thiago Santos
b579cb1ddc mssdemux: removing unused functions 2013-05-07 21:09:48 -03:00
Thiago Santos
1d28c574cf mssdemux: switch bitrates without switching pads 2013-05-07 21:09:48 -03:00
Andre Moreira Magalhaes (andrunko)
c8367a346c mssdemux: Check if pads are valid before removing. 2013-05-07 21:09:48 -03:00
Thiago Santos
bf0ea5d561 mssdemux: add a maximum error count for downloads
mssdemux will tolerate a few download errors before emitting an
error message to the bus
2013-05-07 21:09:48 -03:00
Thiago Santos
255eb4b161 mssdemux: use streams bitrate individually
connection setup times seem to matter when measuring the download
rate of different streams. Streams with longer fragments have a
*relatively* lower connection setup time and achieve higher bitrates.

Using the average seems unfair here, so use each stream's measured bitrate
to select its best quality option.
2013-05-07 21:09:48 -03:00
Thiago Santos
52c97834df mssdemux: use downloadbitrate utility for measuring bitrate
downloadbitrate keeps a short history of bitrates and helps
tracking the current average download bitrate for mssdemux
2013-05-07 21:09:48 -03:00
Andre Moreira Magalhaes (andrunko)
68308b3e54 mssdemux: Properly compute new bitrate and use bitrate_limit. 2013-05-07 21:09:48 -03:00
Andre Moreira Magalhaes (andrunko)
706b127daa mssdemux: Avoid a possible division by zero 2013-05-07 21:09:48 -03:00
Andre Moreira Magalhaes (andrunko)
28beb2ebd7 mssdemux: Add missing object param to GST_DEBUG|INFO_OBJECT calls 2013-05-07 21:09:48 -03:00
Thiago Santos
2219a3a1cc mssdemux: add bitrate-limit property
It allows the plugin to use its own downloading bitrate measures
as a feedback to select the best streams bitrate for the current
network scenario
2013-05-07 21:09:48 -03:00
Andre Moreira Magalhaes (andrunko)
12e9432847 mssdemux: Do not block on reset.
We need to cancel the downloader for each stream before joining the main download task, otherwise
the download task will block until all the stream tasks finish.
2013-05-07 21:09:47 -03:00
Louis-Francis Ratté-Boulianne
8ab3d09f81 mssdemux: handle FLUSH events by resetting the demuxer state 2013-05-07 21:09:47 -03:00
Louis-Francis Ratté-Boulianne
44d02efee0 mssdemux: fix some memory leaks and use right free function 2013-05-07 21:09:47 -03:00
Louis-Francis Ratté-Boulianne
b064910895 mssdemux: don't stop a task from inside the loop
Only pause the task
2013-05-07 21:09:47 -03:00
Louis-Francis Ratté-Boulianne
0239d77999 mssdemux: log manifest content for debugging 2013-05-07 21:09:47 -03:00
Louis-Francis Ratté-Boulianne
3ebb842388 mssdemux: only try to reload the manifest for live streams
There is no way to know if a live stream is really finished, so try to reload the manifest and check if there are more fragments to download. Else just let know it's the EOS.
2013-05-07 21:09:47 -03:00
Thiago Santos
7cb3a367f6 mssdemux: add some documentation
Adds a little bit of docs explaning the internals of mssdemux
2013-05-07 21:09:47 -03:00
Thiago Santos
46efc08809 mssdemux: add max-queue-size-buffers property
Indicates how much buffering should be done internally in
mssdemux
2013-05-07 21:09:47 -03:00
Thiago Santos
23ad760e3a mssdemux: stop tasks faster
Issue a cancel to the downloaders so they stop earlier
2013-05-07 21:09:47 -03:00
Thiago Santos
aa1713068a mssdemux: implement live streams handling
Live streams force the demuxer to keep reloading the Manifest from
time to time, as the new fragments are being added as they are recorded.
The demuxer should also try to keep up and detect when it had to skip
fragments, marking the discont flag when that happens.

Curiously, the spec doesn't seem to mention when/how a live stream is supposed
to end, so keep trying downloads until the demuxer errors out.
2013-05-07 21:05:12 -03:00
Thiago Santos
0704f15103 mssdemux: do not leak fragments 2013-05-07 21:05:12 -03:00
Thiago Santos
0a4c077d2e mssdemux: error out when upstream doesn't implement URI query
Error out when upstream doesn't answer to URI query and mssdemux
doesn't know the URI to fetch the fragments from
2013-05-07 21:05:12 -03:00
Thiago Santos
1116eee681 mssdemux: push newsegments with same start time on bitrate switches
This keeps sinks working in sync after a bitrate switch
2013-05-07 21:05:12 -03:00
Thiago Santos
c2ae981e6d mssdemux: rewriting pad tasks so that buffers are pushed by ts order
Use pad tasks to download data and an extra task that gets the earlier
buffer (with the smallest timestamp) and pushes on the corresponding
pad.

This prevents that the audio stream rushes ahead on buffers as its
fragments should be smaller
2013-05-07 21:05:12 -03:00
Thiago Santos
fba63178fe mssdemux: some fixes to bitrate switching
Removes a possible deadlock from bitrate switching when the pad
that requested the switch blocks on its pad-push
2013-05-07 21:05:12 -03:00
Thiago Santos
6ca10e6c1b mssdemux: refactoring fragment download to its own function
Makes code clearer and helps changing the download part of the
code to its own thread
2013-05-07 21:05:11 -03:00
Thiago Santos
da4fad2f6f mssdemux: implement bitrate switching
When connection-speed changes, signal that we might need a bitrate
switch. During the switch, a new pad group is added and the old one
is drained and removed.

New pads also need to push newsegments before starting to stream
2013-05-07 21:05:11 -03:00
Thiago Santos
b9aec0ad0d mssdemux: add connection-speed property
This speed limits the maximum bitrate of streams. Currently it
is only read when starting the pipeline, but it should be used
for switching bitrates during playback to adapt to network
changes.
2013-05-07 21:05:11 -03:00
Thiago Santos
4b6900999a mssdemux: add an 'active' flag to manifest stream
mssdemux should set the streams it has exposed as active so that
the manifest won't use the non-active streams to compute total bitrates
or providing fragments
2013-05-07 21:05:11 -03:00
Thiago Santos
4726115e83 mssdemux: signal no-more-pads when finished exposing pads
This makes decodebin/playbin mechanism know it can start playing
when buffering is finished
2013-05-07 21:05:11 -03:00
Thiago Santos
3f2409f7e2 mssdemux: do not try to expose unknown streams
When the stream can't have its caps detected, better not to expose it.
If no streams are known, signal an error about no playable streams to
the application
2013-05-07 21:05:11 -03:00
Thiago Santos
9b3f67c5b0 mssdemux: set timestamp and duration to fragment buffers
We can get those from the manifest and helps downstream to know
the fragment start time after a seeking operation
2013-05-07 21:05:11 -03:00
Thiago Santos
cb7e3d1f3b mssdemux: initial implementation of seek event handling
Adds basic handling for seek in time events. Needs to cooperate
with the downstream qtdemux so that it forwards the seeks and
the corresponding newsegments
2013-05-07 21:05:11 -03:00
Thiago Santos
33d872916b mssdemux: handle src pad queries fir duration and latency
Add a src pad query handler to get the duration from the manifest
and report it upstream.

Also adds a simple handler for latency queries
2013-05-07 21:05:11 -03:00
Thiago Santos
0f1ef317f0 mssdemux: add some more error handling
Post error in some more scenarios:
* when the manifest has no streams
* when getting the fragment url fails
2013-05-07 21:05:11 -03:00
Thiago Santos
3f15c9b05a mssdemux: add timescale to the caps
This is important for downstream to properly timestamp the samples

The default value is 10000000, but this can be set in the stream
or at the top-level manifest entry
2013-05-07 21:05:10 -03:00
Thiago Santos
edea61b758 mssdemux: add the correct caps to the outgoing stream
mssdemux outputs a quicktime variant, named mss-fragment
2013-05-07 21:05:10 -03:00
Thiago Santos
32d8a72bfc mssdemux: set caps to buffers before pushing
Also update to the latest gstfragment API that provides
the fragment as a whole buffer.
2013-05-07 21:05:10 -03:00
Thiago Santos
91dd173f3c mssdemux: improve state changing
Keep a ref on pad to prevent it being unreffed while the mssdemux
streams are still using it. Also reset the element when going to
ready instead of when going to null.
2013-05-07 21:05:10 -03:00
Thiago Santos
b4f994d47c mssdemux: adds mininum error handling
This should care for basic scenarios of errors and EOS to allow
the pipeline to stop correctly
2013-05-07 21:05:10 -03:00
Thiago Santos
ca4e5c34cb smoothstreaming: refactor structure names and implement url fetching
Use shorter names for the MSS manifest helper structure and functions.

Also continues the implementation of the stream fetching and pushing loop.
Now it uses the base url correctly and already fetches and pushes the fragments
downstream
2013-05-07 21:05:10 -03:00
Thiago Santos
7ceb023682 mssdemux: initial implementation of the pad loop
The loop will fetch a new fragment and push on its srcpad. Each
stream has its own loop
2013-05-07 21:05:10 -03:00
Thiago Santos
5291985efe mssdemux: pad exposing initial implementation
Does some basic parsing of the stream caps and adds a pad for
each stream detected in the manifest
2013-05-07 21:05:10 -03:00
Thiago Santos
72b05c0051 mssdemux: add manifest parsing
Continued implementing:
1) parse the manifest with libxml2
2) detect stream types
2013-05-07 21:05:10 -03:00
Thiago Santos
95e87fbee9 smoothstreaming: stubs for mssdemux
Just the stubs for mssdemux element.
Also add some useful code from hlsdemux that we intend to reuse
2013-05-07 21:05:10 -03:00