Commit graph

2631 commits

Author SHA1 Message Date
Arun Raghavan
6fdddf45f7 echo-cancel: Fix drift timer restart logic across suspend
The IS_ACTIVE() macro does a pa_sink/source_get_state() on our sink and
source, which does not work in the state change callback, since the
state is not actually committed at that point.
2014-08-18 08:28:06 +05:30
David Henningsson
48edd0a00f alsa: Add a multichannel fallback mapping
In case all other profiles fail, try this fallback mapping as well.
It allows the device to specify the channel count, so it can be used
for devices that only supports being opened in multichannel mode.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-01 18:05:49 +02:00
David Henningsson
c15107eaf6 alsa: Allow "fallback" configuration for mappings and profiles
A fallback mapping or profile will only be considered for probing
if all non-fallback profiles fail.

If auto-profiles are used, a profile made up of one non-fallback
mapping and one fallback mapping will be considered a fallback profile.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-01 18:05:49 +02:00
David Henningsson
be8311417c alsa: Add "exact-channels" mapping configurability
Allow a mapping to relax the exact channel restriction:

exact-channels = yes | no # If no, and the exact number of channels is not supported,
                          # allow device to be opened with another channel count

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-08-01 18:05:49 +02:00
Alexander E. Patrakov
afbe9605c6 alsa: Add extra HDMI mappings
Remove extra-hdmi.conf, as the performance reasons behind it are invalid
Add 7.1 profiles
Add extra HDMI devices, for a total of 8
Add DTS-encoded profiles (they need dcaenc from git)

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2014-08-01 11:01:02 +02:00
Alexander Couzens
c187441ff9 tunnel-new: remove uncorking in thread_func. Now handled by state change callback.
tunnel-new handled a corked stream conditional in the thread_func to be
sure the stream isn't corked. Un/Corking is now handled in the
state change callback.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2014-07-17 13:01:00 +03:00
Alexander Couzens
5170df86b3 tunnel-new: add un/corking to the state change callback
The stream is now corked when the sink or source becomes suspended and
uncorked when it's back idle/ready.

Signed-off-by: Alexander Couzens <lynxis@fe80.eu>
2014-07-17 12:56:00 +03:00
David Henningsson
a476371254 protocol-native: Enable srbchannel
The srbchannel is enabled if protocol version >= 30 and
SHM is available. There is also a module parameter
srbchannel=false that can be used for disabling the srbchannel.

The setup is done in these steps:
1) Server receives authentication (like today)
2) Server sends enable_srbchannel to client
3) Server sends memblock to client
4) Client receives enable_srbchannel
5) Client receives memblock
6) Client sends enable_srbchannel back to server
7) Client switches over
8) Server receives enable_srbchannel and switches over

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-06-27 14:28:21 +02:00
David Henningsson
06bc22b220 iochannel/pstream/pdispatch: Add support for receiving file descriptors
The file descriptors are read from the iochannel just like the creds are.
So instead of passing just creds (and creds_valid), we now pass the
entire pa_ancil struct.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-06-27 14:16:32 +02:00
Tanu Kaskinen
15ae55ed9b bluetooth: Refactor POLLHUP handling
The code in the "io_fail" section was only used for HUP handling, but
there were jumps to there also from places where reading or writing
failed, because the read/write failure could have been caused by HUP.
This patch simplifies things by checking for HUP condition before
trying to read or write. Now if reading or writing fails, we will
jump to "fail" directly instead of going via the "io_fail" label. As
a result, the "io_fail" label isn't needed any more.
2014-06-24 13:29:39 +03:00
Tanu Kaskinen
14845b2c8e esound, native: Pass an absolute path to pa_authkey_load() when using a file in the home directory
If a relative path is passed to pa_authkey_load(), it will interpret
the path as relative to the home directory. This is wrong, because
relative paths should be interpreted to be relative to the config home
directory. Before fixing pa_authkey_load(), this patch prepares for
the change by using absolute paths when the file actually needs to be
in the home directory (i.e. the fallback cookie path for the native
protocol and the default cookie path for the esound protocol).
2014-06-24 13:17:16 +03:00
Tanu Kaskinen
71ead4989a authkey: Rename pa_authkey_load_auto() to pa_authkey_load()
pa_authkey_load() was removed earlier, so the _auto suffix isn't
necessary any more.
2014-06-24 13:15:11 +03:00
Tanu Kaskinen
d02511115c combine-sink: Rearrange block_usec initialization
block_usec should be determined by the sink max latency, not the other
way around. This change doesn't cause any change in behaviour, but
makes the code more logical. Further updates to block_usec are already
done correctly, so this is the only place that needs modification.
2014-06-17 14:13:21 +03:00
Tanu Kaskinen
a6dbfe55c7 combine-sink: Fix the initial requested latency of new outputs
If the combine-sink is running with low latency, and a new output is
added, the new output was not configured with low latency.
2014-06-17 14:06:04 +03:00
Tanu Kaskinen
3d4a20adba combine-sink: Add a convenience variable 2014-06-17 14:06:04 +03:00
Tanu Kaskinen
ddec7e1080 combine-sink: Make the latency range calculation easier to read
I think this is much easier to understand. This should not result in
any functional change.
2014-06-17 12:52:35 +03:00
Wim Taymans
23f120aabb combine-sink: add support for DYNAMIC_LATENCY
Mark the sink as DYNAMIC_LATENCY and implement update_sink_latency_range
on its sink-input to collect the combined latency range of all sinks.

