Commit graph

7898 commits

Author SHA1 Message Date
Wim Taymans 0fd5e3fdb2 libcamera: implement allocation and dataflow
Keep track of the negotiated parameters and use those to construct
the Buffers param.

Use the FrameAllocator to allocate buffer memory. Keep a request for
each buffer and queue them.

In requestComplete, put the request metadata info into the buffer and
header and write the finished buffer id to a ringbuffer. Then wake up
the data thread to pop the finished buffer_id and push it in the
graph.

Remove some old files.
2021-11-03 17:49:10 +01:00
Wim Taymans b2c38a2b3b libcamera: work on rewrite
Use manager to hotplug devices
Use StreamConfig to enumerate formats
2021-11-03 17:49:10 +01:00
Wim Taymans b0e3e43c42 pw-mon: destroy proxies in global_remove event
Keep track of the proxies and remove them when the global is removed.
Otherwise we might end up in a case where the have 2 proxies when
an add/remove/add sequence of messages was queued.
2021-11-03 17:25:11 +01:00
Wim Taymans f70fdf5605 pulse-server: also remove creating objects
When an object is created, it is marked creating until all roundtrips
complete. If the object is removed in between, we don't remove it
because find_object does not return creating objects.

Make find_object also return the creating objects to fix this.
2021-11-03 16:57:41 +01:00
Wim Taymans 73bf30efa6 module-zeroconf: translate audio format
The audio format in the avahi messages is in pulseaudio format so
translate it to PipeWire format in audio.format.

See #1745
2021-11-03 12:54:58 +01:00
Wim Taymans 84ecebbd4e cpu: only run SSE code when supported
Check if we can run SSE instructions before executing the denormals
SSE code.

Fixes #1775
2021-11-02 20:12:35 +01:00
Thomas Weißschuh 7d9b49293c core: add runtime fallback for nonpresent getrandom() sycall
The current compile-time-check only tests for the getrandom() syscall
wrapper of libc. The presence of this wrapper however does not relate to
the presence of the actual syscall at runtime.
2021-11-02 17:55:24 +01:00
Wim Taymans 25ddf0e3cf alsa-plugin: fix a compiler warnings 2021-11-02 17:18:58 +01:00
Martin Geier 1b96142903 alsa: do not ignore rate change when stream is already created
gstreamer alsasink can change sample while stream is already created.
In that case, gstreamer calls snd_pcm_ioplug_callback_t::stop,
snd_pcm_ioplug_callback_t::hw_params and snd_pcm_ioplug_callback_t::prepare

Add new flag to the snd_pcm_pipewire_t that is set every time
snd_pcm_pipewire_hw_params is called to prevent using stream with old
sample rate

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2021-11-02 15:37:07 +00:00
Martin Geier a7d238ed59 alsa: increase precision of delay function
pw->time.delay is delay in number of frames in pw->time.rate domain,
however snd_pcm_pipewire_delay function is suppose to return number of
frames in io->rate domain. Convert pw->time.delay to io->rate domain to
increase precision when the io->rate is not equal to the pw->time.rate

snd_pcm_pipewire_delay should return how many frames are queued in
pipewire, pw_stream_get_time returns numbers of the queued frames before
snd_pcm_pipewire_process is called, however this function inserts (or
removes) some frames from pipewire. Therefore newly inserted (removed)
frames should be added to pw->time.delay to increase precision.

Signed-off-by: Martin Geier <martin.geier@streamunlimited.com>
2021-11-02 15:37:07 +00:00
Aleix Pol 925644fbcc spa/meta: Expand the documentation of SPA_META_VideoDamage
A bit of explanation of how it's meant to be used.
2021-11-02 15:53:16 +01:00
Wim Taymans 859e95126b alsa-seq; use port_type to check port type
Don't use the capabilities for checking the port type.
2021-11-02 14:57:36 +01:00
Thomas Weißschuh 4921c5e94b defs: use intptr types where applicaple
Instead of doing pointer arithmetic through actual pointers, cast them
to the proper integer types.
This is functionally equivalent to the previous code but is clearer for
the compiler.

Fixes #1018
2021-11-02 09:54:10 +00:00
Pauli Virtanen bbc2136e89 meson: ensure all examples are included in doc
Move declaration of examples to use same file lists for build and docs.
2021-11-02 09:46:14 +00:00
Wim Taymans 6ebd589659 alsa-plugin: _prepare will clear the draining state
Leave the draining state when _prepare is done.

