Commit graph

7549 commits

Author SHA1 Message Date
Georg Chini
5c6d91a97c sink-input: Limit rewinding to max_rewind for virtual sinks
This patch is in preparation of allowing virtual sinks to specify their own
max_rewind limit.
Currently, virtual sinks cannot specify their max_rewind limit, but just copy
the value from the master sink. This may not be correct, if the DSP code of the
virtual sink has limited (or no) rewinding capability.
Because the DSP code of the virtual sink is rewound in the process_rewind()
callback of the sink input, it must be ensured, that rewinding a sink input
to the master of a virtual sink is limited similar to rewinding a sink.
There are two remaining exceptions:

1) If an underrun is detected. In that case, the filter should be reset anyway.
2) When the sink input of the filter is moved and attached to the destination
sink.

The move case is handled without involvement of the implementer, so the implementer
can only receive a rewind larger than max_rewind when the filter should be reset
anyway.

All existing virtual sinks do not distinguish between reset and rewind of the
filter.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Georg Chini
f121779f88 loopback: Add resampler delay to latency snapshots
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Georg Chini
129a59a2f0 virtual sources: Include resampler delay in latency reports
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Georg Chini
d55fde2fed source-output: Fix rewinding
If the output implements a process_rewind() callback, the resampler delay is
not taken into account. This leads to glitches during volume changes when
source and source output rates differ.

This patch fixes the problem.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Georg Chini
a275a0b811 sink-input: Change move logic
The introduction of the history queue makes it possible to implement moving
of streams without involving the implementer. Instead of dropping all data
from the render memblockq and requesting the implementer to rewrite the
data, the render memblockq is now reconstructed from the history queue.

Additionally, the render queue will be filled with silence matching the
amount of audio that is left playing on the old sink to avoid playing
the same audio twice.

This patch slightly breaks moving for virtual sinks because they do not
yet include the resampler delay in their latency reports. This will be
fixed in a different patch set.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Georg Chini
da539ed336 sink-input: Implement resampler pseudo rewinding
This patch uses the two previous patches to implemnt pseudo-rewinding for the
resamplers by feeding some old data into the resampler after a reset. This is
necessary because PA is using external resamplers that do not implement
rewinding.

To get exactly the same output data from the resampler after a rewind if possible,
the matching period is calculated. This is the number of input samples that produces
an integral number of output samples. After the matching period, the resampler state
repeats. If the matching period is not too large, feeding history into the resampler
will start at a point that is a multiple of the matching period back in time. Then
the resampler will produce exactly the same samples.

The PA_RESAMPLER_MAX_HISTORY value has been replaced by PA_RESAMPLER_MAX_DELAY_USEC
and the required number of history samples is calculated from the sink input sample
rate. The number of history samples can be as large as about 12500.

This fixes glitches during volume changes when the sink runs on a rate different
from the sink input rate.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Georg Chini
656179a8fe resampler: Add pa_resampler_prepare() and pa_resampler_get_delay() functions
The pa_resampler_get_delay() function allows to retrieve the current resampler
delay in input samples for all supported resamplers. The return value is a double
to maintain precision when using variable rate resamplers. Because in many places
the delay is needed in usec, pa_resampler_get_delay_usec() was also supplied.

The speex resampler now skips leading zero samples to provide meaningful delay values.

In the next patch, the pa_resampler_prepare() function will be used to train the
resampler after a rewind. It takes data from a history memblockq and runs it through
the resampler. The output data is discarded.

To make this logic possible, the soxr resampler had to be converted to use variable
rate. The fixed rate version has a variable delay, therefore the logic above could
not be applied. Additionally, with fixed rate, the delay is larger than 150ms in
some situations, while with variable rate the delay is fixed and comparable to the
other resamplers.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Georg Chini
1bfabd6512 sink-input: Add history memblockq
A new memblockq is added to the sink input code to keep some history of the
input data. The queue is kept in sync with the render memblockq. The old input
data will be used to prepare the resampler after a rewind.

pa_resampler_request() and pa_resampler_result() have been changed to round
as good as possible to avoid loosing or duplicating samples during rewinds.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/120>
2021-11-03 18:37:31 +00:00
Igor V. Kovalenko
90ccfc1688 null-sink: Recalculate max_request and max_rewind while resuming sink
When sink is suspended for reconfiguration changing sample spec, upon resume
internal thread_info max_request and max_rewind are out of date and possibly
not aligned to frame size anymore.

Recalculate thread max_request and max_rewind before resuming sink.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/658>
2021-11-03 15:59:22 +00:00
Igor V. Kovalenko
15c9ee5fec x11: Close session manager connection on ICE I/O error callback
When ICE I/O error occurs ICE connection is closed via IceCloseConnection.
This causes crash while releasing session manager connection later because
this ICE connection was initiated and is managed by session manager, and it will
attempt to close this ICE connection again.

Fix this by closing session manager connection instead.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/650>
2021-11-03 15:29:02 +00:00
Igor V. Kovalenko
696ffb464c message-params: Remove unwanted translations from log statements
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/655>
2021-10-24 13:37:47 +03:00
Igor V. Kovalenko
c0ad3efc18 bluetooth: Release container with device UUID strings
Stop leaking container with UUID strings when releasing adapter.

Fixes: 4b55b8a9d ("bluetooth: Keep a list of local adapters' UUIDs")
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/652>
2021-10-22 09:18:01 +03:00
Marijn Suijten
44ac675a8b bluetooth/native: Include util header for pa_msleep
Commit 7fd89e491 ("bluetooth: Try to reconnect SCO") introduces a call
to pa_msleep but failed to include the header, resulting in a:

    ../pulseaudio/src/modules/bluetooth/backend-native.c: In function ‘sco_acquire_cb’:
    ../pulseaudio/src/modules/bluetooth/backend-native.c:336:17: warning: implicit declaration of function ‘pa_msleep’ [-Wimplicit-function-declaration]
      336 |                 pa_msleep(300);
          |                 ^~~~~~~~~

