platform/upstream/pulseaudio.git
11 years agoecho-cancel: Add function pa_echo_canceller_blocksize_power2()
Peter Meerwald [Wed, 13 Feb 2013 16:26:51 +0000 (17:26 +0100)]
echo-cancel: Add function pa_echo_canceller_blocksize_power2()

computes EC block size in frames (rounded down to nearest power-of-2) based
on sample rate and milliseconds

move code from speex AEC implementation to module-echo-cancel such that
functionality can be reused by other AEC implementations

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agobuild-sys: Properly check for HAVE_DBUS in module-ladspa-sink
Peter Meerwald [Wed, 13 Feb 2013 16:26:49 +0000 (17:26 +0100)]
build-sys: Properly check for HAVE_DBUS in module-ladspa-sink

prevents
  CC     module_ladspa_sink_la-module-ladspa-sink.lo
modules/module-ladspa-sink.c:1332:5: warning: "HAVE_DBUS" is not defined
modules/module-ladspa-sink.c:1370:5: warning: "HAVE_DBUS" is not defined
in case HAVE_DBUS is not available

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agobuild-sys: ALSA use-case manager requires ALSA library >= 1.0.24
Peter Meerwald [Wed, 13 Feb 2013 16:26:48 +0000 (17:26 +0100)]
build-sys: ALSA use-case manager requires ALSA library >= 1.0.24

alsa/use-case.h in needed
require at least version 1.0.24 in configure.ac

prevents the following error at compile time:
  CC     libalsa_util_la-alsa-util.lo
In file included from modules/alsa/alsa-mixer.h:51,
                 from modules/alsa/alsa-util.h:36,
                 from modules/alsa/alsa-util.c:46:
modules/alsa/alsa-ucm.h:27:22: error: use-case.h: No such file or directory
In file included from modules/alsa/alsa-mixer.h:51,
                 from modules/alsa/alsa-util.h:36,
                 from modules/alsa/alsa-util.c:46:
modules/alsa/alsa-ucm.h:89: error: expected ‘)’ before ‘*’ token
modules/alsa/alsa-ucm.h:169: error: expected specifier-qualifier-list before ‘snd_use_case_mgr_t’
make[3]: *** [libalsa_util_la-alsa-util.lo] Error 1

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
11 years agobluetooth: Fix incorrect index check with PA_ELEMENTSOF
Mikel Astiz [Thu, 14 Feb 2013 11:50:11 +0000 (12:50 +0100)]
bluetooth: Fix incorrect index check with PA_ELEMENTSOF

The equality case should also be considered an index-out-of-range case.

11 years agoresampler: Generate normalized rows in calc_map_table()
Stefan Huber [Thu, 7 Feb 2013 13:03:17 +0000 (14:03 +0100)]
resampler: Generate normalized rows in calc_map_table()

Remixing one channel map to another is (except for special cases) done
via a linear mapping between channels, whose corresponding matrix is
computed by calc_map_table(). The k-th row in this matrix corresponds to
the coefficients of the linear combination of the input channels that
result in the k-th output channel. In order to avoid clipping of samples
we require that the sum of these coefficients is (at most) 1. This
commit ensures this.

Prior to this commit tests/remix-test.c gives 52 of 132 matrices that
violate this property. For example:
'front-left,front-right,front-center,lfe' -> 'front-left,front-right'
           prior this commit                  after this commit
         I00   I01   I02   I03              I00   I01   I02   I03
      +------------------------          +------------------------
  O00 | 0.750 0.000 0.375 0.375      O00 | 0.533 0.000 0.267 0.200
  O01 | 0.000 0.750 0.375 0.375      O01 | 0.000 0.533 0.267 0.200

Building the matrix is done in several steps. However, only insufficient
measures are taken in order to preserve a row-sum of 1.0 (or leaves it
at 0.0) after each step. The current patch adds a post-processing step
in order check for each row whether the sum exceeds 1.0 and, if
necessary, normalizes this row. This allows for further simplifactions:
 - The insufficient normalizations after some steps are removed. Gains
   are adapted to (partially) resemble the old matrices.
 - Handling unconnected input channls becomes a lot simpler.

11 years agoresampler: Refactor calc_map_table()
Stefan Huber [Thu, 7 Feb 2013 13:03:16 +0000 (14:03 +0100)]
resampler: Refactor calc_map_table()

- Separate the cases with PA_RESAMPLER_NO_REMAP or PA_RESAMPLER_NO_REMIX
  set and remove redundant if-conditions.
- Fix C90 compiler warning due to mixing code and variable declaration.
- Do not repeatedly count number of left, right and center channels in
  the input channel map.

The logic of calc_map_table() remains unaltered.

11 years agoresampler: Replace pa_bool_t by bool
Stefan Huber [Thu, 7 Feb 2013 13:03:15 +0000 (14:03 +0100)]
resampler: Replace pa_bool_t by bool

11 years agodaemon: Don't rely on prctl(PR_SET_KEEPCAPS, 0) for dropping caps.
Tanu Kaskinen [Thu, 5 Apr 2012 12:37:19 +0000 (15:37 +0300)]
daemon: Don't rely on prctl(PR_SET_KEEPCAPS, 0) for dropping caps.

