platform/upstream/pulseaudio.git
9 years agolaunch: Disable autospawn by default when systemd daemon support is enabled.
Colin Guthrie [Fri, 17 Oct 2014 13:37:33 +0000 (15:37 +0200)]
launch: Disable autospawn by default when systemd daemon support is enabled.

When enabled, this method is prefered over pulseaudio's built in
systems so we should try our best to ensure that it cannot be spawned
outside of the mechanisms desired.

Packagers should call 'systemctl --global enable pulseaudio.socket' to
enable the socket for all users, or alternatively ship an enabling
symlink in /usr/lib/systemd/user/sockets.target.wants/ folder. It may
also make sense for distributions to add in a ConditionNNN= line to the
socket unit if they have a downstream mechanism for enabling or
disabling pulseaudio.

If individual users wish to opt out of this vendor (or administrator)
decision, they can call 'systemctl --user mask pulseaudio.socket'

9 years agolaunch: Add systemd units for launching pulseaudio user instances
Colin Guthrie [Fri, 17 Oct 2014 13:10:14 +0000 (15:10 +0200)]
launch: Add systemd units for launching pulseaudio user instances

9 years agolaunch: Avoid specifically starting PA and rely on autospawn/socket activation
Colin Guthrie [Fri, 17 Oct 2014 12:43:18 +0000 (14:43 +0200)]
launch: Avoid specifically starting PA and rely on autospawn/socket activation

This --start is patched out in several downstreams to allow users to easily
disable PA by simply disabling autospawn.

If autospawn is enabled, then the first pactl command will start it and if not
it will fail and the script will exit.

When switching to systemd socket activation, we very much do not want to
start PA manually here. We could replace it with a
  systemctl --user start pulseaudio
but really it just makes sense to rely on the socket activation as this
should apply equally to non-systemd setups which use PA's own autospawn.

9 years agosocket-server: Add support for systemd socket activation.
Colin Guthrie [Thu, 16 Oct 2014 09:05:19 +0000 (10:05 +0100)]
socket-server: Add support for systemd socket activation.

This adds support to module-native-protocol-unix to take over already
listening sockets passed in via socket activation (e.g. from systemd)

Most of the code is isolated to socket-server but some cleanup code also
had to be tweaked to ensure we do not overzealously close open fds.

9 years agobuild-sys: Add support for newer systemd without compatibility libs
Colin Guthrie [Fri, 17 Oct 2014 11:51:25 +0000 (13:51 +0200)]
build-sys: Add support for newer systemd without compatibility libs

In newer versions of systemd some libraries were combined for the sake of
general simplicity.

This change checks against the newer name first and avoids separate pkgconfig
checks if it's found. We probably want to keep support for the older library
names for some time. systemd does allow for the shipping of compatibility
pkgconfig files to not break downstream code like ourselves which is why this
likely hasn't been "fixed" until now.

With this change we no longer rely on systemd having been built with those
compatibility pkgconfig files.

9 years agobuild-sys: Clarify some systemd sub-component variable/define names.
Colin Guthrie [Fri, 17 Oct 2014 11:32:03 +0000 (13:32 +0200)]
build-sys: Clarify some systemd sub-component variable/define names.

We currently use the term SYSTEMD when referring to libsystemd-login
and JOURNAL when referring to libsystemd-journal.

I will be shortly adding support for libsystemd-daemon and in
preparation I figured it would be a good idea to clarify the names
used currently before adding another!

9 years agoman: Fix XDG_RUNTIME_DIR variable reference.
Colin Guthrie [Fri, 17 Oct 2014 11:09:14 +0000 (13:09 +0200)]
man: Fix XDG_RUNTIME_DIR variable reference.

9 years agosocket-server: Improve readability
Tanu Kaskinen [Mon, 3 Nov 2014 09:23:25 +0000 (11:23 +0200)]
socket-server: Improve readability

9 years agoalsa-mixer: Disable line-out if headphone jack is plugged
Sjoerd Simons [Fri, 31 Oct 2014 21:01:28 +0000 (22:01 +0100)]
alsa-mixer: Disable line-out if headphone jack is plugged

Line-out gets muted when headphones are plugged in on HDA cards, encode
this in the line-out path so pulse can match that state.

9 years agoalsa-mixer: Ignore some elements in the analog-output path
Tanu Kaskinen [Mon, 27 Oct 2014 11:00:00 +0000 (13:00 +0200)]
alsa-mixer: Ignore some elements in the analog-output path

