platform/upstream/pulseaudio.git
6 years agoupdate NEWS upstream/11.1 v11.1
Tanu Kaskinen [Mon, 18 Sep 2017 14:40:00 +0000 (17:40 +0300)]
update NEWS

6 years agoNEWS: add GNU Hurd support
Tanu Kaskinen [Tue, 5 Sep 2017 10:23:58 +0000 (13:23 +0300)]
NEWS: add GNU Hurd support

For some reason this was left out when copying the feature list from the
release notes.

6 years agobluez: Don't crash on strange MTU sizes
Arun Raghavan [Wed, 13 Sep 2017 07:19:28 +0000 (12:49 +0530)]
bluez: Don't crash on strange MTU sizes

We got reports of this with automatically detected MTUs that weren't
frame aligned.

6 years agobluez: Don't autodetect MTU by default
Arun Raghavan [Wed, 13 Sep 2017 03:52:27 +0000 (09:22 +0530)]
bluez: Don't autodetect MTU by default

This breaks a lot of headsets, so disabling by default. Can be
re-enabled in configuration for specific hardware where it is deemed
necessary.

Also added some debug logging to be able to examine what MTU size is
reported by the device.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102660
6 years agoalsa-mixer: add mixer handling to the fallback stereo case
Tanu Kaskinen [Fri, 8 Sep 2017 12:10:41 +0000 (15:10 +0300)]
alsa-mixer: add mixer handling to the fallback stereo case

Some sound cards don't have any alsa-lib configuration, but they used to
work well enough up to PulseAudio 10. PulseAudio 11 stopped using "hw:0"
for the analog-stereo mapping, and instead defined it as a fallback
mapping without any mixer handling. As a result, switching between
headphones and speakers stopped working without changing the mixer
settings manually at least on Toshiba Chromebook 2. This patch adds the
mixer handling back to the fallback mapping.

I also renamed "unknown-stereo" to "stereo-fallback", because I like
that name more.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102560
6 years agosink: remove priority bonus for the "internal" form factor
Tanu Kaskinen [Wed, 6 Sep 2017 13:08:29 +0000 (16:08 +0300)]
sink: remove priority bonus for the "internal" form factor

We're supposed to prioritize USB sound cards over PCI sound cards, but
the priority bonus for the "internal" form factor prevents this from
happening. Not all (if any) USB sound cards have the form factor
property set, whereas at least on my laptop the on-board sound card has
the form factor set to "internal".

6 years agosink, source: fix out of date comments
Tanu Kaskinen [Sun, 10 Sep 2017 19:32:57 +0000 (22:32 +0300)]
sink, source: fix out of date comments

update_shared_real_volume() doesn't exist. I checked that
update_real_volume() does what the comments claim
update_shared_real_volume() to do.

6 years agosink, source: don't try to update volumes of not-yet-linked devices
Tanu Kaskinen [Sun, 10 Sep 2017 19:32:56 +0000 (22:32 +0300)]
sink, source: don't try to update volumes of not-yet-linked devices