Capability dropping when changing the user in the system
mode was previously implemented by calling
prctl(PR_SET_KEEPCAPS, 0), but that doesn't necessarily
work. It's possible that the KEEPCAPS flag is locked to 1,
in which case the prctl() call fails with EPERM (this
happens at least on Harmattan). This patch implements
explicit capability dropping after changing the user.

11 years agocore: Assert on memchunk divisibility by sample spec in pa_memblockq_push().
Jarkko Suontausta [Thu, 24 May 2012 07:38:22 +0000 (10:38 +0300)]
core: Assert on memchunk divisibility by sample spec in pa_memblockq_push().

Earlier, -1 was returned if the memchunk size was not a multiple of the frame
size. Now, it is verified unconditionally through an assertion. Error code -1
is still returned when the memblock queue is full.

In those few cases where the return value of pa_memblockq_push() is checked,
an overflow is assumed to be the reason in case an error code is returned.

11 years agotests: Indicate failure in test-daemon.sh by returning 1 if any test fails.
Tanu Kaskinen [Tue, 29 Jan 2013 08:56:22 +0000 (10:56 +0200)]
tests: Indicate failure in test-daemon.sh by returning 1 if any test fails.

11 years agobuild-sys: Add check-daemon target to the top-level Makefile.am.
Tanu Kaskinen [Tue, 29 Jan 2013 08:53:19 +0000 (10:53 +0200)]
build-sys: Add check-daemon target to the top-level Makefile.am.

11 years agoudev: Add use_ucm module argument
Tanu Kaskinen [Wed, 6 Feb 2013 12:11:40 +0000 (14:11 +0200)]
udev: Add use_ucm module argument

11 years agoalsa-ucm: Fallback to stereo duplex
David Henningsson [Tue, 5 Feb 2013 08:22:17 +0000 (09:22 +0100)]
alsa-ucm: Fallback to stereo duplex

If 'PlaybackChannels' and 'CaptureChannels' are absent in the UCM
file for a device, assume the device is stereo duplex.

Reported-by: Luke Yelavich <luke.yelavich@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agodbus: Fix cleanup when removing signal listeners
Tanu Kaskinen [Wed, 6 Feb 2013 10:34:06 +0000 (12:34 +0200)]
dbus: Fix cleanup when removing signal listeners

11 years agodbus: Fix connection cleanup when killing clients
Tanu Kaskinen [Wed, 6 Feb 2013 10:31:33 +0000 (12:31 +0200)]
dbus: Fix connection cleanup when killing clients

11 years agocombine: Stop rate adjustments if sink is supended
Jyri Sarha [Fri, 27 Nov 2009 08:33:46 +0000 (10:33 +0200)]
combine: Stop rate adjustments if sink is supended

11 years agoalsa-sink/source: Better thread names
David Henningsson [Fri, 14 Dec 2012 15:03:36 +0000 (16:03 +0100)]
alsa-sink/source: Better thread names

Now you can actually see *which* sink/source that sends a specific
message to the log, which is quite useful if you have more than
one sound card.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agopacat: Handle holes in recording streams.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:40 +0000 (16:52 +0200)]
pacat: Handle holes in recording streams.

pa_silence_memory() pulls sample-util as a dependency, so it had to
be moved from libpulsecore to libpulsecommon. sample-util in turn
pulls some more stuff.

11 years agopadsp: Handle holes in recording streams.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:39 +0000 (16:52 +0200)]
padsp: Handle holes in recording streams.

11 years agosimple: Handle holes in recording streams.
Tanu Kaskinen [Wed, 7 Nov 2012 14:52:38 +0000 (16:52 +0200)]
simple: Handle holes in recording streams.

11 years agosconv: Change/fix conversion to/from float32
Peter Meerwald [Mon, 4 Feb 2013 00:30:19 +0000 (01:30 +0100)]
sconv: Change/fix conversion to/from float32

use (1<<15) instead of 0x7fff as a factor when converting from s16 to float32
use (1<<31) instead of 0x7fffffff as a factor when converting from s32 to float32

the change is motivated by the following desireable properties:
* s16_from_f32(f32_from_s16(x)) == x for all possible s16 values
* x / (1.0f << 15) == x * (1.0f / (1 << 15)) for all x in s16

above changes enable easier optimization while guaranteeing bit-exact results

further, other audio sample conversion code (libavresample) does it the same way

v3 (comments Tanu):
* fix saturation in pa_sconv_s16le_from_f32ne_neon(), use vqrshrn
v2 (comments Tanu):
* fix comments in ARM NEON code
* use llrintf() in pa_sconv_s32le_from_float32ne()

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Cc: Tanu Kaskinen <tanuk@iki.fi>
11 years agopactl: Document @DEFAULT_SINK@, @DEFAULT_SOURCE@ and @DEFAULT_MONITOR@
David Henningsson [Tue, 29 Jan 2013 16:27:11 +0000 (17:27 +0100)]
pactl: Document @DEFAULT_SINK@, @DEFAULT_SOURCE@ and @DEFAULT_MONITOR@

