Occasionally gst_app_sink_pull_sample returns sample with width and height set but an empty buffer
Version, Distribution, Desktop Environment:
> pipewire --version pipewire Compiled with libpipewire 0.3.24 Linked with libpipewire 0.3.24
on Arch Linux, GNOME with Wayland.
Description of Problem:
Using pipewiresrc with gstreamer and connecting it to an appsink
gst_app_sink_pull_sample sometimes returns a sample that has it's caps set and reports width and height properties normally but the buffer belonging to the sample is empty.
Interestingly this only seems to happen when I move my mouse around and only if a window, not the whole desktop is selected. Additionally the cursor_mode has to be set to 2 (=Embedded) or 4 (=Metadata), otherwise with mode 1 (=Hidden) this does not happen.
Steps to Reproduce:
The following code was used to trigger this behavior: https://git.sr.ht/~hmh/pipewire_gst_bugs/tree/be6aca38edb30107f1a33f06efc390ec154370f2
gst_sample_get_buffer returns buffer with size set to 0.
According to the docs
gst_sample_get_buffer should not return an empty buffer but NULL if there is no data.