Commit graph

4489 commits

Author SHA1 Message Date
Wim Taymans
1e6615f79d pulse: use the EnumFormat param to set reasonable defaults
Before the node is started, we don't get a Format parameters and we
don't know the channelmap of the node. This forces us to invent a
channelmap that might be wrong. We can do better by using the
EnumFormat param to extract some defaults for the format, rate and
channelmap. Fixes wrong channels in gnome-control-center when testing
speakers.
2020-09-18 11:06:06 +02:00
Wim Taymans
644a35a559 pulse: fallback when default sink/source not set
When we ask for the default sink/source and it is not set,
take the highest priority sink/source as the default.
2020-09-17 20:12:25 +02:00
Wim Taymans
a01cf5eeda pulse: add missing format 2020-09-17 20:10:57 +02:00
Wim Taymans
023281fd0b pulse: parse and fill up the array of formats
A sink and source can have an array of pa_format_info structures
that contain the possible formats of the device. Parse them from
the EnumFormat and return them when introspecting.
2020-09-17 16:34:18 +02:00
Wim Taymans
8406ad8a4e pulse: small cleanup 2020-09-17 16:33:38 +02:00
Wim Taymans
1f9b0c75b7 pulse: always use the default pulse channel map
This causes the least surprises when the channelmap is not
propagated correctly from pipewire.
2020-09-17 12:37:57 +02:00
Wim Taymans
8ee07c3c66 policy-node: always boost default node priority
Make sure the default node as the highest priority.
Fixes a problem with default nodes not being selected when their
priority happens to be too low (bluetooth devices)
2020-09-17 12:35:33 +02:00
Wim Taymans
688041b083 pulse: fix drain
The drain operation does not complete with a sync from the server but
with an event from the stream. Set a flag in the operation that it
completes with a sync. Keep all operations without a sync around in
the list.
2020-09-17 11:48:21 +02:00
Wim Taymans
a9c0435317 loop: don't recursively flush
If we are already in the loop thread and flushing, this means we
added a new invoke item on the list from a callback. Place the
item on the queue and let the flush code take care of it after the
callback completes.

Required to fix some issues with draining in pulse where a stream
is destroyed from the drained callback which then invokes a pause.
2020-09-17 11:46:55 +02:00
Wim Taymans
e9fd38512e node: improve debug 2020-09-17 10:34:42 +02:00
Wim Taymans
8b168935ee a2dp-sink: don't overwrite duration in clock
We should not modify the duration field in the clock, it is set by
the host and contains the desired quantum.

See #297
2020-09-17 10:31:35 +02:00
Wim Taymans
aea9d4fdfe a2dp: remove unused threshold field 2020-09-17 10:31:08 +02:00
Frédéric Danis
7c84b1251d bluez5: backend-hsphfpd: Fix transport release on disconnection
Release transport when endpoint connection property is updated to false.
This also checks if the transport is already created when receiving
endpoint properties update to prevent multiple transport creation.
2020-09-16 16:20:54 +00:00
Wim Taymans
51b6c2cbd7 context: handle the fallback node correctly
A passive node can still be the fallback node. It becomes non-passive
if there is a node assigned to it.
This makes the Dummy node work again in the case of jack clients
that always need to be scheduled.
2020-09-16 18:11:16 +02:00
Wim Taymans
1bf6dead10 alsa: add option to force a samplerate 2020-09-16 15:14:26 +02:00
Wim Taymans
e5f7e040dc loop: simplify before and after events
Because the signal can't be removed from the callback we can
simply iterate backwards and then forwards.

The first added hook (the unlock/lock pair) is called last before
going into the poll and first when leaving. This executes all other
callbacks inside a locked situation. And removing them with the lock
is not going to cause problems.
2020-09-16 13:31:47 +02:00
Wim Taymans
854d019343 pipewire: improve get_prgname() 2020-09-16 12:19:33 +02:00
Wim Taymans
581d4521fd pulse: clean up build file 2020-09-16 12:19:13 +02:00
Wim Taymans
6e77791c8e node: Use the work queue to cancel old operations
Keep track of the last state change and cancel the previous one
if it's still busy.
2020-09-16 10:36:47 +02:00
Wim Taymans
af1cf3d87a work-queue: avoid invalid sequence numbers 2020-09-16 10:36:09 +02:00
Wim Taymans
5821f84c4b work-queue: improve debug 2020-09-16 10:21:45 +02:00
Wim Taymans
e0ce311bc0 impl-node: only complete the last pending state
If we get a complete reply from an old state change, ignore it.
2020-09-15 20:33:30 +02:00
Wim Taymans
23e7a54340 pulse: destroy context immediately
The mainloop might not run anymore to actually destroy the context.
2020-09-15 20:31:09 +02:00
Wim Taymans
05ae8a24de loop: make safe version of befor and after signal
Use a safer version of the before and after hooks. First call
all before hooks and save them in reverse order in a save list.
Then call the after event for the ones remaining in the save list
and move them back to the hook list.

This makes it possible to remove the hooks from one the callbacks or
even from other threads with the right locks. Found as a solution to
the following problem as observed in vlc:

main thread                            thread_loop

pw_thread_loop_lock()            before hook: lock suspend thread
pw_context_destroy()
  - removes before hook to flush clients
pw_thread_loop_unlock()
                                 before hook: lock acquired, resume
				 before hook: flush client hook executed
				   *crash*

