Commit graph

236 commits

Author SHA1 Message Date
Tim-Philipp Müller
f325935314 pulse, speexenc, rtpgsmpay: don't use g_assert() for error handling
Don't use g_assert() for error handling, even if they're highly unlikely.
Either we *know* that something can't happen, in which case we
should just not handle it, or we think something can happen, but it is
very very unlikely that it will ever happen, in which case we should
handle it like any other error instead of asserting.

g_assert() is best left for conditions we have control of, like checking
internal consistency of our code, not checking return values of external
code.

Fixes a bunch of warnings when compiling with -DG_DISABLE_ASSERT:
gstrtpgsmpay.c: In function 'gst_rtp_gsm_pay_handle_buffer':
gstrtpgsmpay.c:130:17: warning: variable 'rtpgsmpay' set but not used
gstspeexenc.c: In function 'gst_speex_enc_encode':
gstspeexenc.c:904:19: warning: variable 'written' set but not used
pulsesink.c: In function 'gst_pulsesink_change_state':
pulsesink.c:2725:9: warning: variable 'res' set but not used
pulsesrc.c: In function 'gst_pulsesrc_change_state':
pulsesrc.c:1253:7: warning: variable 'e' set but not used
2011-04-16 18:15:43 +01:00
Robert Swain
098cf89e34 jpegenc: pulsesink: raw1394: Address unused but set variables
GCC 4.6.x spits warnings about such usage of variables. The variables in
raw1394 were marked with G_GNUC_UNUSED as this seemed omre appropriate.
The others were removed.
2011-04-16 13:13:04 +01:00
Sebastian Dröge
11bcac7c90 Revert "Pulsesink: Allow chunks up to bufsize instead of segsize"
This reverts commit 1e2c1467ae.

The commit causes pulsesink to ignore the latency-time baseaudiosink property.
2011-04-08 14:35:04 +02:00
Arun Raghavan
dc48eaac13 pulsesink: Always call pa_stream_new_with_proplist()
pa_stream_new_with_proplist() can take a NULL proplist, so we don't need
to concern ourselves with whether it's NULL or not.
2011-04-04 17:23:21 +05:30
Mark Nauwelaerts
176b8ffbff pulsesink: also uncork during EOS waiting (and after EOS is rendered)
Pulsesink was recently changed to defer uncorking until there is data
to write. This condition will however never occur when EOS in being
rendered (since that marks the end of data). Changing to PAUSED state
while EOS is being waited on results in a hang: pausing corks the
stream, which will never be undone since there is no more data when
going back to PLAYING. If pulsesink is the clock provider, deadlock
ensues since time doesn't continue in corked state and the clock id
for EOS wait never fires.

Fixes #645961.
2011-03-31 13:25:19 +02:00
Philip Jägenstedt
84decd731f pulsesink: Better fix for deadlock on failed connect
This reverts the previous fix that would cause a double-unlock when the
stream connect failed.

https://bugzilla.gnome.org/show_bug.cgi?id=644510
2011-03-12 00:48:03 +05:30
Arun Raghavan
387f533a07 pulsesink: Fix deadlock if connecting to PA fails
Commit dd4ec22e introduced a deadlock in the failure path while trying
to connect to PulseAudio. This makes sure we drop the lock on the
resource mutex to avoid this.

https://bugzilla.gnome.org/show_bug.cgi?id=644510
2011-03-11 23:19:34 +05:30
Tim-Philipp Müller
14e1d9de3d docs: fix pulsesink gtk-doc markup 2011-03-11 09:54:36 +00:00
Stefan Kost
89914439b7 pulsesink: add a doc example for setting stream-properties 2011-03-04 15:50:49 +02:00
Stefan Kost
edfa99ef31 pulsesink: fix the xml in the docs 2011-03-04 15:50:49 +02:00
Philip Jägenstedt
dd4ec22e7e pulsesink: release pa_shared_resource_mutex before pa_threaded_mainloop_wait
Not doing so can result in a deadlock when two threads enter
gst_pulseringbuffer_open_device at the same time, as
pa_threaded_mainloop_wait releases the mainloop lock while waiting,
allowing another thread to take it, resulting in a deadlock as two
threads waits for the lock the other is holding.

https://bugzilla.gnome.org/show_bug.cgi?id=643087
2011-02-28 16:20:22 +05:30
Philip Jägenstedt
683c96b37a pulsesink: s/ressource/resource/
https://bugzilla.gnome.org/show_bug.cgi?id=643087
2011-02-28 16:20:20 +05:30
David Henningsson
1e2c1467ae Pulsesink: Allow chunks up to bufsize instead of segsize
By allowing larger chunks to be sent, PulseAudio will have a
lower CPU usage. This is especially important on low-end machines,
where PulseAudio can crash if packets are coming in at a higher
rate than PulseAudio can process them.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2011-01-31 17:15:05 +01:00
Arun Raghavan
e18e25a324 pulsesink: Uncork stream while flushing the ringbuffer
After starting the ringbuffer, we wait for enough data to arrive before
uncorking the stream. This will cause the pipeline to stall if we get an
EOS (or otherwise need to flush the stream) before sufficient data
becomes available. This patch makes sure that the stream is uncorked
while flushing to avoid this problem.

Fixes issue with a webkit unit test testing reverse playback of
an MP4 H.264/AAC file.

https://bugzilla.gnome.org/show_bug.cgi?id=639740
2011-01-17 15:40:12 +00:00
Arun Raghavan
7280ea1f68 pulsesink: Make corking during pause synchronous
This makes the call to pa_stream_cork() during ringbuffer pause()
synchronous, which makes sure that the clock does not advance after we
take a snapshot for start_time.

https://bugzilla.gnome.org/show_bug.cgi?id=639240
2011-01-11 20:43:54 +00:00
Mark Nauwelaerts
53b9f87436 pulsesink: flush remaining buffered samples on EOS
... which can make a difference between all or nothing when dealing
with short streams and relatively large ringbuffer segment.
2010-12-16 15:16:54 +01:00
Wim Taymans
8ca094795a pulsesink: don't uncork in _start
Don't uncork in the _start method just yet but wait until we have written some
samples to pulseaudio. This avoid underruns on pulseaudio and less crackling
noises when starting.
2010-12-07 12:39:27 +01:00
Wim Taymans
7f48fb37e9 pulse: fix device_description in READY
Make the is_dead check more clear and add an option to check for the status of
the stream in addition to the context.
We don't need a stream to get the device_description string.

