Commit graph

2048 commits

Author SHA1 Message Date
Peter Hutterer
223f20709d meson: replace join_paths(a, b) with a / b
More readable and from the meson reference manual:
(since 0.49.0) Using the/ operator on strings is equivalent to calling join_paths.
2021-04-15 06:57:00 +00:00
Peter Hutterer
8c369b0a58 spa: install i18n header
Added in 01fe9100e2, fails the ci's
check-missing-headers script
2021-04-15 13:48:25 +10:00
Wim Taymans
3babedec9c acp: get i18n interface from support and use it
Save the i18n interface in a global variable. Make acp use the support
interface when translating strings.
2021-04-14 18:03:46 +02:00
Wim Taymans
7ee23a046c acp: avoid warning for i18n string
spa/plugins/alsa/acp/channelmap.h:466:9: warning: format not a string
literal and no format arguments [-Wformat-security]
  466 |         pa_snprintf(s, l, _("(invalid)"));
2021-04-14 18:03:45 +02:00
Wim Taymans
01fe9100e2 spa: add i18n interface
The interface can be used to get translated strings.
2021-04-14 18:03:45 +02:00
Pauli Virtanen
20e383cea7 v4l2: remove device if inotify reports it's no longer accessible 2021-04-11 16:38:10 +00:00
Pauli Virtanen
bf3b5d4286 alsa: remove device if inotify reports it's no longer accessible
When the session becomes inactive (eg. user on active seat switched),
udev may make devices inaccessible.  In this case, pipewire should give
up the devices and close their open file descriptors.
2021-04-11 16:38:10 +00:00
Pauli Virtanen
277a9a2577 bluez5: retry initial HFP codec selection after a timeout
In case headset fails to reply with AT+BCS to the codec selection
following AT+CMER, try to retry the codec selection, and if it still
fails, assume the headset is configured for CVSD.
2021-04-11 16:34:33 +00:00
Pauli Virtanen
87e06783d1 bluez5: more cleanup on impl_clear
Remove dbus filters and close the dbus connection.  Closing the
connection lets BlueZ to clean up, so we don't call its unregistration
API.
2021-04-10 23:07:51 +03:00
Pauli Virtanen
87aa18edb1 bluez5: free rfcomm when device is freed
Avoids use-after-free if device gets freed before the corresponding
rfcomm.
2021-04-10 15:47:46 +00:00
Huang-Huang Bao
4292e8fe7e
a2dp: set marker bit on AAC header 2021-04-10 04:51:16 +08:00
Huang-Huang Bao
b874362c8e
a2dp: don't reset buffer on EAGAIN
Allow it to resend packet until next port data is received.
2021-04-10 04:50:34 +08:00
Wim Taymans
8251dc11cc spa: add type mappings for F32 and F32OE
so that we can refer to the native float32 format with F32 and the
other endian one with F32OE.
2021-04-09 11:38:54 +02:00
Frédéric Danis
136511fbc8 bluez5: backend-ofono: Enable SCO deferred socket
The incoming SCO socket should be first read to authorize the connection.
2021-04-08 14:18:17 +00:00
Barnabás Pőcze
923d88bd35 spa: support: log-impl: check the return value of strrchr()
Previously, the return value of `strrchr()` was not checked
in `spa_log_impl_logv()` which could cause a segmentation fault
in `snprintf()` if the `file` string argument does not contain
any directory separators ('/').

For example,

  ./build/spa/tools/spa-inspect ./build/spa/plugins/alsa/libspa-alsa.so