Implement update_requested_latency on the sink to configure the final
latency by combining the sink-input requested latencies. This makes us
honour the client latency request.

Also add more debug log.

Fixes https://bugs.freedesktop.org/show_bug.cgi?id=47899
2014-06-17 12:05:47 +03:00
David Henningsson
38c5d6d585 module-rescue-streams: Fixup previous patch w r t fallback sink/sources
- Make sure "no evacuation sink/source found" is not printed when
   fallback source/sink is selected
 - Restore previous behaviour of fallback sink/source selected
   (first one instead of last one)

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-06-10 08:30:05 +02:00
Hui Wang
618a2167f7 rescue-streams: try to find best one using availability and priority
Recently met a problem: when I disconnect the bluetooth headset, the
pulseaudio automatically switch the sound to sink of HDMI output
instead of the sink of internal speaker even though there is no HDMI
cable connected.

To fix this problem, I want to change the rule of selecting the target
sink if the default sink is not available. (same rules apply to the
source selecting):
construct a new hashmap with all ports (of all relevant sinks) and
then call find_best on the new hashmap to find the best port, finally
find the corresponding sink using the best port.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
2014-06-10 08:08:35 +02:00
Tanu Kaskinen
de0d803e3c bluetooth: Refactor device validity management
There are several intertwined changes that I couldn't separate into
nicer commits. This is mostly just refactoring, but this also fixes
a bug: the old code set the device valid in parse_device_properties()
even if the device's adapter was invalid (had NULL address).

To improve the clarity of the code, I split the device_info_valid
variable into two booleans: properties_received and valid.

I added function device_update_valid() that checks all conditions that
affect the device validity. The function can then be called from any
place where something changes that potentially affects the device
validity. However, currently the only validity-affecting thing that
can change is the device adapter, so device_update_valid() is only
called from set_device_adapter().

I added the aforementioned set_device_adapter() function so that
whenever the adapter is set, the device validity gets updated
automatically.

The new properties_received variable allowed me to remove the
is_property_update function parameters.
2014-06-06 15:05:45 +03:00
Tanu Kaskinen
a61d065dcc bluetooth: Add "valid" flag to pa_bluetooth_adapter
This is a cosmetic change. There are a couple of places where we check
whether the adapter object is valid, and while checking whether the
address property is set works just fine, I find it nicer to have a
dedicated flag for the object validity. This improves maintainability
too, because if there will ever be more adapter properties that affect
the adapter validity, the places that check if the adapter is valid
don't need to be updated.
2014-06-06 15:05:25 +03:00
Alexander E. Patrakov
26b9d22dd2 rtp-recv: fix crash on empty UDP packets (CVE-2014-3970)
On FIONREAD returning 0 bytes, we cannot return success, as the caller
(rtpoll_work_cb in module-rtp-recv.c) would then try to
pa_memblock_unref(chunk.memblock) and, because memblock is NULL, trigger
an assertion.

Also we have to read out the possible empty packet from the socket, so
that the kernel doesn't tell us again and again about it.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
2014-06-06 14:41:22 +03:00
Alexander E. Patrakov
42c814b9f3 source, sink: Support weird sample rates
This fixes assertion failures that manifest themselves with cards that
support only weird rates such as 37286Hz. Tested with snd-pcsp.