The order of the pa_sink_input_put() and pa_sink_put() calls in filter
modules was swapped in commit edc465da77 ("virtual sources and sinks:
Don't double attach a sink input or source output on filter load").
If flat volumes and volume sharing is enabled, the pa_sink_input_put()
call will update volumes of the whole tree of virtual sinks that are
connected to the root sink. The recursive updating procedure tried to
also update the volume of the new sink for which pa_sink_put() had not
yet been called, causing an assertion failure.

This patch tries to make sure that the volume of not-yet-linked sinks
is never changed. pa_sink_put() will set the sink volume correctly, so
it's fine to skip the not-yet-linked sinks during pa_sink_input_put().

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102549
6 years agoupdate NEWS v11.0
Tanu Kaskinen [Tue, 5 Sep 2017 09:10:29 +0000 (12:10 +0300)]
update NEWS

6 years agobluez5-device: lower sink/source priority for Audio gateway or a2dp source
Georg Chini [Sat, 2 Sep 2017 19:46:04 +0000 (21:46 +0200)]
bluez5-device: lower sink/source priority for Audio gateway or a2dp source

When a phone is connected via bluetooth and switches to HFP, the sinks
and sources will have higher priority than the built-in devices.
Therefore they are chosen as default and module-bluetooth-policy will
incorrectly insert loopback modules that loop the phone back to itself.

This patch fixes the problem by lowering the priority of sink and source
if PulseAudio is in the headset role. The priority is also lowered if the
device is an a2dp source. In both cases it does not make sense to make the
source or sink default unless there is no other sound device available.

6 years agocore: ignore devices that are not linked when choosing the default sink or source
Tanu Kaskinen [Wed, 30 Aug 2017 18:51:15 +0000 (21:51 +0300)]
core: ignore devices that are not linked when choosing the default sink or source

Sources should probably be added to pa_core.sources in pa_source_put(),
but currently they're added in pa_source_new(). A lot of stuff can
happen between the pa_source_new() and pa_source_put() calls, and
it has happened that the default source was updated during this time.
Therefore, pa_core_update_default_source() needs to take it into account
that not every source is necessarily linked.

6 years agoi18n: add a Norwegian Nynorsk translation
Karl Ove Hufthammer [Thu, 17 Aug 2017 11:15:09 +0000 (14:15 +0300)]
i18n: add a Norwegian Nynorsk translation

6 years agotunnel-{sink, source}-new: Fix assertion when used with loopback or combine-sink
Georg Chini [Sat, 12 Aug 2017 20:29:26 +0000 (22:29 +0200)]
tunnel-{sink, source}-new: Fix assertion when used with loopback or combine-sink

Currently pulseaudio crashes with an assertion in pa_rtpoll_item_new_asyncmsgq_read()
or pa_rtpoll_item_new_asyncmsgq_write() if a loopback is applied to a tunnel-new
sink or source, because tunnel-{sink,source}-new do not set thread_info.rtpoll.
The same applies to module-combine-sink and module-rtp-recv.

This patch is not a complete fix for the problem but provides a temporary band-aid
by initializing thread_info.rtpoll properly. The rtpoll created is never run, but
loopback and combine-sink nevertheless work, see comments in the code.

This patch does not work for module-rtp-recv, but using rtp-recv with a remote
sink does not seem to make a lot of sense anyway.

link: https://bugs.freedesktop.org/show_bug.cgi?id=73429
6 years agoi18n: update the Lithuanian translation
Moo [Tue, 15 Aug 2017 05:41:59 +0000 (08:41 +0300)]
i18n: update the Lithuanian translation

6 years agoconf-parser: provide a replacement for scandir on Win32
Vadim Troshchinskiy [Fri, 4 Aug 2017 13:05:31 +0000 (15:05 +0200)]
conf-parser: provide a replacement for scandir on Win32

PA builds fine on MinGW except for the use of the scandir function in
pulsecore/conf-parser.c, so I provided a Win32 implementation. With this
patch the latest code builds on Win32 without problems.

6 years agoecho-cancel: don't set latency range if the device doesn't support dynamic latency
Tanu Kaskinen [Thu, 3 Aug 2017 07:38:01 +0000 (10:38 +0300)]
echo-cancel: don't set latency range if the device doesn't support dynamic latency

pa_sink/source_set_latency_range() has an assertion that is triggered
when setting the latency range on a fixed latency device.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102020
6 years agopacat: fix a memory issue
Denis Shulyaka [Sun, 30 Jul 2017 20:40:19 +0000 (23:40 +0300)]
pacat: fix a memory issue

If only part of the buffer is written into stdout by stdout_callback,
the buffer_index variable is increased by the number of written bytes,
buffer_length variable is decreased while the allocated buffer size
remains the same. That suggests that the current allocated size is
calculated as (buffer_index + buffer_length). However the current
stream_read_callback implementation writes new data to the start of the
buffer and allocates too little space, so that (buffer + buffer_index +
buffer_length - 1) could actully point outside of the allocated buffer.

6 years agoi18n: update Polish translation
Piotr Drąg [Tue, 25 Jul 2017 15:26:06 +0000 (17:26 +0200)]
i18n: update Polish translation

https://bugs.freedesktop.org/show_bug.cgi?id=101918

6 years agobuild-sys: add coverity/model.c to the tarball v10.99.1
Tanu Kaskinen [Mon, 24 Jul 2017 23:27:31 +0000 (02:27 +0300)]
build-sys: add coverity/model.c to the tarball

6 years agobuild-sys: bump sonames
Tanu Kaskinen [Mon, 24 Jul 2017 22:47:58 +0000 (01:47 +0300)]
build-sys: bump sonames

6 years agosimple: fix negative latency handling
Tanu Kaskinen [Tue, 11 Jul 2017 18:21:43 +0000 (21:21 +0300)]
simple: fix negative latency handling

pa_usec_t is an unsigned type, but there were calculations that used it
as if it were a signed type.

If the latency is negative, pa_simple_get_latency() now reports 0.

Added some comments too.

6 years agosimple: Change latency estimation to account for already-read data in pa_simple_get_l...
Ted Ying [Thu, 1 Jun 2017 22:00:20 +0000 (18:00 -0400)]
simple: Change latency estimation to account for already-read data in pa_simple_get_latency().

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81075
6 years agoprotocol-native: fix bytes-to-usec conversion of "on-the-fly" data
Tanu Kaskinen [Tue, 11 Jul 2017 18:16:17 +0000 (21:16 +0300)]
protocol-native: fix bytes-to-usec conversion of "on-the-fly" data

The on_the_fly_snapshot variable contains the amount of bytes that has
been sent from the source IO thread to the main thread, but not yet
pushed to the stream memblockq. The data is in the stream format, but
the bytes-to-usec conversion used the source format, which caused random
latency reporting errors.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=81075
6 years agocore: change configured_default_sink/source type to string
Tanu Kaskinen [Thu, 29 Jun 2017 21:09:34 +0000 (00:09 +0300)]
core: change configured_default_sink/source type to string

This allows us to restore the default device properly when a
hotpluggable device (e.g. a USB sound card) is set as the default, but
unplugged temporarily. Previously we would forget that the unplugged
device was ever set as the default, because we had to set
configured_default_sink to NULL to avoid having a stale pa_sink pointer,
and also because module-default-device-restore couldn't resolve the name
of a currently-unplugged device to a pa_sink pointer.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=89934
6 years agofix dbus message leaks
Tanu Kaskinen [Mon, 3 Jul 2017 14:35:08 +0000 (17:35 +0300)]
fix dbus message leaks

I reviewed all places that call
dbus_connection_send_with_reply_and_block(), and found several places
where dbus messages aren't properly unreffed.

6 years agosolaris: Support building on GNU Hurd
David Michael [Sun, 4 Jun 2017 03:53:48 +0000 (20:53 -0700)]
solaris: Support building on GNU Hurd

6 years agoman: fix typo: "the" -> "they"
Tanu Kaskinen [Wed, 12 Jul 2017 16:56:09 +0000 (19:56 +0300)]
man: fix typo: "the" -> "they"

6 years agoman: fix typos: "my" -> "may"
Tanu Kaskinen [Wed, 12 Jul 2017 16:44:38 +0000 (19:44 +0300)]
man: fix typos: "my" -> "may"

6 years agoman: fix a copy-paste error
Tanu Kaskinen [Wed, 12 Jul 2017 15:35:24 +0000 (18:35 +0300)]
man: fix a copy-paste error

6 years agobluez5-device: Log subband count instead of subband flag
Grzegorz Kolodziejczyk [Mon, 12 Jun 2017 15:42:26 +0000 (17:42 +0200)]
bluez5-device: Log subband count instead of subband flag

As log information says, SBC log info have to have one of two subband count
values: 4 or 8, instead of subband flag.

6 years agoi18n: update the Ukrainian translation
Yuri Chornoivan [Sun, 25 Jun 2017 19:30:55 +0000 (22:30 +0300)]
i18n: update the Ukrainian translation

6 years agoRevert "bluetooth: Auto recover if profile is 'off'"
Tanu Kaskinen [Tue, 13 Jun 2017 16:02:37 +0000 (19:02 +0300)]
Revert "bluetooth: Auto recover if profile is 'off'"

This reverts commit 69c212f8c13794f70899d1fe6baec1b6e3c92032.

Reasons:

The original reason for the patch was to work around some issue
regarding the profile not connecting immediately (sorry, I don't really
know the details), but that issue was fixed later by commit 998dfdf4cc,
so the original reason doesn't apply any more.

Automatically changing the profile when the transport state changes to
PLAYING has traditionally been handled by module-bluetooth-policy, and
as far as I can tell, there's no reason to change that.

The assertion is unsafe. It's not guaranteed that the profile change
will always succeed (at least pa_thread_mq_init() can fail due to
reaching the maximum file descriptor limit).

7 years agoi18n: update the Italian translation
Milo Casagrande [Thu, 8 Jun 2017 11:30:59 +0000 (13:30 +0200)]
i18n: update the Italian translation

Signed-off-by: Milo Casagrande <milo@milo.name>
7 years agopadsp: Write only frame-aligned chunks to the stream
Arun Raghavan [Thu, 1 Jun 2017 07:01:47 +0000 (16:01 +0900)]
padsp: Write only frame-aligned chunks to the stream

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=101121

7 years agoalsa: make priority of the port headset-mic higher than headphone-mic
Hui Wang [Thu, 25 May 2017 03:10:33 +0000 (11:10 +0800)]
alsa: make priority of the port headset-mic higher than headphone-mic

There are two reasons for this change:

1. If it is a Dell desktop machine with the realtek codec, and there
is no internal microphone on it, there is one physical audio jack
which can support headphone, headset and microphone, but this audio
jack does not have hardware capability to distinguish what is plugged
in, after users plug in a headphone and select headphone from UI
program, the headphone can't output any sound. There are many reasons
for this issue, one of them is the active_port of pa_source is set
to headphone-mic, that means the kernel audio driver will configure
this audio jack to be a microphone jack instead of headphone jack.
If we make the priority of headset-mic a bit higher than headphone-mic,
the headset-mic will be the active_port of pa_source unless users
select the headphone-mic on purpose, then this issue will be fixed.

2. Nowadays, the headset is more popular than traditional microphone,
It is highly possible that users plug in a headset instead of
microphone, it makes sense to make the headset-mic's priority higher
than headphone-mic's.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
7 years agostream-restore: Ignore sink-inputs/source-outputs that connect a filter to the master
Georg Chini [Wed, 31 May 2017 18:54:43 +0000 (20:54 +0200)]
stream-restore: Ignore sink-inputs/source-outputs that connect a filter to the master

module-stream-restore primarily uses the role of a stream for restoring. The sink-inputs
and source-outputs of filters all have role "filter", therefore currently all filters are
treated equally and are restored to the same device and volume.

This patch lets module-stream-restore ignore the streams that connect the filter to the
master.

link: https://bugs.freedesktop.org/show_bug.cgi?id=100065
7 years agoi18n: update the French translation
Tanu Kaskinen [Mon, 22 May 2017 07:06:29 +0000 (10:06 +0300)]
i18n: update the French translation

These changes are from fedora.zanata.org. The authors are
Sam Friedmann <sfriedma@redhat.com>
Wim Taymans <wim.taymans@gmail.com>
Edouard Duliege <edouard.duliege@gmail.com>

7 years agoi18n: Updated Turkish translation
Muhammet Kara [Sat, 20 May 2017 08:20:00 +0000 (11:20 +0300)]
i18n: Updated Turkish translation

7 years agosink-input, source-output: don't allow moving streams that are connected to moving...
Tanu Kaskinen [Mon, 8 May 2017 09:58:49 +0000 (12:58 +0300)]
sink-input, source-output: don't allow moving streams that are connected to moving filter devices

When a filter sink is moving, it's not connected to any master sink, and
therefore it's not connected to any IO thread either. In this situation
trying to move a stream that is connected to the filter sink is likely
to result in crashing, because starting the move involves sending a
message to the IO thread. Sometimes this works by accident (the
asyncmsgq of the filter sink still points to the old master sink's
asyncmsgq), but we really should never attempt it. This patch blocks all
moves where the moving stream is connected to a filter sink that itself
is in the middle of a move.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100277
7 years agosink/source: Don't update default sink/source before calling PA_CORE_HOOK_{SINK,SOURC...
Georg Chini [Thu, 18 May 2017 05:47:27 +0000 (07:47 +0200)]
sink/source: Don't update default sink/source before calling PA_CORE_HOOK_{SINK,SOURCE}_PUT

In sink_put() and source_put(), pa_core_update_default_{sink,source}() was called
before the PA_CORE_HOOK_{SINK,SOURCE}_PUT hook. Therefore module-switch-on-connect
could not correctly determine the old default sink/source if no user default was
set and a sink/source with higher priority than any other sink/source turned up.

This patch corrects the problem by swapping the order of the hook call and the
pa_core_update_default_sink() call.

Additionally it corrects a problem in module-switch-on-connect. If, after the
change above, the new sink/source was the first sink/source to appear, pulseaudio
would crash because module-switch-on-connect assumed that the default sink/source
was not NULL. The patch checks if the default sink/source is NULL and only sets
the new default sink/source in that case.

7 years agovirtual sources and sinks: Don't double attach a sink input or source output on filte...
Georg Chini [Thu, 18 May 2017 05:46:46 +0000 (07:46 +0200)]
virtual sources and sinks: Don't double attach a sink input or source output on filter load

When a filter is loaded and module-switch-on-connect is present, switch-on-connect
will make the filter the default sink or source and move streams from the old
default to the filter. This is done from the sink/source put hook, therefore streams
are moved to the filter before the module init function of the filter calls
sink_input_put() or source_output_put(). The move succeeds because the asyncmsq
already points to the queue of the master sink or source. When the master sink or
source is attached to the sink input or source output, the attach callback will call
pa_{sink,source}_attach_within_thread(). These functions assume that all streams
are detached. Because streams were already moved to the filter by switch-on-connect,
this assumption leads to an assertion in pa_{sink_input,source_output}_attach().

This patch fixes the problem by reverting the order of the pa_{sink,source}_put()
calls and the pa_{sink_input,source_output}_put calls and creating the sink input
or source output corked. The initial rewind that is done for the master sink is
moved to the sink message handler. The order of the unlink calls is swapped as well
to prevent that the filter appears to be moving during module unload.

The patch also seems to improve user experience, the move of a stream to the filter
sink is now done without any audible interruption on my system.

The patch is only tested for module-echo-cancel.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=100065
7 years agovirtual sinks and sources: Revert commits
Georg Chini [Thu, 18 May 2017 05:46:08 +0000 (07:46 +0200)]
virtual sinks and sources: Revert commits

This patch reverts commit db4fbb0121a2577d786cda023a6a439a9734f152 and
3bb94c4e836ca765a36255e416fd8e6cf272ab44. They were the wrong approach
to fix the bug (and did not fix it anyway).

7 years agosink, source: update the default sink/source on port switches
Tanu Kaskinen [Sun, 7 May 2017 09:12:39 +0000 (12:12 +0300)]
sink, source: update the default sink/source on port switches

When sinks are compared during the default sink selection, the active
port's availability is inspected. Therefore, the default sink should be
updated when the active port changes, because the new port may have
different availability status than the old port.

For example, let's say that a laptop has an analog sink with a speaker
and a headphone port, and headphones are initially plugged in, so both
ports can be used[1]. The headphone port is initially the active port.
There's also a null sink in the system. When the headphones are
unplugged, the headphone port becomes unavailable, and the null sink
becomes the new default sink. Then module-switch-on-port-available
changes the analog sink port to speakers. Now the default sink should
change back to the analog sink, but that doesn't happen without this
patch.

[1] Actually we currently mark speakers as unavailable when headphones
are plugged in, but that's not strictly necessary. My example relies on
both ports being available initially, so the bug can't be reproduced
with the current mixer configuration.

7 years agoi18n: update the Croatian translation
muzena [Thu, 27 Apr 2017 13:06:46 +0000 (15:06 +0200)]
i18n: update the Croatian translation

7 years agobluez5-device: Correctly handle suspend/resume cyle for audio gateway role of ofono...
Georg Chini [Thu, 4 May 2017 11:14:51 +0000 (13:14 +0200)]
bluez5-device: Correctly handle suspend/resume cyle for audio gateway role of ofono backend

When the ofono backend released a tranport during suspend of sink or source, the
transport state was not changed to IDLE. Therefore pa_bluetooth_transport_set_state()
would return immediately when trying to resume. Even though the transport was acquired
correctly, setup_stream() would never be called and the resume failed.

This patch sets the transport state to IDLE when the transport is released. On resume,
the first call to transport_acquire() will be done from the message handler of the
*_SET_STATE message when source or sink are set to RUNNING. This call will only request
the setup of the connection, so setup_stream() cannot be called.
When the transport changes the state to PLAYING in hf_audio_agent_new_connection(),
handle_transport_state_change() is called. Because the sink or source state is already
RUNNING, the pa_{source,sink}_suspend() call will not lead to a state change message
and the I/O thread must be signaled explicitely to setup the stream.

The first setup of the device would also fail, which was only visible when the profile
was restored after connecting the headset. When trying to restore the headset_head_unit
profile, the profile was shortly set to off, so the headset always returned to a2dp.

This patch allows a delayed setup for the headset_head_unit profile, so that the profile
can successfully be restored.

7 years agobluetooth: ofono: Fix failing to parse valid NewConnection
Luiz Augusto von Dentz [Thu, 4 May 2017 11:12:59 +0000 (13:12 +0200)]
bluetooth: ofono: Fix failing to parse valid NewConnection

When suspending due to idle timeout the transport will not change its
state, also in case the fd is closed due to POLLERR/POLLHUP events
the release shall check if the fd is still set otherwise it will fail
to be acquired again.

7 years agobluetooth: ofono: Close fd if cannot be accepted
Luiz Augusto von Dentz [Thu, 4 May 2017 11:11:27 +0000 (13:11 +0200)]
bluetooth: ofono: Close fd if cannot be accepted

Always close fd that cannot be accepted otherwise it will be left open
without being attached to any transport.

7 years agobluetooth: Auto recover if profile is 'off'
Luiz Augusto von Dentz [Thu, 4 May 2017 10:58:54 +0000 (12:58 +0200)]
bluetooth: Auto recover if profile is 'off'

This means something went wrong, which in case of ofono backend it is
probably due to the profile not connecting immediately, but it can be
safely restored in that case the transport is playing which means the
profile has recovered connectivity.

7 years agobluetooth: Don't default to native backend
Luiz Augusto von Dentz [Thu, 4 May 2017 10:53:32 +0000 (12:53 +0200)]
bluetooth: Don't default to native backend

The native backend is limited to HSP only which may not work with devices
that can only do HFP so if oFono is enabled it shall be used as default.

7 years agobluetooth: ofono: Detect if Connect has been called
Luiz Augusto von Dentz [Thu, 4 May 2017 10:52:18 +0000 (12:52 +0200)]
bluetooth: ofono: Detect if Connect has been called

This detects if profile has already been called and we are waiting
the response.

7 years agobluetooth: ofono: Fix asserting when connecting as AG
Luiz Augusto von Dentz [Thu, 4 May 2017 10:51:00 +0000 (12:51 +0200)]
bluetooth: ofono: Fix asserting when connecting as AG

Check the card Type property instead of assuming ofono would only be used
for HF role.

7 years agobluetooth: ofono: Don't attempt to connect if fd is ready
Luiz Augusto von Dentz [Thu, 4 May 2017 10:47:58 +0000 (12:47 +0200)]
bluetooth: ofono: Don't attempt to connect if fd is ready

If SCO fd is already set don't attempt to connect again.

7 years agojack-sink: fix latency calculation
Tanu Kaskinen [Tue, 2 May 2017 13:44:29 +0000 (16:44 +0300)]
jack-sink: fix latency calculation

The compiler warned about number_of_frames being possibly used
uninitialized, and on closer inspection I found that it was indeed not
initialized if saved_frame_time_valid is false.

In commit fe70b9e11a "source/sink: Allow pa_{source,
sink}_get_latency_within_thread() to return negative values" the
number_of_frames variable was added as an unsigned version of the l
variable, and number_of_frames partially replaced the l variable. The
replacement should have gone all the way, however. This patch removes
the remaining uses of the l variable and substitutes number_of_frames
on its place, and as a result, number_of_frames is now always
initialized.