Fixes #630317
2010-09-22 19:02:35 +02:00
Stefan Kost
ae8d210fdb pulsesink: move the shared mainloop from class to static var
Just have one static var for the shared mainloop instead of one class variable
and copies in the instance.
2010-09-14 10:10:27 +03:00
Stefan Kost
f62dc6976b pulsesink: rework context sharing
We also need to share the main-loop threads as this owns the context. Thus have
a class wide main-loop thread. From this we create a context per client-name.
Instead of always looking up the context, we keep this with the instance. The
reverse mapping is only needed in pulse singal handlers. This saves a lot of
locking. Also one signal handler becomes simpler as ther eis only one mainloop
to notify.

Now valgind happy - no leaks, no bad reads/writes.

This reverts major parts of commit 69a397c32f.

Fixes #628996
2010-09-13 16:59:22 +03:00
Stefan Kost
6490c4eb3d pulsesink: remove unused code 2010-09-08 17:43:47 +03:00
Stefan Kost
9fd0adc7dc pulsesink: fixup last commit
We need to prevent the eventual leak better.
2010-09-08 14:36:48 +03:00
Stefan Kost
f6892b81ae pulsesink: code cleanups
Use g_slist_prepend as we don't care about the order. Check for list == NULL
instead of iterating the list to see if it is empty. Move ctx allocation down
to prevent leak in case of failure.
2010-09-08 14:19:34 +03:00
Wim Taymans
2148b2db0a pulsesink: simplify clock provide code
Don't leak the pulsesink element by having the clock keep a ref to the sink.
Create the clock only once in the constructor and use the baseaudiosink clock
cleanup code.
2010-09-07 19:03:33 +02:00
Stefan Kost
7fd77c07d5 pulsesink: move the context table init to _get_type phase
This seems to fix the invalid reads on context shutdown better, altough
I can't really explain.
2010-09-07 18:09:28 +03:00
Stefan Kost
f604e20499 pulse: allow setting stream properties
Add a "properties" property to the elements to allow setting extra stream
properties.

Fixes #537544
2010-09-07 14:20:21 +03:00
Stefan Kost
a313bc7524 pulsesink: don't free the context multiple times
Apparently the close function of the ring-buffer can be called multiple times.
2010-09-07 00:27:07 +03:00
Stefan Kost
fc73dd210d pulsesink: add since docs for new property. 2010-09-06 09:57:58 +03:00
Sebastian Dröge
37ee281d13 pulsesink: Fail gracefully if no threaded PA mainloop can be created
Fixes bug #628020.
2010-09-04 14:52:09 +02:00
Sebastian Dröge
998adeb974 pulsesink: Only include the server name in the context name if it's not NULL 2010-09-04 14:52:07 +02:00
Philippe Normand
7116fff3c5 pulsesink: Add "client" property to set the PA client name
Allows the application to modify the client name used to connect when
connecting to the PulseAudio daemon. Note however that updating the
property after the element reached the READY state will have no
effect until the next NULL->READY transition.

Fixes bug #627174.
2010-09-04 14:52:07 +02:00
Sebastian Dröge
03f2e81f69 pulsesink: Free the clock on state change failures too 2010-09-04 14:52:07 +02:00
Sebastian Dröge
bc5345bbd3 pulsesink: Free the GstPulseContext after usage 2010-09-04 14:52:06 +02:00
Philippe Normand
69a397c32f pulsesink: share the PA context between all clients with the same name
Avoid to create a new PA context for each new client by using a hash
table containing the list of ring-buffers and the shared PA context
for each client. Doing this will improve application memory usage in
the cases where multiple pipelines involving multiple pulsesink
elements are used.

Fixes bug #624338.
2010-09-04 14:52:06 +02:00
Philippe Normand
2c5976d355 pulsesink: clear the PA mainloop if baseaudiosink failed to open the ring_buffer
If the application requests a state-change and pulsesink fails to open
the ring_buffer device the mainloop attribute of the sink should be
cleaned up to avoid future state-change (NULL->READY) failures.
2010-09-04 14:52:06 +02:00
Tim-Philipp Müller
74b2af63fd pulse: fix printf format in some debugging messages 2010-08-09 00:36:36 +01:00
Philippe Normand
864a52d8aa pulsesink: use G_TYPE_DEFINE to define ring buffer type
The existing get_type() implementation is racy, and the
g_type_class_ref() workaround didn't actually work because
it was in the wrong function. Since class creation in GObject
is thread-safe these days (since 2.16), the class_ref workaround
is no longer needed and it is sufficient to ensure the _get_type()
function is thread-safe, which G_TYPE_DEFINE does.

https://bugzilla.gnome.org/show_bug.cgi?id=624338
2010-08-04 16:19:09 +01:00
Sebastian Dröge
f6240a4773 pulsesink: Post CLOCK-LOST/CLOCK-PROVIDE when going to/from READY
Otherwise the clocks are redistributed every time the pipeline
goes to PAUSED, which is quite expensive.
2010-08-04 15:21:26 +02:00
Tim-Philipp Müller
7055264e2e pulsesink: correctly check what version of gst-plugins-base we're compiling against
We need to check the gst-plugins-base version, not the core version
(even if both should be the same in any sane setup).
2010-07-26 18:18:02 +02:00
Sebastian Dröge
10424a4064 pulsesink: Only use gst_audio_clock_new() when compiling against newer base 2010-07-16 17:53:55 +02:00
Sebastian Dröge
9e92bd7b1a pulsesink: Post clock-provide/clock-lost when going to/from PAUSED
Also use gst_audio_clock_new_full() to prevent crashes when the
clock is used after the element was destroyed.
2010-07-16 17:45:38 +02:00
Sebastian Dröge
4113a1dad1 pulsesink: Don't request more shared memory than needed 2010-06-09 20:53:06 +02:00
Sebastian Dröge
bd5987a3d2 pulsesink: Flush shm buffer immediately if it's full 2010-06-09 16:22:27 +02:00
Sebastian Dröge
57813d469f pulsesink: Fix writing of buffers larger than segsize
Fixes bug #620540.
2010-06-09 16:21:55 +02:00
Sebastian Dröge
b78a27beb2 pulsesink: Fix playback if PA doesn't give us a large enough shared memory buffer 2010-06-09 15:46:59 +02:00
Tim-Philipp Müller
3486f49808 pulse: log message printf format fixes 2010-06-06 17:25:36 +01:00
Sebastian Dröge
dcae55852e ext: Don't use GST_DEBUG_FUNCPTR for GObject vfuncs 2010-06-06 18:00:22 +02:00
Sebastian Dröge
5072c47624 Revert "pulsesink: Add comments to remove the provide-clock message posting once we depend on base 0.10.30"
This reverts commit 8f3708f38a.