I went to implement the possibility to use the default sink/source
but found that it was already working. So I figured I'd update
the help text instead.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
11 years agoresampler: Improve s16<-->s32 conversion, use s16 work format if input or output...
Peter Meerwald [Wed, 30 Jan 2013 10:04:05 +0000 (11:04 +0100)]
resampler: Improve s16<-->s32 conversion, use s16 work format if input or output is s16

Problem: s16 to s32 conversion is performed as s16->float->s32 (via work
format float) for resamplers TRIVIAL, COPY, PEAKS.
Precision and efficiency suffers: e.g. 0x9fff results in 0x9ffe4001 (instead
of 0x9fff0000) and there are two sample format conversions instead of one
conversion.

Solution: If input or output format is s16, then choose the work format
to be s16 as well.

If remapping is to be performed, we could stick to work format float32ne for
precision reseans. This is debateable.

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoresampler: Drop redundant assignment in convert_from_work_format()
Peter Meerwald [Wed, 30 Jan 2013 10:04:04 +0000 (11:04 +0100)]
resampler: Drop redundant assignment in convert_from_work_format()

r->from_work_format_buf.length is set twice

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agotests: Fix sconv sample correctness in cpu-test
Peter Meerwald [Wed, 30 Jan 2013 10:04:03 +0000 (11:04 +0100)]
tests: Fix sconv sample correctness in cpu-test

do allow up to one sample difference
cleanup output of signed shorts (use 0xhx)

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agosconv: Check for SSE flag before initializing code
Peter Meerwald [Wed, 30 Jan 2013 10:04:01 +0000 (11:04 +0100)]
sconv: Check for SSE flag before initializing code

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agotests: Fix function argument wrapping style in cpu-test.c.
Tanu Kaskinen [Fri, 1 Feb 2013 07:06:18 +0000 (09:06 +0200)]
tests: Fix function argument wrapping style in cpu-test.c.

11 years agotests: Add remap test code to cpu-test
Peter Meerwald [Wed, 30 Jan 2013 10:04:00 +0000 (11:04 +0100)]
tests: Add remap test code to cpu-test

v2 (comments by Paul Menzel):
* generate test samples from -1..1, -0x8000..0x7fff
* check all output samples (not just half of them)

the idea is to compare the output of the C (reference) implementation
against the output of the optimized code path; currently, there are MMX
and SSE implementation for the mono-to-stereo remapper for s16 and float
sample formats

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
Cc: Paul Menzel <paulepanter@users.sourceforge.net>
11 years agotests: Test both, SSE and SSE2, sconv in cpu-test
Peter Meerwald [Wed, 30 Jan 2013 10:03:59 +0000 (11:03 +0100)]
tests: Test both, SSE and SSE2, sconv in cpu-test

SSE sconv was not tested before, only SSE2 was (on CPUs supporting both
instruction sets)

now both code path are tested on CPUs supporting both

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoremap_sse: More specific logging: SSE -> SSE2
Peter Meerwald [Wed, 30 Jan 2013 10:03:58 +0000 (11:03 +0100)]
remap_sse: More specific logging: SSE -> SSE2

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agotests: Fix potential out-of-bound access violation in svolume cpu-test
Peter Meerwald [Wed, 30 Jan 2013 10:03:57 +0000 (11:03 +0100)]
tests: Fix potential out-of-bound access violation in svolume cpu-test

nsamples should be forced to be a multiple of channels; do so correctly
and don't make nsamples larger than it actually is

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agotests: Fix conversion typo in cpu-test
Peter Meerwald [Wed, 30 Jan 2013 10:03:56 +0000 (11:03 +0100)]
tests: Fix conversion typo in cpu-test

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agopactl: Add a command for setting the default sink/source.
poljar (Damir Jelić) [Wed, 30 Jan 2013 17:51:57 +0000 (18:51 +0100)]
pactl: Add a command for setting the default sink/source.

This adds two new commands to pactl:
    set-default-sink
    set-default-source

This command has been part of the native protocol for a long time,
no reason not to expose it in pactl.

11 years agobash-completion: Don't complete devices in the list commands
poljar (Damir Jelić) [Fri, 1 Feb 2013 00:57:49 +0000 (01:57 +0100)]
bash-completion: Don't complete devices in the list commands

This fixes some wrong completion for the list commands for example:
    pactl list sinks _sink_name_

11 years agoreserve: Fix leaking NameLost signals after release+acquire
Mikel Astiz [Wed, 30 Jan 2013 08:30:31 +0000 (09:30 +0100)]
reserve: Fix leaking NameLost signals after release+acquire

The use of the pseudo-blocking D-Bus calls leads to the problem that
NameLost signals are received after the reply to ReleaseName().

The problem with this is that a later acquisition of the same audio
device can potentially receive the NameLost signal corresponding to
the previous instance, due to the fact that the signal hasn't been
popped from the D-Bus message queue.

The simplest approach to solve this problem is to poll the actual name
owner from the D-Bus daemon, in order to make sure that we did really
lose the name.

The proposal uses a blocking call to GetNameOwner to avoid incosistent
states in the internal APIs: it would otherwise be possible to have a
"busy" device before the reservation has been lost, in the unlikely
case if some other process acquires the name before we got the
confirmation that the NameLost was actually true.

