Commit graph

8092 commits

Author SHA1 Message Date
David Henningsson
f2120fc2b6 alsa-mixer/card: Move to use the new mixer interface
Use the new mixer API to get callbacks, instead of using the hctl
API. Using the hctl API caused a memory leak, because alsa-lib itself
used the hctl callbacks, which we were previously overriding.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
David Henningsson
1fd8848e64 alsa-util: Add functions for accessing mixer elements through mixer class
Instead of using the hctl interface, we can find controls belonging
to other iface types than "mixer". We do this by introducing a new
mixer class "SND_MIXER_ELEM_PULSEAUDIO" and create snd_mixer_elem's
for all PCM and CARD iface types (as Jacks are of the CARD type and
ELD controls are of the PCM type).

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-16 09:33:04 +02:00
João Paulo Rechi Vita
f7c7cd1825 bluetooth: Implement org.ofono.HandsfreeAudioAgent.Release() 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
b1a09ebf7e bluetooth: Handle CardRemoved signal 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
8f838b1f31 bluetooth: Handle CardAdded signal 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
0e7f303256 bluetooth: Track oFono service 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
c4c4de532d bluetooth: Implement transport release for hf_audio_agent transports 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
8dd4aa1f00 bluetooth: Implement transport acquire for hf_audio_agent transports 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
c098665820 bluetooth: Parse HandsfreeAudioCard properties 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
a5a0506c4e bluetooth: List HandsfreeAudioCard objects from oFono 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
374c28a40e bluetooth: Register/Unregister Handsfree Audio Agent with oFono
Register as a HandsfreeAudioAgent with oFono during backend
initialization and unregiter during backend finalization. This commit
also adds a check when receiving method calls or signals to make sure
the sender matches with the D-Bus service we're registered with.
2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
d7a8ccce89 bluetooth: Create hf_dbus_send_and_add_to_pending() for oFono backend 2014-09-11 14:00:15 +03:00
João Paulo Rechi Vita
98d3d85705 bluetooth: Monitor D-Bus signals 2014-09-11 14:00:15 +03:00
Peter Meerwald
eed6d95f49 tests: Remove mix-special-test
code has been moved to cpu-mix-test

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 17:56:03 +02:00
Peter Meerwald
f8fe25e8df tests: Use float constants in cpu-sconv-test
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 17:56:03 +02:00
Peter Meerwald
ce9318fb72 tests: Add ARM NEON test code to cpu-remap-test
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 17:56:03 +02:00
Peter Meerwald
d8be5cbf8b tests: Add rearrange remapping test cases to cpu-remap-test
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 17:55:59 +02:00
Peter Meerwald
c68c9f3aa2 tests: Add to remapping special case code tests to cpu-remap-test
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 17:54:51 +02:00
Peter Meerwald
7ae700941c tests: Reorganize cpu-remap-test program
Make run_remap_test() support up to 8 input and output channels.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 17:54:39 +02:00
Peter Meerwald
8f4897e162 tests: Use remap function passed in remap struct
Cleanup and add function to setup remap struct

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:34:12 +02:00
Peter Meerwald
173649e4f7 tests: Add ARM NEON test code to cpu-mix-test
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:34:12 +02:00
Peter Meerwald
d58446963f tests: Add tests for mix special-case code
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:34:12 +02:00
Peter Meerwald
9576ba2d9e tests: Use single-line #ifdef for ARM NEON code
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:34:11 +02:00
Peter Meerwald
4ca3216ee3 tests: Split cpu tests in separate files
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:34:11 +02:00
Peter Meerwald
f4ab8bd835 cpu: Add force_generic_code flag to cpu_info struct
The remapper and channel mixing code have (faster) specialized and (slower)
generic code certain code path. The flag force_generic_code can be set to
force the generic code path which is useful for testing. Code duplication
(such as in mix-special-test) can be avoided, cleanup patches follow.

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:34:11 +02:00
Peter Meerwald
61c888dc93 cpu: Don't check for both x86 and ARM code
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:01:57 +02:00
Peter Meerwald
380591eb18 core: Add pa_cpu_init() / cpu.c
move code dealing with CPU specific code path initialization
from daemon/main.c to pulsecore/cpu.c

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-10 16:01:14 +02:00
Luiz Augusto von Dentz
f508b34b8b bluetooth: Add discovery to pa_bluetooth_backend_new 2014-09-10 13:25:36 +03:00
Luiz Augusto von Dentz
5c2ed8abed bluetooth: Only create backend instance once objects are listed
This makes sure the devices are discovered before the backend start
creating new transports.
2014-09-10 13:25:36 +03:00
David Henningsson
fcfaa77fe7 configure: Fix spelling of "backend"
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-10 11:28:45 +02:00
Wim Taymans
f782155da5 configure: fix headset check 2014-09-10 11:25:47 +02:00
Lukasz Marek
78ca8cfc96 Client API: Add pa_stream_write_ext_free() function.
New function allows to pass data pointer that is a member
of the outer structure that need to be freed too when data
is not needed anymore.

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2014-09-10 10:12:08 +02:00
Sjoerd Simons
594da41d07 alsa-mixer: recognize Dock headphone jack
Recognize the Dock headphone jack in the same way the normal & front
headphone jacks are detected.