The baseaudiosink commit was reverted
2010-06-03 13:45:32 +02:00
Sebastian Dröge
8f3708f38a pulsesink: Add comments to remove the provide-clock message posting once we depend on base 0.10.30
baseaudiosink does all this for us now.
2010-06-03 10:28:08 +02:00
Pierre-Louis Bossart
66a76d1f65 pulsesink: optimize communication with PulseAudio using pa_stream_begin_write 2010-06-02 13:47:06 +02:00
Sebastian Dröge
f5057a9fae pulsesink: Post provide-clock message on the bus if the clock appears/disappears
Fixes bug #620277.
2010-06-02 10:52:56 +02:00
Sebastian Dröge
a8103facc5 pulse: Don't lock the mainloop in NULL 2010-05-17 17:17:01 +02:00
Sebastian Dröge
e69ba0f94f pulsesink: Allocate and free the custom clock in NULL<->READY 2010-05-06 13:57:01 +02:00
Sebastian Dröge
5332287e2d pulsesink: Create and free the PA mainloop in NULL->READY/READY->NULL
This fixes a race condition, when stopping the mainloop during finalization
is done from a mainloop callback.

Fixes bugs #614765 and #590662.
2010-05-06 13:51:59 +02:00
Stefan Kost
7cf9967e0b pulsesink: fix racy shutdown
Keep a ref of pulsesink for deferred mainloop invocation. Fixes #614765
2010-04-06 17:22:03 +02:00
Mark Nauwelaerts
5a082af3aa pulse: use #ifdef rather than #if conditionals 2010-03-18 12:44:53 +01:00
Philippe Normand
3ab666762f pulsesink: gst_pulsesink_get_mute: set result earlier.
In the cases where no buffer was process yet or the index is not
available, get_pulsesink_get_mute() would unconditionally return
FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=610337
2010-02-22 20:49:03 +01:00
Tim-Philipp Müller
3f2a803c48 pulsesink: add comment for translators for 'x by y' message
Fixes #609724.
2010-02-15 00:45:51 +00:00
Wim Taymans
55b5e2e3f3 pulsesink: avoid segfault when shutting down
when we are shutting down, we might still receive state updates from pulseaudio
but since we are unparented we should not do anything with the NULL parent
anymore.
2010-02-12 13:53:57 +01:00
Wim Taymans
0694be2a82 pulsesink: use acquired flag when checking valid state
Use the acquired field of the ringbuffer in get_time to know when we are in an
invalid state. We don't clear the rate flag when releasing the ringbuffer so
this values is not usable.

Avoids some error messages being posted because the pulseaudio connection is
down.
2009-11-18 17:27:19 +01:00
Wim Taymans
f85cf3e200 pulsesink: implement some more callbacks
Implement some more callbacks for debugging purposes.
2009-11-18 12:01:52 +01:00
Tim-Philipp Müller
2270d3359a pulsesink: printf format fix 2009-11-05 23:46:58 +00:00
Sebastian Dröge
3f541452c4 pulsesink: Only set the volume on stream connection if pulse >= 0.9.20 is available
In older versions the volume set during stream connection had
no defined sematic and usually it was a relative volume. What
was needed for our use case is an absolute volume though, otherwise
the volume will be always decreased on stream connection if it's
less than 100%.
Since pulse 0.9.20 that volume is always an absolute volume if
flat volumes are used and relative otherwise, which is the same
as for pa_context_set_sink_input_volume().

Relevant pulse changesets:
http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=f27a50691c8fe45bac7dd6b21fac91a359def3a1
http://git.0pointer.de/?p=pulseaudio.git;a=commit;h=2501687579e359d5032a4d165b2ffc8f5b1b8ba6
2009-10-30 09:27:59 +01:00
Bastien Nocera
a1ac55c7a5 Fix the StreamVolume interface not being advertised
gst_pulsesink_interface_supported() was missing a check for it.

https://bugzilla.gnome.org/show_bug.cgi?id=598933
2009-10-19 15:36:20 +01:00
Lennart Poettering
e4d6a2aa2c pulse: never apply volume more than once
Generally decisions on the volume of the stream should be done inside of
PA, not inside of Gst. Only PA knows how volumes translate between
devices and s on.

This patch makes sure that all volumes set via the volume property are
only applied *once* to the underlying stream. After applying them the
client side will not store them anymore. This should make sure that
really only user-triggered volume changes are forwarded to server, but
the client never tries to save/restore the volume internally.

Fixes bug #595231.
2009-10-18 10:15:59 +02:00
Lennart Poettering
89b0c2fc4f pulse: use 'performer' as a fallback for 'artist' tag 2009-10-17 08:48:23 +02:00
Lennart Poettering
76c8ca4b00 pulse: when constructing a stream title from tag data make sure it is translatable 2009-10-17 08:48:23 +02:00
Lennart Poettering
d64200f46b pulse: make a few things smaller by making them bitfields 2009-10-17 08:48:21 +02:00
René Stadler
f9274226e8 pulsesink: set desired minreq value to segsize/latency-time
If we let the daemon decide freely by passing -1, we end up always getting 20ms.
We want to set this value because in some cases we want to select a higher
latency-time in order to save power.

Fixes #597601
2009-10-14 12:05:14 +02:00
René Stadler
ccddf0643d pulse: rename pa_buffer_attr variables
Makes it much easier to see what is going on and is a lot less error prone.
2009-10-02 23:21:02 +03:00
David Henningsson
bb787f1030 pulsesink: Don't dereference NULL pointers
pa_stream_get_timing_info() can return NULL.