The analog-output path should be suppressed when there are more
specific paths available. Currently that usually doesn't happen. The
suppression can be done with the path subset detection, and this patch
makes that work (another approach would be to mark the elements as
required-absent, like analog-input does, but I like the subset
suppression more, because it requires less stuff in the configuration
files). The problem with listing the now-removed elements in
analog-output.conf was that if the sound card had e.g. a Speaker
element, then the switch behaviour was different between analog-output
and analog-output-speakers, so analog-output was not considered a
subset of analog-output-speakers.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=74609
9 years agobluetooth: Fix some native backend command sending
Arun Raghavan [Fri, 31 Oct 2014 04:45:02 +0000 (10:15 +0530)]
bluetooth: Fix some native backend command sending

We weren't writing out one character from the "OK" response, and the
"AT" part of the "+VGS" and "+VGM" commands was missing. Also, the spec
says that the command is terminated by only a CR and not an LF (probably
doesn't hurt, but let's adhere to the spec for now).

9 years agobackend-native: implement volume control
Wim Taymans [Fri, 24 Oct 2014 07:56:52 +0000 (09:56 +0200)]
backend-native: implement volume control

Parse the gain changed AT commands from the headset and fire 2 new
hooks as a result. The device will connect to those hooks and change the
source/sink volumes.

When the source/sink volume changes, set the gain on the microphone or
speaker respectively. Make sure we do nothing if the transport can not
handle the gain changes.

9 years agobackend-native: add a new native headset backend
Wim Taymans [Fri, 24 Oct 2014 07:56:51 +0000 (09:56 +0200)]
backend-native: add a new native headset backend

Add a simple native headset backend that implements support for the
blutooth HSP profile.
This allows pulseaudio to output audio to a Headset using the HSP profile.

Make the native backend the default.

9 years agobluez5-util: add destroy function
Wim Taymans [Fri, 24 Oct 2014 07:56:50 +0000 (09:56 +0200)]
bluez5-util: add destroy function

Add a destroy function to the transport that is called before freeing
the transport. Useful for cleaning up extra userdata.

9 years agobluez5-device: use get_profile_direction
Wim Taymans [Fri, 24 Oct 2014 07:56:49 +0000 (09:56 +0200)]
bluez5-device: use get_profile_direction

Use the get_profile_direction() helper function to decide when to add a
source and a sink instead of enumerating profiles.

9 years agocreds: Rename pa_ancil to pa_cmsg_ancil_data
Arun Raghavan [Wed, 6 Aug 2014 02:18:19 +0000 (07:48 +0530)]
creds: Rename pa_ancil to pa_cmsg_ancil_data

Makes the purpose of the structure clearear.

9 years agotests: Be careful with data types to avoid cast
Peter Meerwald [Thu, 23 Oct 2014 09:35:29 +0000 (11:35 +0200)]
tests: Be careful with data types to avoid cast

use unsigned and size_t for counters and packet length, resp.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Make global variables static in srbchannel-test
Peter Meerwald [Thu, 23 Oct 2014 09:28:39 +0000 (11:28 +0200)]
tests: Make global variables static in srbchannel-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agoalsa-sink: Check for after-avail is redundant
Peter Meerwald [Thu, 23 Oct 2014 09:47:44 +0000 (11:47 +0200)]
alsa-sink: Check for after-avail is redundant

after-avail is always false at this point

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agomodules: Fix )== typos
Peter Meerwald [Thu, 23 Oct 2014 13:40:15 +0000 (15:40 +0200)]
modules: Fix )== typos

add a space between ) and ==

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agomainloop: Fix typo
Peter Meerwald [Thu, 23 Oct 2014 12:24:28 +0000 (14:24 +0200)]
mainloop: Fix typo

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agoCleanup !! for bool
Peter Meerwald [Thu, 23 Oct 2014 13:00:29 +0000 (15:00 +0200)]
Cleanup !! for bool

!!x makes no sense if x is bool (this is a leftover from the
convertion pa_bool_t -> bool, d806b197)

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agoRemove link to CIA from README
Peter Meerwald [Thu, 23 Oct 2014 12:57:09 +0000 (14:57 +0200)]
Remove link to CIA from README

cia.navi.cx/stats/project/polypaudio does not exist anymore,
see http://cia.vc/

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agobuild-sys: Alias bash-completion for all PulseAudio commands
Michał Górny [Fri, 17 Oct 2014 18:45:18 +0000 (20:45 +0200)]
build-sys: Alias bash-completion for all PulseAudio commands

Bash-completion 1.90 introduced support for on-demand loading
of completions. Install the completion file as 'pulseaudio' to match
the main command, and create symlinks as aliases for other supported
commands in order to support the new system.

9 years agoalsa-mixer: Merge analog-output-desktop-speaker with analog-output-speaker(-always)
Tanu Kaskinen [Mon, 27 Oct 2014 11:20:01 +0000 (13:20 +0200)]
alsa-mixer: Merge analog-output-desktop-speaker with analog-output-speaker(-always)

