Commit graph

5831 commits

Author SHA1 Message Date
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
Wim Taymans
9cd9339c2a alsa-pcm: only disable IRQ when not batch
For batch devices we want to keep the IRQ so that the pointers are
updated with the period-size. Brings my UMC404HD to 4.8ms roundtrip
times with IRQ at 6 sample and batch enabled.
2021-03-11 18:37:13 +01:00
Wim Taymans
b4cf78b5a6 alsa-pcm: improve debug 2021-03-11 18:34:55 +01:00
Wim Taymans
a5922a9c0a pulse-server: use async reply for set_default_sink/source
Because we set the default sink/source before calling the metadata,
we don't send out updates about the new sink and this confuses
pavucontrol.

Instead, use the new async reply to reply once the new metadata has
been configured and the defaults have been updated.
2021-03-11 15:39:19 +01:00
Wim Taymans
fdcbe67941 context: add info log about parsed config sections
So that we can see what's being parsed or not.
2021-03-11 15:23:53 +01:00
Wim Taymans
bdea557fb1 module-portal: improve error message
Pass some error messages and errno around to give a better error
message (instead of ENOMEM) when the connection with dbus fails.
2021-03-11 15:18:28 +01:00
Wim Taymans
d63f4234ae channelmix: remap volumes
The volumes set with the properties need to be reordered to match
the volumes of our internal layout.
2021-03-11 11:26:26 +01:00
Wim Taymans
38d36f1921 media-session: improve saved profile restore
We only want to restore the saved profile when it is available, when
it is not available and there was no change in best profile, leave
the profile as it is.
2021-03-11 10:22:33 +01:00
Wim Taymans
d295d97160 media-session: only restore best profile when something changed
Keep track of the best profile. Only try to switch away from the
saved profile when something changed and the saved profile is not
available.

This makes it possible to select an unavailable profile but when
something is changed, it will switch away from it.
2021-03-11 09:32:17 +01:00
Thibault Saunier
485bae5eb0 meson: Use feature options everywhere it makes sense 2021-03-10 20:18:34 +00:00
Pauli Virtanen
98bedb3895 bluez5: don't set a2dp codec for source device initial profiles
Source devices don't have the a2dp codec profiles, so don't set a codec
profile as the initial one.
2021-03-10 21:32:01 +02:00
FeRD (Frank Dana)
2931522d2c pw-cli: Make 'dump' type arg case-insensitive 2021-03-10 11:41:32 -05:00
Wim Taymans
e334c5862e pulse-server: fill in the format info 2021-03-10 17:27:11 +01:00
Wim Taymans
d5fc67cf06 pulse-server: Prefer the formats of the extended format API
Fix enumerate the formats from the extended API and then append
the old API formats.

See #876
2021-03-10 16:55:01 +01:00
Wim Taymans
ef4b3c403e media-session: -1 as node.target is default
A node.target property of -1 also means to follow the default
sink/source. The ALSA plugin might use this to select the
target node and would otherwise not move to the new default sink.
2021-03-10 15:27:06 +01:00
Wim Taymans
78e9e5958e impl-node: delay starting the driver node
Only start the driver node after we have added ourselves to the
driver node or else we might start too soon, before there is anything
to schedule and we cause driver underruns.
2021-03-10 13:28:56 +01:00
Wim Taymans
62def0399f impl-node: rework link activation
Only activate the links when the node is added to a driver. Otherwise
the driver will expect us to decrement the activation counters for the
links but that won't happen because the node will not be processed
yet.

Instead we activate the links that were not activated yet when the
node is activated.

This improves scheduling for newly added links and nodes.
2021-03-10 13:06:02 +01:00
Wim Taymans
cc26ef9614 impl-node: update the io position from the data-loop
So that the update is synchronized with the data processing and
we don't accidentally process an old driver activation.
2021-03-10 13:03:34 +01:00
Wim Taymans
4f816c1fb0 loop: never try to block in the thread
When we are calling invoke from the thread, the call will be completed
in the thread and there is no need to block for completion.
2021-03-10 13:01:19 +01:00
Wim Taymans
0881d5b881 context: restart graph recalculation when something changed
When we were busy with the graph recalculation and something changed,
restart the graph state change to get the new change applied.

For example, when we start a node and it has a max-quantum set, we
need to restart our calculation with the new quantum limits.
2021-03-09 15:48:47 +01:00
Wim Taymans
63a34f4f84 alsa: after XRun, fill with previous threshold
It is possible that the quantum has changed before the xrun and
then we will assume the previous quantum was in the device.
2021-03-09 15:46:44 +01:00