See #1467
2021-11-02 10:17:31 +01:00
Wim Taymans 9fee88239a pipewire-v4l2: only compile V4L2_BUF_CAP_SUPPORTS* when defined
Fixes #1766
2021-11-02 09:43:59 +01:00
Wim Taymans 3c8a60944f pipewire: handle NULL plugin_dir
We can't load plugins when the plugin directory is unspecified, either
in config.h or with SPA_PLUGING_DIR in the environment.

Fixes #1774
2021-11-02 09:18:42 +01:00
Wim Taymans 9f134ee79d v4l2: add support for ParamBegin/End
To keep the device open while we perform a series of param
enumerations.
2021-10-29 15:41:27 +02:00
Wim Taymans 9facfca45b jack: add option to disable monitor ports
Add a jack.show-monitor option (default true) that makes it possible
to hide the monitor ports.

Monitor ports are not enabled by default on JACK and maybe they also
should not for PipeWire. Or maybe we need some tweaks for some apps.

See #1760
2021-10-29 09:27:46 +02:00
Wim Taymans 0ace131d72 audioconvert: add stereo deinterleave neon asm
This can take some shortcuts and convert twice as many samples in one
iteration as the strided stereo deinterleave one.
2021-10-28 11:30:04 +02:00
Peter Hutterer 6fab8fabca meson: add a libv4l2-path option to match libjack-path
pw-v4l2 uses the gnu ld's ${LIB} features, see meson.build.
Make it possible to work around this by specifying an explicit path,
just like for pw-jac.

Fixes #1751
2021-10-28 07:38:02 +00:00
Wim Taymans f39f9b207b map: don't mix insert_at() and _remove()
You are supposed to allocate with _insert_new()/_remove() or use
someone elses allocated number with _insert_at(), never mix the
two or it will give an error.
2021-10-28 09:36:41 +02:00
Simon McVittie f6b1d65e35 core: Use /dev/urandom for getrandom fallback
Sami Farin pointed out on #833 that on Linux kernels older than 5.6,
/dev/random blocks when entropy estimates are too low, whereas
/dev/urandom does not.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-28 07:15:50 +00:00
Wim Taymans 3509962f3a module-session-manager: don't leak the impl structure
We need to remove the listener for the object as well so that we
can safely free the impl memory.
2021-10-27 17:41:32 +02:00
Wim Taymans 2112a7287b tests: add new ABI test for stream 2021-10-27 11:31:39 +02:00
Wim Taymans a84e43e3ee examples: update some examples with RequestProcess
Let video-src unconditionally call _trigger_process() when it is
ready. This will either start the graph when it is the driver or emit
a RequestProcess event to the driver.

Let video-play-pull intercept the RequestProcess command and use it
to do a trigger_process(). Otherwise use a timer to pull in the next
frame.
2021-10-27 11:20:06 +02:00
Wim Taymans baca092ba5 stream: emit the RequestProcess event
Emit the RequestProcess event when pw_stream_trigger_process() was
called but we are not the driver node.

Fixes #1728
2021-10-27 11:19:56 +02:00
Wim Taymans b5080a0395 node: dispatch RequestProcess event and command
The event is send to the driver node.
The command is sent to node directly.
2021-10-27 11:16:53 +02:00
Wim Taymans 3471391e0e spa: add RequestProcess command and event
The event is emitted by a node that is not a driver but wants the graph
to be scheduled. The command is sent to the driver and suggest that the
graph be scheduled.
2021-10-27 11:16:53 +02:00
Wim Taymans 7529e7c47c stream: add trigger_done event
It is emited after the graph cycle that was started with
trigger_process() completed.
2021-10-27 11:15:29 +02:00
Wim Taymans 0982c903eb fix example a little 2021-10-27 11:09:24 +02:00
columbarius 110aac8c6f examples: video-play-fixate announce ParamBuffer after fixation
This lets the fixation finish. Can this be made unneeded?
2021-10-27 11:09:24 +02:00
columbarius 9f34885174 examples: Create source and sink with fixation on format negotiation
This commit uses the video-src-alloc and video-play-reneg templates to create
examples for manual fixation at the format negotiation phase. These
clients simulate modifier negotiation done by clients handling DmaBufs.

