Commit graph

7520 commits

Author SHA1 Message Date
Igor V. Kovalenko
10384d807f mainloop-test: Disarm io callback on EOF
Mainloop test uses io callback for PA_IO_EVENT_INPUT on stdin.

With glib enabled PA_IO_EVENT_INPUT translates to glib G_IO_IN event which also
matches descriptor in EOF state. While io callback does not check for EOF after
reading from file descriptor this is causing mainloop-test to repeatedly read 0
bytes once EOF is reached, rearm defer callback and spam test log.

Fix this by disarming io callback when EOF is reached in test run.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/625>
2021-08-30 11:31:32 +03:00
Georg Chini
735eb05e64 tunnel: Make fixed latency configurable
Currently, module-tunnel uses the default fixed latency of 250ms as fixed
latency.

There is no reason for such a large latency. This patch adds a parameter
latency_msec to the module to set the fixed latency at load time of the
module. The parameter can range from 5 to 500 milliseconds. With this
patch, I was able to run a tunnel sink at 7ms latency without problems.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
2021-08-25 15:32:22 +00:00
Georg Chini
4c180214c8 tunnel: Fix latency calculations
Currently module-tunnel uses only a rough estimate of the current stream
latency and reports wrong latencies in certain situations. This leads to
very inexact and unstable latency reports for the virtual sink.

This patch fixes the issue by introducing latency snapshots like they
are used in module-loopback. Because the latency reports are now correct,
the update interval for latency re-calculations can be reduced to 1s.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
2021-08-25 15:32:22 +00:00
Georg Chini
45a5e6f0f1 combine-sink: Use configured resampler, reduce update time to 1s
Currently the combine-sink uses the trivial resampler by default.

This patch changes the default to the configured resampler.
Also the default update time is changed from 10s to 1s to achieve
faster convergence and higher precision.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
2021-08-25 15:32:22 +00:00
Georg Chini
9d1a43ae8d combine-sink: Improve initial latency reports
Currently, it takes one adjust time before the smoother is updated after an
unsuspend. Before the first update, the smoother will not be aware of the
slave sink latencies, leading to incorrect latency reports.

This patch moves the first smoother update to one latency time after the
sink was unsuspended, thereby improving initial latency reports. This
only partially resolves the problem because the smoother takes multiple
updates to adapt to the slave sink latencies.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
2021-08-25 15:32:22 +00:00
Georg Chini
54baa223bb combine-sink: Add rate controller
This patch adds a rate controller similar to the one used in module-loopback
to limit step size and maximum deviation from the base rate. Rate changes
are handled more smoothly by the controller. The patch has not much impact
on the behavior of the module, except that there is less rate hunting.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
2021-08-25 15:32:22 +00:00
Georg Chini
ab78f8ed39 combine-sink: Fix latency calculations
Currently module-combine-sink uses only a rough estimate of the current
slave sink latencies to calculate the rate for the various sink inputs.
This leads to very inexact and unstable latency reports for the virtual
sink.

This patch fixes the issue by introducing latency snapshots like they
are used in module-loopback. It also changes the definition of the
target latency to ensure that there is always one sink which uses the
base rate.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/53>
2021-08-25 15:32:21 +00:00
Juho Hämäläinen
b1057f1a37 bluetooth: Only remove cards belonging to the device.
Commit f89d64b98e fixed a crash
when disabling adapters. However, now if any device is removed
ofono card is removed, even if it belongs to different device.

Add a check for the device being unlinked to our callback to fix.

Signed-off-by: Juho Hämäläinen <juho.hamalainen@jolla.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/624>
2021-08-25 15:20:57 +00:00
Chengyi Zhao
3e2dacdb38 alsa-mixer: Recognize rear mic jack mixer of USB audio
Add "- Input" suffix to a new "[Jack]" section of rear mic
in the path file, and the rear mic jack is probed and its
state is compared with the expected "Rear Mic - Input".

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/620>
2021-08-25 15:06:47 +00:00
Igor V. Kovalenko
d517a204de bluetooth: Allow SCO socket packet size to be larger than mSBC frame
With USB Alternate Setting 3 size of HCI payload is 72 bytes which is already
larger than mSBC frame size. Largest known size of HCI payload is with USB
Alternate Setting 5 (144 bytes), make it the default SCO socket MTU.