11 years agoreserve: Move get_name_owner() to the public rd_device API
Mikel Astiz [Wed, 30 Jan 2013 08:30:30 +0000 (09:30 +0100)]
reserve: Move get_name_owner() to the public rd_device API

The function is interesting for both rd_device and rd_monitor so make
it part of the rd_device public API to avoid duplicated code.

The decision to move the function to reserve.c is motivated by the fact
that other projects (i.e. jack) use reserve.c only. Therefore, adding a
reserve->reserve-monitor dependency should be avoided.

11 years agobluetooth: Fail if BlueZ tries to give duplicate device addresses.
Tanu Kaskinen [Thu, 31 Jan 2013 07:34:55 +0000 (09:34 +0200)]
bluetooth: Fail if BlueZ tries to give duplicate device addresses.

11 years agobluetooth: Detect changes in constant properties
Mikel Astiz [Tue, 29 Jan 2013 12:10:12 +0000 (13:10 +0100)]
bluetooth: Detect changes in constant properties

The D-Bus API should guarantee that some properties remain constant and
therefore treat changes in such properties as errors.

11 years agobluetooth: Propagate to property parsers if it is initial value
Mikel Astiz [Tue, 29 Jan 2013 12:10:11 +0000 (13:10 +0100)]
bluetooth: Propagate to property parsers if it is initial value

Add a parameter so that property parsing functions distinguish the
initial case from property changes received later.

11 years agobuild-sys: Use dist_vapi_DATA instead of listing the files in EXTRA_DIST.
Tanu Kaskinen [Thu, 31 Jan 2013 05:09:47 +0000 (07:09 +0200)]
build-sys: Use dist_vapi_DATA instead of listing the files in EXTRA_DIST.

11 years agobuild-sys: Install the bash completion script.
Tanu Kaskinen [Thu, 31 Jan 2013 04:25:02 +0000 (06:25 +0200)]
build-sys: Install the bash completion script.

11 years agobuild: Add bash completion
poljar (Damir Jelić) [Wed, 30 Jan 2013 18:11:43 +0000 (19:11 +0100)]
build: Add bash completion

This patch adds bash completion for pulseaudio and all of the utilities.
Channel maps and properties are not yet completed.

This should make mostly pactl/pacmd more useful for bash users.

Thanks to Denis Kasak for the awk magic (fetching ports and profiles
from the card info).

11 years ago.gitignore: Add pulse-daemon.log.
Tanu Kaskinen [Tue, 29 Jan 2013 15:30:19 +0000 (17:30 +0200)]
.gitignore: Add pulse-daemon.log.

The file is created by test-daemon.sh.

11 years agobluetooth: Fix potential assertion failure due to unaligned packet size
Mikel Astiz [Mon, 28 Jan 2013 17:25:21 +0000 (18:25 +0100)]
bluetooth: Fix potential assertion failure due to unaligned packet size

While reading from the SCO socket, there is no guarantee regarding the
resulting packet size. In some rare cases, it might not even match the
alignment expected in pa_source_post(), resulting in an assertion
failure inside pa_volume_memchunk():

I: [alsa-sink] module-loopback.c: Could not peek into queue
I: [alsa-sink] module-loopback.c: Could not peek into queue
I: [alsa-sink] module-loopback.c: Could not peek into queue
E: [bluetooth] sample-util.c: Assertion 'pa_frame_aligned(c->length, spec)' failed at pulsecore/sample-util.c:725, function pa_volume_memchunk(). Aborting.

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffda98f700 (LWP 8058)]
0x00007ffff6177935 in raise () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install alsa-lib-1.0.26-1.fc17.x86_64 dbus-libs-1.4.10-7.fc17.x86_64 flac-1.2.1-9.fc17.x86_64 glibc-2.15-58.fc17.x86_64 gsm-1.0.13-6.fc17.x86_64 json-c-0.10-2.fc17.x86_64 libICE-1.0.8-1.fc17.x86_64 libSM-1.2.1-1.fc17.x86_64 libX11-1.5.0-2.fc17.x86_64 libXau-1.0.6-3.fc17.x86_64 libXext-1.3.1-1.fc17.x86_64 libXi-1.6.1-1.fc17.x86_64 libXtst-1.2.0-3.fc17.x86_64 libogg-1.3.0-1.fc17.x86_64 libsndfile-1.0.25-2.fc17.x86_64 libtool-ltdl-2.4.2-3.1.fc17.x86_64 libudev-182-3.fc17.x86_64 libuuid-2.21.2-3.fc17.x86_64 libvorbis-1.3.3-1.fc17.x86_64 libxcb-1.9-1.fc17.x86_64 speex-1.2-0.14.rc1.fc17.x86_64

11 years agobuild: Add zsh completion
poljar (Damir Jelić) [Sat, 19 Jan 2013 16:07:59 +0000 (17:07 +0100)]
build: Add zsh completion

This patch adds zsh completion for pulseaudio and all of the utilities.
Channel maps and properties are not yet completed.

This should make mostly pactl/pacmd more usefull for zsh users.

