platform/upstream/pulseaudio.git
6 years agobuild-sys: test for cxx-11 after AC_USE_SYSTEM_EXTENSIONS
Felipe Sateler [Fri, 13 Oct 2017 15:23:37 +0000 (12:23 -0300)]
build-sys: test for cxx-11 after AC_USE_SYSTEM_EXTENSIONS

This avoids the following autoconf warning:
configure.ac:89: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
../../lib/autoconf/specific.m4:368: AC_USE_SYSTEM_EXTENSIONS is expanded from...
configure.ac:89: the top level

6 years agoRevert "alsa-mixer: fix speaker output on a couple of Asus EeePC machines"
Tanu Kaskinen [Thu, 12 Oct 2017 13:59:58 +0000 (16:59 +0300)]
Revert "alsa-mixer: fix speaker output on a couple of Asus EeePC machines"

This reverts commit ca63fbc1d806e63e083cb700567f15066ecfdc07.

I applied the patch too hastily. force-speaker.conf is supposed to be
used only when the alsa mixer doesn't contain any elements that would
indicate the existence of a speaker port, but the reverted patch is a
workaround for a different problem. On the two affected EeePC machines
the Headphone element needs to be unmuted when using speakers. The
analog-output-speaker-always path happens to do that, but that's
unintentional. analog-output-speaker was changed[1] to mute the
headphone output when using the speaker port, and
analog-output-speaker-always should have been changed too, but that was
forgotten.

The kernel driver is buggy if it has a Headphone mixer element that
mutes both headphones and speakers, so this should be fixed in alsa. If
we end up having a workaround in PulseAudio for the broken driver, it
should be implemented with a new profile set and path configuration
files.

[1] https://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/?id=22aac4e9fdb3786178f7815a0cb2150f588b1582

6 years agoalsa-mixer: fix speaker output on a couple of Asus EeePC machines
Guenter Milde [Thu, 12 Oct 2017 13:42:18 +0000 (16:42 +0300)]
alsa-mixer: fix speaker output on a couple of Asus EeePC machines

6 years agoi18n: add raop files to POTFILES.in
Tanu Kaskinen [Wed, 11 Oct 2017 18:03:38 +0000 (21:03 +0300)]
i18n: add raop files to POTFILES.in

6 years agoraop: Init dummy port and card for latency change
Colin Leroy [Mon, 9 Oct 2017 07:42:27 +0000 (09:42 +0200)]
raop: Init dummy port and card for latency change

This adds a port, card and profile to RAOP sinks to make it
possible to change the latency at runtime (and have it persist)
using pavucontrol or pactl set-port-latency-offset.

Also move the IP:port part of the sink name to the port name.

6 years agoraop: Show device codename in sink properties
Colin Leroy [Mon, 9 Oct 2017 07:26:42 +0000 (09:26 +0200)]
raop: Show device codename in sink properties

This will make it easier for testers to report latency offset for their
specific hardware.

6 years agocore: Fix gcc-7 -Wimplicit-fallthrough= warnings by rearranging comment
Peter Meerwald-Stadler [Wed, 6 Sep 2017 10:16:31 +0000 (12:16 +0200)]
core: Fix gcc-7 -Wimplicit-fallthrough= warnings by rearranging comment

'Fall through.' must appear separately

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
6 years agocore: Fix typo and gcc-7 -Wimplicit-fallthrough= warnings
Peter Meerwald-Stadler [Wed, 6 Sep 2017 09:26:15 +0000 (11:26 +0200)]
core: Fix typo and gcc-7 -Wimplicit-fallthrough= warnings

Correct spelling of 'through' in a comment helps to fix a warning :)
also drop some unrelated comments

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
6 years agocore: Fix gcc-7 -Wimplicit-fallthrough= warnings
Peter Meerwald-Stadler [Wed, 6 Sep 2017 09:20:54 +0000 (11:20 +0200)]
core: Fix gcc-7 -Wimplicit-fallthrough= warnings

the comment /* Fall through. */ fixes the warning, but gcc-7 seems to be more
picky about the position in the code

