Commit graph

8092 commits

Author SHA1 Message Date
Sjoerd Simons
66f97c35bd 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.
2014-11-03 08:52:09 +01:00
Tanu Kaskinen
717834086c 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
2014-10-31 14:30:22 +02:00
Arun Raghavan
5dfa83385c 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).
2014-10-31 10:47:56 +05:30
Wim Taymans
34a5c754a9 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.
2014-10-31 10:46:10 +05:30
Wim Taymans
7d4a497b3d 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.
2014-10-31 10:46:10 +05:30
Wim Taymans
d7199bafea 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.
2014-10-31 10:46:10 +05:30
Wim Taymans
2251085dda 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.
2014-10-31 10:46:10 +05:30
Arun Raghavan
8718496d14 creds: Rename pa_ancil to pa_cmsg_ancil_data
Makes the purpose of the structure clearear.
2014-10-31 10:46:10 +05:30
Peter Meerwald
72e5671ece 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>
2014-10-28 17:36:22 +01:00
Peter Meerwald
974fd3bcfd tests: Make global variables static in srbchannel-test
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Peter Meerwald
b7e763bab4 alsa-sink: Check for after-avail is redundant
after-avail is always false at this point

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Peter Meerwald
e798969fd5 modules: Fix )== typos
add a space between ) and ==

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Peter Meerwald
ab37729147 mainloop: Fix typo
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-10-28 17:36:22 +01:00
Peter Meerwald
f390e6e974 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>
2014-10-28 17:36:22 +01:00
Peter Meerwald
3fb349296f 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>
2014-10-28 17:36:21 +01:00
Michał Górny
ee4bbe5cd3 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.
2014-10-28 12:48:38 +02:00
Tanu Kaskinen
052316e419 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
2014-10-28 12:29:43 +02:00
David Henningsson
cc7c626e69 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>
2014-10-28 10:33:31 +01:00
Tanu Kaskinen
eaa80baea9 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.
2014-10-26 21:00:26 +02:00
Tanu Kaskinen
414646769d 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.
2014-10-26 21:00:23 +02:00
David Henningsson
356e133357 pstream-util: Fix build on freebsd
The previous fix was not entirely complete.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-10-26 08:23:36 +01:00
David Henningsson
e728bcf614 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>
2014-10-24 15:01:39 +02:00
David Henningsson
22827a5e1e 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>
2014-10-24 15:01:13 +02:00
David Henningsson
150ace90f3 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>
2014-10-24 15:00:56 +02:00
David Henningsson
6434853b04 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>
2014-10-24 14:59:31 +02:00
Tanu Kaskinen
4971dc9ed6 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.
2014-10-19 14:16:41 +03:00
Tanu Kaskinen
0df4d56cf8 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().
2014-10-19 14:04:46 +03:00
Ricardo Salveti de Araujo
4d9437d78a vala: adding missing fields for sink_input/source_output info struct
Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
2014-10-19 13:36:05 +03:00
Arun Raghavan
2e754b1e78 pulse: Initalise pa_threaded_mainloop with zeroes 2014-10-17 10:56:01 +02:00
Felipe Sateler
93c698c9fc 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.
2014-10-16 15:57:21 +02:00
David Henningsson
c45c0b1490 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>
2014-10-16 12:25:49 +02:00
Tanu Kaskinen
9c135b998c 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.
2014-10-09 15:45:07 +03:00
Ricardo Salveti de Araujo
9dd4e8df3e 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>
2014-10-06 15:50:03 +02:00
Tanu Kaskinen
8fb5e7c32a 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.
2014-10-06 13:30:35 +03:00
Dušan Kazik
f460676ee0 i18n: Update the Slovak translation 2014-10-06 13:21:34 +03:00
David Henningsson
8bfd38d6ca 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>
2014-10-03 14:23:59 +02:00
Tanu Kaskinen
f04e31dc5e 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.
2014-10-02 12:14:09 +03:00
Hui Wang
0e44b127d0 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>
2014-09-28 13:55:20 +03:00
Pali Rohár
380a7fc240 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>
2014-09-28 13:34:27 +03:00
Hui Wang
1ff4f1b67a 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>
2014-09-22 13:26:32 +02:00
Tanu Kaskinen
84ce398ea8 Add a Valgrind suppression file 2014-09-21 11:00:51 +03:00
David Henningsson
e521d38787 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>
2014-09-18 12:07:37 +02:00
David Henningsson
f8aa823998 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>
2014-09-18 11:51:47 +02:00
David Henningsson
c9e8c0703f 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>
2014-09-18 11:51:42 +02:00
David Henningsson
d303489ef0 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>
2014-09-18 11:51:37 +02:00
Luiz Augusto von Dentz
eb108b3539 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.
2014-09-18 10:54:23 +03:00
João Paulo Rechi Vita
7fac520d89 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.
2014-09-18 10:53:49 +03:00
João Paulo Rechi Vita
75bf00a507 bluetooth: Implement org.ofono.HandsfreeAudioAgent.NewConnection() 2014-09-16 14:46:40 +03:00
Dusan Kazik
7a44c9ee0f i18n: Add Slovak translation 2014-09-16 14:35:12 +03:00
David Henningsson
300a5e3ed7 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>
2014-09-16 09:33:04 +02:00