platform/upstream/pulseaudio.git
10 years agosink-input, source-output: Assign to volume from only one place
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:04 +0000 (13:56 +0300)]
sink-input, source-output: Assign to volume from only one place

Forcing all volume changes to go through set_volume_direct() makes
it easier to check where the stream volume is changed, and it also
allows us to have only one place where notifications for changed
volume are sent.

10 years agosink, source: Assign to reference_volume from only one place
Tanu Kaskinen [Tue, 15 Apr 2014 10:56:03 +0000 (13:56 +0300)]
sink, source: Assign to reference_volume from only one place

Forcing all reference volume changes to go through
set_reference_volume_direct() makes it easier to check where the
reference volume is changed, and it also allows us to have only one
place where notifications for changed reference volume are sent.

10 years agoremap: Add stereo to mono and 4-channel special case remapping
Peter Meerwald [Wed, 16 Apr 2014 17:02:02 +0000 (19:02 +0200)]
remap: Add stereo to mono and 4-channel special case remapping

The generic matrix remapping is rather inefficient; special-case code
improves performance by 3x easily.

v4: split into s16 and float code, 4-channel remapping
v3: fix remap_mono_to_stereo_c(), use assignment
v2: use consistent array addressing

on Intel Core i7-870 @ 2.93 GHz (GCC 4.6, 64-bit):

Checking special remap (float, mono->stereo)
func: 70392 usec (avg: 703.92, min = 583, max = 1879, stddev = 295.192).
orig: 193042 usec (avg: 1930.42, min = 1457, max = 2269, stddev = 89.9045).
Checking special remap (float, mono->4-channel)
func: 118408 usec (avg: 1184.08, min = 1151, max = 1454, stddev = 57.1244).
orig: 380074 usec (avg: 3800.74, min = 3740, max = 4180, stddev = 96.3389).
Checking special remap (s16, mono->stereo)
func: 60574 usec (avg: 605.74, min = 582, max = 659, stddev = 20.7681).
orig: 188262 usec (avg: 1882.62, min = 1804, max = 2167, stddev = 79.17).
Checking special remap (s16, mono->4-channel)
func: 120331 usec (avg: 1203.31, min = 1151, max = 1429, stddev = 55.2863).
orig: 376028 usec (avg: 3760.28, min = 3609, max = 4096, stddev = 122.043).
Checking special remap (float, stereo->mono)
func: 61408 usec (avg: 614.08, min = 580, max = 867, stddev = 50.933).
orig: 186484 usec (avg: 1864.84, min = 1808, max = 2121, stddev = 65.3967).
Checking special remap (float, 4-channel->mono)
func: 118101 usec (avg: 1181.01, min = 1157, max = 1383, stddev = 36.4474).
orig: 365191 usec (avg: 3651.91, min = 3540, max = 4083, stddev = 117.509).
Checking special remap (s16, stereo->mono)
func: 82908 usec (avg: 829.08, min = 795, max = 953, stddev = 33.3409).
orig: 182565 usec (avg: 1825.65, min = 1774, max = 2117, stddev = 65.5401).
Checking special remap (s16, 4-channel->mono)
func: 132025 usec (avg: 1320.25, min = 1284, max = 1509, stddev = 47.0133).
orig: 363347 usec (avg: 3633.47, min = 3560, max = 4012, stddev = 111.259).

on ARM Cortex-A8 (TI OMAP3 DM3730 @ 1GHz) (Linaro GCC 4.6):

Checking special remap (float, mono->stereo)
func: 1213562 usec (avg: 12135.6, min = 4669, max = 16266, stddev = 2067.64).
orig: 9251927 usec (avg: 92519.3, min = 87372, max = 134216, stddev = 5965.79).
Checking special remap (float, mono->4-channel)
func: 2479550 usec (avg: 24795.5, min = 7507, max = 29358, stddev = 2690.16).
orig: 13186133 usec (avg: 131861, min = 119843, max = 263855, stddev = 27309).
Checking special remap (s16, mono->stereo)
func: 471894 usec (avg: 4718.94, min = 4058, max = 9583, stddev = 1302.7).
orig: 1673826 usec (avg: 16738.3, min = 14679, max = 31342, stddev = 2271.67).
Checking special remap (s16, mono->4-channel)
func: 869508 usec (avg: 8695.08, min = 7019, max = 19165, stddev = 1866.94).
orig: 3317020 usec (avg: 33170.2, min = 29327, max = 47577, stddev = 2029.11).
Checking special remap (float, stereo->mono)
func: 4405182 usec (avg: 44051.8, min = 41443, max = 77912, stddev = 4160.54).
orig: 13245064 usec (avg: 132451, min = 125244, max = 182282, stddev = 8543.93).
Checking special remap (float, 4-channel->mono)
func: 8607974 usec (avg: 86079.7, min = 81909, max = 116608, stddev = 4311.52).
orig: 26326036 usec (avg: 263260, min = 255097, max = 312928, stddev = 10111.5).
Checking special remap (s16, stereo->mono)
func: 1209135 usec (avg: 12091.4, min = 10742, max = 16632, stddev = 1633.88).
orig: 3081515 usec (avg: 30815.2, min = 27008, max = 50537, stddev = 3124.35).
Checking special remap (s16, 4-channel->mono)
func: 1653868 usec (avg: 16538.7, min = 14648, max = 20721, stddev = 1834.52).
orig: 6017854 usec (avg: 60178.5, min = 56061, max = 89569, stddev = 4052.86).

