Commit graph

5302 commits

Author SHA1 Message Date
Barnabás Pőcze
ee7b82ac9e pulse-server: remove unnecessary NULL check
`spa_streq()` already checks for NULL pointers, so the
pointer does not need to be checked before calling it.
2021-10-18 15:36:22 +02:00
Barnabás Pőcze
80ae688cc6 pulse-server: compile extensions separately
Avoid including other C source files. Compile them separately.
2021-10-18 15:36:17 +02:00
Peter Hutterer
b78371f702 tools: update pw-reserve so don't need to include the c file 2021-10-18 20:44:11 +10:00
Peter Hutterer
1bced6b2ef Remove media-session from this tree
It is now available as a separate project in
https://gitlab.freedesktop.org/pipewire/media-session

The code required by pw-reservice has moved to src/tools/reserve.{c|h}
2021-10-18 20:44:07 +10:00
Wim Taymans
bd8ec29bb5 link-factory: avoid using 0 for invalid id
Use SPA_ID_INVALID instead of 0 when we fail to parse the port id
so that we don't accidentally match an internal port id.

See #1724
2021-10-18 11:35:25 +02:00
Peter Hutterer
dfb63d55dd media-session: use the SESSION_PREFIX for any fallback config dir
Regression introduced in 3560f3ba2d

MEDIA_SESSION_CONFIG_PATH expects the actual directory while
PIPEWIRE_CONFIG_PATH and the built-in fallback both expect the files to
reside within the SESSION_PREFIX subdirectory.

Fixes #1725
2021-10-18 07:23:00 +00:00
Peter Hutterer
56f01a293c media-session: fix config load path
config_dir is the new MEDIA_SESSION_CONFIG_DIR environment variable (if
set), impl.config_dir is that or the fallback, whichever applies.

Fixes 00bd3b5b59
Fixes #1725
2021-10-18 07:23:00 +00:00
Wim Taymans
e1deecc3cd impl-link: also update node id in properties
The link might have been made using the node name/nick/description but
we always want to place the id in the properties to make it easier for
apps to handle the relations between objects.

See #1723
2021-10-15 17:58:05 +02:00
Peter Hutterer
00bd3b5b59 media-session: store the config dir path in our object
The media session modules need to load config files through
sm_media_session_load_conf() and that must be the same config dir as our
main configuration file's directory.
2021-10-15 10:53:32 +10:00
Michael Olbrich
d2ce51d504 stream: decrement busy counter when releasing dequeued buffers
For buffers on the 'dequeued' list, the busy counter was already
incremented in impl_node_process_input(). So it must be decremented again
when these buffers are removed.
2021-10-14 19:16:56 +00:00
Michael Olbrich
314ff82ff0 pipewiresrc: fix handling outstanding buffers when stopping
The current code has several issues if a pipewiresrc is stopped and deleted
while a buffer is still in use downstream.

 - pw_stream_queue_buffer() is never called for the corresponding
   pw_buffer. As a result, the busy counter is never decremented and
   pw_stream_dequeue_buffer() of the corresponding pipewire output will
   return NULL whenever it encounters this buffer.

 - The pipewiresrc does not own the buffer reference unless the buffer is
   queued in the source, so calling gst_buffer_unref() unconditionally
   causes refcount issues for the buffer.

 - buffer_recycle() can race with on_remove_buffer() and
   gst_pipewire_src_close(). As a result, buffer_recycle() may access pwsrc
   when it was already deleted.

The buffer has its own reference to the pool. So the pool object lock can
be used to ensure that the pwsrc, core and stream remain valid in.
buffer_recycle(). If the 'dispose' function pointer was already cleared,
then on_remove_buffer() has already finished, so abort early.

With the pool lock held, it is save to access the pipewire loop. Now the
loop lock can be used to synchronize with on_remove_buffer(). 'dispose'
must be checked again in case on_remove_buffer() was triggered by something
other than gst_pipewire_src_close().