According to David[1], it's unlikely that there are any sound cards
that would have separate "speaker" and "desktop speaker" paths, so
let's remove the unnecessary distinction.

[1] http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/20915/focus=21193

9 years agomodule-card/device-restore: Do not legacy load an empty entry
David Henningsson [Mon, 20 Oct 2014 14:19:36 +0000 (16:19 +0200)]
module-card/device-restore: Do not legacy load an empty entry

There is no use in trying to load data in legacy format, if we
already know that there is no data at all.
Also clarify in the debug message whether there is invalid data
or no data at all.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoshell-completion: zsh: Rework pactl completion
Tanu Kaskinen [Sat, 18 Oct 2014 18:10:41 +0000 (21:10 +0300)]
shell-completion: zsh: Rework pactl completion

So far the command name has been figured out by looking one or two
items back in the $words array, but I needed a way to figure out the
command given an arbitrary number of parameters. I was implementing
a command for removing devices from the device-manager database, and
the command would take a list of devices. Since the number of devices
that need to be completed can be arbitrarily large, the previous "look
one or two words back" approach didn't work.

This new approach is more verbose, but I think it's also easier to
follow. There's some duplication that would be easy to avoid by
merging some of the commands, but I decided to not do that, to make
it more obvious what the code does.

9 years agoshell-completion: zsh: Mark a variable as local
Tanu Kaskinen [Sat, 18 Oct 2014 18:10:40 +0000 (21:10 +0300)]
shell-completion: zsh: Mark a variable as local

Variables are global by default, and we certainly don't want
_pactl_commands to be a global variable.

9 years agopstream-util: Fix build on freebsd
David Henningsson [Fri, 29 Aug 2014 12:54:19 +0000 (14:54 +0200)]
pstream-util: Fix build on freebsd

The previous fix was not entirely complete.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoconfigure: Remove "WIBBLE" test
David Henningsson [Wed, 15 Oct 2014 07:10:02 +0000 (09:10 +0200)]
configure: Remove "WIBBLE" test

Apparently "WIBBLE" is just a test, and maybe the test was "How
long does it take until somebody notices a strange row in configure.ac
and tries to remove it", if so, the test result is "a little over
three years". :-)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoprotocol-native: Fail if trying to push unaligned memblock into queue
David Henningsson [Thu, 16 Oct 2014 09:41:19 +0000 (11:41 +0200)]
protocol-native: Fail if trying to push unaligned memblock into queue

We will just ignore the memblock if this happens. We already have
a check for this in the client library, so this one is just for
security reasons.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agostream: Fail on client submitting non-frame-aligned memblocks
David Henningsson [Thu, 16 Oct 2014 09:41:18 +0000 (11:41 +0200)]
stream: Fail on client submitting non-frame-aligned memblocks

If somebody tries to push a non-frame-aligned memblock onto the
memblockq, then we should fail the write. Otherwise the daemon will
crash, see https://bugs.freedesktop.org/show_bug.cgi?id=77595

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agomemblockq: Do not allow non-frame indices in the memblock queue
David Henningsson [Thu, 16 Oct 2014 09:41:17 +0000 (11:41 +0200)]
memblockq: Do not allow non-frame indices in the memblock queue