11 years agopactl: Add the ability to toggle mute state.
poljar (Damir Jelić) [Thu, 24 Jan 2013 00:14:17 +0000 (01:14 +0100)]
pactl: Add the ability to toggle mute state.

This patch adds the ability to toggle mute for sink/sources and
sink-inputs and source outputs.

All mute commands now accept 1|0|toggle as an argument.

11 years agoladspa: Fix a couple of minor memory leaks.
Tanu Kaskinen [Sun, 27 Jan 2013 02:51:55 +0000 (04:51 +0200)]
ladspa: Fix a couple of minor memory leaks.

11 years agobluetooth: Fix sending D-Bus reply before internal callback
Mikel Astiz [Thu, 24 Jan 2013 09:16:57 +0000 (10:16 +0100)]
bluetooth: Fix sending D-Bus reply before internal callback

Make sure the reply to SetConfiguration() is sent before the internal
hook is fired. This is important because the hook could have side
effects including D-Bus interfactions (i.e. transport Acquire() being
called during module startup).

11 years agobluetooth: Fix potential assertion failure if MTU changes
Mikel Astiz [Thu, 24 Jan 2013 09:16:56 +0000 (10:16 +0100)]
bluetooth: Fix potential assertion failure if MTU changes

The assertion in hsp_process_render() assumes that, if a memory block is
already set by the time the function is reached, its size matches
write_block_size.

This can however fail if a transport has been released and acquired
back, in the unlikely case where the MTU has changed in the meantime,
assuming the memory block wasn't released.

11 years agobuild-sys: Fix an outdated D-Bus version in an error message.
Tanu Kaskinen [Thu, 24 Jan 2013 09:05:37 +0000 (11:05 +0200)]
build-sys: Fix an outdated D-Bus version in an error message.

11 years agobuild-sys: Bump D-Bus dependency version to 1.4.12.
Tanu Kaskinen [Thu, 24 Jan 2013 08:48:43 +0000 (10:48 +0200)]
build-sys: Bump D-Bus dependency version to 1.4.12.

We use DBUS_TIMEOUT_USE_DEFAULT, which was introduced in 1.4.12.

11 years agocard: Remove some unnecessary checks.
Tanu Kaskinen [Tue, 22 Jan 2013 06:54:57 +0000 (08:54 +0200)]
card: Remove some unnecessary checks.

11 years agodevice-port: Return early from pa_device_port_set_latency_offset() if the offset...
Tanu Kaskinen [Tue, 22 Jan 2013 06:48:02 +0000 (08:48 +0200)]
device-port: Return early from pa_device_port_set_latency_offset() if the offset doesn't change.

This avoids sending change notifications when nothing changes.

11 years agojack: Don't fail module-jackdbus-detect loading if the channels argument is not given.
Tanu Kaskinen [Tue, 22 Jan 2013 06:42:27 +0000 (08:42 +0200)]
jack: Don't fail module-jackdbus-detect loading if the channels argument is not given.

The u->channels <= 0 check failed if the channels argument was not
given at all, making the whole module loading fail. I don't think the
check is necessary at all - negative values are not possible, and if
someone gives 0 as the argument, it's probably ok if we act as if
there was no channels argument at all.

11 years agocard-restore: Only use hooks for the events.
poljar (Damir Jelić) [Tue, 15 Jan 2013 22:51:30 +0000 (23:51 +0100)]
card-restore: Only use hooks for the events.

Notification events can be error prone, this patch removes the use of
notification events from card-restore and replaces them with hooks.

11 years agodevice-port: Fire a hook when the latency offset changes.
poljar (Damir Jelić) [Thu, 17 Jan 2013 19:55:17 +0000 (20:55 +0100)]
device-port: Fire a hook when the latency offset changes.

This change adds a new hook type: PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED
And it is fired when the port latency offset changes.

11 years agodevice-port: Cleanup of the sink/source subscription events.
poljar (Damir Jelić) [Thu, 17 Jan 2013 19:55:16 +0000 (20:55 +0100)]
device-port: Cleanup of the sink/source subscription events.

Since it's now decided that we deprecated port info for sinks and
sources this isn't needed anymore.

11 years agodevice-port: Access the cards directly.
poljar (Damir Jelić) [Thu, 17 Jan 2013 19:55:15 +0000 (20:55 +0100)]
device-port: Access the cards directly.

Since the ports now know which card owns them we don't need to iterate
through all of them anymore.

11 years agodevice-port: Add a card pointer to the ports.
poljar (Damir Jelić) [Thu, 17 Jan 2013 19:55:14 +0000 (20:55 +0100)]
device-port: Add a card pointer to the ports.

This way we can directly access the card that owns the port instead of
iterating over all cards.

11 years agoi18n: Update Polish translation
Piotr Drąg [Sat, 12 Jan 2013 20:28:28 +0000 (21:28 +0100)]
i18n: Update Polish translation

11 years agoInitialize monitor's busy status to false if we own the device.
Tanu Kaskinen [Wed, 16 Jan 2013 01:36:04 +0000 (03:36 +0200)]
Initialize monitor's busy status to false if we own the device.

Bug found by David Henningsson.