7 years agocore, device-port: check availability when choosing the default device
Tanu Kaskinen [Thu, 16 Feb 2017 10:09:39 +0000 (12:09 +0200)]
core, device-port: check availability when choosing the default device

It doesn't make sense to use a sink or source whose active port is
unavailable, so let's take this into account when choosing the default
sink and source.

7 years agoimprove default sink/source handling
Tanu Kaskinen [Thu, 16 Feb 2017 10:09:38 +0000 (12:09 +0200)]
improve default sink/source handling

Currently the default sink policy is simple: either the user has
configured it explicitly, in which case we always use that as the
default, or we pick the sink with the highest priority. The sink
priorities are currently static, so there's no need to worry about
updating the default sink when sink priorities change.

I intend to make things a bit more complex: if the active port of a sink
is unavailable, the sink should not be the default sink, and I also want
to make sink priorities dependent on the active port, so changing the
port should cause re-evaluation of which sink to choose as the default.
Currently the default sink choice is done only when someone calls
pa_namereg_get_default_sink(), and change notifications are only sent
when a sink is created or destroyed. That makes it hard to add new rules
to the default sink selection policy.

This patch moves the default sink selection to
pa_core_update_default_sink(), which is called whenever something
happens that can affect the default sink choice. That function needs to
know the previous choice in order to send change notifications as
appropriate, but previously pa_core.default_sink was only set when the
user had configured it explicitly. Now pa_core.default_sink is always
set (unless there are no sinks at all), so pa_core_update_default_sink()
can use that to get the previous choice. The user configuration is saved
in a new variable, pa_core.configured_default_sink.