pulsecore/sink-input.c: In function ‘pa_sink_input_update_proplist’:
pulsecore/sink-input.c:1531:13: warning: this statement may fall through [-Wimplicit-fallthrough=]
             for (state = NULL; (key = pa_proplist_iterate(i->proplist, &state));) {
             ^~~
pulsecore/sink-input.c:1539:9: note: here
         case PA_UPDATE_REPLACE: {
         ^~~~

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
6 years agoraop: Fix typo
Peter Meerwald-Stadler [Wed, 6 Sep 2017 09:12:26 +0000 (11:12 +0200)]
raop: Fix typo

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
6 years agoraop: Fix gcc-7 warnings, EWOULDBLOCK
Peter Meerwald-Stadler [Wed, 6 Sep 2017 09:05:29 +0000 (11:05 +0200)]
raop: Fix gcc-7 warnings, EWOULDBLOCK

EAGAIN is used allover the code rather than EWOULDBLOCK
POSIX allows EAGAIN and EWOULDBLOCK to have the same value (and in fact it is)
don't check for EWOULDBLOCK

modules/raop/raop-client.c: In function ‘send_udp_audio_packet’:
modules/raop/raop-client.c:473:41: warning: logical ‘or’ of equal expressions [-Wlogical-op]
     if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                         ^~
modules/raop/raop-client.c: In function ‘resend_udp_audio_packets’:
modules/raop/raop-client.c:528:45: warning: logical ‘or’ of equal expressions [-Wlogical-op]
         if (written < 0 && (errno == EAGAIN || errno == EWOULDBLOCK)) {
                                             ^~

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
6 years agobluetooth: bluez5: Fix Coverity warning
Peter Meerwald-Stadler [Wed, 6 Sep 2017 07:56:10 +0000 (09:56 +0200)]
bluetooth: bluez5: Fix Coverity warning

Use pa_assert_se() to check return value (pro forma) like everywhere else

Coverity ID: #154313

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
6 years agojson-test: Fix Coverity warning
Peter Meerwald-Stadler [Wed, 6 Sep 2017 07:53:06 +0000 (09:53 +0200)]
json-test: Fix Coverity warning

Cosmetic resource leak in test code

Coverity ID: #1454314

Signed-off-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
6 years agoraop: add latency value for Shairport RAOP server
Colin Leroy [Sat, 7 Oct 2017 18:11:49 +0000 (20:11 +0200)]
raop: add latency value for Shairport RAOP server

After testing, Shairport server's latency is the same as Pioneer N30.

6 years agobuild-sys: simulate ln -s correctly on Windows
Salvador Fandino [Wed, 4 Oct 2017 13:21:24 +0000 (15:21 +0200)]
build-sys: simulate ln -s correctly on Windows

make install was failing on Windows because there cp is
used to replace ln -s commands but cp doesn't resolve its
first argument as relative to the second one.

This patch changes the install-bashcompletion-aliases rules
to chdir to the target dir so that cp works correctly. This
is the solution recomended in the automake documentation.

6 years agoladspa-sink: fix Windows compilation
Salvador Fandino [Tue, 3 Oct 2017 12:27:59 +0000 (14:27 +0200)]
ladspa-sink: fix Windows compilation

The macro LADSPA_PATH was defined as a list of directories quoted but
without taking into account that the directory names, specially on
Windows, can contain backslashes that need escaping.

This patch removes the quoted from the macro and uses the C preprocessor
to quote it properly using a helper macro.

6 years agoproplist-util: fix compilation on Windows without NLS
Salvador Fandino [Tue, 3 Oct 2017 10:58:57 +0000 (12:58 +0200)]
proplist-util: fix compilation on Windows without NLS

Under MinGW, LC_MESSAGES is defined in libint.h which is not
included when pulseaudio is configured with nls disabled.

LC_MESSAGES is referenced when setting PA_PROP_APPLICATION_LANGUAGE.

This patch just disables setting that property when ENABLE_NLS
is not defined.

6 years agoswitch-on-port-available: Add some basic properties
David Henningsson [Fri, 22 Sep 2017 14:27:44 +0000 (16:27 +0200)]
switch-on-port-available: Add some basic properties

Apparently I forgot about this for like, five years, but better
late than never!

Signed-off-by: David Henningsson <diwic@ubuntu.com>
6 years agothread-mq: create event on the right mainloop
Tanu Kaskinen [Tue, 13 Sep 2016 12:48:11 +0000 (15:48 +0300)]
thread-mq: create event on the right mainloop

It seems that the intention was to create create write_thread_event on
thread_mainloop instead of main_mainloop (the first parameter of
io_new() is thread_mainloop, io_free() is called on thread_mainloop
etc.).

As long as both mainloops are implemented with pa_mainloop, this bug has
no effect on behaviour, because the io_new() implementation is the same.
And indeed, with the current code base both mainloops are always
pa_mainloops. However, when the tunnel-new modules switches to pa_rtpoll
as the pa_mainloop_api provider, this bug would cause problems.

6 years agoalsa-mixer: Prioritize hdmi-* mappings over iec958-* mappings
Kristian Klausen [Fri, 22 Sep 2017 17:54:14 +0000 (17:54 +0000)]
alsa-mixer: Prioritize hdmi-* mappings over iec958-* mappings

Pulseaudio tries to pick the best profile (on startup or
hotplugged), the best profile is the profile with the highest
priority which isn't unavailable.
Due to the facts that iec958 ports available status always (?)
is unknown, and that it is generally more likely that a user use
hdmi than iec958, lets prioritze hdmi over iec958.

This patch shift the analog-* mappings +5 and hdmi-* mappings +5.

6 years agoRAOP: Announce real latency
Colin Leroy [Sun, 17 Sep 2017 18:46:49 +0000 (20:46 +0200)]
RAOP: Announce real latency

Use predefined values depending on the server, and make it configurable.
AirPlay is supposed to have 2s of latency. With my hardware, this is
more 2.352 seconds after numerous tests.
Switch from pausing/resuming the smoother to resetting it because the
smoother got stuck returning the same value after an idle/running cycle,
making latency calculation wrong.

6 years agoqpaeq: change license from AGPL to LGPL v2.1
Tanu Kaskinen [Tue, 19 Sep 2017 14:25:47 +0000 (17:25 +0300)]
qpaeq: change license from AGPL to LGPL v2.1

This removes one unnecessary exception in the PulseAudio licensing
terms. In December 2016 I asked permission from all qpaeq contributors
for the license change, and all gave the permission. I have archived the
emails here:
https://www.freedesktop.org/software/pulseaudio/misc/qpaeq_relicensing_emails.txt

6 years agoLICENSE: fix typo
Tanu Kaskinen [Tue, 19 Sep 2017 14:17:09 +0000 (17:17 +0300)]
LICENSE: fix typo

6 years agoi18n: update the Chinese (Taiwan) translation
Cheng-Chia Tseng [Tue, 19 Sep 2017 13:46:21 +0000 (16:46 +0300)]
i18n: update the Chinese (Taiwan) translation

6 years agoupdate NEWS
Tanu Kaskinen [Mon, 18 Sep 2017 14:40:00 +0000 (17:40 +0300)]
update NEWS

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 agolaunch: avoid autostarting pulseaudio systemd units for root
Felipe Sateler [Wed, 6 Sep 2017 22:55:56 +0000 (19:55 -0300)]
launch: avoid autostarting pulseaudio systemd units for root

The autospawn mechanism already had a root-autospawn protection mechanism. When
using systemd that was lost. Systemd 234 has a mechanism to conditionalize unit starting
on the running user, so lets do that to protect against root autospawning.

6 years agobuild-sys: make bootstrap.sh fail if autopoint or intltoolize are not available
Russell Treleaven [Fri, 8 Sep 2017 14:24:31 +0000 (10:24 -0400)]
build-sys: make bootstrap.sh fail if autopoint or intltoolize are not available

6 years agoalways-source: Fix pa_module_load() usage
Arun Raghavan [Sun, 3 Sep 2017 07:56:14 +0000 (13:26 +0530)]
always-source: Fix pa_module_load() usage

The API changed slightly since the original patch was written.

6 years agosink: force suspend/resume on passthrough transitions
Pierre-Louis Bossart [Mon, 28 Aug 2017 22:49:16 +0000 (17:49 -0500)]
sink: force suspend/resume on passthrough transitions

A race condition prevents the AES non-audio bit from being set
when enabling IEC61937 passthrough on resume with no sink-input
connected (pa_sink_is_passthrough returns false). The non-audio
bit should really be set when opening the sink.

Force the sink to suspend/resume when actually entering passthrough
mode, and likewise force a suspend-resume on leaving passthrough mode.

Tested with E-AC3 streams which do need the AES bit set for my
Onkyon receiver to detect the format instead of playing it as
PCM.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
6 years agoImplement module-always-source
Sebastian Dröge [Thu, 29 Jun 2017 21:57:36 +0000 (00:57 +0300)]
Implement module-always-source

This is basically a copy of module-always-sink but doing the same for
sources. Whenever no source is available, a module-null-source is loaded
and whenever a new source is available again, module-null-source is
unloaded.

By this, anything using a source will automatically be switched to the
null source when the actual source disappears, and back to the actual
source if it appears again.

6 years agobuild-sys: add the Arctis configuration
Tanu Kaskinen [Sat, 2 Sep 2017 15:23:12 +0000 (18:23 +0300)]
build-sys: add the Arctis configuration

6 years agobluetooth: recognize another HSP HS UUID
Tanu Kaskinen [Sat, 2 Sep 2017 12:44:58 +0000 (15:44 +0300)]
bluetooth: recognize another HSP HS UUID

There are actually two HSP HS UUIDs. My theory is that the second one
was added, because someone was not happy with the old UUID being used
for identifying two different things (the HSP profile as a whole, and
the HS role within the HSP profile). Some headsets only use the new
UUID, and those headsets won't work if we don't recognize the new UUID.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=93898
6 years agoalsa-mixer: add support for Steelseries Arctis 7 headset
Johan Heikkilä [Sun, 27 Aug 2017 13:29:37 +0000 (16:29 +0300)]
alsa-mixer: add support for Steelseries Arctis 7 headset

6 years agoalsa-mixer: round, not truncate, in to_alsa_dB
Ian Ray [Wed, 30 Aug 2017 08:09:48 +0000 (11:09 +0300)]
alsa-mixer: round, not truncate, in to_alsa_dB

to_alsa_dB() returns a result rounded to two decimal places (instead of
using integer truncation) to avoid small errors when converting between
dB and volume.

Consider playback at -22 dB (which is supported by ALSA) but results in
the higher level of -21 dB plus software attenuation.

    pa_sw_volume_from_dB(-22) = 28172
    pa_sw_volume_to_dB(28172) = -21.9997351
    to_alsa_dB(-21.9997351)   = -2199

    ALSA value 106 = -2200
    ALSA value 107 = -2100
    ...

    rounding = +1  /* "accurate or first above" */
    snd_mixer_selem_ask_playback_dB_vol(me, -2199, rounding, &alsa_val)
    alsa_val = -2100

Signed-off-by: Ian Ray <ian.ray@ge.com>
6 years agocli-command: don't exit on "module already loaded" errors
Colin Leroy [Sat, 26 Aug 2017 09:21:15 +0000 (11:21 +0200)]
cli-command: don't exit on "module already loaded" errors

Some modules may only be loaded once, and trying to load them
twice from default.pa makes PulseAudio startup fail. While that could
be considered a user error, it's nicer to not be so strict. It's not
necessarily easy to figure what went wrong, if for example the user
plays with RAOP and adds module-raop-discover to default.pa, which first
works fine, but suddenly stops working when the user at some point
enables RAOP support in paprefs. Enabling RAOP in paprefs makes
module-gconf load the module too, so the module gets loaded twice.

This patch adds a way to differentiate module load errors, and
make cli-command ignore the error when the module is already
loaded.

6 years agomain: set umask to 077 instead of 022
Tanu Kaskinen [Thu, 17 Aug 2017 17:24:39 +0000 (20:24 +0300)]
main: set umask to 077 instead of 022

It was reported that PulseAudio weakens the umask to 022 if it's
initially set to 077. That's not as big problem as it might seem,
but it's still a problem. The umask affects the permissions of the state
files, and those aren't readable by other users anyway in the per-user
mode, because PulseAudio puts them in directories that aren't
accessible to other users. In the system mode the state files will be
readable by everyone, though, even by those users that don't otherwise
have access to PulseAudio. The state files are slightly
privacy-sensitive, because they contain e.g. history of applications
that have used PulseAudio.

I can't think of any use cases where access to the state files by other
users would be necessary, either in the per-user mode or in the system
mode, so let's use umask 077. This doesn't prevent access to any
sockets in the system mode, because all directories that PulseAudio
creates in the system mode will have permissions 755 regardless of the
umask, and the sockets themselves always have permissions 777.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102060
6 years agocli-command: unload modules synchronously
Tanu Kaskinen [Fri, 18 Aug 2017 07:07:27 +0000 (10:07 +0300)]
cli-command: unload modules synchronously

Users may want to change the parameters of some load-once modules in
~/.config/pulse/default.pa. That should be possible by including
/etc/pulse/default.pa from the per-user configuration file, and then
unloading a module and reloading it with different parameters. However,
that doesn't work, because the unload-module command will not unload the
module immediately, so the subsequent load-module command will fail when
the module can be loaded only once.

This patch makes the module unloading synchronous. "pacmd unload-module
module-cli-protocol-unix" is something that might not like this change,
since the command will unload the code that is processing the command,
but I tested it and it works fine. When pa_module_unload() is called,
that won't yet remove the module code from memory, the lt_dlclose() call
is postponed until it's safe to remove the code from memory.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=102205
6 years agodevice-port, switch-on-port-available: fix automatic profile changing when current...
Tanu Kaskinen [Mon, 31 Jul 2017 06:42:31 +0000 (09:42 +0300)]
device-port, switch-on-port-available: fix automatic profile changing when current profile is off

module-switch-on-port-available didn't do anything when a port changes
its status if the card didn't have any sinks or sources. This was to
avoid bad things during card initialization, but the if condition also
prevented any profile switches away from the "off" profile, because the
card has no sinks or sources when the "off" profile is active.

pa_card nowadays has the "linked" flag that
module-switch-on-port-available could have checked instead, but since it
doesn't make sense to emit port status change events before the card has
been initialized, I added the check in pa_device_port_set_available()
instead.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=101794
6 years agobuild-sys: add iec958-stereo-input.conf to dist_alsapaths_DATA
Tanu Kaskinen [Fri, 4 Aug 2017 13:43:02 +0000 (16:43 +0300)]
build-sys: add iec958-stereo-input.conf to dist_alsapaths_DATA

6 years agoalsa-mixer: set PCM Capture Source for iec958 input
Tanu Kaskinen [Fri, 4 Aug 2017 08:14:43 +0000 (11:14 +0300)]
alsa-mixer: set PCM Capture Source for iec958 input

It was reported that on a certain USB card, identified as
"0d8c:0102 C-Media Electronics, Inc. CM106 Like Sound Device",
the "PCM Capture Source" element had to be set to "IEC958 In" before
the iec958 input would work.

The iec958-stereo-input.conf file didn't exist before, although the path
was referenced in the default.conf profile configuration file.

BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=101973
6 years agoraop: silence a Coverity complaint
Tanu Kaskinen [Fri, 28 Jul 2017 01:07:49 +0000 (04:07 +0300)]
raop: silence a Coverity complaint

CID: 1398155

6 years agobluez5-device: Set transport state correctly for AG role
Georg Chini [Sat, 22 Jul 2017 08:47:07 +0000 (10:47 +0200)]
bluez5-device: Set transport state correctly for AG role

When connecting a headset via the native backend, the transport state was
not updated correctly.

This patch sets the state to PLAYING in transport_acquire() if necessary.

6 years agoequalizer-sink: update sink description when moving
Tanu Kaskinen [Wed, 12 Jul 2017 19:29:56 +0000 (22:29 +0300)]
equalizer-sink: update sink description when moving

If the description is not updated when moving, the old automatically
generated description will refer to the old master sink after the move,
which is not nice.

6 years agoloopback: Use new allow_negative flag of pa_{source, sink}_get_latency_within_thread()
Georg Chini [Mon, 17 Apr 2017 19:37:43 +0000 (21:37 +0200)]
loopback: Use new allow_negative flag of pa_{source, sink}_get_latency_within_thread()

Setting the allow_negative flag of pa_{source,sink}_get_latency_within_thread() to true
leads to improved end to end latency estimation and to correct handling of negative port
latency offsets.

6 years agoalsa-mixer: Add support for usb audio in the Dell dock TB16
Hui Wang [Fri, 26 May 2017 07:42:40 +0000 (15:42 +0800)]
alsa-mixer: Add support for usb audio in the Dell dock TB16

There are one headset jack on the front panel of TB16, through this
jack, we have one stereo headphone output (hw:%f,0,0) and one mono
headset-mic input (hw:%f,0,0); and there is one speaker output jack
(hw:%f,1,0) on the rear panel of TB16.

The detail information of the Dell dock TB16:
http://www.dell.com/support/article/sg/en/sgbsdt1/SLN301105

Signed-off-by: Hui Wang <hui.wang@canonical.com>
6 years agopadsp: Make it compile on musl
Khem Raj [Tue, 7 Apr 2015 04:56:31 +0000 (21:56 -0700)]
padsp: Make it compile on musl

break assumptions on glibc and there is no stat64 on non
glibc C libraries

See pulseaudio bug

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

Signed-off-by: Khem Raj <raj.khem@gmail.com>
6 years agofilter-apply: Do not re-route stream to master sink/source when manually moved to...
KimJeongYeon [Sat, 29 Apr 2017 09:32:23 +0000 (11:32 +0200)]
filter-apply: Do not re-route stream to master sink/source when manually moved to filter

Currently, if a stream is manually moved to a filter sink or source managed by
module-filter-apply, the stream will be silently re-routed to the master sink
or source, because the filter.apply property is not set on that stream. We can
assume, that the users intention however was to have the stream filtered.

Therefore this patch changes the logic, so that the stream will not be moved
to the master but remains on the filter sink or source. To handle the change
of a property correctly, the filter.apply property must be set temporarily.
An additional property filter.apply.set_by_mfa was introduced to mark those
streams, so that filter.apply can be removed again when the stream moves away
from the filter.

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 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

7 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.

7 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
7 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
7 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
7 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.

7 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

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

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

7 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

7 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.

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

7 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.