Since we don't allow lengths that are not frame aligned,
it does not make sense to allow indices that are not frame aligned
either.
Also, allowing such a thing to be added causes the daemon to crash
later instead (see https://bugs.freedesktop.org/show_bug.cgi?id=77595 ).

Also drop _se from assert (there is no side effect).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agotunnel-sink-new: Fix requested latency check
Tanu Kaskinen [Tue, 7 Oct 2014 13:56:55 +0000 (16:56 +0300)]
tunnel-sink-new: Fix requested latency check

This fixes a bug in latency configuration. The wrong type in the cast
caused UINT64_MAX being not treated as special, so the configured
latency was set to UINT64_MAX usecs, which of course is absurdly huge
latency.

9 years agobluetooth: Move stuff to pa_bluetooth_transport_put/unlink()
Tanu Kaskinen [Tue, 7 Oct 2014 11:50:21 +0000 (14:50 +0300)]
bluetooth: Move stuff to pa_bluetooth_transport_put/unlink()

This should not have any effect on behaviour. The goal is to align
with the pattern that I think we should follow:

Object initialization:
 - put() is the place to create references from other objects to the
   newly created object. In this case, adding the transport to
   discovery->transports was moved from new() to put, and adding the
   transport to device->transports was moved from set_state() to
   put().

Object destruction:
 - unlink() undoes put() and removes all references from other objects
   to the object being unlinked. In this case setting the
   device->transports pointer to NULL was moved from set_state() to
   unlink(), and setting the discovery->transports pointer to NULL was
   moved from free() to unlink().
 - free() undoes new(), but also calls unlink() so that object owners
   don't need to remember to call unlink() before free().

9 years agovala: adding missing fields for sink_input/source_output info struct
Ricardo Salveti de Araujo [Wed, 1 Oct 2014 23:08:33 +0000 (20:08 -0300)]
vala: adding missing fields for sink_input/source_output info struct

Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
9 years agopulse: Initalise pa_threaded_mainloop with zeroes
Arun Raghavan [Thu, 16 Oct 2014 15:09:22 +0000 (17:09 +0200)]
pulse: Initalise pa_threaded_mainloop with zeroes

9 years agoutil: Try finding out application name using dladdr if available
Felipe Sateler [Sat, 11 Oct 2014 04:34:23 +0000 (01:34 -0300)]
util: Try finding out application name using dladdr if available

This fixes getting the binary name in the Hurd, or any other port using
the GNU C library, but only in the case where the library is directly
linked to. Opening with dlopen will not work.

Change in v3: reorder header includes and definitions
Change in v2: use a weak reference to main, so that we
don't crash when main cannot be found.

9 years agoconnect-stress-test: Fix number of streams per sink to "20"
David Henningsson [Thu, 16 Oct 2014 10:24:19 +0000 (12:24 +0200)]
connect-stress-test: Fix number of streams per sink to "20"

This test broke when PA_MAX_INPUTS_PER_SINK was increased from 32 to 256.
Because we currently don't have time to figure out why, let's just set
NSTREAMS to 20 in the meantime.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agotunnel-sink-new: Limit the maximum latency to 200 ms
Tanu Kaskinen [Tue, 7 Oct 2014 13:55:47 +0000 (16:55 +0300)]
tunnel-sink-new: Limit the maximum latency to 200 ms

The default maximum latency is 10 seconds, which is not good,
especially since the tunnel sink doesn't support rewinding. Due to the
lack of rewinding, e.g. volume changes take a long time with large
latencies.

9 years agomodule-stream-restore: use entry_write when filling up the database
Ricardo Salveti de Araujo [Wed, 1 Oct 2014 23:07:04 +0000 (20:07 -0300)]
module-stream-restore: use entry_write when filling up the database

It seems at some point the code migrated to use the entry_write calls,
but fill_db is still using the old syntax, causing the entry to be
invalid.

The crash happens when clean_up_db gets called, which then calls
entry_read, causing the crash.

Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
9 years agoswitch-on-connect: Initialize userdata contents to zero
Tanu Kaskinen [Mon, 6 Oct 2014 10:30:35 +0000 (13:30 +0300)]
switch-on-connect: Initialize userdata contents to zero

This fixes userdata.only_from_unavailable being uninitialized in case
the user doesn't give the value in modargs.

9 years agoi18n: Update the Slovak translation
Dušan Kazik [Mon, 6 Oct 2014 10:19:19 +0000 (13:19 +0300)]
i18n: Update the Slovak translation

9 years agomodule-mmkbd-evdev: Don't crash on failure to close fd
David Henningsson [Fri, 12 Sep 2014 08:01:24 +0000 (10:01 +0200)]
module-mmkbd-evdev: Don't crash on failure to close fd

If the keyboard is unplugged, it looks like the kernel is reporting
back -ENODEV when trying to close the fd. This is probably a kernel
error, but still, it's better to complain than to crash.

Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=80867
Reported-by: Stelios Bounanos
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agocore-util: Add pa_unset_env()
Tanu Kaskinen [Thu, 2 Oct 2014 09:14:09 +0000 (12:14 +0300)]
core-util: Add pa_unset_env()

Since we already have pa_set_env(), it's nice to also have a
corresponding function for unsetting environment variables.

9 years agomodule-switch-on-port-available: make the output more accurate
Hui Wang [Fri, 26 Sep 2014 03:34:28 +0000 (11:34 +0800)]
module-switch-on-port-available: make the output more accurate

It is possible that the chosen active_port doesn't equal
new_data->active_port, using p->name is more accurate.

Please refer to sink_new_hook_callback()

Signed-off-by: Hui Wang <hui.wang@canonical.com>
9 years agobluetooth: bluez4: Add profile name to sinks and sources
Pali Rohár [Thu, 25 Sep 2014 13:27:58 +0000 (15:27 +0200)]
bluetooth: bluez4: Add profile name to sinks and sources

Now a2dp and hsp sinks and sources will have different names which means that
applications and other modules can use sink/source to distinguish selected
profile.

Module module-device-restore uses sink/source name and port name as identifier,
so if different profiles have different names module-device-restore can store
volume settings for each profile.

So with this patch it is possible to configure different volume settings for
a2dp and hsp profiles.

This patch does not change port names so gnome applications will be happy.

Note that similar patch is needed also for bluez5, but I'm not using bluez5
so I cannot write or test it.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
9 years agomodule-switch-on-connect: add an argument for conditionally connecting
Hui Wang [Mon, 22 Sep 2014 03:50:49 +0000 (11:50 +0800)]
module-switch-on-connect: add an argument for conditionally connecting

On a machine without fixed connecting audio devices like internal
microphone or internal speaker, and when there is no external audio
devices plugging in, the default source/sink is alsa_input/alsa_output
and there is no input devices/output devices listed in the gnome
sound-setting.

Under this situation, if we connect a bluetooth headset, the gnome
sound-setting will list bluez input/output devices, but they are not
active devices by default. This looks very weird that sound-setting
lists only one input device and one output device, but they are not
active. To change this situation, we add an argument, the policy is
if a new source/sink is connected and current default source/sink's
active_port is AVAILABLE_NO, we let the new added one switch to
default one.

BugLink: http://bugs.launchpad.net/bugs/1369476
Signed-off-by: Hui Wang <hui.wang@canonical.com>
9 years agoAdd a Valgrind suppression file
Tanu Kaskinen [Fri, 19 Sep 2014 11:39:50 +0000 (14:39 +0300)]
Add a Valgrind suppression file

9 years agosrbchannel: Defer reading when setting up read callback
David Henningsson [Wed, 17 Sep 2014 06:56:51 +0000 (08:56 +0200)]
srbchannel: Defer reading when setting up read callback

Calling the callback while setting it up can make things
complicated for clients, as the callback can do arbitrarily
things.

In this case, a protocol error caused the srbchannel to be
owned by both the pstream and the native connection.

Now the read callback is deferred, making sure the callback
is called from a cleaner context where errors are handled
appropriately.

Reported-by: Tanu Kaskinen <tanu.kaskinen@linux.intel.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoalsa-time-test: Make constants for channels and rate
David Henningsson [Wed, 10 Sep 2014 12:52:01 +0000 (14:52 +0200)]
alsa-time-test: Make constants for channels and rate

Hard-coding constants on several places is bad coding practice.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoalsa-time-test: Do not use Lennart's card by default
David Henningsson [Wed, 10 Sep 2014 12:45:01 +0000 (14:45 +0200)]
alsa-time-test: Do not use Lennart's card by default

Lennart probably had a card with a specific name. It is not a
common name anymore.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoalsa-time-test: Add fillrate parameter
David Henningsson [Wed, 10 Sep 2014 12:43:19 +0000 (14:43 +0200)]
alsa-time-test: Add fillrate parameter

As a third parameter, add the number of samples to read/write in
every iteration. This will help slow CPUs.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agobluetooth: Allow policy module to pick 'off' profile
Luiz Augusto von Dentz [Wed, 17 Sep 2014 10:05:00 +0000 (13:05 +0300)]
bluetooth: Allow policy module to pick 'off' profile

This allow 'off' profile to be choosen when no other profile is available
which is considered better since it requires less resources than other
profiles.

9 years agobluetooth: Switch transport state to idle in case of HUP
João Paulo Rechi Vita [Wed, 17 Sep 2014 10:04:59 +0000 (13:04 +0300)]
bluetooth: Switch transport state to idle in case of HUP

In case the socket HUP the transport state should be set to idle which
will indicate the profile is no longer available.

9 years agobluetooth: Implement org.ofono.HandsfreeAudioAgent.NewConnection()
João Paulo Rechi Vita [Mon, 15 Sep 2014 10:02:02 +0000 (13:02 +0300)]
bluetooth: Implement org.ofono.HandsfreeAudioAgent.NewConnection()

9 years agoi18n: Add Slovak translation
Dusan Kazik [Tue, 16 Sep 2014 11:30:31 +0000 (14:30 +0300)]
i18n: Add Slovak translation

9 years agoalsa: Remove unnecessary hctl handles being passed around
David Henningsson [Mon, 1 Sep 2014 13:58:22 +0000 (15:58 +0200)]
alsa: Remove unnecessary hctl handles being passed around

Now that we have switched to using the mixer handle only,
there is no use for sending hctl handles around.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoalsa-mixer/card: Move to use the new mixer interface
David Henningsson [Mon, 1 Sep 2014 13:41:39 +0000 (15:41 +0200)]
alsa-mixer/card: Move to use the new mixer interface

Use the new mixer API to get callbacks, instead of using the hctl
API. Using the hctl API caused a memory leak, because alsa-lib itself
used the hctl callbacks, which we were previously overriding.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoalsa-util: Add functions for accessing mixer elements through mixer class
David Henningsson [Mon, 1 Sep 2014 13:38:25 +0000 (15:38 +0200)]
alsa-util: Add functions for accessing mixer elements through mixer class

Instead of using the hctl interface, we can find controls belonging
to other iface types than "mixer". We do this by introducing a new
mixer class "SND_MIXER_ELEM_PULSEAUDIO" and create snd_mixer_elem's
for all PCM and CARD iface types (as Jacks are of the CARD type and
ELD controls are of the PCM type).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agobluetooth: Implement org.ofono.HandsfreeAudioAgent.Release()
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:34 +0000 (11:48 +0200)]
bluetooth: Implement org.ofono.HandsfreeAudioAgent.Release()

