Commit graph

5851 commits

Author SHA1 Message Date
Huang-Huang Bao
e7cecaaea6 media-session: apply updated properties to bluez/v4l2 device handle 2021-03-16 10:31:08 +00:00
Florian Hülsmann
41d4039ee4 jack: omit debugging macros in jack_{error,info,log} 2021-03-16 08:59:01 +00:00
Florian Hülsmann
21ff2740d6 jack: jackctl_server_create2 add dummy driver 2021-03-16 08:59:01 +00:00
Florian Hülsmann
1a59711ce1 jack: jackserver sources, add stubs for control.h 2021-03-16 08:59:01 +00:00
Wim Taymans
1b1a3b96ec alsa: improve startup
Start with an extra period of silence.
Reconfigure a new timeout if we are too far off from the desired
buffer fill level. Reduce this level to the maximum error we
tollerate.

With this we use the extra period of silence to reconfigure the
timeout until we are close enough and we can start the dll with a
small error.

See #892
2021-03-16 09:48:12 +01:00
Pauli Virtanen
8f075619b2 bluez5: set volume for both channels when switching HFP -> A2DP
Retain mono volume level set with HFP, for A2DP, in case session manager
fails to restore it.
2021-03-15 23:24:40 +02:00
Pauli Virtanen
d9c5ea54fd media-session: set bluetooth volume directly on the local adapter node
Avoid problems with session proxy appearing too late by setting props on
directly on the local SPA node.
2021-03-15 21:24:39 +02:00
Pauli Virtanen
c7ad443e03 bluez5: update supported codec list when profiles changed
When A2DP is connected and new device profiles appear, update also
supported codec list.

Fixes missing codec profiles when A2DP is connected late.
2021-03-15 20:47:22 +02:00
Wim Taymans
5c91f23c18 default-routes: only restore routes when profile changed
When the profile changes, try to restore the previously saved
routes. Otherwise, follow the best route when it changes.

See #863
2021-03-15 16:06:13 +01:00
Wim Taymans
85a102f414 default-profile: restore saved profile only for first time
Don't always try to restore the saved profile when it's available
but only do this the first time. From then on, try to follow the
best profile when it changes.
2021-03-15 14:57:10 +01:00
Wim Taymans
0b6d3e4b71 default-routes: reconfigure the profile when routes change
When something changes to the route status, try to reconfigure the
current profile.
2021-03-15 11:51:24 +01:00
Wim Taymans
9964741637 context: non-passive loopback links also active a driver
If a driver node is linked with a non-passive link to itself, it
should also become running.

One example of this is the Midi bridge, that needs to start when you
link one device to another. The devices are all on the same node
so linking devices would result in loopback connections.
2021-03-15 11:42:09 +01:00
Pauli Virtanen
8ba6e98320 media-session: move libcamera+bluez5 device removal to object free callback
libcamera + bluez5 devices should be freed/unloaded via the sm_object
free callback, similarly as in alsa and v4l2 monitors.  This ensures
they are run at session_shutdown.
2021-03-15 08:20:38 +00:00
Pauli Virtanen
5b8c7c405d media-session: deal with global id race conditions
To resolve monitor and policy core global ids racing with each other,
use separate registry event handlers for both cores.  Each handles only
their own objects, determined by where the object handle was created.

Postpone handling of policy core new global events after monitor sync,
which orders them after the corresponding monitor proxy and registry
events. Monitor core is then more up-to-date, so we resolve id clashes
in favor of monitor globals, which avoids duplicate objects.

