UCM profiles can use the same ports, but with different priorities. One
good example is a phone, having an earpiece and a speaker:
- the default profile will put a higher priority on the speaker
- the "voice call" profile will put a higher priority on the earpiece
When switching to the "voice call" profile, we want pipewire to take
into account the priority change, so that the earpiece gets the highest
priority and is selected by default.
As the ports have the same name in both profiles, we have a single
instance of each port in memory, and therefore need to trigger a port
update when the profile is changed, so that the priority set by the new
profile is used.
Moreover, the UCM code updates only the priority inside the
`pa_device_port` structure, so this commit also makes sure we reflect
this value into the `acp_port` structure when enabling a device.
SCO socket connect may fail with ECONNABORTED if it is done too soon
after previous close. To avoid this in cases where nodes are toggled
between stopped/started rapidly, postpone release until the transport
has remained unused for a time. Since this behavior appears common to
multiple SCO backends, do it for all SCO backends.
Move SCO polling to a single place, and abstract mtu handling.
Autodetect suitable tx packet size based on rx, instead of relying on
the kernel providing correct values.
Since the data thread accesses the spa_bt_transport, its destroy event
needs to sync with data thread to avoid races.
Also check transport is present in places that need it.
Simplify mSBC buffer handling and syncing to frame headers to work
on a per-byte basis.
The previous code could terminate with buffer overrun if it encountered
multiple consecutive incomplete packets.
When reusing buffers, do it in the same way as the other sinks.
The previous code did not set a valid next buffer for the i/o,
possibly causing it to hang.
Allow bare strings with all non-special other chars.
Add # to comment a line till \n
Allow = as separator for keys
Fix end of string handling.
Now:
{
"#": "this is a comment"
"key": "value",
"foo": 24
}
and
{
# this is a comment
key = value
foo = 24
}
Parse to the same thing with less clutter.
Fixespipewire/pipewire#502.
Also move media application creating from filter callback to initialization.
Application object path and endpoint paths only need to be registered once.
Signed-off-by: Huang-Huang Bao <eh5@sokka.cn>
Backends don't necessarily allow for opening the same device multiple
times, and it shouldn't be necessary.
Since source and sink are not necessarily both running at the same time,
refcount the transport acquire/release so that it knows to close the fd
only when no source/sink is running.
Let the transport manage the fd lifecycle, also closing it once it is
not needed.
Don't return the fd from acquire(), since each transport is associated
with a single socket fd.
Wrap read() with the CHECK() used elsewhre in the test program, in order
to render out the compiler warning represented by this transcript:
➜ pipewire (af38edea) ✔ make
ninja -C /home/jarkko/Projects/pipewire/build
ninja: Entering directory `/home/jarkko/Projects/pipewire/build'
[6/397] Compiling C object spa/plugins/alsa/test-timer.p/test-timer.c.o
../spa/plugins/alsa/test-timer.c: In function ‘main’:
../spa/plugins/alsa/test-timer.c:195:3: warning: ignoring return value of ‘read’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
195 | read(state.timerfd, &expirations, sizeof(expirations));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@iki.fi>
Use a different way to generate the upper bits of the ASYNC mask
instead of undefined shift as warned by sanitizer
Add some unit test for this
See #497