9 years agobluetooth: Handle CardRemoved signal
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:33 +0000 (11:48 +0200)]
bluetooth: Handle CardRemoved signal

9 years agobluetooth: Handle CardAdded signal
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:32 +0000 (11:48 +0200)]
bluetooth: Handle CardAdded signal

9 years agobluetooth: Track oFono service
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:31 +0000 (11:48 +0200)]
bluetooth: Track oFono service

9 years agobluetooth: Implement transport release for hf_audio_agent transports
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:30 +0000 (11:48 +0200)]
bluetooth: Implement transport release for hf_audio_agent transports

9 years agobluetooth: Implement transport acquire for hf_audio_agent transports
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:29 +0000 (11:48 +0200)]
bluetooth: Implement transport acquire for hf_audio_agent transports

9 years agobluetooth: Parse HandsfreeAudioCard properties
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:28 +0000 (11:48 +0200)]
bluetooth: Parse HandsfreeAudioCard properties

9 years agobluetooth: List HandsfreeAudioCard objects from oFono
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:27 +0000 (11:48 +0200)]
bluetooth: List HandsfreeAudioCard objects from oFono

9 years agobluetooth: Register/Unregister Handsfree Audio Agent with oFono
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:26 +0000 (11:48 +0200)]
bluetooth: Register/Unregister Handsfree Audio Agent with oFono

