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.
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.
Keep separate map for fd to files so we can implement dup.
Filter out duplicates in enumfmt.
tryfmt should return the closest match.
Use pthread_once to init the global state.
Make things mostly work in GStreamer.
Add support for more formats.
Connect in the reqbufs ioctl so that we can negotiate the right amount
of buffers.
Keep file and buffer maps so that we can map an address to a file and
then the address to a buffer of that file. We can then also check if the
buffers were unmapped properly.
Implement some more ioctls.
Add some more checks.
Collect all video/source nodes and enumerate their formats. We use this
to return the supported formats and to check if a format is supported.
Use evenfd as the even we return from open. Make the eventfd readable
when we have a new buffer ready.
Connect a stream when setting a format. Collect buffers. Implement
mmap/munmap on the buffer memory. Implement queue and dequeue of buffers.
This is enough to make the webcam test work in firefox.
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.
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
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.
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.
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);
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.
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.