pa_namereg_get_default_sink() is now unnecessary, because
pa_core.default_sink can be used directly to get the
currently-considered-best sink. pa_namereg_set_default_sink() is
replaced by pa_core_set_configured_default_sink().

I haven't confirmed it, but I expect that this patch will fix problems
in the D-Bus protocol related to default sink handling. The D-Bus
protocol used to get confused when the current default sink gets
removed. It would incorrectly think that if there's no explicitly
configured default sink, then there's no default sink at all. Even
worse, when the D-Bus thinks that there's no default sink, it concludes
that there are no sinks at all, which made it impossible to configure
the default sink via the D-Bus interface. Now that pa_core.default_sink
is always set, except when there really aren't any sinks, the D-Bus
protocol should behave correctly.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=99425
7 years agoalsa: don't assume that hw:x is an analog output
Tanu Kaskinen [Mon, 24 Apr 2017 15:06:52 +0000 (18:06 +0300)]
alsa: don't assume that hw:x is an analog output

Previously, if front:x didn't work, we would try to use hw:x for analog
stereo output. There's no guarantee that hw:x is an analog output,
however. For example, the Intel HDMI LPE driver uses hw:x for HDMI
output, and PulseAudio incorrectly created analog profiles for that
card, because front:x doesn't work but hw:x does.