In on_remove_buffer() unref the buffer if it is queued. Otherwise call
pw_stream_queue_buffer() to ensure that the busy counter is decremented
correctly.
2021-10-14 19:16:56 +00:00
Michael Olbrich
744a8aaeb7 gst: init last_error
Otherwise, it may be used uninitalized.
2021-10-14 19:16:56 +00:00
Wim Taymans
1f5396fedb stream: don't change to the error state on proxy errors
The proxy errors are really from the session manager informing us about
decisions it made (failure to link, etc). The state of the stream is not
really affected by this so just emit the error signal and let the app
decide what to do.
2021-10-14 16:00:40 +02:00
Wim Taymans
8c346ab3a7 pulse-server: list NETWORK flag on devices
Mark network sinks and sources with node.network.
2021-10-14 13:45:58 +02:00
Wim Taymans
d6c1479ba0 module-zeroconf-discover: also parse the channel_map
So that we create the device with the same channel_map as the remote
end.

Fixes #1692
2021-10-14 13:28:43 +02:00
Wim Taymans
257bbb1fd5 echo-cancel: flush streams in PAUSED
so that we don't end up with old data when we resume.

Fixes #1660
2021-10-14 12:18:37 +02:00
Wim Taymans
30f8219afd stream: improve some debug 2021-10-14 10:02:13 +02:00
Peter Hutterer
40eb9578d5 media-session: make a few debug messages easier to understand
Especially with PIPEWIRE_LOG_LINE=false, those messages are too
confusing otherwise.
2021-10-14 07:51:27 +00:00
Peter Hutterer
6c156cdbb4 media-session: move the media-session config files to here 2021-10-14 07:51:27 +00:00
Peter Hutterer
3560f3ba2d media-session: add MEDIA_SESSION_CONFIG_DIR as lookup location
Use this to override the default $PIPEWIRE_CONFIG_DIR/media-session.d
directory. This allows us to have separate configuration directories for
pipewire and media-session.
2021-10-14 07:51:27 +00:00
Peter Hutterer
4ec2a6b320 modules: fix a property fetch
Leftover from an earlier version where get() was what is now called
fetch().

Fixes d8d7e90ceb21dac3723fa3c3fd3c2983afe1372
2021-10-14 06:32:20 +10:00
Wim Taymans
64d6ff4184 modules: flush and reset state in paused
So that we don't end up with previous data when we resume.

See #1660
2021-10-13 18:37:02 +02:00
Wim Taymans
6e818480c1 filter-chain: implement convoler_reset
To reset the state of the convolver.
2021-10-13 18:36:20 +02:00
Wim Taymans
0d1f7be0e9 context: the max quantum is never scaled with samplerate
Or else we could end up with a quantum > 8192 when we have a higher
samplerate than the default and we crash.

See #1702
2021-10-13 17:11:28 +02:00
Wim Taymans
058cecee7e pulse-server: remove some pw_log_info debug 2021-10-13 15:44:38 +02:00
Wim Taymans
f1c29194a8 pulse-server: improve lookup of default source and sink
Make things work then there is no default input device and the default
source is actually the monitor of the default sink.

Also implement lookups of monitor sources with the monitor id as the
name.

Fixes #1691
2021-10-13 15:39:41 +02:00
Wim Taymans
1b09640b6f pulse-server: use find_device for get_info of a device
So that we also go through the same logic for finding the default
source and sink when needed.
2021-10-13 15:38:59 +02:00
Peter Hutterer
027dd25980 pipewire: declare pw_proxy_ref/unref
Both are already SPA_EXPORT but missing from the public header file.
2021-10-13 09:13:12 +00:00
Wim Taymans
d8540cc596 impl-node: always deactivate node in suspend
pause_node() will check the IDLE state of the node and will not
deactivate the node when suspending when it was already IDLE.

Fixes an issue where node.pause-on-idle=false filters would not want to
resume after a suspend.
2021-10-13 10:54:45 +02:00
Wim Taymans
e77a0e8dc4 impl-node: start always need activate_node 2021-10-13 10:51:24 +02:00
Wim Taymans
e0974122ce impl-node: rename pending to pending_state for clarity 2021-10-13 10:50:41 +02:00
Peter Hutterer
eabd00e012 properties: log a warning if the property type differs
If we try to fetch a property as some specific type and the parsing
fails, log a warning. This should catch any client bugs where the
properties are set wrongly.
2021-10-13 07:12:00 +00:00
Peter Hutterer
32fb369b66 modules: switch more modules to the new property helpers 2021-10-13 07:12:00 +00:00
Peter Hutterer
c59ede837d pipewire: switch to new property helpers 2021-10-13 07:12:00 +00:00
Peter Hutterer
56bc3508c4 module-rt{kit}: replace get_default_int with the new property helper 2021-10-13 07:12:00 +00:00
Peter Hutterer
1d8d7e90ce modules: switch a few modules to the new property helpers 2021-10-13 07:12:00 +00:00
Peter Hutterer
d8de1cb255 modules: switch to new property helpers 2021-10-13 07:12:00 +00:00
Peter Hutterer
12c5a9b7ea media-session: switch to new property helpers 2021-10-13 07:12:00 +00:00
Peter Hutterer
0028b294d0 properties: add type-specific pw_properties_get helpers
Two method calls to get properties,
- pw_properties_fetch_$type()
- pw_properties_get_$type()