Register as a HandsfreeAudioAgent with oFono during backend
initialization and unregiter during backend finalization. This commit
also adds a check when receiving method calls or signals to make sure
the sender matches with the D-Bus service we're registered with.

9 years agobluetooth: Create hf_dbus_send_and_add_to_pending() for oFono backend
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:25 +0000 (11:48 +0200)]
bluetooth: Create hf_dbus_send_and_add_to_pending() for oFono backend

9 years agobluetooth: Monitor D-Bus signals
João Paulo Rechi Vita [Wed, 10 Sep 2014 09:48:24 +0000 (11:48 +0200)]
bluetooth: Monitor D-Bus signals

9 years agotests: Remove mix-special-test
Peter Meerwald [Wed, 23 Apr 2014 15:47:26 +0000 (17:47 +0200)]
tests: Remove mix-special-test

code has been moved to cpu-mix-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Use float constants in cpu-sconv-test
Peter Meerwald [Wed, 23 Apr 2014 21:48:17 +0000 (23:48 +0200)]
tests: Use float constants in cpu-sconv-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Add ARM NEON test code to cpu-remap-test
Peter Meerwald [Tue, 22 Apr 2014 17:12:28 +0000 (19:12 +0200)]
tests: Add ARM NEON test code to cpu-remap-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Add rearrange remapping test cases to cpu-remap-test
Peter Meerwald [Wed, 23 Apr 2014 14:52:39 +0000 (16:52 +0200)]
tests: Add rearrange remapping test cases to cpu-remap-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Add to remapping special case code tests to cpu-remap-test
Peter Meerwald [Wed, 23 Apr 2014 20:18:34 +0000 (22:18 +0200)]
tests: Add to remapping special case code tests to cpu-remap-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Reorganize cpu-remap-test program
Peter Meerwald [Wed, 23 Apr 2014 20:18:05 +0000 (22:18 +0200)]
tests: Reorganize cpu-remap-test program

Make run_remap_test() support up to 8 input and output channels.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Use remap function passed in remap struct
Peter Meerwald [Wed, 23 Apr 2014 21:22:58 +0000 (23:22 +0200)]
tests: Use remap function passed in remap struct