This patch changes things so that the analog stereo mapping doesn't any
more use hw:x as a fallback. A separate "unknown stereo" fallback
mapping is added to handle the rare case where hw:x is the only PCM
device that works.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100488
7 years agovolume: Fix overflow in percent calculation of pa_*volume_snprint*()
Georg Chini [Sat, 29 Apr 2017 08:38:05 +0000 (10:38 +0200)]
volume: Fix overflow in percent calculation of pa_*volume_snprint*()

The percent calculation could overflow in the pa_*volume_snprint*() functions.
For large volumes, volume * 100 can exceed UINT32_MAX.

This patch adds appropriate type casts.

7 years agovolume: Print a warning when volume is clipped in pa_sw_volume_multiply/divide()
Georg Chini [Sat, 29 Apr 2017 08:12:01 +0000 (10:12 +0200)]
volume: Print a warning when volume is clipped in pa_sw_volume_multiply/divide()

When the volume exceeds PA_VOLUME_MAX in pa_sw_volume_multiply() or
pa_sw_volume_divide(), volume settings are insanely high and the
user should be notified about it.

This patch adds volume clamping to pa_sw_volume_divide() and prints
a warning when the volume is clipped in both functions.

7 years agosource/sink: Fix wrong calculation of thread_info.current_hw_volume
Georg Chini [Sat, 29 Apr 2017 08:07:01 +0000 (10:07 +0200)]
source/sink: Fix wrong calculation of thread_info.current_hw_volume

In pa_{source,sink}_new() and pa_{source,sink}_put() the current hardware
volume was miscalculated:

hw volume (dB) = real volume (dB) + soft volume (dB)
was used instead of
hw volume (dB) = real volume (dB) - soft volume (dB)

This lead to a crash in pa_alsa_path_set_volume() if high volumes were
set and the port was changed.

This patch fixes the calculation. Thanks to Tanu for pointing out
the correct solution.

link: https://bugs.freedesktop.org/show_bug.cgi?id=65520
7 years agoi18n: update the Brazilian Portuguese translation
Rafael Fontenelle [Sun, 9 Apr 2017 23:22:04 +0000 (20:22 -0300)]
i18n: update the Brazilian Portuguese translation

7 years agovirtual sources and sinks: Fix possible segfault
Georg Chini [Mon, 24 Apr 2017 18:31:54 +0000 (20:31 +0200)]
virtual sources and sinks: Fix possible segfault

Several virtual sources and sinks apart from module-echo-cancel also query the master
sink or source to estimate the current latency. Those modules might potentially show
the bug that is described for module-echo-cancel in bug 100277.

This patch checks in the message handlers for the PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY
if the master sink or source is valid and returns 0 as latency if not. This is however
not yet sufficient to solve the issue. Additional patches will follow.

7 years agoecho-cancel: Fix segfault during profile switch
Georg Chini [Mon, 24 Apr 2017 18:30:48 +0000 (20:30 +0200)]
echo-cancel: Fix segfault during profile switch

When module-echo-cancel is loaded and there is only one sound card, then during a
profile switch, all sinks and sources can become temporarily unavailable. If
module-always sink is loaded, it will load a null-sink in that situation. If
also module-switch-on-connect is loaded, it will try to move the sink-inputs to
the new null-sink. If a sink-input was connected to the echo-cancel sink,
pa_sink_input_start_move() will send a PA_SINK_GET_LATENCY message to the
echo-cancel sink. The message handler will then in turn call
pa_sink_get_latency_within_thread() for the invalid master sink of module-echo-cancel.
This lead to a segfault.

This patch checks in the message handler if the master sink (or source) is valid and
returns 0 if not.

7 years agoi18n: Update the Korean translation
KimJeongYeon [Sat, 22 Apr 2017 17:29:24 +0000 (02:29 +0900)]
i18n: Update the Korean translation

Translate filter modules and fixed wrong c-format.

Signed-off-by: KimJeongYeon <jeongyeon.kim@samsung.com>
7 years agoi18n: add Croatian translation
muzena [Sun, 23 Apr 2017 21:06:47 +0000 (23:06 +0200)]
i18n: add Croatian translation

7 years agobluez5-util: Fix segfault during shutdown of daemon
Georg Chini [Fri, 21 Apr 2017 19:49:58 +0000 (21:49 +0200)]
bluez5-util: Fix segfault during shutdown of daemon