benchmark code will be posted as follow-up patches

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Add special remapping case which just re-arranges channels
Peter Meerwald [Wed, 16 Apr 2014 13:07:25 +0000 (15:07 +0200)]
remap: Add special remapping case which just re-arranges channels

Input channels may just be copied to output channels, no mixing; this
avoids the generic (slow) matrix remapping code in cases where channels
are dropped or reordered.
This makes use of the remap struct state introduced earlier.

on Intel Core i7-870 @ 2.93 GHz (GCC 4.6, 64-bit):

Checking special remap (s16, stereo rearrange)
func: 126117 usec (avg: 1261.17, min = 1150, max = 2111, stddev = 117.332).
orig: 190509 usec (avg: 1905.09, min = 1807, max = 2402, stddev = 100.984).
Checking special remap (float, stereo rearrange)
func: 194329 usec (avg: 1943.29, min = 1876, max = 2127, stddev = 64.3486).
orig: 205263 usec (avg: 2052.63, min = 2005, max = 2452, stddev = 70.177).
Checking special remap (s16, 4-channel rearrange)
func: 278754 usec (avg: 2787.54, min = 2719, max = 3093, stddev = 78.22).
orig: 383885 usec (avg: 3838.85, min = 3634, max = 4121, stddev = 128.522).
Checking special remap (float, 4-channel rearrange)
func: 312429 usec (avg: 3124.29, min = 3017, max = 3498, stddev = 120.127).
orig: 388198 usec (avg: 3881.98, min = 3768, max = 4655, stddev = 138.441).

on ARM Cortex-A8 (TI OMAP3 DM3730 @ 1GHz) (Linaro GCC 4.6):

Checking special remap (s16, stereo rearrange)
func: 1204647 usec (avg: 12046.5, min = 10406, max = 25451, stddev = 2491.9).
orig: 1660311 usec (avg: 16603.1, min = 14740, max = 20416, stddev = 1708.07).
Checking special remap (float, stereo rearrange)
func: 1391392 usec (avg: 13913.9, min = 12207, max = 28260, stddev = 2238.12).
orig: 9246707 usec (avg: 92467.1, min = 87525, max = 125611, stddev = 5494.64).
Checking special remap (s16, 4-channel rearrange)
func: 2540225 usec (avg: 25402.2, min = 16937, max = 68268, stddev = 10786.7).
orig: 3319852 usec (avg: 33198.5, min = 29571, max = 36957, stddev = 1250.39).
Checking special remap (float, 4-channel rearrange)
func: 3024414 usec (avg: 30244.1, min = 26153, max = 58105, stddev = 4506.01).
orig: 12643624 usec (avg: 126436, min = 120575, max = 159088, stddev = 5519.28).

benchmark code will be posted as follow-up patches

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Add (optional) state to remap struct
Peter Meerwald [Wed, 16 Apr 2014 13:00:45 +0000 (15:00 +0200)]
remap: Add (optional) state to remap struct

State can be used by remap function implementations to
speed up the remapping, e.g. by precomputing things or
even by generating specialized code for a specific channel
remapping task

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Change remapping function argument type from void to int16_t / float as approp...
Peter Meerwald [Sun, 27 Apr 2014 20:22:03 +0000 (22:22 +0200)]
remap: Change remapping function argument type from void to int16_t / float as appropriate

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Cleanup remap function selection, add pa_set_remap_func() helper
Peter Meerwald [Tue, 22 Apr 2014 15:45:23 +0000 (17:45 +0200)]
remap: Cleanup remap function selection, add pa_set_remap_func() helper

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Add helper function to setup channel arrangement information
Peter Meerwald [Wed, 16 Apr 2014 13:06:29 +0000 (15:06 +0200)]
remap: Add helper function to setup channel arrangement information

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Use float constant instead of double
Peter Meerwald [Wed, 16 Apr 2014 10:00:06 +0000 (12:00 +0200)]
remap: Use float constant instead of double

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Split remapping functions into s16 and float implementation
Peter Meerwald [Wed, 16 Apr 2014 09:58:11 +0000 (11:58 +0200)]
remap: Split remapping functions into s16 and float implementation

The sample format is known when the remap structure is initialized,
no runtime decision needed.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Make resampler's remap structure more self-contained
Peter Meerwald [Wed, 16 Apr 2014 09:25:58 +0000 (11:25 +0200)]
remap: Make resampler's remap structure more self-contained

Initialization of the remap structure now happens in one place

Rename calc_map_table() to setup_remap(), copy sample format and
channel specs; the remap structure is initialized when we know the
work sample format of the resampler

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Refactor channel remap table computation calc_map_table()
Peter Meerwald [Wed, 16 Apr 2014 08:48:21 +0000 (10:48 +0200)]
remap: Refactor channel remap table computation calc_map_table()

Make the resampler argument const, and pass explicit remap
structure argument

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Rename pa_init_remap() to pa_init_remap_func()
Peter Meerwald [Wed, 16 Apr 2014 09:37:50 +0000 (11:37 +0200)]
remap: Rename pa_init_remap() to pa_init_remap_func()

pa_init_remap_func() only sets the appropriate remapping function, it
does not initialize the pa_remap struct

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoremap: Don't use PA_VOLUME_NORM
Peter Meerwald [Wed, 16 Apr 2014 17:24:01 +0000 (19:24 +0200)]
remap: Don't use PA_VOLUME_NORM

