Commit graph

23 commits

Author SHA1 Message Date
Thiago Santos
f7e9a58c58 adaptivedemux: refactor common code to function
Reuse the same function when finishing downloading and signaling to
the download loop thread to get the next fragment or abort
2015-01-16 15:00:11 -03:00
Thiago Santos
5823f8b408 adaptivedemux: inform subclass when headers/index are being downloaded
This allows the subclasses to know if the chunks that are downloaded are
part of the header or of the index and will parse the parts that are
of their interest.
2015-01-16 15:00:11 -03:00
Thiago Santos
c1251ab861 adaptivedemux: only update segment if we have a valid PTS
Otherwise we set the position to GST_CLOCK_TIME_NONE and it disrupts
bitrate switching
2015-01-07 09:30:40 -03:00
Thiago Santos
af78e2501c adaptivedemux: prepare for supporting seeks in live streams
Add function to allow subclasses to specify seeking range for
live streams

https://bugzilla.gnome.org/show_bug.cgi?id=725435
2015-01-05 17:58:54 -03:00
Thiago Santos
c65aeedb6f adaptivedemux: check if element exists before setting it to null
Under certain error conditions it might happen that the element
has been freed already and trying to set it to NULL causes an
assertion
2014-12-23 10:08:57 -03:00
Thiago Santos
3dfab51b92 adaptivedemux: make sure task has stopped before freeing it
Otherwise the thread will be running and its memory will get freed.
This leads to memory corruption
2014-12-23 10:08:56 -03:00
Thiago Santos
0bef1974e2 adaptivedemux: fix segment start when exposing new streams
Segment start needs only to be updated when starting the streams
or after a seek, doing it during bitrate changes will cause the
running time to go discontinuous (jump back to a previous ts)
and QOS will drop buffers
2014-12-23 10:08:56 -03:00
Thiago Santos
73fb0850c9 adaptivedemux: allow subclass to use new pads group when switching bitrate
Fix pad groups switching when bitrate changes to allow HLS to use this feature
2014-12-23 10:08:51 -03:00
Thiago Santos
75b0bac7f8 adaptivedemux: fix seek event handling
Properly do seeking and avoid only seeking when the segment was updated.
It would cause seeks after the stream was EOS to fail, for example.

https://bugzilla.gnome.org/show_bug.cgi?id=738920
2014-12-11 21:09:26 -03:00
Thiago Santos
c8fa688d26 adaptivedemux: check the return from update_manifest correctly
It is a GstFlowReturn and not a boolean
2014-12-10 18:23:02 -03:00
Thiago Santos
d30ec9f9f7 adaptivedemux: do not try to unlock not locked mutex
A misplaced unlock was causing an assertion for playback with a
set stop time
2014-12-08 08:53:00 -03:00
Thiago Santos
66f40b798d adaptivedemux: release threads waiting for manifest update on shutdown
For live streams, also unblock threads that might be waiting for a manifest
update when stopping the pipeline.

Also add some more debug messages
2014-12-04 01:48:07 -03:00
Thiago Santos
a7712c2983 adaptivedemux: use gst_task_stop instead of gst_task_pause
To avoid race conditions with gst_task_stop(); gst_task_join() with
another thread doing gst_task_pause(), the joining thread would be
waiting for the task to stop but it would never happen. So just
use gst_task_stop() everywhere to prevent more mutexes
2014-12-04 01:48:07 -03:00
Thiago Santos
87df15a214 adaptivedemux: fix deadlock when stopping streams
Remember to unlock the manifest's lock when leaving the download task.
2014-12-04 01:48:07 -03:00
Thiago Santos
92fd73ab5f adaptivedemux: remove unused error variable
CID #1256556
2014-12-03 10:06:09 -03:00
Thiago Santos
d9944506c8 adaptivedemux: remove more get_duration checks
Subclasses must implement get_duration function. If they do not know
the duration they can return GST_CLOCK_TIME_NONE
2014-12-03 09:45:58 -03:00
Thiago Santos
9afed503ed adaptivedemux: all subclasses must implement get_duration
CID #1256557
2014-12-03 09:42:39 -03:00
Thiago Santos
e11c311c31 adaptivedemux: make sure to always stop the stream on EOS
For On-Demand streams, always stop the tasks for streams that reached
EOS
2014-12-03 09:42:39 -03:00
Thiago Santos
df66909129 adaptivedemux: reworking live manifest update wait
Check if the stream is live before checking if it is EOS as a live
stream might be considered EOS when it just needs to wait for a manifest
update to proceed with the next fragments
2014-11-30 21:56:25 -03:00
Thiago Santos
66202d4c1b adaptivedemux: fix manifest update locking
To avoid unlocking a not locked mutex
2014-11-30 21:56:25 -03:00
Thiago Santos
5f3cce2e58 adaptivedemux: Fix segment for manifests that won't start at 0
For live streams, the manifest might start at an advanced position. Avoid
using segment start=0 to have playback start immediately
2014-11-30 21:56:25 -03:00
Thiago Santos
023b284c2d adaptivedemux: also clear flushing state on pads before restarting
During flushing seeks the flushing flow return will propagate up to the
source element and all pads are going to have the flushing flag set.

So before restarting also remove that flag together with the EOS one.

We don't do that when pushing the flush stop event because our event
handler for the proxypad will drop all events.
2014-11-30 21:56:03 -03:00
Thiago Santos
9ec9f3f119 adaptivedemux: add adaptivedemux base class
https://bugzilla.gnome.org/show_bug.cgi?id=735848
2014-11-30 21:56:01 -03:00