11 years agoCall change_cb() only when there's an actual change.
Tanu Kaskinen [Wed, 16 Jan 2013 01:36:03 +0000 (03:36 +0200)]
Call change_cb() only when there's an actual change.

Calling change_cb() whenever anything happens in the ownership of the
bus name caused trouble in PulseAudio in this scenario:

1. PulseAudio is using a device and owns the corresponding service
   name.
2. Another application requests device release.
3. PulseAudio releases the device.
4. Change in the bus name ownership: PulseAudio gives up the
   ownership, and nobody owns the name.
5. reserve-monitor notices that, and notifies PulseAudio.
6. Since reserve-monitor reports the device as "not busy", PulseAudio
   decides to reserve the bus name immediately back to itself and
   opens the device again.

The other application will forcibly take the bus name to itself, as
it should according to the protocol, but the other application may
have trouble opening the device if it tries to do that before
PulseAudio has had time to react to the NameLost signal.

This can be solved by not calling change_cb() if there are no changes
in the device busy status. In this scenario the device is considered
"not busy" while PulseAudio is owning the bus name, so PulseAudio gets
no notification when the ownership changes from PulseAudio to nobody.

11 years agopulse: Initialize pa_operation objects to all-zero.
Tanu Kaskinen [Sun, 13 Jan 2013 01:15:23 +0000 (03:15 +0200)]
pulse: Initialize pa_operation objects to all-zero.

state_callback and state_userdata fields were not initialized.

11 years agoi18n: Update Polish translation
Piotr Drąg [Thu, 10 May 2012 17:39:53 +0000 (19:39 +0200)]
i18n: Update Polish translation

11 years agopulse: Add pa_operation_set_state_callback() API
Paul Meng [Mon, 7 Jan 2013 13:41:26 +0000 (21:41 +0800)]
pulse: Add pa_operation_set_state_callback() API

[The original commit message didn't have any explanation why this
change is made, so I'll add that information here myself.
--Tanu Kaskinen]

This change is from the developers of a Haskell binding[1]. According
to them, this change isn't strictly necessary, but their code gets
significantly cleaner if they can register an operation callback that
is called when the operation is cancelled due to the context getting
disconnected.

[1] https://github.com/favonia/pulse

11 years agobluetooth: Convert booleans to stdbool.
Tanu Kaskinen [Fri, 11 Jan 2013 20:11:04 +0000 (22:11 +0200)]
bluetooth: Convert booleans to stdbool.

11 years agobluetooth: Simplify redundant error check
Mikel Astiz [Fri, 11 Jan 2013 10:07:49 +0000 (11:07 +0100)]
bluetooth: Simplify redundant error check

As pointed out by Tanu, checking both error conditions is redundant and
raises the question whether it's possible that one of the conditions is
true while the other is false.

Therefore, simplify the condition by just checking one part of the
disjunction.

11 years agobluetooth: Remove device_is_audio_ready()
Mikel Astiz [Fri, 11 Jan 2013 10:07:48 +0000 (11:07 +0100)]
bluetooth: Remove device_is_audio_ready()

The function was used to check whether the basic properties of the
Bluetooth device have been received. This can be simplified by just
checking d->device_info_valid, since the state of the audio interface
is only relevant inside pa_bluetooth_device_any_audio_connected(), which
is used to trigger the discovery callback.

While checking device_info_valid, special care must be taken with all
three possible values: when set to -1, it means some error was triggered
while getting the device properties. Therefore, these devices can also
be ignored outside bluetooth-util.

Besides that, the patch slightly modifies the behavior of the internal
API affecting pa_bluetooth_discovery_get_by_address() and
pa_bluetooth_discovery_get_by_path(), since they will return the device
no matter the state of the audio interface. This however makes sense and
should have no influence in the current codebase given that the modules
make use of devices only after the discovery hook has been triggered.

11 years agobluetooth: Do not check profile states is device_audio_is_ready()
Mikel Astiz [Fri, 11 Jan 2013 10:07:47 +0000 (11:07 +0100)]
bluetooth: Do not check profile states is device_audio_is_ready()

The function is used to make sure some basic information has already
been gathered before the device is being used. At this point profile
states can be ignored, since their initial value will be
PA_BT_AUDIO_STATE_INVALID and thus effectively similar to
PA_BT_AUDIO_STATE_DISCONNECTED due to audio_state_to_transport_state().

The change should make no difference given that the behavior of
pa_bluetooth_device_any_audio_connected() doesn't change: by the time
TRUE is returned, a transport needs to exist. This means a profile
will exist in CONNECTING or CONNECTED state and thus the old
implementation of device_audio_is_ready() would also have returned TRUE.

11 years agobluetooth: Use stdbool for pa_bool_t
Mikel Astiz [Fri, 11 Jan 2013 10:07:46 +0000 (11:07 +0100)]
bluetooth: Use stdbool for pa_bool_t

Use lowercase true/false instead of TRUE/FALSE for pa_bool_t.

11 years agobluetooth: Check message signature for SetConfiguration
Mikel Astiz [Fri, 11 Jan 2013 10:07:45 +0000 (11:07 +0100)]
bluetooth: Check message signature for SetConfiguration