(Un)fortunately this implicit declaration gets resolved at link-time,
otherwise the issue would have been caught sooner.

Fixes: 7fd89e491 ("bluetooth: Try to reconnect SCO")
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/651>
2021-10-22 00:24:33 +02:00
Marijn Suijten
ca9b723afa daemon/cmdline: Invert log-level list to match numerical values
Just like the manpage these written out log levels should correspond to
the numerical values listed before, intead of being in the opposite
order and provoking thoughts of the relation being the wrong way around
where 0=debug and 4=error.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/647>
2021-10-20 17:16:21 +02:00
Igor V. Kovalenko
8262815e94 message-params: If message paremeters is not JSON, wrap into JSON string
Requiring user to invoke send-message with correctly quoted parameters string
is not good for usability. Wrap parameters string into JSON string and try
again. If that works, log a warning use wrapped JSON string with parameters.

As an example these two commands will now invoke the same action:

    pactl send-message /card/bluez_card... switch-codec '"CODECNAME"'
    pactl send-message /card/bluez_card... switch-codec CODECNAME

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/648>
2021-10-19 09:45:27 +03:00
Igor V. Kovalenko
4c71f42fd5 bluetooth: Add missing breaks to profile availability check
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/643>
2021-10-06 19:06:45 +03:00
João Paulo Rechi Vita
48c78f0835 bluetooth: Add debug logging to profile creation
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/638>
2021-10-06 15:07:00 +00:00
João Paulo Rechi Vita
f7acc2ad7d bluetooth: Do not create a card profile for unsupported profiles
Check whether a Bluetooth profile is supported both by the remote device
and the local host before creating a card profile for it.

This is useful when some of the media profiles have not been registered
with bluetoothd because ex., oFono is not running and the headset
backend is not available.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/638>
2021-10-06 15:07:00 +00:00
João Paulo Rechi Vita
ab47d9394b bluetooth: Add debug logging to pa_bluetooth_device_supports_profile
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/638>
2021-10-06 15:07:00 +00:00
João Paulo Rechi Vita
d7f95170a1 bluetooth: Consider adapter UUIDs when evaluating profile support
The remote device list of UUIDs reflects which profiles are supported by
the remote device alone. We currently rely solely on this list to decide
if a certain card profile is supported, and thus should be created and
get connected.

This used to be accurate when the Bluetooth modules were first written,
but now BlueZ is more dynamic and local profile support can be added or
removed during runtime. The adapter's list of UUIDs is an accurate
representation of the profiles supported by the local host at a certain
moment.

This commit combines the list of UUIDs supported by remote device and
the list of UUIDs supported by the local host to determined whether a
Bluetooth profile is actually supported or not, and whether it should be
expected to get connected during device connection.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/638>
2021-10-06 15:07:00 +00:00
Igor V. Kovalenko
b81b995809 thread-mainloop: Release once_unlocked_data object after callback
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/642>
2021-10-06 14:18:24 +00:00
Chupligin Sergey
17a573782a Fix spelling of warning
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/639>
2021-10-01 19:12:14 +03:00
Igor V. Kovalenko
e189924570 Fix expression with side effect in pa_assert
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/641>
2021-09-30 11:20:52 +03:00
Igor V. Kovalenko
733969ac19 socket-server: Move systemd socket activation code to pulsecore
There is no need to support server sockets in client library. Move all related
code and tcp-wrappers dependency to pulsecore library.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/640>
2021-09-27 01:34:42 +00:00
Igor V. Kovalenko
60fb0c30c7 ladspa-sink: fix compiled in default LADSPA_PATH string
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/636>
2021-09-22 15:25:52 +00:00
Chengyi Zhao
7fd89e491f bluetooth: Try to reconnect SCO
When the SCO connection is in use, if you disconnect first and then connect,
the SCO connection will occasionally fail, and the Bluetooth error code is 42
(0x2A in hexadecimal). This is usually because an error occurred when the SCO
connection was initiated, we need to try to reconnect to optimize the handling
of this problem. The log returned by the kernel is as follows:

Bluetooth: sco_connect_cfm: hcon 0000000003328902 bdaddr 40:ef:4c:0c:11:f0 status 42
Bluetooth: sco_sock_connect status is -38
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/622>
2021-09-22 15:13:26 +00:00
Biswapriyo Nath
f5b94eff76 Fix pointer to integer cast warnings
This fixes warning: cast to pointer from integer of different size.
In Windows platform, long is 4 bytes. So, void* is first cast to
intptr_t then to int.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/630>
2021-09-22 14:43:59 +00:00
Igor V. Kovalenko
c94a3a9fb5 combine-sink: Add remix modarg
When module-combine-sink is used to create virtual surround card it is expected
that each slave channel receives data for exactly one combined sink channel.
Currently this is not the case because module-combine-sink would follow
core->disable_remixing setting. Usually this means that multiple channels of
combined sink are getting remixed into slave channel, and there is no option to
disable this behavior just for combined sink.

Improve this by implementing "remix" modarg for module-combine-sink,
default to original behavior (follow core->disable_remixing setting).

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/627>
2021-09-08 15:16:20 +00:00
Igor V. Kovalenko
af2e50c515 alsa-mixer: add support for SteelSeries Arctis Pro + GameDAC
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/626>
2021-09-08 14:23:34 +00:00
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