If a HFP audio gateway was connected via the ofono backend, pulse would
segfault during shutdown of the daemon. pa_bluetooth_discovery_unref()
removed the devices and transports before the ofono backend was freed.
Because the ofono backend keeps its own list of transports, transport_free()
was then called during termination of the ofono backend with an invalid
transport. Bug reported by Andrew Hlynskyi.

This patch moves the termination of the ofono and native backends before
freeing the devices.

7 years agoecho-cancel: Change the DEVICE_MASTER_DEVICE property when changing device
Corentin Noël [Wed, 12 Apr 2017 23:54:25 +0000 (01:54 +0200)]
echo-cancel: Change the DEVICE_MASTER_DEVICE property when changing device

7 years agosink: Add missing 'hifi' form factor to priorities
Christian Kellner [Wed, 5 Apr 2017 11:59:08 +0000 (13:59 +0200)]
sink: Add missing 'hifi' form factor to priorities

Assign it a propriety of 600, therefore ranking higher then speaker,
but below headphone.

https://bugs.freedesktop.org/show_bug.cgi?id=100579

7 years agosink: Add portable form factor priority (450)
Christian Kellner [Wed, 5 Apr 2017 11:52:27 +0000 (13:52 +0200)]
sink: Add portable form factor priority (450)

The 'portable' form factor was currently missing meaning it is not
getting any form-factor priority at all and it would therefore always
be ranked lower then internal devices (which receive 400 form factor
priority). The priority 450 is smaller then 'speaker', based on the
idea that a portable device might have less quality then a dedicated
'speaker' device (some Yamaha amplifiers announce themselves as such).

https://bugs.freedesktop.org/show_bug.cgi?id=100579

7 years agosource/sink: Allow pa_{source, sink}_get_latency_within_thread() to return negative...
Georg Chini [Mon, 17 Apr 2017 17:50:10 +0000 (19:50 +0200)]
source/sink: Allow pa_{source, sink}_get_latency_within_thread() to return negative values

The reported latency of source or sink is based on measured initial conditions.
If the conditions contain an error, the estimated latency values may become negative.
This does not indicate that the latency is indeed negative but can be considered
merely an offset error. The current get_latency_in_thread() calls and the
implementations of the PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY messages truncate negative
latencies because they do not make sense from a physical point of view. In fact,
the values are truncated twice, once in the message handler and a second time in
the pa_{source,sink}_get_latency_within_thread() call itself.
This leads to two problems for the latency controller within module-loopback:

- Truncating leads to discontinuities in the latency reports which then trigger
  unwanted end to end latency corrections.
- If a large negative port latency offsets is set, the reported latency is always 0,
  making it impossible to control the end to end latency at all.

This patch is a pre-condition for solving these problems.
It adds a new flag to pa_{sink,source}_get_latency_within_thread() to allow
negative return values. Truncating is also removed in all implementations of the
PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY message handlers. The allow_negative flag
is set to false for all calls of pa_{sink,source}_get_latency_within_thread()
except when used within PA_{SINK,SOURCE}_MESSAGE_GET_LATENCY. This means that the
original behavior is not altered in most cases. Only if a positive latency offset
is set and the message returns a negative value, the reported latency is smaller
because the values are not truncated twice.

Additionally let PA_SOURCE_MESSAGE_GET_LATENCY return -pa_sink_get_latency_within_thread()
for monitor sources because the source gets the data before it is played.

7 years agosource/sink: Don't let pa_{sink, source}_get_latency_within_thread() return -1 if...
Georg Chini [Mon, 17 Apr 2017 17:48:37 +0000 (19:48 +0200)]
source/sink: Don't let pa_{sink, source}_get_latency_within_thread() return -1 if process_msg() fails

None of the callers checks the return value anyway. Return the offset only
if message processing fails. This is in preparation for the next patch.

7 years agoladspa-sink, virtual-surround-sink: fix master sink argument handling
Tanu Kaskinen [Fri, 14 Apr 2017 15:20:40 +0000 (18:20 +0300)]
ladspa-sink, virtual-surround-sink: fix master sink argument handling

The old code worked incorrectly in several situations. For example,
trying to use the "master" argument wouldn't work, because if
"sink_master" wasn't specified, pa_namereg_get() would pick the default
sink as the master sink.

7 years agosample.c: Allow module-loopback to exceed PA_RATE_MAX
Georg Chini [Fri, 14 Apr 2017 13:03:56 +0000 (15:03 +0200)]
sample.c: Allow module-loopback to exceed PA_RATE_MAX

The rate set by module loopback may exceed PA_RATE_MAX by 1%, therefore
allow rates higher than PA_RATE_MAX in pa_sample_rate_valid().

7 years agoloopback: Implement underrun protection
Georg Chini [Fri, 14 Apr 2017 13:02:36 +0000 (15:02 +0200)]
loopback: Implement underrun protection

The latency controller will try to adjust to the configured latency regardless
of underruns. If the configured latency is set too small, it will lead to
periodically occuring underruns. Therefore an underrun protection is implemented
which will increase the target latency if too many underruns are detected.
Underruns are tracked and if more than 3 underruns occur, the target latency
is increased in increments of 5 ms. One underrun per hour is accepted.
The protection ensures, that independent from the configured latency the
module will converge to a stable latency if the configured latency is too
small.

The print_msg argument to update_minimum_latency() had to be re-introduced,
because there is one place where the message should not be logged.

7 years agofilter-apply: Add ability to pass parameters to a filter module
KimjeongYeon [Thu, 13 Apr 2017 19:09:49 +0000 (21:09 +0200)]
filter-apply: Add ability to pass parameters to a filter module

Currently passing parameters to a filter loaded by module-filter-apply is
not possible.

To enable passing parameters to a filter this patch uses an additional property
filter.apply.{MODULE_NAME}.parameters. This way, filters like virtual-surround-sink
and ladspa-sink are fully supported. For example:
paplay file.wav --property=filter.apply=ladspa-sink \
                --property=filter.apply.ladspa-sink.parameters="plugin=ladspa \
                  label=ladspa_stereo control=0"

7 years agoladspa-sink: Add sink_master argument to enable filter-apply to load the module
KimjeongYeon [Thu, 13 Apr 2017 18:58:14 +0000 (20:58 +0200)]
ladspa-sink: Add sink_master argument to enable filter-apply to load the module