Cleanup and add function to setup remap struct

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Add ARM NEON test code to cpu-mix-test
Peter Meerwald [Wed, 23 Apr 2014 20:49:14 +0000 (22:49 +0200)]
tests: Add ARM NEON test code to cpu-mix-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Add tests for mix special-case code
Peter Meerwald [Wed, 23 Apr 2014 20:48:53 +0000 (22:48 +0200)]
tests: Add tests for mix special-case code

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Use single-line #ifdef for ARM NEON code
Peter Meerwald [Tue, 22 Apr 2014 16:25:48 +0000 (18:25 +0200)]
tests: Use single-line #ifdef for ARM NEON code

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agotests: Split cpu tests in separate files
Peter Meerwald [Tue, 22 Apr 2014 16:19:05 +0000 (18:19 +0200)]
tests: Split cpu tests in separate files

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agocpu: Add force_generic_code flag to cpu_info struct
Peter Meerwald [Fri, 18 Apr 2014 07:59:32 +0000 (09:59 +0200)]
cpu: Add force_generic_code flag to cpu_info struct

The remapper and channel mixing code have (faster) specialized and (slower)
generic code certain code path. The flag force_generic_code can be set to
force the generic code path which is useful for testing. Code duplication
(such as in mix-special-test) can be avoided, cleanup patches follow.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agocpu: Don't check for both x86 and ARM code
Peter Meerwald [Wed, 10 Sep 2014 13:53:37 +0000 (15:53 +0200)]
cpu: Don't check for both x86 and ARM code

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agocore: Add pa_cpu_init() / cpu.c
Peter Meerwald [Wed, 10 Sep 2014 13:23:11 +0000 (15:23 +0200)]
core: Add pa_cpu_init() / cpu.c

move code dealing with CPU specific code path initialization
from daemon/main.c to pulsecore/cpu.c

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agobluetooth: Add discovery to pa_bluetooth_backend_new
Luiz Augusto von Dentz [Wed, 10 Sep 2014 09:48:23 +0000 (11:48 +0200)]
bluetooth: Add discovery to pa_bluetooth_backend_new

9 years agobluetooth: Only create backend instance once objects are listed
Luiz Augusto von Dentz [Mon, 8 Sep 2014 10:35:33 +0000 (13:35 +0300)]
bluetooth: Only create backend instance once objects are listed

This makes sure the devices are discovered before the backend start
creating new transports.

9 years agoconfigure: Fix spelling of "backend"
David Henningsson [Wed, 10 Sep 2014 09:28:45 +0000 (11:28 +0200)]
configure: Fix spelling of "backend"

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoconfigure: fix headset check
Wim Taymans [Mon, 8 Sep 2014 09:15:55 +0000 (11:15 +0200)]
configure: fix headset check

9 years agoClient API: Add pa_stream_write_ext_free() function.
Lukasz Marek [Tue, 15 Apr 2014 00:08:23 +0000 (02:08 +0200)]
Client API: Add pa_stream_write_ext_free() function.

New function allows to pass data pointer that is a member
of the outer structure that need to be freed too when data
is not needed anymore.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
9 years agoalsa-mixer: recognize Dock headphone jack
Sjoerd Simons [Sun, 31 Aug 2014 18:11:21 +0000 (20:11 +0200)]
alsa-mixer: recognize Dock headphone jack

Recognize the Dock headphone jack in the same way the normal & front
headphone jacks are detected.

Reviewed-by: David Henningsson <david.henningsson@canonical.com>
9 years agocore-util: Fail if XDG_RUNTIME_DIR belongs to someone else
David Henningsson [Tue, 12 Nov 2013 06:52:48 +0000 (07:52 +0100)]
core-util: Fail if XDG_RUNTIME_DIR belongs to someone else

Usually, PA will use the PULSE_SERVER X11 property instead of using XDG_RUNTIME_DIR,
so this environment variable does not matter.

If this property is not available, or if one is using the pacmd cli protocol,
the client will go ahead and call pa_make_secure_dir on XDG_RUNTIME_DIR/pulse.
This will either fail (if you're another regular user), or succeed (if you're root).
Both scenarios are bad - failing will cause the connection to fail, and succeeding
is even worse, as it can cause *other* connections to fail (as the directory
ownership has changed).

Instead fail and complain loudly.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=83007
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agoalsa-mixer: Improve workaround for Valgrind's false warnings
David Henningsson [Tue, 2 Sep 2014 14:11:53 +0000 (16:11 +0200)]
alsa-mixer: Improve workaround for Valgrind's false warnings

Valgrind is not correctly handling ALSA TLV syscalls, which leads
to false warnings, looking like this:
 "Conditional jump or move depends on uninitialised value(s)"

Unfortunately, alsa-lib itself also uses these values which valgrind
falsely believe are uninitialized, so not all warnings are removed,
but this is what we can do from PA until the valgrind bug is fixed.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
9 years agobluetooth: Add pa_bluetooth_transport_unlink
Luiz Augusto von Dentz [Mon, 8 Sep 2014 09:14:43 +0000 (12:14 +0300)]
bluetooth: Add pa_bluetooth_transport_unlink

