Commit graph

103 commits

Author SHA1 Message Date
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