could run into this problem:

  Program received signal SIGSEGV, Segmentation fault.
  0x00007ffff7f1d505 in __strlen_avx2 () from /usr/lib/libc.so.6
  (gdb) bt
  #0  0x00007ffff7f1d505 in __strlen_avx2 () from /usr/lib/libc.so.6
  #1  0x00007ffff7e29408 in __vfprintf_internal () from /usr/lib/libc.so.6
  #2  0x00007ffff7e3a19a in __vsnprintf_internal () from /usr/lib/libc.so.6
  #3  0x00007ffff7e146f6 in snprintf () from /usr/lib/libc.so.6
  #4  0x0000555555558818 in spa_log_impl_logv (object=<optimized out>, level=SPA_LOG_LEVEL_INFO,
      file=0x7fffffffd4d0 "[I][", line=260, func=0x7ffff7ce8090 "error_node", fmt=<optimized out>,
      args=0x7fffffffd920) at ../spa/include/spa/support/log-impl.h:49
  #5  0x00007ffff7d8c69e in alsa_error_handler (file=<optimized out>, line=<optimized out>,
      function=<optimized out>, err=<optimized out>, fmt=<optimized out>)
      at ../spa/plugins/alsa/acp/alsa-util.c:866
  #6  0x00007ffff7cd6a8f in ?? () from /usr/lib/libasound.so.2
  #7  0x00007ffff7cdb55e in snd_use_case_mgr_open () from /usr/lib/libasound.so.2
  #8  0x00007ffff7d8940f in pa_alsa_ucm_query_profiles (ucm=ucm@entry=0x55555556ba28, card_index=0)
      at ../spa/plugins/alsa/acp/alsa-ucm.c:752
  #9  0x00007ffff7d6e3c2 in acp_card_new (index=0, props=props@entry=0x7fffffffdc50)
      at ../spa/plugins/alsa/acp/acp.c:1508
  #10 0x00007ffff7d29b7a in impl_init (factory=<optimized out>, handle=0x55555556b540,
      info=<optimized out>, support=<optimized out>, n_support=<optimized out>)
      at ../spa/plugins/alsa/alsa-acp-device.c:963
  #11 0x0000555555558429 in inspect_factory (factory=0x7ffff7daefa0 <spa_alsa_acp_device_factory>,
      data=0x7fffffffdcf0) at ../spa/tools/spa-inspect.c:231
  #12 main (argc=<optimized out>, argv=<optimized out>) at ../spa/tools/spa-inspect.c:309

as in that particular case, the filename was returned by libasound,
and it was just "parser.c".

Furthermore, separate the static variable from the rest, and apply
the `const` qualifier to the pointers in the `levels` array.
2021-04-07 15:55:44 +02:00
Pauli Virtanen
026e3882d2 bluez5: remove battery when RFCOMM connection drops
There won't be further battery level updates when RFCOMM connection is
down, so remove the battery then.

Fix minor things with canceling the provider registration.
2021-04-05 15:04:16 +00:00
Dmitry Sharshakov
97b01ed9b0 bluez5: add a property to select default profile 2021-04-04 08:43:09 +00:00
Wim Taymans
9562cd56a2 alsa-seq: tweak port names some more
Remove the client id, it can change and is otherwise not generally
useful. Move the direction with the port.

Fixes #1007
2021-04-01 19:43:28 +02:00
Dmitry Sharshakov
e3f344b3fa bluez5/native: send correct AT+CMER HFP HF command
Signed-off-by: Dmitry Sharshakov <d3dx12.xx@gmail.com>
2021-04-01 19:12:49 +03:00
Wim Taymans
b318a9e1d3 support: add right property id 2021-04-01 10:08:47 +02:00
Wim Taymans
339927ac76 spa: allow variable format, rate, channels, size, framerate
Use 0 values to skip adding the values to the format param, which
leaves them variable.
2021-04-01 09:58:08 +02:00
Huang-Huang Bao
63281413bd
a2dp: fix a problem in b9d1b818 2021-03-31 19:33:21 +08:00
Huang-Huang Bao
b9d1b818d5 a2dp: guard against LDAC quality value, add labels for LDAC quality prop info 2021-03-31 11:14:58 +00:00
Huang-Huang Bao
5c93f780cf a2dp: improve a2dp sink codec data flushing
Let codec decides when rtp packet need to be sent (terminated by MTU size in most case).
LDAC encoding loop can now be terminated by reading if frame_num is written, no 'frame_count' updating is needed.
RTP payload fragmentation can now be implemented more easily based on this.
2021-03-31 11:14:58 +00:00
Wim Taymans
f0ab2bc1db bluez5: pass the route save property around
So that volumes are saved by the session manager.

Fixes  #995
2021-03-30 16:31:17 +02:00
Wim Taymans
dc3bf68aa2 acp: make sure we pass the save flag around
When we set the volume on a port, make sure we also set the save flag
so that the flag is put into the volume changed event and the session
manager can save it.

