Commit graph

10650 commits

Author SHA1 Message Date
Ashok Sidipotu
e75fe4d469 adapter-control: add support of scale volume ramp param 2023-04-03 19:04:55 +00:00
Ashok Sidipotu
8bfafaeca2 audioconvert: add support of volume ramp scale parameter
- Add support for Linear and Cubic volume scales
- Also start treating a "zero" value of volume ramp parameters as invalid
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
7b91d506f1 adapter-control: add support for volume ramp time params
- Add support for both native and non-native modes
- Add "examples" in the help text
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
b0f6c4a8c0 audioconvert: add support for volume ramp time params 2023-04-03 19:04:55 +00:00
Ashok Sidipotu
075fd49ccc adapter-control: add CLI options
-To select between non-native(via control channel) and native modes(via audio
adapter ). The control port will be opened only in the non-native mode.
-To select different sample and sample step sizes. The Legacy non-native
 mode also uses these params now.
-To provide the alsa device.
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
b1b5367d40 adapter-control: use the volume ramp parameters to ramp volume
Add a compiler macro for now to switch between the inband(control port based)
volume ramping and out of band(using volume ramp parameters)
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
40cf237eb3 audioconvert: add volume ramp parameters
Add volume ramp parameters and the add ramp up and down funtions which get
triggered on volume change.
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
3b1ce6c268 audioconvert: parameterize channelmix_process_control() function
Decouple the function from control port and parameterize it, so that it can be
called any spa pod sequence.
2023-04-03 19:04:55 +00:00
Ashok Sidipotu
2a12dfeb47 adapter-control: add more debug messages 2023-04-03 19:04:55 +00:00
Ashok Sidipotu
3ed282fad5 adapter-control: enable SPA debug logs
Also add timestamp to the logs.
2023-04-03 19:04:55 +00:00
Pauli Virtanen
6db234ad0c bluez5: media-sink: use iso-io for BAP
Use the ISO IO helpers to get synchronized BAP output, and rate match to
the ISO schedule.

The rate matching is necessary, since the driver may be ticking at a
corrected rate, different from the ISO interval rate.
2023-04-03 16:35:22 +00:00
Pauli Virtanen
cec050ac25 bluez5: add spa_bt_iso_io that does the low-level part for ISO
Add factored out helper for ISO socket I/O.

ISO sockets need synchronization of writes and audio position for
different stream fds in the same isochronous group, and it's easier to
separate out the part that coordinates it.
2023-04-03 16:35:22 +00:00
Pauli Virtanen
0ed124f0fb bluez5: add rate matching for BAP to media-sink
Add basics for rate matching.
2023-04-03 16:35:22 +00:00
Pauli Virtanen
41c155bb4c bluez5: split rate control out of decode-buffer 2023-04-03 16:35:22 +00:00
Pauli Virtanen
e0939ff8ab bluez5: don't set bluez timeout on transport release
Setting bluez timeout on transport release makes codec switches delayed,
and is not necessary.
2023-04-03 16:35:22 +00:00
Pauli Virtanen
c0d55eae86 bluez5: use release timeout for all transport types
Avoiding unnecessary release + reacquire when nodes restart makes sense
for all transport types.  Do timed releases for all transport types, not
only SCO.
2023-04-03 16:35:22 +00:00
Wim Taymans
35d2bce24b context: also follow link-groups
Nodes from the same link-group also need to be linked together to the
same driver.
2023-04-03 16:59:17 +02:00
Wim Taymans
147674c5dd Revert "context: handle link-group nodes"
This reverts commit 2bfe772bb4.

This does not take into account nodes recursively becomming runnable and
so does not set the runnable state on all nodes correctly, like for
combine-stream.

Revert for now, it probably requires a new algorithm to make this work.