Reviewed-by: David Henningsson <david.henningsson@canonical.com>
2014-09-10 09:59:00 +02:00
David Henningsson
076601ee28 core-util: Fail if XDG_RUNTIME_DIR belongs to someone else
Usually, PA will use the PULSE_SERVER X11 property instead of using XDG_RUNTIME_DIR,
so this environment variable does not matter.

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

Instead fail and complain loudly.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=83007
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-08 13:46:01 +02:00
David Henningsson
b8656afe4a alsa-mixer: Improve workaround for Valgrind's false warnings
Valgrind is not correctly handling ALSA TLV syscalls, which leads
to false warnings, looking like this:
 "Conditional jump or move depends on uninitialised value(s)"

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

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-08 13:05:10 +02:00
Luiz Augusto von Dentz
19180345fa bluetooth: Add pa_bluetooth_transport_unlink 2014-09-08 13:19:59 +03:00
Luiz Augusto von Dentz
4e041f7b36 bluetooth: Add pa_bluetooth_transport_set_state 2014-09-08 13:00:54 +03:00
Tanu Kaskinen
610704d225 alsa-mixer: Mark "Line HP Swap" as required-any
In the (theoretical) case that no other elements exists but
"Line HP Swap", the presence of that element signals that there are
headphone and line-out outputs, otherwise there would be nothing to
swap.
2014-09-08 11:26:00 +03:00
Peter Meerwald
293a1739e2 endianmacros: Replace borked PA_FLOAT32_SWAP() with PA_READ_FLOAT32RE() / PA_WRITE_FLOAT32RE()
building PA with -O0 leads to test failure in mix-test on i386

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

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

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

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

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

// snip

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

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

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

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

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

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

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reported-by: Felipe Sateler <fsateler@debian.org>
2014-09-04 09:58:20 +02:00
Peter Meerwald
5d7b5e509c svolume: Make volume pointer parameter const for pa_volume_float32re_c()
const obviously missing

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-03 12:51:22 +02:00
Peter Meerwald
c6bc835e45 daemon: Debian/kFreeBSD 9.2 fails to compile due to caps
Debian/kFreeBSD 9.2 comes with sys/capability.h but it is not usable; work around it

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

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

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
2014-09-02 19:35:51 +02:00
David Henningsson
58cffdcfc8 Replace "authorization" with "authentication"
Since we don't have "limited" clients, a client that authenticates
correctly is automatically authorized. However, it's the authentication
that can go wrong, rather than the authorization.

Buglink: https://bugs.freedesktop.org/show_bug.cgi?id=78566
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-02 12:50:48 +02:00
David Henningsson
764da4260a Make all debug/info level messages untranslatable
Debug and info messages are primarily meant for developers,
rather than end users. Let's save translators' time,
and leave them untranslated.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-09-02 12:50:22 +02:00
Lukas Peleska
5d20f571bc jack: made it possible to use multiple jack sources and sinks 2014-09-01 08:19:17 +02:00
Arun Raghavan
a7667b990e srbchannel: Fix documentation error
I seem to have misread the code previously.
2014-08-31 15:10:22 +05:30
David Henningsson
f611b9b7aa resampler: Remove duplicate forward declaration of pa_resampler
This duplicated line also caused a compiler warning on some compilers.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-29 15:34:34 +02:00
David Henningsson
5dba418160 sink/source: Fix restore of volume on devices without hw volume
Module-device-restore sets reference_volume, but soft_volume remains at
zero dB, so if a device only has soft_volume (i e no hw volume controls),
its volume was not restored correctly.

Reported-by: Richardo Salveti de Araujo <ricardo.salveti@canonical.com>
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-29 15:34:18 +02:00
Tanu Kaskinen
10da0578c1 device-manager: Don't allow setting an empty description in the client API
The module implementation treats an empty description as a protocol
error, so we should validate the description already at client side.
2014-08-24 12:43:11 +03:00
Tanu Kaskinen
638d0a51e2 bluetooth: Always initialize profile->available
If the transport for the profile doesn't exist, the old behaviour was
to leave cp->available at the default value, which is
PA_AVAILABLE_UNKNOWN, but if there's no transport, the profile should
be marked as unavailable.
2014-08-24 12:38:18 +03:00
Tanu Kaskinen
b1c4e7bf6b raop: Don't use incompatible default sample spec parameters
Since the RAOP sink supports only some formats and channel counts, we
shouldn't blindly use pa_core.default_sample_spec. This patch changes
things so that we default to PA_SAMPLE_S16NE and 2 channels, and only
take the sample rate from pa_core.default_sample_spec.
2014-08-24 12:08:12 +03:00