Jarkko Nikula [Thu, 22 Mar 2012 09:29:11 +0000 (11:29 +0200)]
alsa: move pa_alsa_setting_select close to pa_alsa_path_select
Move pa_alsa_setting_select call just after the pa_alsa_path_select in
[sink | source]_set_port_cb functions as there is no dependency to volume
calculations that are done between these two calls. Idea here is to make
possible to merge these two functions since they are called together from
other places too.
This is a basic module for enabling loopback as soon as a new bluetooth A2DP
source is created. The module is given a source and a media role using command
line. This allows module-intended-roles or module-device-manager to choose a
target sink for the stream.
Frédéric Dalleau [Wed, 20 Jun 2012 15:33:35 +0000 (17:33 +0200)]
loopback: Enable routing on loopback streams
At module-loopback load, if no sink is given, the default sink is used. If the
stream has a media.role property, the property cannot be used because a the
source or sink is forced to default. Both module-intended-roles and
module-device-manager are affected. The same apply to sources.
With this patch, if sink or source is missing, routing modules can be used.
David Henningsson [Tue, 3 Jul 2012 08:31:30 +0000 (10:31 +0200)]
alsa-mixer: Add "Front Headphone Jack" (fixup)
I forgot half of the front headphone patch, i e, to hide the
speaker output when the front headphone is connected. Thanks to
Shih-Yuan Lee for noticing.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
core-util: Fix permissions handling while creating directories
This makes updating of permissions on existing directories optional with
pa_make_secure_dir() and pa_make_secure_parent_dir(). This makes sure
that the recursive directory creation doesn't end up modifying existing
directories, and also fixes a problem where creating an auth cookie
(specifically ~/.esd_auth) would end up modifying permissions on ~.
Thanks to Frédéric Danis for reporting this.
David Henningsson [Mon, 2 Jul 2012 10:09:06 +0000 (12:09 +0200)]
alsa-mixer: Add "Front Headphone" jack
Many desktops have headphone on the front and line outs on the back.
Sometimes this means that the headphone is labelled "Front Headphone Jack",
but the volume controls are only "Headphone Playback Volume", i e,
without the "Front" prefix.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Thu, 28 Jun 2012 13:40:17 +0000 (15:40 +0200)]
alsa-mixer: Always turn "Inverted Internal Mic" off
Some devices have inverted right channel, so when you add left and right,
the result is silence, or very faint sound. In recent kernels (3.5,
perhaps also 3.4) these are starting to be marked with a special
"Inverted Internal Mic" capture switch.
While we might want to add some reverse summing mechanism in the
future, for now, we just turn the thing off to avoid the problem of
recording silence.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Thu, 28 Jun 2012 13:35:38 +0000 (15:35 +0200)]
alsa-mixer: Add Phantom Jack support
For kernel 3.6, "phantom jack" kctls have been added. They serve as
a marker that a particular port exist. They were made so we can detect
that there actually are speakers and internal mic on a laptop, even if
there are no other indications (volume controls etc).
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
David Henningsson [Thu, 3 May 2012 13:39:18 +0000 (15:39 +0200)]
alsa-mixer: Add special profiles for some laptops missing speaker and/or internal mic
Several laptops have speaker ports, and/or internal mic ports, but we have
no way of detecting that. So we make the port(s) always show up for these
devices.
conf-parser: Initialize the state to zero immediately.
Set the state variable immediately to zero so if we fail to open the
configuration file we don't check an uninitialized pointer and free an
nonexistent proplist.
Tanu Kaskinen [Fri, 8 Jun 2012 18:49:10 +0000 (21:49 +0300)]
card: Ensure that there's always at least one profile.
In practice there is always at least one profile, and I
don't think there will ever be cards without profiles.
Therefore, I added assertions to pa_card_new() stating that
the card new data must always contain at least one profile.
Now a lot of code can be simplified, because it's guaranteed
that the profiles hashmap and the active_profile field are
always non-NULL.
Tanu Kaskinen [Fri, 8 Jun 2012 16:36:45 +0000 (19:36 +0300)]
card: Don't crash if someone gives NULL name to pa_card_set_profile().
In my opinion, pa_card_set_profile() should assert that name
is not NULL, and it would be the job of the client interface
to filter out NULLs from the client input, but this is done
this way also when setting sink and source ports, so for
consistency I'll do this this way for now.
conf-parser: Pass parser state in a struct instead of function parameters.
I don't like long function parameter lists, and I plan to
add some more state data to the parser which would make the
parameter lists even longer without this refactoring.
tagstruct: Allow NULL proplist with pa_tagstruct_get_proplist().
module-tunnel doesn't care about the proplist contents, so
pa_tagstruct_get_proplist() is only used for removing the
data from the tagstruct buffer. In that case it's more
convenient to just pass NULL as the proplist argument.
Arun Raghavan [Thu, 28 Jun 2012 14:01:37 +0000 (19:31 +0530)]
glib: Stop using g_source_get_current_time()
This function is now marked as deprecated. It is functionally identical
to g_get_current_time(), so we use that instead. The GLib API docs
suggest g_source_get_time(), but that does not provide wallclock time
(which is what the pa_time_event API expects), so we don't use it.
poljar [Fri, 22 Jun 2012 18:55:54 +0000 (20:55 +0200)]
sink, source: Add a latency offset which is inherited from the port
A latency offset variable was added to the sink/source struct.
Also a function was introduced to update the latency offset of the
sink/source and a new message type was introduced so we can send the latency
offset to the IO thread.
The latency offset is automatically populated with the latency from the
currently active port.
Frédéric Danis [Tue, 12 Jun 2012 13:49:50 +0000 (15:49 +0200)]
bluetooth: Fix bluetooth.nrec property not updated
PropertyChanged signal of org.BlueZ.MediaTransport is processed in
pa_bluetooth_transport_parse_property() which updates t->nrec.
This is called by :
- First by filter_cb() of bluetooth-util.c
- Then by filter_cb() of module-bluetooth-device.c which retrieve value
of t->nrec before calling parse function, then it checks if t->nrec
has changed before updating bluetooth.nrec property.
As t->nrec has alreday been changed during first process, property
update is never performed.
This patch creates a new hook in pa_bluetooth_transport called
PA_BLUETOOTH_TRANSPORT_HOOK_NREC_CHANGED.
The hook is fired by bluetooth-util.c when the transport's NREC
property changes.
module-bluetooth-device.c won't listen the PropertyChanged signal of
MediaTransport anymore. Instead, it will use the hook in
pa_bluetooth_transport to get a notification when the NREC property
changes, and update the sink or source proplist accordingly.
const qualifier for returned pointer of
pa_bluetooth_discovery_get_transport() is removed.
Arun Raghavan [Mon, 11 Jun 2012 07:42:50 +0000 (13:12 +0530)]
core-util: Make pa_make_secure_dir() act like mkdir -p
This makes pa_make_secure_dir() create any missing parent directories in
the given path as well. This is useful, for example, on a pristine
system with a clean $HOME that needs ~/.config/pulse/ to be created when
~/.config does not exist.
native: Don't save device, volume or mute of new streams.
Specifying the volume when creating a new stream is not an
equivalent act as setting the volume with a volume control
application. When creating a new stream, stream-restore
shouldn't save the volume, but when changing the volume,
then saving it is ok. For example, when I say
"paplay --volume=10000 somefile.wav", I mean that I want the
new stream to have volume 10000. I don't mean that also
future paplay invocations (without the --volume option)
should have that same volume.
Tanu Kaskinen [Mon, 4 Jun 2012 14:44:20 +0000 (17:44 +0300)]
device-port: Create the profiles hashmap at initialization.
I doesn't make sense to require all callers of
pa_device_port_new() to create the hashmap themselves. There
are and there will be no cases where a port without any
profiles would be desired.
Eero Nurkkala [Thu, 31 May 2012 07:44:23 +0000 (10:44 +0300)]
alsa-source: add missing header 'signal.h'
Compilation with -DDEBUG_TIMING fails due to a missing header:
modules/alsa/alsa-source.c: In function 'check_left_to_record':
modules/alsa/alsa-source.c:426:9: warning: implicit declaration of function 'raise' [-Wimplicit-function-declaration]
modules/alsa/alsa-source.c:426:9: error: 'SIGTRAP' undeclared (first use in this function)
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
Eero Nurkkala [Thu, 31 May 2012 07:44:22 +0000 (10:44 +0300)]
alsa-sink: add missing header 'signal.h'
Compilation with -DDEBUG_TIMING fails due to a missing header:
modules/alsa/alsa-sink.c: In function 'check_left_to_play':
modules/alsa/alsa-sink.c:453:9: warning: implicit declaration of function 'raise' [-Wimplicit-function-declaration]
modules/alsa/alsa-sink.c:453:9: error: 'SIGTRAP' undeclared (first use in this function)
Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
David Henningsson [Fri, 18 May 2012 20:29:41 +0000 (22:29 +0200)]
once: Fix race causing pa_once to sometimes run twice
There was a race in the existing code that could cause the pa_once code
to be run twice, see:
http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-April/013354.html
Therefore the existing implementation was rewritten to instead look like
the reference implementation here:
http://www.hpl.hp.com/research/linux/atomic_ops/example.php4
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Frédéric Danis [Tue, 15 May 2012 13:55:36 +0000 (15:55 +0200)]
bluetooth: Fix crash on disconnection
When a Bluetooth headset is connected only to HFP profile (not connected
to A2DP) and host streams to it, a crash occurs if host disconnects.
When HFP disconnects, audio thread will fail on POLLHUP then generate
a message to set PA profile to Off before ending.
If this message is managed before PA unload bluetooth device module,
all works fine.
But, if this message is managed during module unload, this finish by
re-entrance in release code (stop_thread) and a crash.
This fix prevents to process profile change when module is unloading.
Lennart Poettering [Tue, 15 May 2012 21:13:28 +0000 (23:13 +0200)]
core-util: move configuration home directory from ~/,pulse to ~/.config/pulse to follow XDG basedir spec
If ~/.pulse/ already exists we stick to it in order not to lose
configuration and so that pulse configuration may still be shared across
the network with different PA versions.