remapping operates on channel contributions, not volumes

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agopacat: Mention source in addition to sink where applicable in help
Peter Meerwald [Wed, 16 Apr 2014 16:12:52 +0000 (18:12 +0200)]
pacat: Mention source in addition to sink where applicable in help

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agosconv: Cleanup ARM NEON code
Peter Meerwald [Wed, 16 Apr 2014 16:20:16 +0000 (18:20 +0200)]
sconv: Cleanup ARM NEON code

Fix compiler warning, code formatting

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agodefault.pa: Use freedesktop theme sounds in sample examples
Bradley Broom [Sat, 26 Apr 2014 09:16:50 +0000 (12:16 +0300)]
default.pa: Use freedesktop theme sounds in sample examples

10 years agogconf: Avoid calling deprecated function if possible
Arun Raghavan [Tue, 22 Apr 2014 07:35:19 +0000 (13:05 +0530)]
gconf: Avoid calling deprecated function if possible

g_type_init() is need no longer be called explicitly from glib 2.36
onwards.

10 years agogconf: Remove unused variable
Arun Raghavan [Tue, 22 Apr 2014 07:35:18 +0000 (13:05 +0530)]
gconf: Remove unused variable

10 years agosink-input, source-output: Fix mute saving
Tanu Kaskinen [Tue, 15 Apr 2014 07:59:03 +0000 (10:59 +0300)]
sink-input, source-output: Fix mute saving

"i->save_muted = i->save_muted || mute" makes no sense. The intention
was most likely to use "save" instead of "mute" in the assignment.
This line originates from reverting the volume ramping code, commit
8401572fd534f10e07ed6a418e1399b1294d5596.

The idea of "i->save_muted |= save" is that even if the mute state
doesn't change, save_muted should still be updated, but only if the
transition is from "don't save" to "save".

Changing "!i->muted == !mute" to "mute == i->muted" is cosmetic only.
The rationale behind the old form was probably that when we still had
pa_bool_t, booleans could in theory be defined as int, so comparing
the values without the ! operator was not entirely safe. That's
unnecessary now that we use the standard bool type, which can only
have values 0 or 1.

10 years agocombine-sink: fix zero adjust_time behaviour.
Hemanth Meenakshisundaram [Mon, 21 Apr 2014 00:30:07 +0000 (17:30 -0700)]
combine-sink: fix zero adjust_time behaviour.

A value of 0 for adjust_time should disable rate adjustment.
Fix a bug where a 0 value causes rate adjustment to be called
continuously instead after an unsuspend event.

10 years agocore-util: Remove redundant check of directory permissions
Alexander E. Patrakov [Sun, 20 Apr 2014 15:58:19 +0000 (21:58 +0600)]
core-util: Remove redundant check of directory permissions

Initially (in commit ef422fa4ae626e9638ca70d1c56f27e701dd69c2),
pa_make_secure_dir followed a simple principle: "make a directory, or,
if it exists, check that it is suitable". Later this evolved into "make
a directory, or, if it exists, ensure that it is suitable". But the
check remained.

The check is now neither sufficient nor necessary. On POSIX-compliant
systems, the fstat results being checked are actually post-conditions of
fchmod and fchown. And on systems implementing POSIX ACLs, fstat only
reflects a part of the information relevant to the security of the
directory permissions, so PulseAudio could accept an existing insecure
directory anyway.

Also, the check still fires on non-POSIX-compliant filesystems like CIFS.
As a user cannot do anything to fix it, just accept insecure permissions
in this case.

10 years agocore-util: Call fchown() only when necessary
Bradley Broom [Fri, 25 Apr 2014 10:00:00 +0000 (13:00 +0300)]
core-util: Call fchown() only when necessary

This reportedly fixes some cases where the home directory is on NFS.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=45656
10 years agofdsem: Use atomic.h
David Henningsson [Tue, 15 Apr 2014 15:23:06 +0000 (17:23 +0200)]
fdsem: Use atomic.h

The fdsem header uses pa_atomic_t, which is declared in atomic.h

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agofdsem: remove superfluous parameter in call to pa_fdsem_new_shm
David Henningsson [Tue, 15 Apr 2014 14:26:12 +0000 (16:26 +0200)]
fdsem: remove superfluous parameter in call to pa_fdsem_new_shm

This parameter was never assigned, so just remove it.

Note that the only current user of this function is shmasyncq.c,
which is unused - we don't even build it. But I fixed it up anyway.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agovala: Add bindings for libpulse-simple
Alexander Kurtz [Thu, 17 Apr 2014 12:22:04 +0000 (15:22 +0300)]
vala: Add bindings for libpulse-simple

10 years agodbus: Use correct initialization for source ports hashmap.
Juho Hämäläinen [Tue, 15 Apr 2014 13:11:48 +0000 (16:11 +0300)]
dbus: Use correct initialization for source ports hashmap.

Source ports hashmap is created without value freeing function, which
results in (hashmap values) device ports not being freed when source
ports are removed or module is unloaded. This results in memory leak
during normal operation and during daemon shutdown dbus_protocol shared
object isn't unreferenced correctly, leaving dbus_protocol object in
core->shared, which causes assert when shared hashmap is checked for
isempty() before freeing.

10 years agodoxygen: Enable GENERATE_DEPRECATEDLIST
Tanu Kaskinen [Sat, 5 Apr 2014 09:30:47 +0000 (12:30 +0300)]
doxygen: Enable GENERATE_DEPRECATEDLIST

This generates a list of deprecated things, which is accessible from
the table of contents frame. The list, however, isn't the important
thing here. The important thing is that this also prevents doxygen
from stripping all documentation for the deprecated things.

