Commit graph

24 commits

Author SHA1 Message Date
Thiago Santos
b54367e211 mssdemux: reenable segment tracking for streams
Store the latest pushed timestamp so that mssdemux streams know
where they are in time
2014-05-12 16:27:37 -03:00
Thiago Santos
99a2e425de mssdemux: measure bitrate similarly to hlsdemux
new bitrate = (old bitrate + (last fragment bitrate * 3)) / 4
2014-05-12 16:27:37 -03:00
Thiago Santos
90577c3ae7 mssdemux: remove uridownloader in favor of internal source
Refactor mssdemux to remove uridownloader to use an internal
source element which reduces startup latency and provides smaller
buffers for better buffering management downstream
2014-05-12 16:27:37 -03:00
Thiago Santos
99c8fb7330 mssdemux: track segments per stream
As streams now flow independently, the GstSegment needs to be put
on each stream so they can track the position of each one correctly
instead of being mixed in a single segment
2013-12-18 18:52:19 -03:00
Thiago Santos
67f3190301 mssdemux: remove the stream loop task
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-18 18:52:19 -03:00
Thiago Santos
e847bea1e1 mssdemux: remove stream locks
Simplify the locking by using a single lock instead of having one
lock per stream. This still works and is simpler to maintain.
2013-12-18 18:52:18 -03:00
Thiago Santos
2ce4f6a8e4 mssdemux: avoid downloading not-linked streams
When a stream gets a not-linked return, it will be marked as so and
won't download any more new fragments until a reconfigure event
is received. This will make mssdemux expose all pads, but only download
fragments for the streams that are actually being used.

Relying on the pads being linked/unlinked isn't enough in this scenario
as there might be an input-selector downstream that is actually discarding
buffers for a given linked pad.

When streams are switching, the old active stream can be blocked because
input-selector will block not-linked streams. In case the mssdemux's
stream loop is blocked pushing a buffer to a full queue downstream it will
never unblock as the queue will not drain (input-selector is blocking).

In this scenario, stream switching will deadlock as input-selector is
waiting for the newly active stream data and the stream_loop that would
push this data is blocked waiting for input-selector.

To solve this issue, whenever an stream is reactivated on a reconfigure
it will enter into the 'catch up mode', in this mode it can push buffers
from its download thread until it reaches the currrent GstSegment's position.
This works because this timestamp will always be behind or equal to the maximum
timestamp pushed for all streams, after pushing data for this timestamp,
the stream will go back to default and be pushed sequentially from the main
streaming thread. By this time, the input-selector should have already
released the thread.

https://bugzilla.gnome.org/show_bug.cgi?id=711849
2013-12-18 18:52:18 -03:00
Sebastian Dröge
5b702b894e mssdemux: Add support for group-id in the stream-start event 2013-07-23 10:33:31 +02:00
Thiago Santos
4545f4bf4e smoothstreaming: port to 1.0 2013-05-07 21:09:49 -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
1d28c574cf mssdemux: switch bitrates without switching pads 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
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
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
Thiago Santos
a0a05b2941 mssdemux: use the shared uridownloader lib instead of an internal copy 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
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
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
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
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
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