Fixes #995
2021-03-30 16:06:30 +02:00
Wim Taymans
5b2b256ecd alsa: initialize reserve array 2021-03-30 09:40:10 +02:00
Wim Taymans
43317f67ba a2dp-source: improve info parsing
Make sure we handle NULL info.
Simplify the property parsing.
2021-03-30 09:24:35 +02:00
Dmitry Sharshakov
e7f2f450ff bluez5: add parameter to use A2DP source as input 2021-03-30 09:21:12 +02:00
Wim Taymans
149471631e alsa: use higher ports for listening
Allocate up to the first 16 ports, use the last 2 ports and free the
first 14 ports.

This ensure our ports are not among the first ports so that port 128
and following are for normal apps, what is usually expected when
PipeWire is not running.

Fixes #951
2021-03-29 17:05:03 +02:00
Wim Taymans
80ce2c94ac alsa: add start-delay parameters to sink
The start-delay adds extra silence to the buffer before starting the
playback. The idea is to have more time to adapt to the device
startup and set the timer more accurately.

See #983, #431
2021-03-29 13:20:14 +02:00
Wim Taymans
fda565864c alsa: limit headroom to buffer-size
We can never have more headroom that the total buffer-size so better
clamp this here.
2021-03-29 13:17:01 +02:00
Wim Taymans
73f50bb964 improve debug 2021-03-29 11:41:06 +02:00
Pauli Virtanen
ef74ef3654 bluez5: use the actual latency in a2dp-source 2021-03-28 14:20:42 +03:00
Pauli Virtanen
b19bd74b22 bluez5: adjust sco-source behavior as a follower
Don't try to drive as a follower, specify latency when AG, and
bump up number of buffers to allow process being called less often.
2021-03-28 14:15:26 +03:00
Wim Taymans
ae22852a9b remove some useless checks
The variable was already dereferenced above and thus can't be NULL
2021-03-27 20:36:43 +01:00
Wim Taymans
e7ca1b474e acp: use the input ports for the input mappings 2021-03-27 20:16:04 +01:00
Wim Taymans
7c819320c7 tests: fix test of array values
Don't assign but test. Also test the right array index..
2021-03-27 20:10:01 +01:00
Wim Taymans
f26c642055 loop: initialize some variables
Just in case the read fails.
2021-03-27 19:23:34 +01:00
Pauli Virtanen
f330446291 bluez5: better error/malformed input handling
Safer parsing of AT commands, additional null and error checks.
2021-03-27 14:38:31 +00:00
Pauli Virtanen
54e06d9df0 bluez5: add additional aac encoder options, and implement optional vbr 2021-03-27 11:47:34 +00:00
Huang-Huang Bao
bd7dba617f
bluez5: fix SPA_PROP_bluetoothAudioCodec param prop setting
Remove 'const' from 'codec_id' declaration.
2021-03-27 09:27:33 +08:00
Pauli Virtanen
51b0248d09 bluez5: update a2dp codec list when remote endpoints change 2021-03-26 16:59:07 +00:00
Pauli Virtanen
a552655edc bluez5: add bluetoothAudioCodec property to device
Also make the "codecless" profiles to automatically switch to the codec
profiles.
2021-03-26 16:59:07 +00:00
Pauli Virtanen
6b0cf799c4 spa: add bluetoothAudioCodec property and type 2021-03-26 16:59:07 +00:00
Huang-Huang Bao
34c9f24d2a bluez5: autoconnect device profiles on startup
Auto-connect all paired & trusted devices on startup.
Since devices that already connected or powering off would reject the connecting requests, it should be fine with this behavior.
Also reconnect remaining profiles if only partial profiles are connected.
2021-03-26 14:15:55 +00:00
Wim Taymans
d805253c69 bluez5: don't warn when the services are not available
If oFono or hsphfpd are not installed, just log an info message
that they are not used. The native backend will work fine and we
don't want to log warnings.

See #971
2021-03-26 12:09:43 +01:00
Wim Taymans
ee99693f77 bluez5: check for NULL info before accessing it 2021-03-25 17:38:45 +01:00
Wim Taymans
8c334fa3ab alsa: never queue buffers when rate matching
When we are following the resampler requested size in capture, never
keep queued buffers around or we might get out of sync with the
requested size and cause cracks and pops in the resampler.

See #805
2021-03-24 11:48:32 +01:00
Wim Taymans
34800dc019 json: don't move past the end of a symbol
We can't move past the } or ] or we might miss the end of the
container. Now that we ignore \0 it is not a problem if the \0
is placed at the container boundary.
2021-03-23 18:05:44 +01:00