Previous discussion:
http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/18794

10 years agovirtual-surround-sink: Move normalization heuristic to its own function
Niels Ole Salscheider [Wed, 2 Apr 2014 20:32:34 +0000 (22:32 +0200)]
virtual-surround-sink: Move normalization heuristic to its own function

This patch also adds a description how the heuristic works and mentions that
there is a scaling factor that can be adjusted if there is audible clipping.

10 years agoUse pa_hashmap_remove_and_free() where appropriate
Tanu Kaskinen [Wed, 26 Mar 2014 15:39:48 +0000 (17:39 +0200)]
Use pa_hashmap_remove_and_free() where appropriate

10 years agohashmap: Add pa_hashmap_remove_and_free()
Tanu Kaskinen [Wed, 26 Mar 2014 15:39:47 +0000 (17:39 +0200)]
hashmap: Add pa_hashmap_remove_and_free()

10 years agopactl: Clean up checking for VOL_RELATIVE flag
Peter Meerwald [Sat, 29 Mar 2014 17:03:05 +0000 (18:03 +0100)]
pactl: Clean up checking for VOL_RELATIVE flag

VOL_RELATIVE if a bit flag (1 << 4), hence we can simply do
    if (vol_flags & VOL_RELATIVE) ...
instead of
    if ((vol_flags & VOL_RELATIVE) == VOL_RELATIVE) ...

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agopactl: Document ability to specify channel volumes individually
Peter Meerwald [Thu, 13 Feb 2014 20:15:04 +0000 (21:15 +0100)]
pactl: Document ability to specify channel volumes individually

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agopactl: Check consistency of volumes specified
Peter Meerwald [Thu, 13 Feb 2014 20:07:06 +0000 (21:07 +0100)]
pactl: Check consistency of volumes specified