Currently, module-filter-apply cannot load module-ladspa-sink because filter-apply
provides the argument "sink_master" but ladspa-sink expects "master" instead.

Therefore this patch adds the sink_master argument to module-ladspa-sink.

Additionally, the autoloaded argument was also added.

7 years agovirtual-surround-sink: Add sink_master argument to enable filter-apply to load the...
KimjeongYeon [Thu, 13 Apr 2017 18:44:41 +0000 (20:44 +0200)]
virtual-surround-sink: Add sink_master argument to enable filter-apply to load the module

Currently, module-filter-apply cannot load module-virtual-surround-sink because filter-apply
provides the argument "sink_master" but virtual-surround-sink expects "master" instead.

Therefore this patch adds the sink_master argument to module-virtual-surround-sink.

Additionally, the autoloaded argument was also added.

7 years agofilter-apply: Fix memory leak in process()
KimjeongYeon [Thu, 13 Apr 2017 18:33:26 +0000 (20:33 +0200)]
filter-apply: Fix memory leak in process()

fltr->name should be freed before freeing fltr. Because filter_free()
can never be called from other places without f set, the pa_assert()
can be removed and filter_free() can be used in process() as well.

7 years agocontext: Check for errno == ECHILD instead of ESRCH after failed waitpid().
Imre Vadász [Sat, 8 Apr 2017 22:15:03 +0000 (00:15 +0200)]
context: Check for errno == ECHILD instead of ESRCH after failed waitpid().

When the specified pid no longer exists as a child of the process (since
it was already reaped by the SIGCHLD handler), errno is set to ECHILD, not
to ESRCH.

7 years agoloopback: Reset sink input rate when source or sink changes
Georg Chini [Tue, 11 Apr 2017 19:49:11 +0000 (21:49 +0200)]
loopback: Reset sink input rate when source or sink changes

If source or sink are changed, the current sink input rate may be different
from the default rate. Switch sink input rate back to default to avoid the
influence of the previous combination of source and sink.

7 years agosink-input: Allow sink_input_set_rate() to be called during a move
Georg Chini [Tue, 11 Apr 2017 19:48:31 +0000 (21:48 +0200)]
sink-input: Allow sink_input_set_rate() to be called during a move

During a move sink_input->sink is not valid. This leads to a crash when
sink_input_set_rate() is called from the moving() callback. This patch
fixes the problem.

7 years agoloopback: Add hooks to track port latency offsets
Georg Chini [Mon, 10 Apr 2017 19:47:23 +0000 (21:47 +0200)]
loopback: Add hooks to track port latency offsets

The previous patch assumed constant port latency offsets. The offsets can
however be changed by the user, therefore these changes need to be tracked
as well. This patch adds the necessary hooks.

Also the print_msg argument was removed from update_minimum_latency() and
update_latency_boundaries() because the message should always be logged.

7 years agoMerge branch 'master' of ssh://git.freedesktop.org/git/pulseaudio/pulseaudio
Georg Chini [Fri, 7 Apr 2017 06:20:43 +0000 (08:20 +0200)]
Merge branch 'master' of ssh://git.freedesktop.org/git/pulseaudio/pulseaudio

7 years agoloopback: Calculate and track minimum possible latency
Georg Chini [Fri, 7 Apr 2017 06:18:08 +0000 (08:18 +0200)]
loopback: Calculate and track minimum possible latency

With the current code, the user can request any end-to-end latency. Because there
is no protection against underruns, setting the latency too small will result in
repetitive underruns.

This patch tries to mitigate the problem by calculating the minimum possible latency
for the current combination of source and sink. The actual calculation has been put
in a separate function so it can easily be changed. To keep the values up to date,
changes in the latency ranges have to be tracked.

The calculated minimum latency is used to limit the configured latency.
The minimum latency is only a "best guess", so the actual minimum may be much
larger (for example for USB devices) or much smaller than the calculated value.

Changes of the port latency offsets are not yet handled, this will be done in a
separate patch.

7 years agomemblock: multiple references should make blocks read-only
Tanu Kaskinen [Wed, 8 Jun 2016 18:18:52 +0000 (21:18 +0300)]
memblock: multiple references should make blocks read-only

The old code makes no sense to me. Why would multiple references mean
that a previously read-only memblock is suddenly writable? I'm pretty
sure that the original intention was to treat multi-referenced blocks
as read-only. I don't have any examples where the old code would have
caused bad behaviour, however.

7 years agoprotocol-native: log who changes card profiles
Tanu Kaskinen [Tue, 4 Apr 2017 09:46:25 +0000 (12:46 +0300)]
protocol-native: log who changes card profiles

Some volume control applications, including gnome-control-center[1],
Budgie Volume Control[2] and possibly something in xfce4 too[3],
sometimes do unwanted card profile changes. This patch makes it possible
to see from the log which application requested a profile change, which
makes it easier to detect when an application misbehaves.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=762932
[2] https://bugs.freedesktop.org/show_bug.cgi?id=93903#c41
[3] https://bugs.freedesktop.org/show_bug.cgi?id=93903#c40

7 years agopipe-sink: set correct latency
Tanu Kaskinen [Fri, 12 Aug 2016 22:12:31 +0000 (01:12 +0300)]
pipe-sink: set correct latency

The old pa_sink_set_fixed_latency() call didn't take into account that
other places use pa_frame_align() on the pa_pipe_buf() result, so the
configured latency could be sometimes slightly too high.

Adding a buffer_size variable in userdata makes it a bit easier to keep
all places that deal with the buffer size in sync.

7 years agothread-mainloop: fix volatile use in example
Tanu Kaskinen [Fri, 28 Oct 2016 16:00:26 +0000 (19:00 +0300)]
thread-mainloop: fix volatile use in example

In the example, drain_result is a volatile pointer to an int, not
a regular pointer to a volatile int.

7 years agoi18n: update the Swedish translation
Tanu Kaskinen [Sun, 2 Apr 2017 18:19:35 +0000 (21:19 +0300)]
i18n: update the Swedish translation

7 years agobluetooth: allow UTF-8 in device descriptions
Tanu Kaskinen [Tue, 11 Oct 2016 14:27:06 +0000 (17:27 +0300)]
bluetooth: allow UTF-8 in device descriptions