Note: Neither client is capable of proper DmaBuf handling!

video-play-fixate can be used to test if a producer is capable to
fallback to shm buffer transport, while video-src-fixate can only be
used with the former example!
2021-10-27 11:09:24 +02:00
Wim Taymans 0568958856 impl-link: keep on negotiatiating until fixed Format
Send unfixed Format to nodes but don't proceed to the next state.
When EnumFormat is emited, change the link state back to INIT to restart
the negotiation.

Fixes #1732
2021-10-27 11:09:07 +02:00
Tom Briden 6cea8b201b meson: Allow session-managers option to be an absolute path
If it's not an absolute_path, then set the build_ms and build_wp
as normal, otherwise use the value as passed in.
2021-10-27 08:27:53 +00:00
Simon McVittie e167123667 Reinstate compatibility with older Linux with no getrandom()
Commit 42d8b2b1 "Remove legacy FreeBSD compatibility code" removed
compatibility with old versions of FreeBSD, but also removed
compatibility with old versions of Linux and glibc, which was requested
in #833.

This partially reverts commit 42d8b2b167.

Resolves: #833
Signed-off-by: Simon McVittie <smcv@collabora.com>
2021-10-26 19:32:02 +01:00
Wim Taymans 31f387868a jack: reorganize jack_port_get_buffer()
Dequeue a new buffer only once and reuse this queued buffer when
jack_port_get_buffer() is called multiple times in process().

Recycle an old buffer in the next cycle.

After calling process, mark all input buffers as consumed, process the
empty buffers and move the output buffers to the mix ports.

Fixes #1748
2021-10-26 12:28:31 +02:00
Wim Taymans 6f75b1433c jack: add some more debug 2021-10-26 12:10:15 +02:00
Wim Taymans a2f06be199 pulse-server: Improve combine sink properties
Make streams and sink have the same description so that they show
up as the same node in catia.
2021-10-26 10:50:28 +02:00
Wim Taymans 33653cbabf protocol-pulse: flush streams on pause
To remove any lingering data
2021-10-26 10:49:50 +02:00
Wim Taymans ba18768246 impl-link: both ports need to be negotiated before we can allocate
Fix allocation check. Both ports need to be at least negotiated before
we can attempt to allocate buffers.
2021-10-26 10:13:21 +02:00
Peter Hutterer cd3bd825c1 ci: add a job to build with the minimum required meson version
We can't build the session managers though, both require higher meson
versions than us.
2021-10-26 06:28:30 +00:00
Peter Hutterer cc38f8cc79 ci: add a job to build with the latest meson prerelease
This avoids us running into possible regressions in meson, see
https://nibblestew.blogspot.com/2021/10/a-call-for-more-downstream-testing-of.html
2021-10-26 06:28:30 +00:00
Peter Hutterer 9acee530e2 meson: switch to "foo in array" style for meson arrays
In Meson, string.contains() is a substring check but array.contains() is
a full string check. Let's use 'foo in bar' style instead to avoid
confusion.

Supported since meson 0.49.0
2021-10-26 06:22:20 +00:00
Peter Hutterer 07c5511aed test: handle chdir errors correctly
When we get to this code, we already updated the environment variables
so we need to use the usual error path to restore them.

And where chdir does fail, print an error to the log. 256 chars should
be enough here, if your tmpdir exceeds that you just have the error
message cut off.
2021-10-26 11:15:35 +10:00
Peter Hutterer cf3c0431c3 test: fix tmpdir value after setenv
Introduced in a2856c6e0f

set_test_env() modifies TMPDIR so we must not use getenv until after
that call.

Fixes #1736
2021-10-26 11:15:34 +10:00
Wim Taymans c4d5c01429 impl-link: check port state before allocating
At least one port needs to be ready to do allocation.
2021-10-25 18:13:47 +02:00
Wim Taymans f9a45a8b84 impl-link: improve debug 2021-10-25 18:12:24 +02:00
Wim Taymans f7eafe1404 stream: use user param field to track param changes
count the number of changes and then when there are any, flip the
SERIAL bit in the param info so that the server can detect a
change. Without this, 2 updated params would not flip the bit and the
param changes would not be noticed.
2021-10-25 18:08:58 +02:00
Wim Taymans eea6e7a1fb spa: add method to check if an object is fixated
See #1732
2021-10-25 18:08:10 +02:00