9 years agobluetooth: Add pa_bluetooth_transport_set_state
Luiz Augusto von Dentz [Mon, 8 Sep 2014 09:14:42 +0000 (12:14 +0300)]
bluetooth: Add pa_bluetooth_transport_set_state

9 years agoalsa-mixer: Mark "Line HP Swap" as required-any
Tanu Kaskinen [Sun, 7 Sep 2014 12:20:18 +0000 (15:20 +0300)]
alsa-mixer: Mark "Line HP Swap" as required-any

In the (theoretical) case that no other elements exists but
"Line HP Swap", the presence of that element signals that there are
headphone and line-out outputs, otherwise there would be nothing to
swap.

9 years agoendianmacros: Replace borked PA_FLOAT32_SWAP() with PA_READ_FLOAT32RE() / PA_WRITE_FL...
Peter Meerwald [Tue, 2 Sep 2014 21:53:09 +0000 (23:53 +0200)]
endianmacros: Replace borked PA_FLOAT32_SWAP() with PA_READ_FLOAT32RE() / PA_WRITE_FLOAT32RE()

building PA with -O0 leads to test failure in mix-test on i386

issue reported by Felipe, see
http://lists.freedesktop.org/archives/pulseaudio-discuss/2014-August/021406.html

the problem is the value 0xbeffbd7f: when byte-swapped it becomes 0x7fbdffbe and according
to IEEE-754 represents a signalling NaN (starting with s111 1111 10, see http://en.wikipedia.org/wiki/NaN)

when this value is assigned to a floating point register, it becomes 0x7ffdffbe, representing
a quiet NaN (starting with s111 1111 11) -- a signalling NaN is turned into a quiet NaN!

so PA_FLOAT32_SWAP(PA_FLOAT32_SWAP(x)) != x for certain values, uhuh!

the following test code can be used; due to volatile, it will always demonstrate the issue;
without volatile, it depends on the optimization level (i386, 32-bit, gcc 4.9):

// snip

static inline float PA_FLOAT32_SWAP(float x) {
    union {
        float f;
        uint32_t u;
    } t;

    t.f = x;
    t.u = bswap_32(t.u);
    return t.f;
}

int main() {
  unsigned x = 0xbeffbd7f;
  volatile float f = PA_FLOAT32_SWAP(*(float *)&x);
  printf("%08x %08x %08x %f\n", 0xbeffbd7f, *(unsigned *)&f, bswap_32(*(unsigned *)&f), f);
}
// snip

the problem goes away with optimization when no temporary floating point registers are used

the proposed solution is to avoid passing swapped floating point data in a
float; this is done with new functions PA_READ_FLOAT32RE() and PA_WRITE_FLOAT32RE()
which use uint32_t to dereference a pointer and byte-swap the data, hence no temporary
float variable is used

also delete PA_FLOAT32_TO_LE()/_BE(), not used

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Felipe Sateler <fsateler@debian.org>
9 years agosvolume: Make volume pointer parameter const for pa_volume_float32re_c()
Peter Meerwald [Wed, 3 Sep 2014 00:03:44 +0000 (02:03 +0200)]
svolume: Make volume pointer parameter const for pa_volume_float32re_c()

const obviously missing

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agodaemon: Debian/kFreeBSD 9.2 fails to compile due to caps
Peter Meerwald [Mon, 1 Sep 2014 20:53:29 +0000 (22:53 +0200)]
daemon: Debian/kFreeBSD 9.2 fails to compile due to caps

Debian/kFreeBSD 9.2 comes with sys/capability.h but it is not usable; work around it

the patch does several things:
* it makes the comment point to the correct bugtracker issue: https://bugs.freedesktop.org/show_bug.cgi?id=72580
* it handles Debian/kFreeBSD the same way as FreeBSD
* it logs a warning that capabilities are actually NOT dropped

daemon/caps.c: In function ‘pa_drop_caps’:
daemon/caps.c:93:2: error: #error "Don't know how to do capabilities on your system.  Please send a patch."
 #error "Don't know how to do capabilities on your system.  Please send a patch."
  ^
Makefile:9575: recipe for target 'daemon/pulseaudio-caps.o' failed

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
9 years agoReplace "authorization" with "authentication"
David Henningsson [Tue, 2 Sep 2014 09:50:39 +0000 (11:50 +0200)]
Replace "authorization" with "authentication"

Since we don't have "limited" clients, a client that authenticates
correctly is automatically authorized. However, it's the authentication
that can go wrong, rather than the authorization.

Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=78566
Signed-off-by: David Henningsson <david.henningsson@canonical.com>