pw_thread_loop_stop()
pw_thread_loop_destroy()

Any of the safer cursor methods (like spa_hook_list_call()) would also
work but are more expensive and don't reverse the before/after
order.
2020-09-15 20:13:32 +02:00
Wim Taymans
b5517cc2fe thread-loop: add some more debug 2020-09-15 18:01:51 +02:00
Wim Taymans
eaa08e209f protocol-native: remove mainloop hook only once 2020-09-15 18:00:08 +02:00
Wim Taymans
175cd43226 context: don't leak ports 2020-09-15 15:45:04 +02:00
Wim Taymans
a599e91c68 context: don't leak port info proplist 2020-09-15 14:04:57 +02:00
Wim Taymans
1a2e783a6f protocol-native: keep client around while processing
When we process the messages of a client, keep the client around
because some callback might have disconnected and tried to free
us.
2020-09-15 13:54:50 +02:00
Wim Taymans
8332d3e3ed alsa: don't change the resampler delay value
Don't change the resampler delay value, we need it to make sure
we keep samples around for the next round. With small period sizes,
we set the delay to 0 and mess up the resampler and cause dropouts
and clicking.

Fixes #287
2020-09-15 13:22:41 +02:00
Wim Taymans
f29bf9cb40 resample: reset resample state when starting
Update the initial delay and size in the rate_match io area when
starting.
2020-09-15 13:22:41 +02:00
Wim Taymans
c10feda5ce merger: follow the position duration if we can 2020-09-15 13:22:41 +02:00
Wim Taymans
8825a21e86 fmtconvert: improve channel debug names 2020-09-15 13:22:41 +02:00
Wim Taymans
e142e40cfe stream: set latency variable correctly 2020-09-15 13:22:41 +02:00
Wim Taymans
f07aa6a9fd node: only warn for slow clients
Just use debug level for other clients and warning for the ones
that are still busy.
2020-09-15 08:19:23 +02:00
Wim Taymans
2b0b44edc0 alsa: add option do use chmap from alsa, disable by default
This should be more in line with what PulseAudio does and so lead
to less surprises.

See #289
2020-09-14 20:19:44 +02:00
Wim Taymans
30dfe16c52 media-session: destroy errored links
When a link we create is in error, destroy it.
2020-09-14 20:19:44 +02:00
Simon McVittie
8dcf76f661 audioconvert tests: Default to using an installed libspa-support
This makes installed-tests (see commit b852b58f) do the right thing.
For build-time testing, spa/plugins/audioconvert/meson.build overrides
this with the SPA_PLUGIN_DIR environment variable, and for ad-hoc
testing by developers, pw-uninstalled.sh sets the necessary variables.

Signed-off-by: Simon McVittie <smcv@debian.org>
2020-09-14 18:16:49 +00:00
Siwon Kang
f7b22b934c doc: fix typos
Signed-off-by: Siwon Kang <siwon.kang@daimler.com>
2020-09-14 20:00:59 +02:00
Wim Taymans
e59c4675a7 audioconvert: send the command to the children
Send the command on the converter to all children as well.
Reset the resampler when we are paused so that we don't end up
with old data.

Fixes #288
2020-09-14 16:39:42 +02:00
Wim Taymans
310ed89aad context: match wildcards @DEFAULT_SINK/SOURCE/MONITOR@
See #291
2020-09-14 13:21:39 +02:00
Wim Taymans
67f4acaf1d pulse: try hard to always create a valid channel map
Unknown channel names are mapped to aux channels.
Add extra AUX channels when we don't know the channel layout.
This makes sure apps always receive valid channel layouts so they
don't abort (pactl).
2020-09-14 11:06:11 +02:00
Wim Taymans
320e63fe48 fmtconvert: place unknown channels at end
Sort the unknown channels to the end of the remap array.
2020-09-14 11:03:52 +02:00
Wim Taymans
f6bc9113ce gst: stop the thread loop before destroying objects
When we destroy the proxy we should either take the thread lock
or stop the thread loop because the destroy might trigger a reply
to remove the object from another thread. This can cause the
refcounting to become invalid and cause double free.

Fixes #286
2020-09-11 16:39:05 +02:00
Wim Taymans
38f8c9c6c8 pulse: always notify of available data
If we have some data available for capture, always report this
to get the lowest latency possible.
2020-09-11 15:34:30 +02:00
Wim Taymans
8f75056689 pulse: improve handling of buffer attributes
Repect minreq and fragsize for playback and capture.
Try to configure tlength at 2 seconds, minreq at around 25ms. Should
greatly improve compatibility with audacious and mpv.
Count since_underrun correctly.

Fixes #278
2020-09-11 13:08:20 +02:00
Wim Taymans
6eb4b552ad stream: unmark Not Implemented methods
_prebuf and _trigger are not implemented but should not really cause
any trouble, so just debug them without warning.
2020-09-11 11:41:29 +02:00
Wim Taymans
3b7f2c527c stream: call _done after operation callback 2020-09-11 11:40:57 +02:00
Wim Taymans
c979f181a5 jack: return useful version number (major version 3)
Also add the PipeWire string in there to give apps a chance to
report this.
2020-09-11 11:28:04 +02:00
Wim Taymans
b0c758719d 0.3.11 2020-09-10 13:13:36 +02:00