Reserve additional space in bluetooth encoder buffer to cover this case.

Since mSBC encoder and decoder will now work with larger packet sizes, drop
assertions about MTU larger than mSBC frame size.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/617>
2021-08-25 15:00:28 +00:00
Igor V. Kovalenko
ade71b8ce7 alsa-mixer: Add EPOS/Sennheiser GSP 670 and GSA 70
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/616>
2021-08-25 14:45:55 +00:00
Arun Raghavan
404795ad05 combine-sink: Set origin_sink for each output stream
While the threading model for combine is different from other filters
(which expect to just piggy-back on the I/O thread of the most
downstream sink), it might still be valuable to set this field to
indicate that this sink input is intended to behave as a filter stream
rather than a conventional stream.

At the very least, routing behaviour and cycle detection should act on
these streams as with any other filter.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/399>
2021-08-23 17:14:13 +00:00
acheronfail
19adddee31 pactl: add format flag for JSON output
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/497>
2021-08-11 15:31:05 +00:00
Takashi Sakamoto
3fcd5e398d Revert "udev: use ID_MODEL/ID_VENDOR to give friendly name for FireWire devices"
This reverts commit 3ac73598c6.

Systemd v249 has new entries of hwdb for node and unit in IEEE 1394 bus
(hwdb.d/80-ieee1394-unit-function.hwdb). It can obsolete my workaround
added by commit 3ac73598c6 ("udev: use ID_MODEL/ID_VENDOR to give
friendly name for FireWire devices"). The hwdb entry is handy prepared.
When user finds missing entry, it's preferable to file issue or merge
request in systemd project site.

IEEE 1394 bus is enough legacy and it's easy to expect that few developer
can evaluate the change. For reviewers, I describe the original issues and
the integration of hwdb in systemd side.

In systemd, udev rule for sound card (rules.d/78-sound-card.rules) has
below line to assign information in hwdb to instance for sound card.

```
IMPORT{builtin}="hwdb"
```

In the case, the udev hwdb builtin finds information according to
modalias by following nodes in device topology tree toward root. For
sound card associated to unit in node in IEEE 1394 bus, it's inconvenient
since hwdb had no entry for the unit. The instance for node in IEEE 1394
bus doesn't have modalias. As a result, the builtin reaches 1394 OHCI
controller in PCI Express bus which maintains the IEEE 1394 bus, then the
value for ID_VENDOR_FROM_DATABASE and ID_MODEL_FROM_DATABASE properties
from hwdb of pci device (hwdb.d/20-pci-vendor-model.hwdb) for the sound
card.

For example, when two nodes are in IEEE 1394 bus and one of them has
unit instance for audio and music functions, the topology of the bus is
depicted in following diagram:

```
 * 1394 OHCI controller (pci*, modalias)
   * node A - (pci*/fw0, /dev/fw0)
   * node B - (pci*/fw1, /dev/fw1)
     * unit B-1 - (pci*/fw1/fw1.0, modalias)
       * sound card 0 - (pci*/fw1/fw1.0/sound/card0, card0)
```

In the case,  the udev hwdb builtin picks up from hwdb of pci device for
the sound card:

```
$ udevadm test-builtin hwdb /sys/class/sound/card2
Load module index
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /usr/lib/systemd/network/73-usb-net-by-mac.link
Created link configuration context.
ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
ID_PCI_SUBCLASS_FROM_DATABASE=FireWire (IEEE 1394)
ID_PCI_INTERFACE_FROM_DATABASE=OHCI
ID_VENDOR_FROM_DATABASE=Texas Instruments
ID_MODEL_FROM_DATABASE=XIO2213A/B/XIO2221 IEEE-1394b OHCI Controller [Cheetah Express]
Unload module index
Unloaded link configuration context.
```

The aim of my workaround is to avoid using ID_VENDOR_FROM_DATABASE and
ID_MODEL_FROM_DATABASE for sound card associated to unit in IEEE 1394
bus. Instead, ID_VENDOR and ID_MODEL properties are used.

However, it has another issue. For the properties, the udev rule for
sound card has the other lines for sound card associated to unit in
IEEE 1394 bus, below:

```
SUBSYSTEMS=="firewire", ATTRS{guid}=="?*", \
  ENV{ID_BUS}="firewire", ENV{ID_SERIAL}="$attr{guid}", ENV{ID_SERIAL_SHORT}="$attr{guid}", \
  ENV{ID_VENDOR_ID}="$attr{vendor}", ENV{ID_MODEL_ID}="$attr{model}", \
  ENV{ID_VENDOR}="$attr{vendor_name}", ENV{ID_MODEL}="$attr{model_name}"
SUBSYSTEMS=="firewire", GOTO="skip_pci"
```

The values of ID_VENDOR and ID_MODEL properties come from vendor_name and
model_name attributes in parent instance of the sound card, therefore
they come from audio and music units in IEEE 1394 bus. Unfortunately
these attributes are not available always.

All of nodes in IEEE 1394 bus should have configuration ROM in place
according to IEEE 1212 and Linux FireWire subsystem parses the content of
ROM to detect units in the node. At the same time, the subsystem manages
to detect information about vendor and model according to standard layout
defined by 1394 Trading Association[1].

When the content of ROM is against the standard, the subsystem is
discouraged the name detection.  In the case, vendor_name and model_name
attributes are not available, and supplemental information should be from
software implementation.

The new hwdb (hwdb.d/80-ieee1394-unit-function.hwdb) added to systemd v249
can solve the above issues. The prepared names for vendor and model in
hwdb are assigned to both node and unit. The udev hwdb builtin can find
the vendor and model names for the unit according to modalias before
arriving at pci-device. Regardless of standard or non-standard
configuration ROM, the hwdb gives prepared names of vendor and model.

This is an example of Mark of the Unicorn (MOTU) Traveler. The search
finishes at instance for unit in IEEE 1394 bus expectedly:

```
$ udevadm test-builtin hwdb /sys/class/sound/card2
Load module index
Parsed configuration file /usr/lib/systemd/network/99-default.link
Parsed configuration file /usr/lib/systemd/network/73-usb-net-by-mac.link
Created link configuration context.
ID_MODEL_FROM_DATABASE=Traveler
ID_VENDOR_FROM_DATABASE=MOTU
IEEE1394_UNIT_FUNCTION_AUDIO=1
IEEE1394_UNIT_FUNCTION_MIDI=1
Unload module index
Unloaded link configuration context.
```

[1] Configuration ROM for AV/C Devices 1.0 (Dec. 12, 2000, 1394 Trading
    Association, TA Document 1999027)

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/610>
2021-08-11 15:04:07 +00:00
Igor V. Kovalenko
1a575bb0a7 rtp: Initialize adapter to NULL for early pipeline error
If gstreamer pipeline immediately returns error, adapter pointer would not be
initialized and pa_rtp_recv may crash calling gst_object_unref() on it.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/615>
2021-08-06 22:45:26 +03:00
Igor V. Kovalenko
49b07edcaf alsa-mixer: Set mdev to NULL if there is no mapping
We check if mapping is NULL but if so we never set mdev, set it to NULL as well.

Fixes: 79cb1369fc
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/615>
2021-08-06 22:45:16 +03:00
Sanchayan Maity
86d1dd0d70 rtp: Enable support for OPUS
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/510>
2021-07-30 13:10:08 +00:00
João Paulo Rechi Vita
0b9ef4cd0a bluetooth: backend-native: Handle RegisterProfile failure
Try to register profile support again after RegisterProfile fails, when
BlueZ indicates no one else is implementing the profiles we are
interested in.

Ideally this would rely on a list of UUIDs supported by the profile
manager instead of the adapter, but BlueZ has no such API.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
cd0a8a5a0c bluetooth: Create PA_BLUETOOTH_HOOK_ADAPTER_UUIDS_CHANGED
This hook will be fired any time the UUIDs property on the adapter
object changes.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
a84914f7b3 bluetooth: backend-native: Keep track of profiles' status
Track the profile status changes for the profiles implemented by this
backend.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
2f7c4969db bluetooth: Add mechanism to track profile's status
Create pa_bluetooth_profile_status_t to represent all stages an external
Bluetooth profile can go through:

 0. Inactive: Initial state, no D-Bus object has been registered for
    this profile yet.
 1. Active: an object implementing the org.bluez.Profile1 interface has
    been registered on the system bus.
 2. Registering: RegisterProfile has been called.
 3. Registered: RegisterProfile succeeded.

This will be useful to handle RegisterProfile failures, as well as
dynamically register and un-register a profile based on the current
active seat.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
28fd9bc319 bluetooth: backend-native: Pass profile id in register_profile*
Passing the profile id to register_profile and register profile reply
makes a clearer debug and will allow easier tracking of the profile
status changes.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
a631d4c07c bluetooth: backend-native: Rename profile to object in register_profile*
This string contains a object path name, not a profile name, so lets
make this accurate.

This commit brings no functional change apart from a small change in the
text of one log message.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
João Paulo Rechi Vita
4b55b8a9d0 bluetooth: Keep a list of local adapters' UUIDs
This commit stores the UUID list when an adapter is discovered and
updates it whenever a PropertiesChanged signal notifies it has changed.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/593>
2021-07-30 12:52:04 +00:00
Marijn Suijten
a246bb77c7 bluetooth/native: Accept and report battery HF indicator value
HF indicator 2 (see [assigned-numbers], Hands-Free Profile) is able to
report battery percentage at 1% intervals (in range [0, 100]), contrary
to the `+XAPL` `+IPHONEACCEV` extension which only supports 10%
increments.  This does not guarantee increased granularity however, as
peers may still be limited to imprecise battery measurements internally
or round to coarser percentages.
Supporting both additionally broadens the range of devices for which PA
can report its battery level.

[assigned-numbers]: https://www.bluetooth.com/specifications/assigned-numbers/

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
713e3f0680 bluetooth: Deregister battery provider when profile disconnects
Whenever a device disconnects the device is not removed from BlueZ, only
the profiles that had an active connection are disconnected. Since we
were providing this battery level based on AT commands received through
HSP/HFP these services should be responsible for deregistering it again.

Deregister the interface to signal BlueZ (And UPower in return) that the
battery level won't be accurate/updated anymore.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
f7955eeb48 bluetooth: Register as BlueZ experimental BatteryProvider1
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
c667befe9a bluetooth: Provide (HSP/HFP-received) battery level as device property
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
d2c97190ef bt/native: Parse specified number of arguments in IPHONEACCEV
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
e6157c8b1f bt/native: Answer AT command with ERROR if unhandled
The peer will wait some time and eventually time out the connection if
no reply is sent back. When sending `ERROR` the peer can decide to break
the RFCOMM connection immediately or continue when a command is not
critical.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
4cbac23894 bluetooth/native: Signal support for dock status in XAPL reply
The previous commit parses both battery level and dock status (if only
for printing to logs). Make sure bit `2` is set in the `+XAPL=` reply to
signify support for reading this, too.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Sebastian Reichel
7a84a24652 bluetooth: backend-native: add battery level reporting
Devices for Apple's iOS uses a few extra HFP AT commands to
inform the iPhone about the headphone's battery status.
Apple documented the AT commands in the following document:

https://developer.apple.com/hardwaredrivers/BluetoothDesignGuidelines.pdf

The patch has been tested with a Bose QC35, which results
in the following communication:

D: [pulseaudio] backend-native.c: RFCOMM << AT+VGS=14
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] backend-native.c: RFCOMM << AT+XAPL=009E-400C-0129,3
D: [pulseaudio] backend-native.c: RFCOMM >> +XAPL=iPhone,2
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] backend-native.c: RFCOMM << AT+XEVENT=Bose SoundLink,158
D: [pulseaudio] backend-native.c: RFCOMM >> OK
D: [pulseaudio] backend-native.c: RFCOMM << AT+IPHONEACCEV=2,1,4,2,0
N: [pulseaudio] backend-native.c: Battery Level: 50%
N: [pulseaudio] backend-native.c: Dock Status: undocked
D: [pulseaudio] backend-native.c: RFCOMM >> OK

