Commit graph

1145 commits

Author SHA1 Message Date
Wim Taymans
62b882c13d acp: improve debug 2020-10-01 11:32:28 +02:00
Wim Taymans
735eefa2fb acp: pass right user_data to event 2020-10-01 11:31:52 +02:00
Wim Taymans
41db0f35b3 acp: sync with latests 2020-09-30 12:56:05 +02:00
Wim Taymans
664ecbefee loop: move debug to _fp 2020-09-30 12:01:23 +02:00
Wim Taymans
9639f32db5 v4l2: zero some structures before ioctl 2020-09-29 17:06:53 +02:00
Wim Taymans
ced338ad7d v4l2: mmap the buffer again
Some drivers need a mmaped buffer...
2020-09-29 17:06:24 +02:00
Wim Taymans
ed1ee3f164 v4l2: detect driver reusing buffers
Some drivers seem to only use 2 buffers when asked for 16 buffers. We
can see this because the buffer is already queued. In this case, just
use the 2 buffers.

See #294
2020-09-29 12:33:14 +02:00
Wim Taymans
2df10d1a40 channelmix: reset the volume if the channels changed. 2020-09-29 12:02:37 +02:00
Wim Taymans
f70d0b19af channelmix: add option to NORMALIZE volumes
Normalize the complete matrix with the same coefficient
2020-09-29 12:02:34 +02:00
Wim Taymans
700a0aa35c Fix FLC+FRC to FL+FR 2020-09-29 12:02:30 +02:00
Wim Taymans
df3394a694 add some more debug 2020-09-29 12:02:25 +02:00
Wim Taymans
08438903e5 acp: reset soft volume
When we have accurate enough hardware volume, set the software volume to
1.0. Also fixes the issue of going to 0 volume and then staying silent
until we raise the volume above 1.0.
2020-09-28 12:40:16 +02:00
Wim Taymans
479bf3c803 fmtconvert: fix debug line 2020-09-28 11:47:16 +02:00
Wim Taymans
d13181fb37 acp: prefer some other profile than Off
The Off profile is always available but we should only use it as the
ultimate fallback when all other profiles are NO.

Fixes #309
2020-09-28 11:39:09 +02:00
Wim Taymans
a97287351c acp: use flag for the Off profile 2020-09-28 11:32:36 +02:00
Wim Taymans
9f1d84e37c v4l2: in alloc buffer, don't mmap, just pass the fd
If we can't use EXPBUF, just put the fd and mapoffset in the buffer
memory. This way we can pass the fd to the client and let it mmap .
2020-09-27 17:07:29 +02:00
Wim Taymans
59990ea049 v4l2: fall back to mmap when EXPBUF fails
If EXPBUF returns and error, try to mmap instead.

Fixes #294
2020-09-27 16:30:51 +02:00
Wim Taymans
cce8f3fb08 v4l2: improve debug 2020-09-27 16:30:06 +02:00
Wim Taymans
013e94ee4e audioadapter: propagate errors from the follower 2020-09-25 18:24:04 +02:00
Wim Taymans
d2d722efb3 node: add an ASYNC flag
The flag means that the process function might not complete
synchronously.

We can use this knowledge to improve the adapter. In sync mode we
can pull before scheduling the converter. In async mode we need to
schedule the follower after the converter to get the data ready for
the next iteration.

We can also improve the stream when it is operating async to schedule
a process call when a new buffer is ready to be filled.

This reduces a cycle latency from alsa and improves latency in
pulse.
2020-09-25 17:02:54 +02:00
Wim Taymans
9dfd261c71 add some more debug info 2020-09-25 17:01:52 +02:00
Wim Taymans
584ae678c6 audioadapter: improve the processing loop
Handle the case where the converter in a source needs more output
buffers (-EPIPE). Schedule the follower in that case and try to
run the converter again until we have output or we can't make progress
anymore.

If the converter needs more data, schedule the follower before we
exit the loop with the data. This gives the follower a chance to get
more data asynchronously for the next iteration.
2020-09-24 17:18:47 +02:00
Wim Taymans
1cccaaa2bd merger: we always consume all input
Even when we only have empty input buffers
2020-09-24 16:57:15 +02:00
Wim Taymans
6bc3b1b764 audioconvert: fix Buffers param debug 2020-09-24 11:53:10 +02:00
Wim Taymans
c6358c4ed5 alsa: add and install spa-acp-tool 2020-09-23 11:37:53 +02:00
Wim Taymans
28f60eaf6f spa: install the spa-resample tool 2020-09-23 11:37:16 +02:00
Wim Taymans
66cc13cc56 acp: update properties correctly
After modifying the properties, update the exported dictionary again
because the memory might have changed.

Fixes #304
2020-09-22 12:40:21 +02:00
Wim Taymans
392eff4628 audioconvert: debug stride as well 2020-09-21 11:21:15 +02:00
Wim Taymans
7a2741c9e1 v4l2: do TRY_FMT on the filter format
Do a TRY_FMT on the filter format before enumerating the sizes with it
because some drivers don't check the format anymore.

Fixes #294
2020-09-19 13:32:47 +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
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
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
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
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
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
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
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
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
d456893f31 acp-device: just always select the best port/profile for now 2020-09-09 14:12:00 +02:00
Wim Taymans
4a35fcaf09 acp: update Route and Profile param on availability change 2020-09-09 14:10:17 +02:00
Wim Taymans
6e339200af acp: improve port and profile index select
Keep 3 options, the available ports, unknown and highest priority
other ports.
2020-09-09 14:08:15 +02:00
Wim Taymans
5f38562d38 acp: remove active_port_index
It is not clear if the port index is in the card or device port array
and it doesn't work when many ports are active. So simply iterate the
device ports and find the ones with the active flag set.
2020-09-09 13:57:33 +02:00
Wim Taymans
a956c265a2 acp: also act on new available ports 2020-09-08 16:49:07 +02:00
Wim Taymans
5e368b1ad6 acp: add option to switch profile and ports
Enable an option to switch to the next best profile and port when
the current one becomes unavailable.
2020-09-08 16:39:47 +02:00