Must use one way to specify volumes consistently, e.g.
+3dB +3dB, mixing different ways is not allowed, such as
40% 1000

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agopactl: Allow to set volume of each channel independently (Bug #39190)
Parin Porecha [Thu, 19 Dec 2013 11:58:15 +0000 (17:28 +0530)]
pactl: Allow to set volume of each channel independently (Bug #39190)

Example: pactl set-sink-volume "sink_name" 32000 40000
If the number of volumes provided is different than the number of channels
(excluding the case where a single volume is provided), an error message
is displayed explaining why the volumes could not be set.

patch proposed by Parin Porecha
code refactoring and commit message slightly edited by Peter Meerwald

10 years agopactl: Stop parsing option when the first non-option is encountered
Peter Meerwald [Tue, 15 Apr 2014 08:58:21 +0000 (10:58 +0200)]
pactl: Stop parsing option when the first non-option is encountered

fix bug
https://bugs.freedesktop.org/show_bug.cgi?id=77108

see getopt(3):
""By default, getopt() permutes the contents of argv as it scans, so that
  eventually all the nonoptions are at the end.  Two other modes are also
  implemented.   If  the first character of optstring is '+' or the envi‐
  ronment variable POSIXLY_CORRECT is set, then option  processing  stops
  as soon as a nonoption argument is encountered.  If the first character
  of optstring is '-', then each nonoption argv-element is handled as  if
  it were the argument of an option with character code 1.  (This is used
  by programs that were written to expect options and other argv-elements
  in any order and that care about the ordering of the two.)  The special
  argument "--" forces an end of option-scanning regardless of the  scan‐
  ning mode.""

prepend optstring with '+' to use POSIXLY_CORRECT mode

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoman: Fix typos in pulse-daemon.conf.5.xml.in
Peter Meerwald [Tue, 15 Apr 2014 08:37:26 +0000 (10:37 +0200)]
man: Fix typos in pulse-daemon.conf.5.xml.in

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agopstream: Use pa_xnew0 in initialization
David Henningsson [Tue, 15 Apr 2014 09:52:22 +0000 (11:52 +0200)]
pstream: Use pa_xnew0 in initialization

...for simplicity.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoName HDMI outputs uniquely
Alexander E. Patrakov [Thu, 10 Apr 2014 15:13:43 +0000 (21:13 +0600)]
Name HDMI outputs uniquely

On Haswell hardware, there are multiple HDMI outputs capable of
digital sound output. As they were identically named, KDE's control
center was unable to distinguish them, restored the wrong profile and
thus routed sound to the wrong HDMI monitor.

Also, having identically-named menu items in other mixer applications
looks like a bug.

10 years agomodule-switch-on-port-available: Use new find best port function
David Henningsson [Fri, 28 Mar 2014 10:09:14 +0000 (11:09 +0100)]
module-switch-on-port-available: Use new find best port function

Now that we have a generic function in device-port.h, we can use
it instead of the custom one.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agomodule-switch-on-port-available: Use port->card pointer
David Henningsson [Fri, 28 Mar 2014 10:55:24 +0000 (11:55 +0100)]
module-switch-on-port-available: Use port->card pointer

We now have a port->card pointer, we can use it instead of iterating
over cards to find the correct one.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agomodule-switch-on-port-available: Don't switch profiles on uninitialized cards
David Henningsson [Fri, 28 Mar 2014 10:59:09 +0000 (11:59 +0100)]
module-switch-on-port-available: Don't switch profiles on uninitialized cards

This could cause the HDMI port to become the default on some systems
where analog output was available.

BugLink: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/1256511
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=73375
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agozeroconf-publish: Don't assume any particular defer event ordering
Tanu Kaskinen [Wed, 19 Mar 2014 07:50:39 +0000 (09:50 +0200)]
zeroconf-publish: Don't assume any particular defer event ordering

Also, initialize userdata with zeros to avoid invalid pointers in
client_free().

This fixes a crash when client_free() is called before
create_client(). The whole issue could be avoided by using some other
mechanism than defer events for running the two functions, but I'll
do that change later (I have also other cleanups planned for
zeroconf-publish).

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=76184
10 years agoclient-conf: Don't create multiple cookie files
Tanu Kaskinen [Wed, 19 Mar 2014 10:19:08 +0000 (12:19 +0200)]
client-conf: Don't create multiple cookie files

The old code loaded cookies at the time of loading the client
configuration, which could lead to creation of multiple cookie files.
For example, when pa_client_conf_load() was called, the default cookie
file was created, and then if PULSE_COOKIE was set,
pa_client_conf_env() would create another cookie file.

This patch moves the loading of the cookie to a separate function,
which pa_context calls just before needing the cookie, so the cookie
won't be loaded from the default file if PULSE_COOKIE is set. This
patch also splits the single cookie and cookie_file fields in
pa_client_conf into multiple fields, one for each possible cookie
source. That change allows falling back to another cookie source if
the primary source doesn't work.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=75006
10 years agoclient-conf: Remove redundant function parameters
Tanu Kaskinen [Wed, 19 Mar 2014 10:19:07 +0000 (12:19 +0200)]
client-conf: Remove redundant function parameters

10 years agoutil: Check that the home dir is an absolute path
Tanu Kaskinen [Wed, 19 Mar 2014 10:16:08 +0000 (12:16 +0200)]
util: Check that the home dir is an absolute path

Avoid unpredictable behaviour in case e.g. the HOME environment
variable is incorrectly set up for whatever reason.

I haven't seen non-absolute HOME anywhere, but this feels like a good
sanity check anyway.

10 years agopactl: Fix crash with older servers
Tanu Kaskinen [Wed, 19 Mar 2014 07:18:06 +0000 (09:18 +0200)]
pactl: Fix crash with older servers

Servers older than 0.9.15 don't know anything about cards, and card
operations will return a NULL pa_operation object when connected to
that old server. We must check the pa_operation pointer before passing
it to pa_operation_unref(), otherwise a NULL operation will result in
a crash.

10 years agosink/source: Initialize port before fixate hook (fixes volume/mute not saved)
David Henningsson [Fri, 21 Mar 2014 09:19:19 +0000 (10:19 +0100)]
sink/source: Initialize port before fixate hook (fixes volume/mute not saved)

In case a port has not yet been saved, which is e g often the case
if a sink/source has only one port, reading volume/mute will be done
without port, whereas writing volume/mute will be done with port.

Work around this by setting a default port before the fixate hook,
so module-device-restore can read volume/mute for the correct port.

BugLink: https://bugs.launchpad.net/bugs/1289515
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agointrospect: Use pa_direction_valid() to validate port direction
Tanu Kaskinen [Wed, 26 Mar 2014 09:52:34 +0000 (11:52 +0200)]
introspect: Use pa_direction_valid() to validate port direction

There's no behavioral change, just nicer code.

10 years agodirection: Add a couple of direction helper functions
Tanu Kaskinen [Wed, 26 Mar 2014 09:52:33 +0000 (11:52 +0200)]
direction: Add a couple of direction helper functions

10 years agodevice-restore: log restored mute state
Wim Taymans [Wed, 26 Mar 2014 14:57:16 +0000 (15:57 +0100)]
device-restore: log restored mute state

Log the mute state as it was restored

10 years agoalsa-util: Reset hwparams_copy before the second try of buffer setup
Peter Ujfalusi [Fri, 21 Mar 2014 07:18:40 +0000 (09:18 +0200)]
alsa-util: Reset hwparams_copy before the second try of buffer setup

hwparams_copy needs to be reset (as it is also reset for the third and
fourth try) before the second try.

If the reset is not done and the first try fails:
D: [lt-pulseaudio] alsa-util.c: Maximum hw buffer size is 743 ms
I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_period_size_near() failed: Invalid argument
I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
D: [lt-pulseaudio] alsa-util.c: Set only period size (to 1102 samples).

We have three failures and finally the fourth (only period size) succeed.

With this patch:
D: [lt-pulseaudio] alsa-util.c: Maximum hw buffer size is 743 ms
I: [lt-pulseaudio] alsa-util.c: snd_pcm_hw_params_set_buffer_size_near() failed: Invalid argument
D: [lt-pulseaudio] alsa-util.c: Set period size first (to 1102 samples), buffer size second (to 4408 samples).

We only fail with the first try, the second (period followed by buffer) is
fine.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
10 years agodoxygen: Update the configuration file
Tanu Kaskinen [Sat, 15 Mar 2014 10:43:12 +0000 (12:43 +0200)]
doxygen: Update the configuration file

I reviewed the changes, and I didn't find anything that would actually
have effects on the generated output.

10 years agozeroconf-publish: Don't react to messages while shutting down
Tanu Kaskinen [Sat, 15 Mar 2014 07:37:06 +0000 (09:37 +0200)]
zeroconf-publish: Don't react to messages while shutting down

This fixes a case where pa__done() is called while
AVAHI_MESSAGE_PUBLISH_ALL is waiting for processing. The
pa_asyncmsgq_wait_for(AVAHI_MESSAGE_SHUTDOWN_COMPLETE) call will
process all pending messages, and processing AVAHI_MESSAGE_PUBLISH_ALL
causes publish_all_services(), and that in turn accesses u->services,
which has been already freed at this point. If we are shutting down,
we shouldn't react to any of the messages that the Avahi thread is
sending to the main thread.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=76184
10 years agozeroconf-publish: Add locking around pa_mainloop_api_once()
Tanu Kaskinen [Sat, 15 Mar 2014 07:37:05 +0000 (09:37 +0200)]
zeroconf-publish: Add locking around pa_mainloop_api_once()

Commit e1e154c7377779377fa1a36655a10effd693f7b5 added locking around
pa_mainloop_api_once() everywhere except pa__done(). This fixes that
omission.

10 years agopacat: Fix partially translated message
Tanu Kaskinen [Mon, 24 Mar 2014 07:22:20 +0000 (09:22 +0200)]
pacat: Fix partially translated message

The word "not" was not translated.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=76529
10 years agocore-util: Make pa_yes_no() translatable
Tanu Kaskinen [Mon, 24 Mar 2014 07:17:53 +0000 (09:17 +0200)]
core-util: Make pa_yes_no() translatable

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=76529
10 years agodoc: Fix some typos/wording in man/pulse-daemon.conf.5
Peter Meerwald [Mon, 17 Mar 2014 14:36:22 +0000 (15:36 +0100)]
doc: Fix some typos/wording in man/pulse-daemon.conf.5

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agomainloop-api: Improve pa_mainloop_api_once() documentation
Tanu Kaskinen [Sat, 15 Mar 2014 07:52:07 +0000 (09:52 +0200)]
mainloop-api: Improve pa_mainloop_api_once() documentation

10 years agovolume: Increase PA_SW_VOLUME_SNPRINT_DB_MAX
Tanu Kaskinen [Sun, 9 Mar 2014 08:56:07 +0000 (10:56 +0200)]
volume: Increase PA_SW_VOLUME_SNPRINT_DB_MAX

10 bytes isn't enough for "-123.45 dB", including the terminating null
byte.

10 years agoalsa: Use card description in default sink/source prefix when available
Pete Beardmore [Thu, 13 Mar 2014 10:14:40 +0000 (10:14 +0000)]
alsa: Use card description in default sink/source prefix when available

When given an explicit device.description in card_properties, prefer
this information over other default prefixes (e.g. 'Built-in Audio')
when constructing sink/source descriptions.

For example, if I manually configure the card description to be
"FooBar", I then expect that the sinks and created by the card also
have "FooBar" in their description instead of generic "Built-in
Audio".

10 years agotunnel: Fix inverted if condition
Tanu Kaskinen [Thu, 13 Mar 2014 11:04:55 +0000 (13:04 +0200)]
tunnel: Fix inverted if condition

10 years agoalsa-mixer: Fix Analog Input showing up on USB Headset
David Henningsson [Tue, 11 Mar 2014 04:50:10 +0000 (05:50 +0100)]
alsa-mixer: Fix Analog Input showing up on USB Headset

In some cases, "Analog Input" could show up as well as
"Headset Mic" (or "Headphone Mic"), because I forgot to add the
relevant "required-absent" lines when I added the headset mic path.

As a result, both "Analog Input" and "Headset Mic" showed up on the
Logitech USB 530 Headset.

Reported-by: Steve Magoun <steve.magoun@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agopactl: Fix a copy-paster error
Tanu Kaskinen [Mon, 10 Mar 2014 10:48:23 +0000 (12:48 +0200)]
pactl: Fix a copy-paster error

10 years agodoc: Use \since doxygen command correctly in mainloop-api.h
Peter Meerwald [Fri, 7 Mar 2014 12:08:35 +0000 (13:08 +0100)]
doc: Use \since doxygen command correctly in mainloop-api.h

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agocore: add missing SET_PORT_LATENCY_OFFSET to dispatcher opcode string table
Peter Meerwald [Fri, 7 Mar 2014 11:33:06 +0000 (12:33 +0100)]
core: add missing SET_PORT_LATENCY_OFFSET to dispatcher opcode string table

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agodoc: Use correct parameter name wait_for_accept in documentation of pa_threaded_mainl...
Peter Meerwald [Fri, 7 Mar 2014 12:34:41 +0000 (13:34 +0100)]
doc: Use correct parameter name wait_for_accept in documentation of pa_threaded_mainloop_signal()

also sneaks in a full stop in documentation elsewhere

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoFix a few "it's -> its" typos
Alexander E. Patrakov [Fri, 7 Mar 2014 15:26:28 +0000 (21:26 +0600)]
Fix a few "it's -> its" typos

10 years agotunnel-source-new: Fix shadow compiler warning
Peter Meerwald [Thu, 6 Mar 2014 12:15:12 +0000 (13:15 +0100)]
tunnel-source-new: Fix shadow compiler warning

  CC     modules/module_tunnel_sink_la-module-tunnel.lo
modules/module-tunnel-source-new.c: In function 'read_new_samples':
modules/module-tunnel-source-new.c:145:16: warning: declaration of 'read' shadows a global declaration [-Wshadow]

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agodoc: Fix pa_stream_set_latency_update_callback() documentation
Peter Meerwald [Thu, 6 Mar 2014 09:31:32 +0000 (10:31 +0100)]
doc: Fix pa_stream_set_latency_update_callback() documentation

the latency_update callback is supported on playback AND record
streams

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agodoc: Fix a couple of 'to to' typos
Peter Meerwald [Thu, 6 Mar 2014 09:25:35 +0000 (10:25 +0100)]
doc: Fix a couple of 'to to' typos

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agoalsa: Remove a redundant check
Tanu Kaskinen [Wed, 29 Jan 2014 18:59:00 +0000 (20:59 +0200)]
alsa: Remove a redundant check

If mixer_handle is not NULL, then hctl_handle won't be NULL either.
The redundant check was confusing, because it looked like we would
leak the mixer_handle if mixer_handle is non-NULL and hctl_handle is
NULL.

10 years agobluetooth: Fix timing to count based on decoded data
James Bunton [Sun, 26 Jan 2014 14:14:39 +0000 (01:14 +1100)]
bluetooth: Fix timing to count based on decoded data

Currently the latency information is being updated based on the encoded
SBC data instead of the decoded PCM data. Fixing this required moving
the timing update to be after the packet has been decoded.

10 years agobluetooth: Don't abort on SBC decoding error
James Bunton [Sun, 26 Jan 2014 14:14:38 +0000 (01:14 +1100)]
bluetooth: Don't abort on SBC decoding error

The Nokia E7 running Symbian Belle Refresh seems to generate invalid SBC
packets every few minutes. This causes pulseaudio to disconnect the
stream and log "SBC decoding error (-3)".

If a single packet is bad, pulseaudio should keep playing the stream.

10 years agoRemove all references to the removed KDE files
Tanu Kaskinen [Sun, 26 Jan 2014 15:40:31 +0000 (17:40 +0200)]
Remove all references to the removed KDE files

10 years agodaemon: ensure pulseaudio early startup on kde
Rex Dieter [Wed, 22 Jan 2014 15:43:27 +0000 (09:43 -0600)]
daemon: ensure pulseaudio early startup on kde

10 years agodaemon: consolidate startup scripts
Rex Dieter [Wed, 22 Jan 2014 15:41:35 +0000 (09:41 -0600)]
daemon: consolidate startup scripts

simplify pulseaudio autostart into one, avoid needless extra
work for kde, and avoid possible startup races.

10 years agosuspend-on-idle: Fix monitor source handling upstream/5.0 v5.0
Tanu Kaskinen [Mon, 3 Mar 2014 14:21:21 +0000 (16:21 +0200)]
suspend-on-idle: Fix monitor source handling

Fixes a crash that happened due to calling pa_source_check_suspend()
when d->source was NULL.

10 years agoUpdate NEWS
Tanu Kaskinen [Mon, 3 Mar 2014 13:42:21 +0000 (15:42 +0200)]
Update NEWS

10 years agortp-send: Add "inhibit_auto_suspend" module argument
Tanu Kaskinen [Sun, 23 Feb 2014 17:47:15 +0000 (19:47 +0200)]
rtp-send: Add "inhibit_auto_suspend" module argument

Some people want module-rtp-send to send silence when the sink that is
monitored goes idle, and some people want module-rtp-send to pause the
RTP stream to avoid unnecessary bandwidth consumption.

10 years agosuspend-on-idle: Ensure we still time out if a stream remains corked
David Henningsson [Tue, 25 Feb 2014 15:56:49 +0000 (16:56 +0100)]
suspend-on-idle: Ensure we still time out if a stream remains corked

If a stream is started corked and remains corked, the sink/source
remained idle without being properly suspended. This patch fixes
that issue.

BugLink: https://bugs.launchpad.net/bugs/1284415
Tested-by: Ricardo Salveti <ricardo.salveti@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agosink-input/source-output: Fix LFE remixing suddenly enabled
David Henningsson [Fri, 28 Feb 2014 11:16:54 +0000 (12:16 +0100)]
sink-input/source-output: Fix LFE remixing suddenly enabled

Steps to reproduce:
 1) Leave LFE remixing disabled (the default)
 2) Start playback of stereo material on e g 5.1 surround, notice nothing in LFE
 3) Now change profile to e g 4.0 surround and then back to 5.1 surround
 4) Notice that LFE channel is now remixed

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
10 years agoMake tests compile on FreeBSD
Koop Mast [Sat, 22 Feb 2014 23:56:59 +0000 (00:56 +0100)]
Make tests compile on FreeBSD