The former allows for easy error checking and conditional setting of
properties. The latter for easy fetching of a property with a default
value. This simplifies the code and makes property parsing behave more
consistently across the code base.

Before:
   str = pw_properties_get(props, "foo");
   if (str)
	myval = pw_properties_parse_int(props, str);
	if (myval == 0) /* parsing error or a valid zero */
	    do_stuff(myval);

Now:
   if (pw_properties_fetch_int32(props, "foo", &myval) == 0)
	do_stuff(myval);
2021-10-13 07:12:00 +00:00
Peter Hutterer
696a4b22e9 module-rt{kit}: use spa_atoi32 instead of custom strtol
And duplicate the function into rtkit which had a similar but different
approach to it. Let's get both to do the same here.
2021-10-13 07:12:00 +00:00
Peter Hutterer
87a1e1534c daemon: let meson handle the uninstalled media-session path
If we build media-session before the daemon we have the executable
variable available and can rely on meson to fill in the path instead of
handling it manually.
2021-10-13 07:09:13 +00:00
Peter Hutterer
c81dcae683 media-session: rename the executable variable name in meson.build
Makes it more obvious to access the result from other meson.build
files.
2021-10-13 07:09:13 +00:00
Peter Hutterer
f4516e6745 media-session: decouple config from the pipewire daemon config
There are only two values we care about that are identical, we can
re-set those in a new configuration_data() object.

All the other values set by the pipewire daemon are related to how we
start the session manager which isn't applicable here.
2021-10-13 07:09:13 +00:00
Wim Taymans
a5c64ffa3b impl-node: deactivate node in destroy
When pause-on-idle is false, the node can be destroyed without ever
being deactivated, which would crash. Make sure we deactivate in destroy
and remove the node from the graph.
2021-10-12 12:07:18 +02:00
Peter Hutterer
12379a9a3c pipewire: fix error message if the DBus library load failed
If the handle is NULL, we'd print out the strerror with res at whatever
value it currently has, leading to confusion.
2021-10-12 09:45:33 +10:00
Wim Taymans
9afb832d22 pulse-server: find the sink when doing monitor source lookup
When we do a lookup of a source with the monitor flag bits set in the
id, strip off the monitor bits se we can find the associated sink.

Fixes #1677
2021-10-11 17:02:13 +02:00
Wim Taymans
38981a4c8c filter-chain: biquad fequency is half the samplerate
See #1699
2021-10-11 16:07:13 +02:00
Wim Taymans
85d5c8cd6c cpu: add zero_denormals method
Add a method to enable/disable the denormals flush-to-zero and
denormals-as-zero CPU options.

Add a config option to make it possible to disable this again.

Fixes high CPU usage when dealing with denormals, which can happen
in many DSP functions.

Fixes #1681
2021-10-11 14:57:02 +02:00
Wim Taymans
036371c48f media-session: fix aux channels links
AUX channels can link to any other channel but when AUX channels are
linked, they must match exactly.

Fixes some issues with split devices with aux channels.
2021-10-11 11:35:29 +02:00
Pauli Virtanen
4b831021fb bluez5: add a dummy AVRCP player as a workaround
Some devices (Bose Mini Soundlink II, Air 1 Plus, ...) don't enable
AVRCP volume control, or fail to enable it before a hardware button is
pressed.  However, these devices appear to enable it, if an AVRCP player
is present.

As a workaround, register a dummy AVRCP player for each adapter. It only
displays the current transport acquisition state as playing/stopped, but
just its presence appears to be enough to make devices behave.

Multiple AVRCP players interfere with each other, as BlueZ uses the one
registered earliest as the default player. So add also a config option
for disabling this. (It's not common to have mpris-proxy etc. running,
so defaulting to true should be OK.)

See pipewire#1157
2021-10-10 16:24:41 +03:00