Fix use-after-free by tracking whether a monitor holds references to
sm_object. Keep also objects pending for id in a list, so that they can
be cleaned up on session_shutdown (monitors may leak objects at
shutdown, because spa objectinfo events won't be handled then).

Caveats:

Zombie objects may still created if policy core is late by several
events, but in those cases the corresponding remove events are already
in the queue.

Also, there's a (theoretical) possibility that pw_registry_bind will
bind the wrong object, if the registry event is handled too late and an
id is reused by the server.

For details, see reverted 77e4fdb1e4
for which this is a another approach.
2021-03-15 08:20:38 +00:00
Ivan
864d0148c2 meson: Change codec options description 2021-03-14 22:54:37 +00:00
Ivan
4c9af21ec6 meson: Add 'feature' options to enable/disable bluetooth codecs
Fixes: #606
2021-03-15 00:14:23 +02:00
Wim Taymans
b07bfd0661 alsa: fix dll handling
Pass the right value for the rate, we need to pass the graph rate.
Don't reduce bandwidth, it is not needed.

Fixes timings for reading the alsa-sequencer.
2021-03-14 21:42:17 +01:00
Wim Taymans
f372de8608 resample: refactor rate match code
Use the same code to start rate matching so that we get the same
results for passthrough.
2021-03-14 20:06:45 +01:00
Wim Taymans
017900575c alsa: don't compensate for resampler delay
Don't try to move closer to the read/write pointers in the ringbuffer
to compensate for the resampler delay. We might not have enough time
anymore to complete a cycle without xruns. The delay is properly
reported in the clock times and should also be reported on the port
latency eventually.
2021-03-14 17:08:04 +01:00
Wim Taymans
17fd38c3a5 channelmix: use front-center matrix values
Use the front-center matrix values to mix left and right.
2021-03-14 15:42:53 +01:00
Wim Taymans
c4e3b5adbc alsa: don't double the resampler delay
The delay of the resampler is what it reports, don't double it.

See #854
2021-03-14 14:13:37 +01:00
Wim Taymans
cc12755c6c json: ignore '\0'
We ignore '\0' chars as we use the string length to check for the
end and the 0 chars might be inserted to parse the json in-place.
2021-03-14 10:23:40 +01:00
Wim Taymans
eb4a439488 conf: parse json config in-place
Avoid allocs by parsing the json in-place.
2021-03-14 09:32:01 +01:00
Wim Taymans
2d1f84fd7d json: Move past the end char of a symbol
So that we can put a \0 there and continue parsing the rest of
the string. This allows us to in-place parse_string.
2021-03-14 09:28:38 +01:00
Huang-Huang Bao
762663e74e
meson: create soft link for 'pipewire-uninstalled', fix gdb target in Makefile 2021-03-14 13:32:08 +08:00
insop
a9c247bdab Minor typo fixes 2021-03-13 21:13:01 +00:00
Wim Taymans
c974318686 pipewire: disable colors when NO_COLOR is set
See no-color.org
2021-03-13 20:36:46 +01:00
Wim Taymans
da5c43fb33 logger: printf \n even when colors disabled 2021-03-13 20:36:23 +01:00
Wim Taymans
4873dbcf8e pw-dump: respect NO_COLOR
See no-color.org
2021-03-13 20:30:13 +01:00
Jan Alexander Steffens (heftig)
c6aa48548e
pulse-server: Use fprintf to write the pid file
This simplifies the code and also avoids a warning with _FORTIFY_SOURCE:

    ../pipewire/src/modules/module-protocol-pulse/pulse-server.c: In function ‘create_pid_file’:
    ../pipewire/src/modules/module-protocol-pulse/pulse-server.c:6028:2: warning: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
     6028 |  write(fd, pid_str, strlen(pid_str) + 1);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-03-13 20:09:31 +01:00
Jan Alexander Steffens (heftig)
ac9bcdee31
pulse-server: Error out if pid file name would be too long 2021-03-13 20:09:03 +01:00
Jan Alexander Steffens (heftig)
6e2f78fffc acp: Check return value of asprintf
Building with `-D c_args="-D_FORTIFY_SOURCE=2"` triggers warnings:

    ../spa/plugins/alsa/acp/acp.c: In function ‘add_pro_profile’:
    ../spa/plugins/alsa/acp/acp.c:298:2: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      298 |  asprintf(&device, "hw:%d", index);
          |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../spa/plugins/alsa/acp/acp.c:334:4: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      334 |    asprintf(&name, "Mapping pro-output-%d", dev);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../spa/plugins/alsa/acp/acp.c:364:4: warning: ignoring return value of ‘asprintf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
      364 |    asprintf(&name, "Mapping pro-input-%d", dev);
          |    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-03-13 14:50:42 +00:00
Jan Alexander Steffens (heftig)
9cdf3d1a0b meson.build: Check strndupa using has_header_symbol
It's a macro here, which has_function misses, at least from meson
0.57.1.
2021-03-13 14:49:35 +00:00
Albert Chang
2ae6851698 pulse-server: create pid file on start up
Some PulseAudio clients, such as QEMU, check that the pid file exists
prior to initialization.
2021-03-13 14:47:45 +00:00
Wim Taymans
a9bf93030e resample: limit input size to max size of empty space
When flushing use the max size of the empty space, not the
max size of the input buffers, which might be larger.
2021-03-13 13:53:41 +01:00
Wim Taymans
801bd98233 audioconvert: use preallocated empty buffer to drain
Avoid calling memset on a large piece of memory when draining
the resampler because it might use up all the allocated time in
our realtime thread. Instead use a prealloced empty buffer.
2021-03-13 12:54:41 +01:00
Huang-Huang Bao
d6be84ddd0
bluez5: close sco socket if bluetooth daemon disappeared
Fixes pipewire/pipewire#853
2021-03-13 19:06:49 +08:00
Dmitry Sharshakov
e2ac16ccbd fix: remove v-battery when device disconnects 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
a0ac3ac8dd fix: cancel and free battery register pending call 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
5c9028a94d bluez5-dbus: move battery provider functions, fix ghost batteries 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
48cc5915fb chore: backend-native: remove unused define 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
2683c1ef5e backend-native: report battery status to BlueZ 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
a1ed8aec68 chore: bluez5: move spa_bt_monitor to common header file 2021-03-12 15:45:41 +00:00
Dmitry Sharshakov
0078b3b73e backend-native: get battery status via HFP 2021-03-12 15:45:41 +00:00
Wim Taymans
196fe8b51b jack: use configured node.latency when inactive
In the inactive state, use the configured latency values for the
node instead of the current values used in the graph. We need to
do this because the graph only changes the buffer-size to our
requirements when the node becomes active.

Some clients do get_buffer_size before activating and would then
get a different value from when they would activate, causing some
apps to be confused and stop.

See #886
2021-03-12 15:58:34 +01:00
Wim Taymans
90b0410280 conf: improve config files
Make arrays from config sections that should really be an array.
Having the module name as the object key technically makes it
impossible to load the same module twice because the key can only
be once in the object.

The same applies to the context.objects and context.exec sections.

This also makes it somewhat easier to parse the config..
2021-03-12 12:39:58 +01:00
Wim Taymans
86cf4ad5a5 audioconvert: keep better track of changed params
Keep all the children param flags around and use those to decide
if something changed. Also don't change the param flag serial when
we are simply adding a listener.

This should reduce the number of param updates, most notably the
PropInfo that was updated along with the Props on volume changes.
2021-03-12 11:10:43 +01:00
Wim Taymans
6562a2ab79 channelmix: clean up param handling
Use defines to access the different params.
Fix the name of the function to emit properties.
2021-03-12 10:36:08 +01:00
Wim Taymans
f41de50b28 json: escape and unescape invalid unicode chars 2021-03-12 09:23:33 +01:00
Thibault Saunier
22f6e8e36d meson: Fixed remaining issues from the port to feature options 2021-03-11 18:29:11 +00:00