[Marijn: Adapt for recent HSP/HFP code changes]

Co-authored-by: Marijn Suijten <marijns95@gmail.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Marijn Suijten
66e2672360 bt/bluez5-device: Update link to assigned Baseband numbers
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/482>
2021-07-28 09:11:43 +02:00
Evan Miller
bea3fa7d21 Fix a strict-prototypes warning
Some older compilers complain about the empty arg list in
pa_memfd_is_locally_supported.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/603>
2021-07-14 15:07:46 +00:00
Laurent Bigonville
0efc38e95f iochannel: Fix FTBFS on Debian kfreebsd
Fixes: #1233
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/605>
2021-07-13 10:49:01 +02:00
Igor V. Kovalenko
5febac482d alsa-ucm: fix persistent port names with alsa-lib >= 1.2.5
Alsa UCM device string can contain private configuration prefix required to make
correct device open call. Private prefix is dynamically generated by UCM manager
depending on internal state. Since pulseaudio sink/source port names currently
contain device string, these may change between runs breaking volume database
and module arguments referring to sink/source.

Fix this by skipping UCM private prefix available via `_alibpref` key while
creating UCM mapping name. Mapping object will still contain unmodified
device string for device open call.

See also https://github.com/alsa-project/alsa-ucm-conf/issues/104

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/598>
2021-07-12 13:49:21 +03:00
Tanu Kaskinen
13fd21a9c9 stream-restore: make version check stricter when dropping old entries
If we increment ENTRY_VERSION in the future, the old code would drop
entries with version 2, but we only want to drop entries with version 1.