See #3128
2023-04-03 10:25:58 +02:00
Wim Taymans
0873c6942a stream: don't crash when _set_control is given 0 values 2023-03-31 11:28:55 +02:00
Wim Taymans
bed961a4b2 keys: update comment 2023-03-31 10:33:20 +02:00
Wim Taymans
9485b2819a impl-node: add support for node.force-rate=0
If you set node.force-rate=0, the rate will be forced to the node.rate
denominator.

This makes it possible to autiomatically make the graph switch to the
native rate of the stream by setting this as the default property on
streams.

See #3026
2023-03-31 10:30:36 +02:00
Arun Raghavan
3dc08c09d1 volume: Fix inverted check for buffer validity 2023-03-31 08:19:07 +00:00
Wim Taymans
7372a078b4 context: don't try to restore rate on !runnable nodes
There is no point in trying to restore a node to the default rate when
it's not going to run.

This avoids loops when rate switching from one forced rate to another.
2023-03-31 10:14:36 +02:00
Wim Taymans
108715ebfb alsa: add tsched use to info log
Fixes !1580
2023-03-30 17:50:35 +02:00
Wim Taymans
917d865ea8 stream: invoke RequestProcess in the main loop
pw_stream_trigger_process() can be called from any thread but the
RequestProcess event always needs to be scheduled in the main-loop.
2023-03-30 16:39:32 +02:00
Wim Taymans
7da61e2dfa examples: fix adapter control
target_rate and duration need to be configured now.

Fixes #3125
2023-03-30 15:15:41 +02:00
Wim Taymans
d3bd687bc2 buffers: add new ASYNC flag
Make sure we allocate at least 2 buffers when we are dealing with an
ASYNC node. This ensures that an adapter without a converter will at
least negotiate to 2 buffers when the follower stream is async (such as
is the case with pw-cat).
2023-03-30 15:03:29 +02:00
Wim Taymans
b3940627dd audioconvert: pass the NODE_ASYNC flag correctly
Pass the follower async flag correctly in the adapter.
2023-03-30 15:03:29 +02:00
Wim Taymans
4fb17d1c03 audioadapter: clear rate matching when not using converter
Ensure that we clear the rate matching when we are not using the
converter. This will make the follower use the quantum instead of the
dummy unused rate matching area.

Exit when we can't make an internal converter because then things really
are not going to work. Remove some of the pointless NULL checks.
2023-03-30 15:03:29 +02:00
Wim Taymans
a163f29a43 improve logging 2023-03-30 15:03:21 +02:00
Wim Taymans
7bddb80c93 pulse-server: improve Buffer param
We need to be able to fill up one quantum of data when the stream
requests it so suggest a quantum_limit buffer size. Normally, the
converter will further improve the buffer size parameters when
resampling is involved but this is a good default for when working in
passthrough mode.

We don't actually use the stream buffering features so we're happy with
just 1 or 2 buffers.
2023-03-30 10:13:43 +02:00
Wim Taymans
495a227e5e jack: don't call callbacks when deactivating
Set the active state to false right when we start deactivate to make
sure that we don't call any callbacks anymore during shutdown.

One of the callbacks that might be called is the bufsize of samplerate
change callbacks when the node is moved to the dummy driver and this
might deadlock any app that doesn't expect this.

Fixes #2781
2023-03-29 16:18:26 +02:00
Wim Taymans
5ae73fccdd alsa: only update alsa sources when added to the data loop 2023-03-29 15:31:21 +02:00
Wim Taymans
b16b80601d alsa: start playback right away in IRQ mode 2023-03-29 15:13:00 +02:00
Wim Taymans
354836075d alsa: setup sources from the data thread
For IRQ based scheduling we might otherwise be woken up after we only
added one of the fds to the poll loop and then we get an error when we
try to update it afterwards. Instead, add the fds from the data thread
to get things nicely in sync.
2023-03-29 12:21:23 +02:00
Wim Taymans
8c264d2dcb alsa: in IRQ mode, disable sources while we wait
In IRQ mode, disable the ALSA fds while we wait for the graph to produce
data. Otherwise we will wake up very quickly over and over.