cpu_set_t is named cpuset_t on FreeBSD.
Add headers to allow for warning free compilation.

10 years agortp-send: Use _cb suffix with callbacks
Tanu Kaskinen [Sun, 23 Feb 2014 17:41:42 +0000 (19:41 +0200)]
rtp-send: Use _cb suffix with callbacks

10 years agodoc: Assorted spelling and grammar fixes for doxygen output
Peter Meerwald [Thu, 20 Feb 2014 20:41:47 +0000 (21:41 +0100)]
doc: Assorted spelling and grammar fixes for doxygen output

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agomodules: Fix uninitialized variable in rtp-send
Peter Meerwald [Fri, 3 Jan 2014 22:52:19 +0000 (23:52 +0100)]
modules: Fix uninitialized variable in rtp-send

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
10 years agosconv, svolume: Fix compilation on 32-bit FreeBSD
Koop Mast [Thu, 20 Feb 2014 23:21:46 +0000 (00:21 +0100)]
sconv, svolume: Fix compilation on 32-bit FreeBSD

Don't try to compile this code on 32-bit FreeBSD, it will error out complain
about registers only being available in 64-bit mode.

10 years agoRevert "protocol-native: Don't enumerate unlinked sinks and sources"
Arun Raghavan [Mon, 17 Feb 2014 11:02:40 +0000 (16:32 +0530)]
Revert "protocol-native: Don't enumerate unlinked sinks and sources"