Fixes bug #595220.
2009-09-15 10:05:51 +02:00
Wim Taymans
ccda761562 pulsesink: handle stream events
Handle stream events and request a PAUSE/PLAY state change from the application
when we receive a CORK/UNCORK event.
2009-09-14 16:05:30 +02:00
Sebastian Dröge
0c50816aaa pulsesink: Implement GstStreamVolume interface 2009-09-11 16:38:03 +02:00
Sebastian Dröge
7fb6ad6d4c pulsesink: Implement mute property 2009-09-11 16:38:03 +02:00
Wim Taymans
42ee5e22a2 pulsesink: remove ringbuffer reset compensation
Remove the code to deal with a ringbuffer reset as this code is now in the base
class.
Bump the -base requirement as we need the new baseaudiosink code to function
properly.
2009-09-09 16:25:06 +02:00
Stefan Kost
e82e16480d pulsesink: also guard reseting subscribe callback with ifdefs
It is conditionaly set, so do the same when unsetting.
2009-09-02 23:14:20 +03:00
Wim Taymans
abee4f1d64 pulsesink: don't use relative seeks
Don't use relative seeks, it's too hard to track where we are after a flush
etc.

fixes #593015
2009-08-25 17:33:04 +02:00
Tim-Philipp Müller
a3c393248a pulsesink: don't do logic within g_assert() statements
Otherwise that code will just be expanded to nothing when compiled
-DG_DISABLE_ASSERT (PS: why is mainloop_start() called in the init
function and not when changing state to READY?)
2009-08-02 11:49:17 +01:00
Wim Taymans
9c341347ba pulse: conditionally compile newer stuff
configured_sink/source_usec in the timing_info is only since 0.9.11 so
conditionally compile this information.

fixes #590038
2009-07-29 12:13:20 +02:00
Wim Taymans
2308999849 pulsesink: avoid using ivalid stream indexes
when we get an invalid stream index from pulse because we were just starting,
avoid using it for getting and setting the volume.

