Commit graph

148 commits

Author SHA1 Message Date
Youness Alaoui
84e67767a3 hlsdemux: Do not lock the mutex of the fetcher during EOS
The fetch_location might call stop_fetcher which could generate an EOS
and cause a deadlock
2011-09-09 12:10:56 +02:00
Youness Alaoui
baf875b928 hlsdemux: Do not join the task from the task's thread itself. join it only in the state change 2011-09-07 22:26:47 +02:00
Youness Alaoui
473e71e1ca hlsdemux: If a fetch fails, decrement the sequence number 2011-09-03 09:09:02 +02:00
Youness Alaoui
5aa972eab2 hlsdemux: make hlsdemux lock/unlock the m3u8 client when it accesses it 2011-09-03 09:01:40 +02:00
Youness Alaoui
6133608789 hlsdemux: Add a get_target_duration and get_current_uri api to m3u8_client 2011-09-03 09:00:50 +02:00
Youness Alaoui
a252794a03 hlsdemux: Make the m3u8 client thread-safe 2011-09-03 09:00:35 +02:00
Sebastian Dröge
a82f92aed2 hlsdemux: Reset in PAUSED->READY after chaining up to the parent class
Otherwise there are possible race conditions with the streaming thread.
2011-09-02 19:45:21 +02:00
Sebastian Dröge
0561c3751c hlsdemux: Remove obsolete FIXME comment 2011-09-02 15:00:58 +02:00
Sebastian Dröge
82bbc76f15 hlsdemux: Reset the internal state going to/from READY instead of NULL
This theoretically allows reuse of the element when setting it to READY
instead of NULL.
2011-09-02 14:55:45 +02:00
Sebastian Dröge
445f626016 hlsdemux: Set playlist parsing helper object to NULL after freeing 2011-09-02 14:54:56 +02:00
Youness Alaoui
acacc251fa hlsdemux: Allow up to 3 consecutive failed downloads before erroring
In some networks, especiall in 3G, a fragment download or playlist
update may fail. We allow for up to 3 consecutive failures, while using
the rfc's specs for retry delays before considering that there was an
error on the stream.
2011-09-02 14:52:07 +02:00
Youness Alaoui
8889c5927c hlsdemux: remove unused argument 2011-09-02 14:51:11 +02:00
Sebastian Dröge
cf8f00d57a hlsdemux: Just join the task
gst_task_join() will already stop the task, no need
to stop it additionally.
2011-08-31 14:48:47 +02:00
Sebastian Dröge
119771eaab hlsdemux: Join the task instead of just stopping it and not waiting for it to finish
Fixes interesting race conditions that cause crashes in decodebin2
because pads are added/removed from child elements although they
should be in READY state already.
2011-08-31 14:47:40 +02:00
Sebastian Dröge
c8b7ae1ffa hlsdemux: Remove unused variable 2011-08-31 12:12:59 +02:00
Youness Alaoui
0c97deb59d hlsdemux: switch to higher/lower bitrate by more than one step at a time 2011-08-31 12:12:33 +02:00
Youness Alaoui
6436747eb0 hlsdemux: remove spamming GST_LOG_OBJECT 2011-08-31 12:11:32 +02:00
Youness Alaoui
277a7d05b2 hlsdemux: If paused, do not cache fragments until out of memory error!
We should stop the update thread in PAUSED state and avoid fetching
new fragments when the queue is not empty. The queue should always be
empty since we push data into a queue. Also, in totem, if we seek and
pause the stream while it's buffering, then the state will stay playing
for some reason, so it's best not to continue fetching fragments forever.
2011-08-31 12:11:20 +02:00
Youness Alaoui
917708df82 hlsdemux: start/stop update thread and keep track of status 2011-08-31 12:10:32 +02:00
Youness Alaoui
4724b9a5b6 hlsdemux: Post duration message when we parse the playlist 2011-08-31 12:09:53 +02:00
Youness Alaoui
f93939b46c hlsdemux: Send a flush-stop when switching pads. Fixes A->A/V sync issue.
This is to ensure that we reset the accumulate segment on the sinks
so if we start with audio only then switch to audio+video, then both
sinks will have the same segments and will be synchronized.
2011-08-31 12:09:38 +02:00
Youness Alaoui
ed5a5cc139 hlsdemux: seems there was a typo, free the adapter if it contains data, not if already empty 2011-08-30 16:18:30 +02:00
Youness Alaoui
4a6d888961 hlsdemux: oups, we need to empty the queue after freeing its content 2011-08-30 16:18:08 +02:00
Youness Alaoui
cb30cd242c hlsdemux: do not broadcast the fetcher_cond on bus error if we're cancelled
If we cancel the fetch and call the stop_fetcher, which holds the lock,
when it sets the fetcher's state to NULL, it might send an error
on the bus. In that case, we must ignore it, otherwise it will try
to take the lock and will block forever.
2011-08-30 16:16:54 +02:00
Jonas Larsson
fc0fe37b10 hlsdemux: Split playslist on \r\n not just \n 2011-08-30 16:16:07 +02:00
Youness Alaoui
6e9eeb7678 hlsdemux: Do not succeed a download if the fetcher had an error 2011-08-30 16:15:41 +02:00
Youness Alaoui
e22c300be2 hlsdemux: Rename functions that need to be called with a locked mutex 2011-08-30 16:15:28 +02:00
Youness Alaoui
50d0468241 hlsdemux: We must signal the fetcher_cond while holding its lock 2011-08-30 16:15:03 +02:00
Youness Alaoui
3054355dc1 hlsdemux: We do not need to set the current playlist to the main one
When caching fragments, if we set the current playlist to main, then
it will always think it's a live stream (no endlist in it) so it will
force the redownload of the main playlist after every seek, which is
unnecessary. Also, it causes a race condition where a seek migh happen
during that redownload, and we'll think we're trying to seek a live pipeline.
2011-08-30 16:14:30 +02:00
Youness Alaoui
108493ee51 hlsdemux: do not make the update_thread joinable 2011-08-26 09:51:46 +02:00
Youness Alaoui
8c04ea47d2 hlsdemux: Ensure the task is paused in case of cache error 2011-08-26 09:51:46 +02:00
Youness Alaoui
46ac6a2589 hlsdemux: stop the threads in the proper order
first pause the task, then stop all fetchers, then stop the update thread
then pause the task again, since it might have been restarted by
another thread in the meantime
2011-08-26 09:51:46 +02:00
Youness Alaoui
015d1e11e2 hlsdemux: do not post an error if we seek/cancel during caching of fragments 2011-08-26 09:51:46 +02:00
Youness Alaoui
d69297a23c hlsdemux: if we're canceling a fetcher, we must stop its thread 2011-08-26 09:51:46 +02:00
Youness Alaoui
42401da686 hlsdemux: lock the update_thread mutex before stopping it 2011-08-26 09:51:46 +02:00
Youness Alaoui
39657fa52f hlsdemux: lock the fetcher mutex before stopping it 2011-08-26 09:51:45 +02:00
Youness Alaoui
e1a0bdcdf5 hlsdemux: do not allow two fetchers to run simultanously 2011-08-26 09:51:45 +02:00
Youness Alaoui
adcfcabb14 hlsdemux: Stop the streaming task on PAUSED_TO_READY state change 2011-08-26 09:51:45 +02:00
Youness Alaoui
a3fc3ec443 hlsdemux: Send buffering messages on the bus 2011-08-24 08:12:19 +02:00
Youness Alaoui
e2de4e5870 hlsdemux: cache the number of fragments we are required to cache 2011-08-24 08:12:14 +02:00
Sebastian Dröge
20f9738c10 hlsdemux: Use FALSE instead of 0 for a bool parameter 2011-08-23 09:23:33 +02:00
Youness Alaoui
3f42050c34 hlsdemux: switch pads when we seek (need_segment) since tsdemux doesn't cope well with a reset 2011-08-23 09:22:40 +02:00
Youness Alaoui
2d90f1c0dc hlsdemux: Add a FIXME comment. loop task should be a pad task 2011-08-23 09:21:03 +02:00
Youness Alaoui
b55f157d6f hlsdemux: Do not seek in a live stream 2011-08-23 09:20:25 +02:00
Youness Alaoui
18f53cf547 hlsdemux: Do not take the pad stream lock, use the task's lock instead 2011-08-23 09:20:14 +02:00
Youness Alaoui
e2f69e1be9 hlsdemux: Implement EVENT_SEEK 2011-08-23 09:19:59 +02:00
Youness Alaoui
475abd15b6 hlsdemux: Implement the GST_QUERY_SEEKING properly 2011-08-23 09:18:16 +02:00
Youness Alaoui
ae4af3910e hlsdemux: Implement correctly the GST_QUERY_DURATION 2011-08-23 09:17:30 +02:00
Youness Alaoui
a916d4dfd2 hlsdemux: Do not use GST_TASK_WAIT in the task function
The task function uses GST_TASK_WAIT which does a g_cond_wait giving it
the GST_OBJECT_GET_LOCK of the task. The mutex gets locked when
g_cond_wait returns, so if we don't lock/unlock it, it will
stay locked forever, preventing the task from ever finishing.
We shouldn't lock the task object lock, so let's remove the GST_TASK_WAIT
and make the task pause instead if there are no buffers in the queue.
2011-08-23 09:16:35 +02:00
Youness Alaoui
690e59e497 hlsdemux: Keep a separate variable for the current variant used
By using a separate variable, first it allows us to sort the lists
of alternates but keep the pointer on the first occurence in the main
playlist (to respect the spec of starting with the bitrate specified
first in the main playlist). It also avoid playing with the lists variable
which should be used to store the list of playlists and not as a pointer
to the current one.
Also fixes a memleak with the g_list_foreach freeing the lists, if it wasn't
pointing to the first element of the list.
2011-08-22 15:46:41 +02:00
Youness Alaoui
5878f71233 hlsdemux: Set buffer timestamp since we send a TIME segment 2011-08-18 14:05:10 +02:00
Youness Alaoui
8b762708cd hlsdemux: Allow bandwidth switching during caching of fragments 2011-08-18 14:00:42 +02:00
Youness Alaoui
a62aa2b774 hlsdemux: set the pad's caps before adding it 2011-08-18 13:53:02 +02:00
Edward Hervey
5572e63858 hlsdemux: Send NEWSEGMENT events
Previously hlsdemux wasn't sending out any newsegment.
Here we push a GST_FORMAT_TIME newsegment, and whenever possible we
try to indicate the proper start time.