This reverts commit bd0bd9143f8159e5475b1295e30ec026ff0b6fef.

10 years agobuild-sys: Bump soname v4.99.4
Arun Raghavan [Sat, 15 Feb 2014 04:34:39 +0000 (10:04 +0530)]
build-sys: Bump soname

Bumping from 0->3 since we missed bumping correctly for v4.99.{1,2,3}

10 years agoprotocol-native: Don't enumerate unlinked sinks and sources
Arun Raghavan [Sun, 8 Dec 2013 22:18:00 +0000 (14:18 -0800)]
protocol-native: Don't enumerate unlinked sinks and sources

This makes sure that there is no window between pa_sink/source_new()
and _put() where enumerating sinks/sources causes an assert (several
calls in sink/source_get_info need a linked sink or source).

10 years agosink-input, source-output: Don't crash if format negotiation fails
Tanu Kaskinen [Wed, 12 Feb 2014 10:41:34 +0000 (12:41 +0200)]
sink-input, source-output: Don't crash if format negotiation fails

A segfault was reported on this line:

pa_return_val_if_fail(PA_SINK_IS_LINKED(pa_sink_get_state(data->sink)), -PA_ERR_BADSTATE);

After expanding the pa_sink_get_state() macro, the line looks like
this:

pa_return_val_if_fail(PA_SINK_IS_LINKED(data->sink->state), -PA_ERR_BADSTATE);