This issue was spotted by Igor Kovalenko:
https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/298#note_983365

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/604>
2021-07-09 12:32:27 +03:00
Igor V. Kovalenko
0555d4f5a5 module-gsettings: Handle I/O hangup
When child `gsettings-helper` terminates prematurely, unconditionally reading
from child pipe fails in a busy loop until child process is reaped.

Fix this by terminating module upon PA_IO_EVENT_HANGUP or PA_IO_EVENT_ERROR.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/600>
2021-07-04 11:14:37 +03:00
Alper Nebi Yasak
7580ef31a1 alsa-ucm: Log about the correct path value when probing volumes
These two log messages are most likely intended for the path that was
just tried, but they are mistakenly printing the name of the port's
current path. Fix them.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/594>
2021-06-30 15:09:14 +00:00
Igor V. Kovalenko
c817dfb5a4 build-sys: meson: Require bluez dependency if bluez5 feature is enabled
Build breaks if bluez5 and bluez5-native-headset are both enabled
but bluez headers are not available.

Fix this by changing `bluez5` to Meson feature requiring `bluez` dependency.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/583>
2021-06-21 10:50:08 +00:00
Igor V. Kovalenko
58052e0e04 build-sys: meson: require GIO dependency for RTP-GStreamer
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/584>
2021-06-21 03:25:32 +03:00
Hui Wang
36fcfeb211 alsa-sink/source: set volume to hw immediately if ucm_port changing
Recently we found an issue of output volume on speaker and headphone,
they should have their own volume but in practice they share one
output volume.

