[gnome-remote-desktop] rdp-pipewire-stream: Skip corrupted buffers



commit 3faecb431b47a35a3bc96d01cc777e0f0853fe44
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Thu Jul 21 21:32:07 2022 +0200

    rdp-pipewire-stream: Skip corrupted buffers
    
    With [0] mutter now also sends additional header data for each SPA
    buffer.
    This header contains a flag field, where mutter can specify, that a SPA
    buffer is corrupted.
    This flag is necessary, as queued PipeWire buffers, which wrap around
    SPA buffers, MUST be queued again, after dequeuing them.
    So, if setting the data in the SPA buffer fails, the buffer MUST be
    ignored.
    
    So, look for the header data in each SPA buffer. If available, and the
    SPA_META_HEADER_FLAG_CORRUPTED flag is set, skip the buffer, instead of
    trying to process it.
    
    [0]: https://gitlab.gnome.org/GNOME/mutter/-/commit/30b5229e0eeb5117fe3061cfcc1d1e59c199f4d9

 src/grd-rdp-pipewire-stream.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c
index 88a465da..1e16a09b 100644
--- a/src/grd-rdp-pipewire-stream.c
+++ b/src/grd-rdp-pipewire-stream.c
@@ -843,6 +843,18 @@ on_stream_process (void *user_data)
 
   while ((next_buffer = pw_stream_dequeue_buffer (stream->pipewire_stream)))
     {
+      struct spa_meta_header *spa_meta_header;
+
+      spa_meta_header = spa_buffer_find_meta_data (next_buffer->buffer,
+                                                   SPA_META_Header,
+                                                   sizeof (struct spa_meta_header));
+      if (spa_meta_header &&
+          spa_meta_header->flags & SPA_META_HEADER_FLAG_CORRUPTED)
+        {
+          pw_stream_queue_buffer (stream->pipewire_stream, next_buffer);
+          continue;
+        }
+
       if (grd_pipewire_buffer_has_pointer_bitmap (next_buffer))
         {
           if (last_pointer_buffer == last_frame_buffer)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]