Make sure inside endpoint_set_configuration() that the received D-Bus
message matches the expected signature.

11 years agobluetooth: Fix minor style issues
Mikel Astiz [Fri, 11 Jan 2013 10:07:44 +0000 (11:07 +0100)]
bluetooth: Fix minor style issues

Trivially fix some style issues affecting line wrap (128 chars max with
the exception of multi-line comments, which are limited to 80),
indentation and unnecessary parentheses.

11 years agobluetooth: Fix incorrect error messages
Mikel Astiz [Fri, 11 Jan 2013 10:07:43 +0000 (11:07 +0100)]
bluetooth: Fix incorrect error messages

err.message doesn't contain anything useful in these error cases so
fix the mistake and avoid misleading messages.

11 years agoecho-cancel: Fix error cleanup of pa_speex_ec_init()
Peter Meerwald [Fri, 11 Jan 2013 14:59:27 +0000 (15:59 +0100)]
echo-cancel: Fix error cleanup of pa_speex_ec_init()

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agopulse: Fix endianness definition on Sparc.
Tanu Kaskinen [Fri, 4 Jan 2013 15:21:25 +0000 (17:21 +0200)]
pulse: Fix endianness definition on Sparc.

Patch by Brian Cameron <brian.cameron@oracle.com>.

11 years agosolaris: When suspending, flush the device instead of draining it.
Tanu Kaskinen [Fri, 4 Jan 2013 14:57:48 +0000 (16:57 +0200)]
solaris: When suspending, flush the device instead of draining it.

Patch by Brian Cameron <brian.cameron@oracle.com>.

11 years agosolaris: Fix get_playback_buffered_bytes() return value.
Tanu Kaskinen [Fri, 4 Jan 2013 14:49:52 +0000 (16:49 +0200)]
solaris: Fix get_playback_buffered_bytes() return value.

Based on a patch by Brian Cameron <brian.cameron@oracle.com>.

11 years agoshm: Support Solaris shm file paths.
Tanu Kaskinen [Fri, 4 Jan 2013 14:31:57 +0000 (16:31 +0200)]
shm: Support Solaris shm file paths.

Patch by Brian Cameron <brian.cameron@oracle.com>

11 years agotests: Fix allowed sample formats in resampler-test usage text
Peter Meerwald [Thu, 3 Jan 2013 15:38:48 +0000 (16:38 +0100)]
tests: Fix allowed sample formats in resampler-test usage text

Signed-off-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agojackdbus-detect: Add channel count override.
Peter Nelson [Sat, 22 Dec 2012 22:18:52 +0000 (22:18 +0000)]
jackdbus-detect: Add channel count override.

Allow configuration of number of channels when using module-jackdbus-detect
to load jack-sink and jack-source. This is useful when the default channel
count doesn't match the logical channel count desired, e.g. with multi-
channel audio interfaces.

Signed-off-by: Peter Nelson <peter@fuzzle.org>
11 years agobluetooth: Remove pa_bluetooth_discovery_sync().
Tanu Kaskinen [Mon, 17 Dec 2012 07:01:03 +0000 (09:01 +0200)]
bluetooth: Remove pa_bluetooth_discovery_sync().

pa_bluetooth_discovery_sync() waited until all pending method calls
had completed. I don't understand what the benefit of that could be,
so I removed the function. We should avoid blocking as much as
possible, and the code that used pa_bluetooth_discovery_sync() didn't
look like it really needed to wait for anything.

11 years agoecho-cancel: Extend null implementation to arbitary sample specs
Stefan Huber [Thu, 20 Dec 2012 10:33:05 +0000 (11:33 +0100)]
echo-cancel: Extend null implementation to arbitary sample specs

The new null implementation works with arbitrary sample specs for source
and sink. In particular, it handles a different number of channels for
source and sink.

Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Enable different blocksizes for sink and source
Stefan Huber [Thu, 20 Dec 2012 10:33:04 +0000 (11:33 +0100)]
echo-cancel: Enable different blocksizes for sink and source

In order to support different blocksizes for source and sink (e.g, for
4-to-1 beamforming/echo canceling which involves 4 record channels and 1
playback channel) the AEC API is altered:

The blocksize for source and sink may differ (due to different sample
specs) but the number of frames that are processed in one invokation of
the AEC implementation's run() function is the same for the playback and
the record stream. Consequently, the AEC implementation's init()
function initalizes 'nframes' instead of 'blocksize' and the source's
and sink's blocksizes are derived from 'nframes'. The old API also
caused code duplication in each AEC implementation's init function for
the compution of the blocksize, which is eliminated by the new API.

Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Fix calc_diff for asymmetric sample specs
Stefan Huber [Tue, 18 Dec 2012 12:52:32 +0000 (13:52 +0100)]
echo-cancel: Fix calc_diff for asymmetric sample specs

In case that source and sink use different sample specs (e.g., different
number of channels) the computation of the latency difference fails.
To fix this, we obtain the corresponding latencies in terms of time using
the respective sample specs instead of buffer sizes.

Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Fix missing setup of sink_ss in echo-cancel-test.
Stefan Huber [Tue, 18 Dec 2012 12:52:31 +0000 (13:52 +0100)]
echo-cancel: Fix missing setup of sink_ss in echo-cancel-test.