Users may configure the device alias to have characters outside the
ASCII range, so our name cleanup routine was too aggressive. Let's just
make sure that the device description is a valid UTF-8 string.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=98160
7 years agosink: Invert priorities to prefer external devices
Christian Kellner [Thu, 9 Mar 2017 14:51:49 +0000 (15:51 +0100)]
sink: Invert priorities to prefer external devices

Currently internal > speaker > headphone and pci > usb > bluetooth.
Invert both of these sets, with the reasoning that a headphone and
speakers are something that a user has actively attached and should
therefore get a higher priority. The same reasoning is applied for
the bus type, i.e. bluetooth and usb should be higher than pci,
because they most likely have been actively attached be a user.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=99222
7 years agoloopback: Do not skip audio at startup
Georg Chini [Fri, 31 Mar 2017 05:50:12 +0000 (07:50 +0200)]
loopback: Do not skip audio at startup

The code is now waiting for source and sink to start up, so the skip
logic is not necessary anymore.

7 years agobluetooth: assert that dbus_message_iter_append_basic() doesn't fail
Tanu Kaskinen [Sat, 29 Oct 2016 18:06:53 +0000 (21:06 +0300)]
bluetooth: assert that dbus_message_iter_append_basic() doesn't fail

The function can only fail if there's not enough memory available, and
if that happens, the convention in PulseAudio is to abort.

CID: 1353106, 1353108, 1353140

7 years agoecho-cancel: Try to minimise in-flight chunks in snapshot latency
Arun Raghavan [Thu, 9 Mar 2017 04:28:23 +0000 (09:58 +0530)]
echo-cancel: Try to minimise in-flight chunks in snapshot latency

We don't always know whether the in-flight memory chunks will be
rendered or skipped (if the source is not in RUNNING). This can cause us
to have an erroneous estimate of drift, particularly when the canceller
starts.

To avoid this, we explicitly flush out the send and receive sides of the
message queue of audio chunks going from the sink to the source before
trying to perform a resync.

7 years agoloopback: Fix corking logic of module-loopback
Georg Chini [Wed, 29 Mar 2017 05:11:50 +0000 (07:11 +0200)]
loopback: Fix corking logic of module-loopback

When moving from a user suspended source or sink to an idle suspended source or sink
the sink input or source output would not be uncorked because we did not check for
the suspend cause.

Uncorking also would not be possible in that situation because the state change callback
of the source output or sink input is called before the new source or sink is attached,
leading to a crash of pulseaudio due to a cork() call without valid source or sink.

The previous patch fixes this problem, therefore sink input or source output can now also
be uncorked when the destination is idle suspended.

7 years agosink-input/source-output: Don't crash when cork() is called without valid sink or...
Georg Chini [Wed, 29 Mar 2017 05:10:28 +0000 (07:10 +0200)]
sink-input/source-output: Don't crash when cork() is called without valid sink or source

If pa_sink_input_cork() or pa_source_output_cork() were called without a sink
or source attached, the calls would crash pulseaudio.

This patch fixes the problem, so that a source output or sink input can still
be corked or uncorked while source or sink are invalid. This is needed to
correct the corking logic in module-loopback.

7 years agobluez5-util: fix profile waiting logic
Tanu Kaskinen [Thu, 16 Mar 2017 21:48:43 +0000 (23:48 +0200)]
bluez5-util: fix profile waiting logic

There were two bugs in the old logic. The first one:

If a device has two profiles, the old code would start the wait timer
when the first profile connects, but when the second profile connects,
the timer would not get stopped and the CONNECTION_CHANGED hook would
not get fired, because the code for that was inside an if block that
only gets executed when the first profile connects. As a result,
module-bluez5-device loading would always be delayed until the wait
timeout expires.

The second bug:

A crash was observed in device_start_waiting_for_profiles(). That
function is called whenever the connected profile count changes from 0
to 1. The function also has an assertion that checks that the timer is
not running when the function is called. That assertion crashed in the
following scenario with a headset that supports HSP and A2DP:

1. First HSP gets connected. The timer is started.

2. Then HSP gets disconnected for some reason. The timer is still
running.

3. Then A2DP gets connected. device_start_waiting_for_profiles() is
called, because the connected profile count changed from 0 to 1 again.
The timer is already running, so the assertion fails.

First I thought I'd remove the assertion from
device_start_waiting_for_profiles() and just restart the timer on the
second call, but then I figured that when the device returns to the
"everything disconnected" state in step 2, it would be better to stop
the timer. The purpose of the timer is to delay the notification of the
device becoming connected, but if the device becomes disconnected during
the waiting period, the notification doesn't make sense any more, and
therefore the timer doesn't make sense either.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=100237
7 years agoallow-passthrough: Fix indentation
Jungsup Lee [Mon, 27 Mar 2017 18:29:34 +0000 (20:29 +0200)]
allow-passthrough: Fix indentation

Signed-off-by: Jungsup Lee <jungsup4.lee@samsung.com>
7 years agoecho-cancel: Fix assert with webrtc's built-in drift compensation
Arun Raghavan [Mon, 13 Mar 2017 10:30:41 +0000 (16:00 +0530)]
echo-cancel: Fix assert with webrtc's built-in drift compensation

The webrtc canceller seems to have changed to require that the
set_stream_drift_samples() method be called before every call of
ProcessStream().

So we now call ec->set_stream_drift_samples() before calling
ec->record() by:

1. Always calling do_push_drift_comp() instead of only when the sink is
   running

2. Calling set_stream_drift_samples() in the loop with record() instead
   of outside

We do kind of leak this quirk of the webrtc canceller into the generic
bits of module-echo-cancel, but this should not be harmful in the
general case either.

7 years agobluetooth-policy: retain backwards compatibility
Tanu Kaskinen [Wed, 15 Mar 2017 18:02:48 +0000 (20:02 +0200)]
bluetooth-policy: retain backwards compatibility

The auto_switch argument was added in PulseAudio 10.0. In that release
the argument type was boolean. The type was changed to integer in commit
3397127f00. This patch adds backwards compatibility so that old
configuration files won't break when upgrading PulseAudio to 11.0.

7 years agobluez5-util: Disconnect AG devices when ofono is started and headset=auto
Georg Chini [Tue, 14 Mar 2017 06:32:31 +0000 (07:32 +0100)]
bluez5-util: Disconnect AG devices when ofono is started and headset=auto

With headset=auto it is possible that AG devices are connected and handled
via the native backend when ofono is started. Because the HS role will then
be disabled in the native backend, AG devices must be disconnected and any
future connections will be handled by ofono.