Fixes #589365
2009-07-27 11:51:39 +02:00
Colin Guthrie
4efca7b68e pulsesink: Fix a couple error messages that mentioned incorrect function names.
Fixes #589459.
2009-07-23 10:54:45 +01:00
Wim Taymans
b3c55f5ce5 pulsesink: set some values to their defaults
Set the minreq and maxlength buffer attributes to -1 to let puleseaudio select a
sensible value.
2009-07-20 19:09:19 +02:00
Wim Taymans
8bfd80e5a2 pulsesink: don't wait for posted message
We can't wait for the ENTER/LEAVE messages to be be posted because the base
class sometimes calls the start method with the object lock, which would block
the message posting.
Instead, just assume that the message will be posted soon and continue. We'll
have to fix this in the base class.
2009-07-20 19:07:19 +02:00
Wim Taymans
e914f5254a pulsesink: use relative seeks
Use relative seeks because I was told that absolute seeks don't work.
2009-07-20 19:07:19 +02:00
Olivier Crête
dbb8a331de pulsesink: Emit stream-status leave message
Fixes #587695
2009-07-14 18:52:15 +02:00
Olivier Crête
b2e9f0a7c9 pulsesink: Emit stream-status enter message
Emit stream-status messages for the pulse thread.
Don't use our own GCond for signaling but simply use the pulse mainloop
mechanisms for synchronisation.
See #587695
2009-07-14 18:44:21 +02:00
Wim Taymans
b0643b745a pulsesink: debug the latency update values 2009-07-14 18:15:59 +02:00
Wim Taymans
ab3bed81a5 pulsesink: add 24bit sample formats
Add check for pulseaudio 0.9.15 and enable 24bits samples in that case.
2009-07-14 16:14:34 +02:00
Stefan Kost
6d0007372b pulsesink: include "1.0=100%" in volume and change upper limit
Upper volume limmit was 1000. That appear unneceasrily high. It would also cause
sever distortion if accidentialy used. Now its 10 (~ +15db) which is also in
sync with volume and playbin2.
2009-06-30 14:53:25 +03:00
Wim Taymans
1e98580204 pulsesink: clear ringbuffer when asked to
Since we map the ringbuffer to the pulseaudio internal ringbuffer, flush the
pulseaudio buffer when we are asked to clear the ringbuffer.
This avoids some leftover audio after a seek.
2009-06-29 15:21:37 +02:00
Wim Taymans
b8e88710e1 pulseink: don't leak device_description
don't leak the device_description.
some cleanups.
2009-06-19 16:00:51 +02:00
Tim-Philipp Müller
dea67f3d96 pulsesink: ref custom ring buffer class and type in class_init
Hack around thread-safety issues in GObject and our racy _get_type()
functions (we could easily fix the _get_type() functions, but we still
need to hack around the GObject class races until we require a newer
GLib version, I think).
2009-06-15 15:51:32 +01:00
Wim Taymans
0bd984c52f pulsesink: handle border cases in resampler 2009-06-11 19:18:52 +02:00
Stefan Kost
85ba1b3e6a pulsesink: only notify if all checks passed
Replace goto done: with return, as those are checks when we don't want to flag a
pending notify.
2009-06-04 17:43:15 +03:00
Stefan Kost
44956f98d7 pulsesink: check pointer before accessing
Move existing check a few lines up, so that we check before accessing fields.
2009-06-03 18:23:53 +03:00
Stefan Kost
f77650c024 pulsesink: rename gst_pulse_sink_get_time to gst_pulsesink_get_time
Rename internal method for consistency.
2009-06-03 18:21:12 +03:00
Stefan Kost
2af7977e1d pulsesink: use values from pa_stream_get_buffer_attr()
We were putting the requested values back into ringbuffer spec, instead of
using the queried values.
2009-06-03 18:19:22 +03:00
Jan Schmidt
cf584105c6 pulsesink: Convert an erroneous assertion
Occasionally, we get a change callback for an old stream, triggering
the assertion unnecessarily. Just ignore such callbacks.
2009-05-21 21:16:14 +01:00
Olivier Crête
ca25de8f77 pulse: Print a warning on under/overflows 2009-05-21 22:05:11 +02:00
Wim Taymans
28afc6e591 pulsesink: make sure we always signal waiters
Always signal the waiters in the async callbacks. Especially for the volume
callbacks since this might cause deadlocks.
2009-04-30 10:32:39 +02:00
Edward Hervey
4a9e80720a Remove unused variables in _class_init
Detected by LLVM's CLang static analyzer
2009-04-18 18:51:27 +02:00
Wim Taymans
c052906590 pulsesink: fix sample offset calculation again 2009-04-16 22:51:54 +02:00
Wim Taymans
776b0ae8cb pulsesink: handle NULL timing info
Don't crash when the timing info is not yet available.
2009-04-10 21:32:54 +02:00
Stefan Kost
b3d66d5e8d pulse: make it work on 0.9.12
First we ignore request to fill the ringbuffer which are less then a segment.
The small request where causing stutter.
Then we disable flushing the stream when running against pa 0.9.12 as this
triggers an assertiong in the sound server and terminates it. It does not happen
with 0.9.10 and 0.9.14.
2009-04-10 21:42:13 +03:00
Wim Taymans
963b343548 pulsesink: handle server disconnect in get_time
When the server is disconnected or when we are shut down, make our clock return
an invalid time instead of erroring out.
2009-04-10 14:18:48 +02:00
Wim Taymans
20a6908dfd pulsesink: bps is signed int to avoid overflow
Keep bps as gint instead of guint because we will be doing signed math with it
later on and we don't want weird results.
2009-04-10 12:01:27 +02:00
Wim Taymans
7d438518fb pulsesink: check for a stream
Don't try to change the stream volume (and other things) when we don't have a
stream yet. Just store the values for later.
2009-04-09 23:43:58 +02:00
Wim Taymans
ae83945349 pulsesink: fix compilation for newer pulseaudio 2009-04-09 18:07:38 +02:00
Wim Taymans
8d58de128d pulsesink: uncork fixes and use prebuf = 0
We can use prebuf = 0 to instruct pulse to not pause the stream on underflows.
This way we can remove the underflow callback. We however have to manually
uncork the stream now when we have no available space in the buffer or when we
are writing too far away from the current read_index.
2009-04-09 17:26:21 +02:00
Wim Taymans
d849340e64 pulsesink: handle write errors 2009-04-09 17:26:20 +02:00
Wim Taymans
81c5fb9e48 pulsesink: write silence on underflow
Start filling up the buffer with empty samples when an underflow happens. We
need to do this to keep pulseaudio reporting the right time for us.
2009-04-09 17:26:20 +02:00
Wim Taymans
2e2f1d73ca pulsesink: handle pull-based scheduling
Use the default basesink methods for implementing pull based scheduling, it
works fine for us.
2009-04-09 17:26:20 +02:00
Wim Taymans
8855ed90c0 pulsesink: add beginnings of pull-based scheduling 2009-04-09 17:26:20 +02:00
Wim Taymans
236baa5a13 pulsesink: keep track of clock reset
when we switch streams, the clock will reset to 0. Make sure that the provided
clock doesn't get stuck when this happens by keeping an initial offset. We also
need to make sure that we subtract this offset in samples when writing to the
ringbuffer.
2009-04-09 17:26:20 +02:00
Wim Taymans
6bc6cafcc6 pulsesink: rewrite pulsesink
Derive from BaseAudioSink and implement our custom ringbuffer that maps to the
internal pulseaudio ringbuffer.
2009-04-09 17:26:20 +02:00
Wim Taymans
39f59ea456 pulsesink: clean up the state change function
Make the state change function a bit more readable and only pause after the
parent had a change to pause first.
2009-03-23 11:22:08 +01:00
Jan Schmidt
b39d090a49 pulsesink: Track the corked/uncorked state ourselves
Use an instance variable to track whether the stream is corked or not,
instead of using PA API that was only introduced in 0.9.11
2009-03-20 13:27:59 +00:00
Jan Schmidt
120e6bfc5c pulse: Make sure the stream is uncorked in the write function
If the caps changes, the sink is reset without transitioning through
a PAUSED->PLAYING state change, resulting in a corked stream. This avoids
the problem by checking that the stream is uncorked when writing samples
to it.
2009-03-20 12:11:06 +00:00
Jan Schmidt
608d13d462 pulsesink: Wait until there is enough room to write an entire segment
When trying to write out a segment, wait until there is enough free space
for the entire segment. This helps to reduce ripple in the clock reporting,
where the app might query the playback position while only half a segment
has been written (and is therefore reported by _delay(), even though
the ring buffer has not yet been advanced)
2009-03-13 15:40:50 +00:00
Mark Nauwelaerts
7756d37531 pulsesink: Issue property change notification in streaming thread,
rather than PA thread.

pa_threaded_mainloop_lock() (a.o.) and by extension get_property should
not be done from a PA thread, but the latter may occur as a result of a
property change notification.  Fixes #571204 (though current situation
not ideal, e.g. post message rather than signal).
2009-02-13 18:04:41 +01:00
Jan Schmidt
9795e95f39 Fix compile error in the last commit 2009-01-28 21:40:11 +00:00
Jan Schmidt
0037635bf2 Rewrite the pulse plugin, conditionally enabling new behaviour with
newer pulseaudio.

Fixes: #567794

* Hook pulsesink's volume property up with the stream volume -- not the
  sink volume in PA.

* Read the device description directly from the sink instead of going
  via the mixer.

* Properly implement _reset() methods for both sink and source to avoid
  deadlocks when shutting down a pipeline.

* Replace all simple pa_threaded_mainloop_wait() by proper loops to
  guarantee that we wait for the right event in case multiple events are
  fired.  While this is not strictly necessary in many cases it
  certainly is more correct and makes me sleep better at night.

* Replace CHECK_DEAD_GOTO macros with proper functions

* Extend the number of supported channels to 32 since that is the actual
  limit in PA.

* Get rid of _dispose() methods since we don't need them.

* Increase the volume property upper limit of the sink to 1000.

* Reset function pointers after we disconnect a stream/context. Better
  fix for bug 556986.

* Reset the state of the element properly if open/prepare fails

* Cork the PA stream when the pipeline is paused. This allows the PA
* daemon to
  close audio device on pause and thus save a bit of power.