So data->sink was apparently NULL. That could happen if we try to fall
back to the default sink, but format negotiation fails.

This bug was introduced in commit
71816ecb7f81fe7a124cefa2258cfa64046908a1.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=74646
10 years agoi18n: Update Polish translation
Piotr Drąg [Tue, 11 Feb 2014 14:18:08 +0000 (15:18 +0100)]
i18n: Update Polish translation

10 years agoman: pulse-cli-syntax: Document the "journal" log target
Tanu Kaskinen [Wed, 12 Feb 2014 12:31:26 +0000 (14:31 +0200)]
man: pulse-cli-syntax: Document the "journal" log target

10 years agodbus: Use correct idxset when getting sources
Juho Hämäläinen [Mon, 10 Feb 2014 10:46:28 +0000 (12:46 +0200)]
dbus: Use correct idxset when getting sources

This fixes get_sources() which iterates wrong idxset when
getting source object paths in GetSources or GetAll.

10 years agoman: improve man page and help for cmdline options
Wim Taymans [Thu, 6 Feb 2014 15:08:50 +0000 (16:08 +0100)]
man: improve man page and help for cmdline options

10 years agosource: Increase max outputs per source
Tanu Kaskinen [Wed, 5 Feb 2014 15:55:44 +0000 (17:55 +0200)]
source: Increase max outputs per source

This change is just for being symmetric with sinks, which got this
change in 26bf2df903b1c7439ad3eef0dc3bb1e777835cc3.

10 years agoprotocol-native: Fix a crash
Tanu Kaskinen [Tue, 4 Feb 2014 19:28:44 +0000 (21:28 +0200)]
protocol-native: Fix a crash

Without this check pa_source_output_set_volume() crashes if
so->volume_writable is false. The same check already exists for sink
inputs.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=74529
10 years agothread-win32: Implement pa_thread_free_nojoin()
Tanu Kaskinen [Sun, 26 Jan 2014 17:11:07 +0000 (19:11 +0200)]
thread-win32: Implement pa_thread_free_nojoin()

This fixes a build error with mingw32:

pulsecore/.libs/libpulsecommon_4.99_la-lock-autospawn.o: In function `unref':
/home/abuild/rpmbuild/BUILD/pulseaudio-4.99.2/src/pulsecore/lock-autospawn.c:123: undefined reference to `pa_thread_free_nojoin'
collect2: error: ld returned 1 exit status

pa_thread_free_nojoin() was initially only implemented for the pthread
based pa_thread backend, because it was incorrectly assumed that
autospawning (the only user of pa_thread_free_nojoin()) is not used on
Windows.

Reported-By: Michael DePaulo <mikedep333@gmail.com>
10 years agocard-restore: Fix a memory leak v4.99.3
Tanu Kaskinen [Wed, 29 Jan 2014 18:54:39 +0000 (20:54 +0200)]
card-restore: Fix a memory leak

entry_read() may set entry->profile, so we need to free that string
before we can replace it with a new string.

10 years agoresampler: Resample first followed by remapping if have more out channels than in...
Peter Meerwald [Mon, 2 Dec 2013 16:27:01 +0000 (17:27 +0100)]
resampler: Resample first followed by remapping if have more out channels than in channels

Reintroduces a cleaned-up version of commit 30ce3a14e5ae1cd316a18bec95b831c07ac57a1a which
was reverted by 1ce71cbd8206d1be59ac62274ad83cdbe693a96a; for more information see
http://thread.gmane.org/gmane.comp.audio.pulseaudio.general/17479/focus=17487

The patch intends to reduce computational load when resampling AND remapping. The PA
resampler performs the following steps:

sample format conversion -> remapping -> resampling -> sample format conversion

In case the number of output channels is higher than the number of input channels, the
resampler has to be run more often than necessary. E.g. in case of mono to 4-channel remapping,
the resampler runs on 4 channels separately.

To ímprove this, the PA resampler pipeline is made adaptive:

if out-channels <= in-channels:
  sample format conversion -> remapping -> resampling -> sample format conversion
if out-channels > in-channels:
  sample format conversion -> resampling -> remapping -> sample format conversion

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>