This allows downstream elements to relay the start/time values properly
to the sinks, allowing better stream switching.
2011-08-01 18:48:03 +02:00
Edward Hervey
976f4b0bbf hsldemux: Handle change of media types
When switching bitrates, we might end up switching to a different
media-type (like from aac to/from mpeg-ts).

For this switch to behave properly in decodebin2, this patch adds:
* dynamic source pads (which will be added/removed whenever a stream
  media type changes
* re-checking the fragment media type whenever we switch to a different
  playlist
2011-07-27 16:56:37 +02:00
Olaf Seibert
7583080023 hlsdemux: fix wrong usage of GST_ELEMENT_ERROR macros and compilation on NetBSD
https://bugzilla.gnome.org/show_bug.cgi?id=655319
2011-07-27 11:02:41 +01:00
Alessandro Decina
adc0817b2a hls: fix handling of strol() overflows 2011-05-15 10:02:20 +02:00
Andoni Morales Alastruey
851e9b1f8d hlsdemux: set duration in outgoing buffers
Currently we push each fragment as a single buffer.
2011-05-03 14:39:15 +01:00
Tim-Philipp Müller
7ec71fb446 hlsdemux: fix DURATION query handling
Only answer duration queries in TIME format with a duration
in seconds. Make sure we don't return GST_CLOCK_TIME_NONE as
duration (which is non-0, but still invalid/useless).
2011-05-03 12:01:25 +01:00
Tim-Philipp Müller
0d9dbd4c0f hlsdemux: implement SEEKING query 2011-05-03 11:51:44 +01:00
Tim-Philipp Müller
5d6bdf6052 Fix some unused-but-set-variable warnings with gcc 4.6 2011-04-15 00:24:47 +01:00
Andoni Morales Alastruey
9334e819e5 hlsdemux: m3u8: return duration in nanoseconds 2011-04-14 15:36:06 +01:00
Andoni Morales Alastruey
9454003249 hlsdemux: fix handling of end of playlist
Don't send the EOS event until we reached the end of the playlist
and the queue is really empty.
2011-04-14 15:36:06 +01:00
Andoni Morales Alastruey
c890a212b6 hlsdemux: fix example pipeline 2011-04-14 15:36:01 +01:00
Andoni Morales Alastruey
3b19ade905 hlsdemux: ignore seek events until it's implemented 2011-04-14 11:47:50 +01:00
Andoni Morales Alastruey
b49461df48 hlsdemux: dispose the fetcher from the same thread it's created 2011-04-14 11:41:56 +01:00
Thibault Saunier
17fd7ebcb4 android: make it ready for androgenizer
Remove the android/ top dir
Fixe the Makefile.am to be androgenized

To build gstreamer for android we are now using androgenizer which generates the needed Android.mk files.
Androgenizer can be found here: http://git.collabora.co.uk/?p=user/derek/androgenizer.git
2011-04-11 07:27:11 +02:00
Andoni Morales Alastruey
650418b9d8 hlsdemux: validate properly utf-8 playlist 2011-04-04 09:14:05 +02:00
Andoni Morales Alastruey
650142f054 hlsdemux: m3u8: clear the list of media files before updating the playlist 2011-04-04 09:13:41 +02:00
Andoni Morales Alastruey
e13ef203e3 hlsdemux: use and adapter instead of costful buffer joins 2011-04-04 09:13:26 +02:00
David Schleef
a8f047f689 Remove setting of plugindir from Makefiles 2011-04-01 13:54:02 -07:00
Thiago Santos
12f539c6bb hlsdemux: Another windows build fix
Replace %lld with %u as GST_BUFFER_SIZE is a guint
2011-04-01 16:52:48 -03:00
Thiago Santos
944d54e359 hls: Fix compilation on windows
Use string literal on printing format
2011-04-01 16:12:50 -03:00
Tim-Philipp Müller
6edcf4fbe6 hlsdemux: update for media type was renaming from playlist/m3u8 to application/x-hls 2011-03-30 15:53:12 +01:00
Sebastian Dröge
e24a43c61b hlsdemux: Some minor cleanup
Use GST_DEBUG_FUNCPTR and G_PARAM_STATIC_STRINGS
2011-03-30 10:11:24 +02:00
Andoni Morales Alastruey
d5e4f8caf8 hlsdemux: fix indentation and docs sections 2011-03-30 09:19:24 +02:00
Andoni Morales Alastruey
91196418ea hlsdemux: don't leek the query 2011-03-30 09:19:23 +02:00
Andoni Morales Alastruey
77c0971b62 hlsdemux: check if the task's cond was signaled because it's the end of playlist 2011-03-30 09:19:23 +02:00
Andoni Morales Alastruey
42470cd313 hlsdemux: post a message in the bus when the playlist changes 2011-03-30 09:19:23 +02:00
Andoni Morales Alastruey
daeed217e5 hlsdemux: don't update the playlist if we stay in the same bitrate 2011-03-30 09:19:23 +02:00
Andoni Morales Alastruey
cd0aeb2403 hlsdemux: Add support for URI queries 2011-03-30 09:19:23 +02:00
Andoni Morales Alastruey
5daae4bb18 hlsdemux: Add support for duration queries 2011-03-30 09:19:23 +02:00
Andoni Morales Alastruey
18cd90e73f hlsdemux: m3u8: protect public methods properly 2011-03-30 09:19:23 +02:00
Andoni Morales Alastruey
09b2b31422 hlsdemux: m3u8: add support to get the duration from a playlist 2011-03-30 09:19:22 +02:00
Andoni Morales Alastruey
c599e4a9a1 hlsdemux: don't print an error if the download was cancelled 2011-03-30 09:19:22 +02:00
Andoni Morales Alastruey
4602b42dee hlsdemux: make sure the fetcher state change is complete before continuing 2011-03-30 09:19:22 +02:00
Andoni Morales Alastruey
c580ff26a4 hlsdemux: don't leak the first buffer 2011-03-30 09:19:22 +02:00
Andoni Morales Alastruey
ec1d03e1b4 hlsdemux: clean up code a little bit 2011-03-30 09:19:22 +02:00
Andoni Morales Alastruey
1450233a21 hlsdemux: only check for the end of playlist when the queue is empty 2011-03-30 09:19:22 +02:00
Andoni Morales Alastruey
b765260098 hlsdemux: make sure to stop fragments cache if something cancelled it 2011-03-30 09:19:22 +02:00
Andoni Morales Alastruey
fe883740c5 hlsdemux: reuse the code in reset() to free resources in dispose() 2011-03-30 09:19:21 +02:00
Andoni Morales Alastruey
5a40a62ff4 hlsdemux: use a typefinder to set the caps in the source pad 2011-03-30 09:19:21 +02:00
Andoni Morales Alastruey
3fa4b22149 hlsdemux: add more comments and document better all the threads involved 2011-03-30 09:19:21 +02:00
Andoni Morales Alastruey
8a683fc035 hlsdemux: handle 404 from the source element 2011-03-30 09:19:21 +02:00
Andoni Morales Alastruey
cbba7c8bc5 hlsdemux: stop the fetcher in the PAUSED_TO_READY transition, not when disposing() 2011-03-30 09:19:21 +02:00
Andoni Morales Alastruey
b9a0b4ddd4 hlsdemux: make sure we don't stop the fetcher twice from different threads 2011-03-30 09:19:21 +02:00
Andoni Morales Alastruey
6a0aec0639 hlsdemux: query the uri upstream before updating the playlist 2011-03-30 09:19:20 +02:00
Andoni Morales Alastruey
9aff2de625 hlsdemux: Add HTTP live streaming demuxer element
Based on previous work by Marc-André Lureau
2011-03-30 09:19:20 +02:00