* Set PA stream properties based on GST tags such as GST_TAG_TITLE,
  GST_TAG_ARTIST, and so on.

Signed-off-by: Lennart Poettering <lennart@poettering.net>
2009-01-28 20:34:40 +00:00
Stefan Kost
9cf73bdd8f Update and add documentation for plugins with deps (ext).
Link to properties. Correct titles for examples. Document a few trivial cases. Keep lists in section file and docs/plugins/Makefile.am alphabetically ordered. Fix warnings that gtk-doc points out.
2009-01-28 18:05:09 +02:00
Jan Schmidt
3e380b488d ext/pulse/pulsesink.*: Use a mutex to protect the current stream pointer, and ignore callbacks for stream objects tha...
Original commit message from CVS:
* ext/pulse/pulsesink.c:
* ext/pulse/pulsesink.h:
Use a mutex to protect the current stream pointer, and ignore
callbacks for stream objects that have been destroyed already.
Fixes problems with unprepare/prepare cycles caused by the input
caps changing, without reintroducing bug #556986.
2009-01-07 20:38:50 +00:00
Sebastian Dröge
67cc69ad52 ext/pulse/pulsesink.c: Don't wait for the pulse mainloop when destroying the stream.
Original commit message from CVS:
* ext/pulse/pulsesink.c: (gst_pulsesink_destroy_stream):
Don't wait for the pulse mainloop when destroying the stream.
Fixes a deadlock when the pulsedaemon goes away while pulsesink
is PLAYING. Fixes bug #556986.
2009-01-05 17:31:13 +00:00
Stefan Kost
81dd155274 ext/pulse/pulsesink.c: Change #if 0 to something more expresive and add pointer to related bug ticket.
Original commit message from CVS:
* ext/pulse/pulsesink.c:
Change #if 0 to something more expresive and add pointer to related
bug ticket.
2008-11-23 15:08:45 +00:00
Wim Taymans
621dab2328 ext/pulse/: Return -1 instead of 0 in error cases. Fixes #554771.
Original commit message from CVS:
* ext/pulse/pulsesink.c: (gst_pulsesink_write):
* ext/pulse/pulsesrc.c: (gst_pulsesrc_read):
Return -1 instead of 0 in error cases. Fixes #554771.
2008-10-03 16:13:32 +00:00
Jan Schmidt
44cb25a342 ext/pulse/pulsesink.c: Fix problems with pulsesink randomly erroring with code 'OK' after a format change on the stre...
Original commit message from CVS:
* ext/pulse/pulsesink.c:
Fix problems with pulsesink randomly erroring with code 'OK' after a
format change on the stream by waiting when disconnecting the stream.
2008-09-27 00:43:07 +00:00
Sebastian Dröge
95d4239819 ext/pulse/: Use GST_BOILERPLATE everywhere and fix coding style at some places.
Original commit message from CVS:
* ext/pulse/pulsemixer.c: (gst_pulsemixer_class_init),
(gst_pulsemixer_set_property), (gst_pulsemixer_get_property):
* ext/pulse/pulsemixerctrl.c: (gst_pulsemixer_ctrl_subscribe_cb),
(gst_pulsemixer_ctrl_open), (gst_pulsemixer_ctrl_timeout_event),
(gst_pulsemixer_ctrl_set_volume):
* ext/pulse/pulsemixertrack.c: (gst_pulsemixer_track_new):
* ext/pulse/pulseprobe.c: (gst_pulseprobe_open):
* ext/pulse/pulsesink.c: (gst_pulsesink_class_init),
(gst_pulsesink_init), (gst_pulsesink_open),
(gst_pulsesink_prepare), (gst_pulsesink_write),
(gst_pulsesink_delay), (gst_pulsesink_reset):
* ext/pulse/pulsesrc.c: (gst_pulsesrc_class_init),
(gst_pulsesrc_init):
Use GST_BOILERPLATE everywhere and fix coding style at some places.
Fix a locking issue in pulsesink's prepare function.
* ext/pulse/pulseutil.c: (gst_pulse_channel_map_to_gst):
Check if the created channel layout is valid for GStreamer.
2008-08-20 17:46:48 +00:00
Sebastian Dröge
cfc5ea685a ext/pulse/: The bytes_per_sample and silence_sample fields of the GstRingBufferSpec are already filled with the corre...
Original commit message from CVS:
* ext/pulse/pulsesink.c: (gst_pulsesink_prepare):
* ext/pulse/pulsesrc.c: (gst_pulsesrc_prepare):
The bytes_per_sample and silence_sample fields of the GstRingBufferSpec
are already filled with the correct values by
gst_ring_buffer_parse_caps() so there's no need to set them again
with wrong values.
2008-08-18 15:05:32 +00:00
Sebastian Dröge
37dee77f26 ext/pulse/pulsesink.*: Add "device-name" property to pulsesink too and currently commented out and not working suppor...
Original commit message from CVS:
* ext/pulse/pulsesink.c: (gst_pulsesink_class_init),
(gst_pulsesink_init), (gst_pulsesink_finalize),
(gst_pulsesink_set_volume), (gst_pulsesink_get_volume),
(gst_pulsesink_set_property), (gst_pulsesink_get_property),
(gst_pulsesink_prepare), (gst_pulsesink_change_state):
* ext/pulse/pulsesink.h:
Add "device-name" property to pulsesink too and currently commented
out and not working support for a "volume" property.
2008-08-13 13:57:01 +00:00
Sebastian Dröge
9e572ebf00 ext/pulse/: Improve debugging a bit by including the parent object in pulsemixerctrl and pulseprobe objects and using...
Original commit message from CVS:
* ext/pulse/pulsemixer.c: (gst_pulsemixer_change_state):
* ext/pulse/pulsemixerctrl.c: (gst_pulsemixer_ctrl_subscribe_cb),
(gst_pulsemixer_ctrl_open), (gst_pulsemixer_ctrl_new),
(gst_pulsemixer_ctrl_free), (gst_pulsemixer_ctrl_timeout_event):
* ext/pulse/pulsemixerctrl.h:
* ext/pulse/pulseprobe.c: (gst_pulseprobe_open),
(gst_pulseprobe_enumerate), (gst_pulseprobe_new),
(gst_pulseprobe_free), (gst_pulseprobe_needs_probe),
(gst_pulseprobe_probe_property), (gst_pulseprobe_get_values):
* ext/pulse/pulseprobe.h:
* ext/pulse/pulsesink.c: (gst_pulsesink_init):
* ext/pulse/pulsesrc.c: (gst_pulsesrc_init), (gst_pulsesrc_delay),
(gst_pulsesrc_change_state):
Improve debugging a bit by including the parent object in pulsemixerctrl
and pulseprobe objects and using GST_WARNING_OBJECT instead of
GST_WARNING.
Use the parent GObject subclass instead of a random struct as GObject
parameter for G_OBJECT_WARN_INVALID_PROPERTY_ID. This fixes a crash
when probing for another property than "device".
2008-08-13 12:34:13 +00:00
Laszlo Pandy
397da5daf0 ext/pulse/: Implement GstPropertyProbe interface on pulsesink for detecting sink devices and on pulsesrc for detectin...
Original commit message from CVS:
Patch by: Laszlo Pandy <laszlok2 at gmail dot com>
* ext/pulse/pulsesink.c: (gst_pulsesink_interface_supported),
(gst_pulsesink_implements_interface_init),
(gst_pulsesink_init_interfaces), (gst_pulsesink_init),
(gst_pulsesink_finalize), (gst_pulsesink_set_property),
(gst_pulsesink_get_type):
* ext/pulse/pulsesink.h:
* ext/pulse/pulsesrc.c: (gst_pulsesrc_interface_supported),
(gst_pulsesrc_init_interfaces), (gst_pulsesrc_init),
(gst_pulsesrc_finalize), (gst_pulsesrc_set_property):
* ext/pulse/pulsesrc.h:
Implement GstPropertyProbe interface on pulsesink for detecting
sink devices and on pulsesrc for detecting source devices.
Fixes bugs #547227 and #547217.
2008-08-13 12:01:01 +00:00
Sebastian Dröge
74e9eb72c5 ext/pulse/: Some smaller cleanup. Use G_PARAM_STATIC_STRINGS, gst_element_class_set_details_simple() and fix coding s...
Original commit message from CVS:
* ext/pulse/pulsemixer.c: (gst_pulsemixer_base_init),
(gst_pulsemixer_class_init):
* ext/pulse/pulsesink.c: (gst_pulsesink_base_init),
(gst_pulsesink_class_init), (gst_pulsesink_prepare):
* ext/pulse/pulsesrc.c: (gst_pulsesrc_interface_supported),
(gst_pulsesrc_base_init), (gst_pulsesrc_class_init),
(gst_pulsesrc_prepare):
Some smaller cleanup. Use G_PARAM_STATIC_STRINGS,
gst_element_class_set_details_simple() and fix coding style a bit
more.
2008-06-10 08:59:17 +00:00
Sebastian Dröge
7390985262 Add documentation to the pulseaudio plugin and run make update in docs/plugins.
Original commit message from CVS:
* docs/plugins/Makefile.am:
* docs/plugins/gst-plugins-good-plugins-docs.sgml:
* docs/plugins/gst-plugins-good-plugins-sections.txt:
* docs/plugins/gst-plugins-good-plugins.args:
* docs/plugins/gst-plugins-good-plugins.hierarchy:
* docs/plugins/gst-plugins-good-plugins.interfaces:
* docs/plugins/gst-plugins-good-plugins.prerequisites:
* docs/plugins/inspect/plugin-aasink.xml:
* docs/plugins/inspect/plugin-alaw.xml:
* docs/plugins/inspect/plugin-alpha.xml:
* docs/plugins/inspect/plugin-alphacolor.xml:
* docs/plugins/inspect/plugin-annodex.xml:
* docs/plugins/inspect/plugin-apetag.xml:
* docs/plugins/inspect/plugin-audiofx.xml:
* docs/plugins/inspect/plugin-auparse.xml:
* docs/plugins/inspect/plugin-autodetect.xml:
* docs/plugins/inspect/plugin-avi.xml:
* docs/plugins/inspect/plugin-cacasink.xml:
* docs/plugins/inspect/plugin-cairo.xml:
* docs/plugins/inspect/plugin-cdio.xml:
* docs/plugins/inspect/plugin-cutter.xml:
* docs/plugins/inspect/plugin-debug.xml:
* docs/plugins/inspect/plugin-dv.xml:
* docs/plugins/inspect/plugin-efence.xml:
* docs/plugins/inspect/plugin-effectv.xml:
* docs/plugins/inspect/plugin-equalizer.xml:
* docs/plugins/inspect/plugin-esdsink.xml:
* docs/plugins/inspect/plugin-flac.xml:
* docs/plugins/inspect/plugin-flxdec.xml:
* docs/plugins/inspect/plugin-gamma.xml:
* docs/plugins/inspect/plugin-gconfelements.xml:
* docs/plugins/inspect/plugin-gdkpixbuf.xml:
* docs/plugins/inspect/plugin-goom.xml:
* docs/plugins/inspect/plugin-goom2k1.xml:
* docs/plugins/inspect/plugin-halelements.xml:
* docs/plugins/inspect/plugin-icydemux.xml:
* docs/plugins/inspect/plugin-id3demux.xml:
* docs/plugins/inspect/plugin-jpeg.xml:
* docs/plugins/inspect/plugin-level.xml:
* docs/plugins/inspect/plugin-matroska.xml:
* docs/plugins/inspect/plugin-monoscope.xml:
* docs/plugins/inspect/plugin-mulaw.xml:
* docs/plugins/inspect/plugin-multifile.xml:
* docs/plugins/inspect/plugin-multipart.xml:
* docs/plugins/inspect/plugin-navigationtest.xml:
* docs/plugins/inspect/plugin-ossaudio.xml:
* docs/plugins/inspect/plugin-png.xml:
* docs/plugins/inspect/plugin-pulseaudio.xml:
* docs/plugins/inspect/plugin-quicktime.xml:
* docs/plugins/inspect/plugin-rtp.xml:
* docs/plugins/inspect/plugin-rtsp.xml:
* docs/plugins/inspect/plugin-smpte.xml:
* docs/plugins/inspect/plugin-soup.xml:
* docs/plugins/inspect/plugin-spectrum.xml:
* docs/plugins/inspect/plugin-speex.xml:
* docs/plugins/inspect/plugin-taglib.xml:
* docs/plugins/inspect/plugin-udp.xml:
* docs/plugins/inspect/plugin-video4linux2.xml:
* docs/plugins/inspect/plugin-videobalance.xml:
* docs/plugins/inspect/plugin-videobox.xml:
* docs/plugins/inspect/plugin-videocrop.xml:
* docs/plugins/inspect/plugin-videoflip.xml:
* docs/plugins/inspect/plugin-videomixer.xml:
* docs/plugins/inspect/plugin-wavenc.xml:
* docs/plugins/inspect/plugin-wavpack.xml:
* docs/plugins/inspect/plugin-wavparse.xml:
* docs/plugins/inspect/plugin-ximagesrc.xml:
* ext/pulse/plugin.c:
* ext/pulse/pulsemixer.c:
* ext/pulse/pulsesink.c:
* ext/pulse/pulsesrc.c:
Add documentation to the pulseaudio plugin and run make update
in docs/plugins.
2008-06-10 08:22:17 +00:00
Sebastian Dröge
f3b03cd773 Add pulseaudio GStreamer element from gst-pulse. Development will continue here instead of pulseaudio SVN. Fixes bug ...
Original commit message from CVS:
* configure.ac:
* ext/pulse/Makefile.am:
* ext/pulse/plugin.c: (plugin_init):
* ext/pulse/pulsemixer.c: (gst_pulsemixer_interface_supported),
(gst_pulsemixer_implements_interface_init),
(gst_pulsemixer_init_interfaces), (gst_pulsemixer_base_init),
(gst_pulsemixer_class_init), (gst_pulsemixer_init),
(gst_pulsemixer_finalize), (gst_pulsemixer_set_property),
(gst_pulsemixer_get_property), (gst_pulsemixer_change_state):
* ext/pulse/pulsemixer.h:
* ext/pulse/pulsemixerctrl.c:
(gst_pulsemixer_ctrl_context_state_cb),
(gst_pulsemixer_ctrl_sink_info_cb),
(gst_pulsemixer_ctrl_source_info_cb),
(gst_pulsemixer_ctrl_subscribe_cb),
(gst_pulsemixer_ctrl_success_cb), (gst_pulsemixer_ctrl_open),
(gst_pulsemixer_ctrl_close), (gst_pulsemixer_ctrl_new),
(gst_pulsemixer_ctrl_free), (gst_pulsemixer_ctrl_list_tracks),
(gst_pulsemixer_ctrl_timeout_event), (restart_time_event),
(gst_pulsemixer_ctrl_set_volume), (gst_pulsemixer_ctrl_get_volume),
(gst_pulsemixer_ctrl_set_record), (gst_pulsemixer_ctrl_set_mute):
* ext/pulse/pulsemixerctrl.h:
* ext/pulse/pulsemixertrack.c: (gst_pulsemixer_track_class_init),
(gst_pulsemixer_track_init), (gst_pulsemixer_track_new):
* ext/pulse/pulsemixertrack.h:
* ext/pulse/pulseprobe.c: (gst_pulseprobe_context_state_cb),
(gst_pulseprobe_sink_info_cb), (gst_pulseprobe_source_info_cb),
(gst_pulseprobe_invalidate), (gst_pulseprobe_open),
(gst_pulseprobe_enumerate), (gst_pulseprobe_close),
(gst_pulseprobe_new), (gst_pulseprobe_free),
(gst_pulseprobe_get_properties), (gst_pulseprobe_needs_probe),
(gst_pulseprobe_probe_property), (gst_pulseprobe_get_values),
(gst_pulseprobe_set_server):
* ext/pulse/pulseprobe.h:
* ext/pulse/pulsesink.c: (gst_pulsesink_base_init),
(gst_pulsesink_class_init), (gst_pulsesink_init),
(gst_pulsesink_destroy_stream), (gst_pulsesink_destroy_context),
(gst_pulsesink_finalize), (gst_pulsesink_dispose),
(gst_pulsesink_set_property), (gst_pulsesink_get_property),
(gst_pulsesink_context_state_cb), (gst_pulsesink_stream_state_cb),
(gst_pulsesink_stream_request_cb),
(gst_pulsesink_stream_latency_update_cb), (gst_pulsesink_open),
(gst_pulsesink_close), (gst_pulsesink_prepare),
(gst_pulsesink_unprepare), (gst_pulsesink_write),
(gst_pulsesink_delay), (gst_pulsesink_success_cb),
(gst_pulsesink_reset), (gst_pulsesink_change_title),
(gst_pulsesink_event), (gst_pulsesink_get_type):
* ext/pulse/pulsesink.h:
* ext/pulse/pulsesrc.c: (gst_pulsesrc_interface_supported),
(gst_pulsesrc_implements_interface_init),
(gst_pulsesrc_init_interfaces), (gst_pulsesrc_base_init),
(gst_pulsesrc_class_init), (gst_pulsesrc_init),
(gst_pulsesrc_destroy_stream), (gst_pulsesrc_destroy_context),
(gst_pulsesrc_finalize), (gst_pulsesrc_dispose),
(gst_pulsesrc_set_property), (gst_pulsesrc_get_property),
(gst_pulsesrc_context_state_cb), (gst_pulsesrc_stream_state_cb),
(gst_pulsesrc_stream_request_cb), (gst_pulsesrc_open),
(gst_pulsesrc_close), (gst_pulsesrc_prepare),
(gst_pulsesrc_unprepare), (gst_pulsesrc_read),
(gst_pulsesrc_delay), (gst_pulsesrc_change_state),
(gst_pulsesrc_get_type):
* ext/pulse/pulsesrc.h:
* ext/pulse/pulseutil.c: (gst_pulse_fill_sample_spec),
(gst_pulse_client_name), (gst_pulse_gst_to_channel_map):
* ext/pulse/pulseutil.h:
Add pulseaudio GStreamer element from gst-pulse. Development will
continue here instead of pulseaudio SVN. Fixes bug #400679.
Only changes over gst-pulse SVN are added copyright to the top of
files and coding style changes.
2008-06-10 06:45:33 +00:00