This issue happens on the laptops which use the ucm2 sof-hda-dsp,
originally the speaker has output volume A while the headphone has the
output volume B, suppose the speaker is the active port at the moment
and the output volume is A, users plug a headphone to the jack and the
headphone becomes the active port, in this process, ucm_set_port()
calls _disdev/_enadev which triggers the io_mixer_callback(), in the
meanwhile, the module_device_restore will restore the headphone's
volume to B, it will call set_volume_cb() to set the volume to B, but
this value is not written to hw immediately, during the time of
waiting for the B to be written to the hw, the io_mixer_callback()
calls get_volume_cb(), it reads hw volume and gets the volume A, then
it overrides the output volume to A, this results in the headphone
gets the volume A instead of B.

If a machine doesn't use the ucm, this issue will not happen since the
set_port_cb() will not trigger the io_mixer_callback(). If the ports
don't belong to the same sink/source, this issue also doesn't happen.

BugLink: http://bugs.launchpad.net/bugs/1930188
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/577>
2021-06-16 19:58:24 +03:00
Patrick Gaskin
ce962563eb win32: Add DACLs for directories created by system daemon
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/549>
2021-06-16 09:17:27 +00:00
Patrick Gaskin
4f3ca10d9e daemon: Add support for running as a service on win32
* Minimal implementation of --system on win32.
* Wrap main with a Windows Service on win32 (with a fallback to
  running it directly).