In main() of echo-cancel-test it is wrongly assumed that the EC
implementation's init() function properly initializes sink_ss. In
contrast, pa__init() sets sink_ss by default to
sink_master->sample_spec. Fix this by setting sink_ss to default
parameters and let EC implementation's init() override these settings.

Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agoecho-cancel: Fix echo-cancel-test's argument number checking
Stefan Huber [Tue, 18 Dec 2012 12:52:30 +0000 (13:52 +0100)]
echo-cancel: Fix echo-cancel-test's argument number checking

Argument argv[5] is accessed when argc>4, which leads to an invalid
access for argc==5. Fix this.

Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
11 years agobuild: Don't enable BlueZ if libbluetooth is not found.
Tanu Kaskinen [Sat, 22 Sep 2012 15:16:24 +0000 (18:16 +0300)]
build: Don't enable BlueZ if libbluetooth is not found.

Previously, if libsbc was available but libbluetooth was not, BlueZ
would get incorrectly enabled.

11 years agobluetooth: Don't access a transport after it's freed.
Tanu Kaskinen [Tue, 18 Dec 2012 06:47:58 +0000 (08:47 +0200)]
bluetooth: Don't access a transport after it's freed.

In addition to moving the freeing a bit later, unnecessary checks for
t->device are removed. t->device is initialized to a non-NULL value
when the transport is created, and it's never changed.

11 years agoman: Update log-target documentation.
Tanu Kaskinen [Mon, 17 Dec 2012 05:46:04 +0000 (07:46 +0200)]
man: Update log-target documentation.

11 years agomodargs: Don't fail needlessly in pa_modargs_get_sample_spec_and_channel_map().
Tanu Kaskinen [Wed, 9 May 2012 03:04:52 +0000 (06:04 +0300)]
modargs: Don't fail needlessly in pa_modargs_get_sample_spec_and_channel_map().

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=49664
11 years agosndfile-util: reduce useless loop
Wang Xingchao [Mon, 7 May 2012 08:52:18 +0000 (16:52 +0800)]
sndfile-util: reduce useless loop

it's useless to get the same SF_FORMAT_INFO three times, just compare the
name/extention in the same loop.

Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
11 years agomemblockq: Use pa_xnew0() to avoid manual zeroing.
Tanu Kaskinen [Sat, 28 Apr 2012 15:54:10 +0000 (18:54 +0300)]
memblockq: Use pa_xnew0() to avoid manual zeroing.

11 years agodoc: Generate API documentation for ext-device-manager and ext-device-restore.
Christoph Gysin [Wed, 11 Apr 2012 20:05:54 +0000 (23:05 +0300)]
doc: Generate API documentation for ext-device-manager and ext-device-restore.

I noticed that the doxygen API (http://freedesktop.org/software/pulseaudio/doxygen)
does not include ext-device-manager.h. The following patch adds ext-device-manager.h
and ext-device-restore.h to the list of files processed by doxygen.

11 years agodevice-restore: Fix empty argument list declaration.
Tanu Kaskinen [Tue, 10 Apr 2012 11:36:04 +0000 (14:36 +0300)]
device-restore: Fix empty argument list declaration.

11 years agovirtual-sink: Removed the option to specify sample format.
Ștefan Săftescu [Fri, 6 Apr 2012 21:57:43 +0000 (00:57 +0300)]
virtual-sink: Removed the option to specify sample format.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=46529
11 years agocpulimit: Explicitly ignore pa_read() return value.
Tanu Kaskinen [Tue, 3 Apr 2012 07:18:55 +0000 (10:18 +0300)]
cpulimit: Explicitly ignore pa_read() return value.

It doesn't matter if the function fails (I'm not sure if
it's even possible), because the read data isn't used for
anything and the daemon will terminate in any case. The
void cast should get rid of a Coverity warning.

Removing the whole pa_read() call should be ok too, but I
guess it's nice to clean up the pipe before terminating...

11 years agooss: Check pa_read() return value.
Tanu Kaskinen [Mon, 2 Apr 2012 13:13:54 +0000 (16:13 +0300)]
oss: Check pa_read() return value.

11 years agomainloop-signal: Explicitly ignore pa_write() return value.
Tanu Kaskinen [Fri, 30 Mar 2012 08:04:33 +0000 (11:04 +0300)]
mainloop-signal: Explicitly ignore pa_write() return value.

Coverity warned about an ignored return value. I'm not sure
if there's something that should be done if writing fails;
at least I couldn't think of anything. Would logging an
error be acceptable here?

11 years agosmoother-test: Fix array overflow.
Tanu Kaskinen [Fri, 30 Mar 2012 07:31:48 +0000 (10:31 +0300)]
smoother-test: Fix array overflow.

11 years agoFix pa_parse_boolean() return value checking.
Tanu Kaskinen [Thu, 29 Mar 2012 12:24:02 +0000 (15:24 +0300)]
Fix pa_parse_boolean() return value checking.

pa_parse_boolean() return value shouldn't be stored in
pa_bool_t, because 1 and -1 need to be distinguished.