Signed-off-by: Alexander E. Patrakov <patrakov@gmail.com>
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=48109
2014-06-05 15:57:00 +03:00
Wim Taymans
d3d09c949d combine-sink: rework output add/remove
Add the output from its sink-input attached callback and remove it
again from the detach callback. This simplifies some output_enable
and we can also avoid posting 2 messages for the sink.
2014-06-05 12:19:36 +03:00
João Paulo Rechi Vita
5881368bf4 bluetooth: Notify the main thread of a stream fd HUP 2014-06-01 14:45:31 +03:00
João Paulo Rechi Vita
01feb3c162 bluetooth: Rename variable to improve code readability
The label 'u' is used throughout the code to name pointers to the struct
userdata.
2014-06-01 13:37:23 +03:00
David Henningsson
3f140f9022 alsa-mixer: Add surround 2.1 profile
Surround 2.1 is one of the more common surround profiles these days,
so it's about time we support it.

The "surround21" was added to alsa-lib a few months ago, and there
hasn't yet been an alsa-lib release since, but I doubt it will change.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
2014-05-27 12:02:31 +02:00
João Paulo Rechi Vita
09933e582b bluetooth: Change BlueZ 5 card profile name from a2dp to a2dp_sink
This name is more acurate with regards of what role we're currently
playing and we've already been using it in
pa_bluetooth_profile_to_string() since 449d6cb.
2014-05-25 12:24:17 +03:00
João Paulo Rechi Vita
7fe34cff61 bluetooth: Fix lines going over column 128 2014-05-25 12:24:03 +03:00
Tanu Kaskinen
3af39c648f bluetooth: Fix a copy-paste error in log message 2014-05-03 14:21:31 +03:00
Tanu Kaskinen
be9672b8c1 bluetooth: Remove redundant assignments 2014-05-03 14:10:52 +03:00
Tanu Kaskinen
f88912af9b solaris, tunnel: Remove some redundant boolean conversions 2014-05-02 16:00:56 +03:00
Tanu Kaskinen
ef4ae785aa sink-input, source-output: Remove redundant get_mute() functions
The functions just return the muted value. Callers can as well read
the struct field directly, it's simpler that way.
2014-05-02 16:00:56 +03:00
Tanu Kaskinen
e4a7625ba8 sink, source: Assign to s->muted from only one place
Forcing all mute changes to go through set_mute() makes it easier to
check where the muted field is changed, and it also allows us to have
only one place where notifications for changed mute are sent.
2014-05-02 16:00:49 +03:00
Tanu Kaskinen
c93cfc1ca6 echo-cancel: Remove redundant get_mute() callback
The callback just called pa_source_output_get_mute(), which doesn't
have any side effects, and the return value wasn't used either, so
the callback was essentially a no-op.
2014-05-02 15:50:15 +03:00
Arun Raghavan
c78860c97b gconf: Avoid calling deprecated function if possible
g_type_init() is need no longer be called explicitly from glib 2.36
onwards.
2014-04-26 11:32:45 +03:00
Arun Raghavan
a30650d2ce gconf: Remove unused variable 2014-04-26 11:32:34 +03:00
Hemanth Meenakshisundaram
4bd39f9501 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.
2014-04-26 11:22:25 +03:00
Juho Hämäläinen
a306d66525 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.
2014-04-17 11:13:01 +03:00
Niels Ole Salscheider
3064511df6 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.
2014-04-17 10:46:26 +03:00
Tanu Kaskinen
eca082a93f Use pa_hashmap_remove_and_free() where appropriate 2014-04-17 10:06:23 +03:00
Alexander E. Patrakov
a5ba31bf96 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.
2014-04-15 09:03:55 +02:00
David Henningsson
319a665ce8 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>
2014-04-04 07:28:34 +02:00
David Henningsson
06ad1b7a06 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>
2014-04-04 07:24:10 +02:00
David Henningsson
ef4a41e8b0 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>
2014-04-04 07:24:09 +02:00
Tanu Kaskinen
b75a20db10 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
2014-03-28 15:08:24 +02:00
Wim Taymans
5621b7898b device-restore: log restored mute state
Log the mute state as it was restored
2014-03-26 17:15:26 +02:00
Peter Ujfalusi
3c73e2130f 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>
2014-03-24 10:24:00 +02:00
Tanu Kaskinen
37e73e10be 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
2014-03-24 09:28:43 +02:00
Tanu Kaskinen
d03ffdccdb zeroconf-publish: Add locking around pa_mainloop_api_once()
Commit e1e154c737 added locking around
pa_mainloop_api_once() everywhere except pa__done(). This fixes that
omission.
2014-03-24 09:28:34 +02:00