* Update PA_SYSTEM_{RUNTIME,STATE,CONFIG}_PATH and HOME dynamically
  on Windows (overrides the build config, similar to the existing
  config path replacement logic).

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/549>
2021-06-16 09:17:27 +00:00
Hui Wang
87b4d68978 alsa-mixer: only use switch to mute Front in the Headphone path
According to the alsa-info.txt in the pipewire issues of 747 and 1206,
the Front Playback Volume is shared by Headphone and Lineout or
Headphone and Speaker, But Headphone, Lineout or Speaker they all have
independent Playback Switch, change to only use switch to mute the
Lineout or Speaker. This could resolve the issues of 747 and 1206.

BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1206
BugLink: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/747
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/565>
2021-06-16 09:13:58 +00:00
Patrick Gaskin
6222f610e8 win32: Misc Unix socket fixes
* Make pa_parse_address recognize Unix socket addresses with
  Windows-style absolute paths.
* Treat WASEINVAL as a stale socket.
* Make HAVE_AF_UNIX in config templates recognize winsock2.h.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/546>
2021-06-16 09:05:58 +00:00
Patrick Gaskin
a01cce726f win32: Fix environment variables set with pa_{unset,set}_env not taking effect
SetEnvironmentVariable is not visible to getenv.

See https://github.com/curl/curl/issues/4774.
See https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/getenv-wgetenv.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/546>
2021-06-16 09:05:58 +00:00
Patrick Gaskin
ac8e786026 win32: Fix minimum Windows version for inet_{ntop,pton}
https://docs.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-inet_ntop#requirements

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/546>
2021-06-16 09:05:58 +00:00
Scott Worley
9d27317873 gsettings: Emit glib logs on stderr, not stdout
Having G_MESSAGES_DEBUG=all set in the environment (a normal thing to do
when debugging Gnome troubles) causes gsettings-helper to emit a bunch
of helpful gnome debug logs (which is good), but before this change they
were printed on stdout rather than stderr (which was bad!).  Rather than
going somewhere the user could see, these log messages were being sent
to the pulesaudio server and interpreted as the src/modules/stdin-util.c
protocol.  pulseadio waits to see a '!' message from gsettings-helper
before continuing startup.  With the log messages mixed in messing up
the stdin-util protocol, pulseaudio never saw the '!' message, and so
never completed startup.

This simple fix relies on a recent glib > 2.68 (Mar 2021), so builds
against old versions of glib will still have this problem!  We consider
this good enough until some complains otherwise.

Fixes: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/issues/1222
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/579>
2021-06-15 11:46:20 -07:00
Igor V. Kovalenko
1a4fb0ff63 alsa-mixer: updated Sennheiser GSX 1200 device ID
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/581>
2021-06-15 09:20:41 +03:00