When we get more data, we activate the sources again to start the next
cycle.
2023-03-29 11:30:40 +02:00
Wim Taymans
dc5aa21c87 alsa-pcm: use full period size in IRQ mode
We can simply wake up every period and check the timers there is no need
to tweak the period size.
2023-03-29 11:29:43 +02:00
Wim Taymans
aa0d9c5b41 alsa: add disable-tsched to params 2023-03-28 18:27:53 +02:00
Arun Raghavan
26e37b6575 alsa: Implement period-based wakeups
Provides configuration to disable timer-based scheduling. This can be
useful at low latencies, for example, where period-based interrupts
might be more reliable than timers.
2023-03-28 16:22:53 +00:00
Wim Taymans
f28c30d526 impl-link: only make passive links with suspendable peers
Only make a passive link when one of the peers is passive and the other
one can be suspended or when both are explicitly passive.

This avoid making passive links between a sink/source pair.

It also avoid making passive links between two streams if they are not
explicitly marked as passive.

It does allow making passive links between a passive stream and a
sink/source or between two passive streams.
2023-03-28 18:14:19 +02:00
Wim Taymans
c84ef9e29a Revert "impl-link: make passive link if both ports are passive"
This reverts commit 6a64b4461e.

Now that sinks and sources are no longer passive by default, we need
just one part of the link to be passive to make things passive.

This breaks the stream recording from a passive stream case but we can
find a different fix for that later.
2023-03-28 17:32:02 +02:00
Wim Taymans
0f27432f8c Revert "impl-node: assume Sink/Source nodes are passive"
This reverts commit 67999f0f9c.

This breaks direct links between two devices because all ports are
passive. This needs some more thinking.
2023-03-28 17:32:02 +02:00
Harri Nieminen
4323a8ad4a module-pipe-tunnel: remove extra whitespace 2023-03-28 13:36:16 +00:00
Wim Taymans
2bfe772bb4 context: handle link-group nodes
Nodes with the same link-group should be added to the same driver.

Also the runnable state of the nodes in the same link group is
shared between eachother. This makes it look like the linked nodes are
really just one big node.

With this change we correctly calculate the state of all nodes and we
can then only set the running state on the runnable nodes.

If you have 2 loopback sinks in front of a driver, this change will
only make the used loopback sink running and keep the other one
idle. It also works for grouped nodes, where only the active nodes
will now be running (such as rtp-session nodes).
2023-03-28 15:19:16 +02:00
Wim Taymans
93e6e98a17 module-link-factory: ignore link.passive by default
Make an option to allow link.passive properties and set it to false by
default.

This effectively ignores the link.passive properties from the session
manager, jack clients and pw-link when set. This is a good idea because
the logic for making passive links is better handled in the core.
2023-03-28 15:19:16 +02:00
Wim Taymans
67999f0f9c impl-node: assume Sink/Source nodes are passive
If not otherwise stated, assume the Sink and Source nodes
are passive.
2023-03-28 15:18:50 +02:00
Wim Taymans
6a64b4461e impl-link: make passive link if both ports are passive
Only make a passive link when both ports are passive.
Otherwise, adding a monitor stream on the loopback output stream will
make a passive link.
2023-03-28 11:58:32 +02:00
Wim Taymans
c8bfa69320 context: init flags before starting recalculate
Init the node flags before recalculating the graph state. There is no
reason to do this later.
2023-03-28 11:52:36 +02:00
Wim Taymans
8fca3808d8 impl-node: only update the trigger node state once
Don't increment the required activation count every time we change the
node prorties with a TRIGGER property. Only increment/decrement when the
value actually changed.
2023-03-28 09:48:21 +02:00
Wim Taymans
08642adddc module-rtp: free the avahi client as well 2023-03-27 16:01:50 +02:00