From ded7b8dfba0bfca35e3a5f919424865ad6a235ad Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Sat, 3 Dec 2022 19:15:19 -0300 Subject: [PATCH] screen-cast/src: Clean up DMA-BUF only error paths When a stream source subclass asks for a DMA-BUF only frame record, it is legitimate to return FALSE in do_record_frame() - meaning that a frame was not recorded - but not return an error - meaning nothing actually failed. This avoids spamming the journal with warnings on a legitimate case. Part-of: --- src/backends/meta-screen-cast-stream-src.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c index 21427c3bd..6c071236a 100644 --- a/src/backends/meta-screen-cast-stream-src.c +++ b/src/backends/meta-screen-cast-stream-src.c @@ -516,6 +516,9 @@ do_record_frame (MetaScreenCastStreamSrc *src, gboolean dmabuf_only; dmabuf_only = flags & META_SCREEN_CAST_RECORD_FLAG_DMABUF_ONLY; + if (dmabuf_only && spa_buffer->datas[0].type != SPA_DATA_DmaBuf) + return FALSE; + if (!dmabuf_only && (spa_buffer->datas[0].data || spa_buffer->datas[0].type == SPA_DATA_MemFd)) @@ -818,7 +821,8 @@ meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStr } else { - g_warning ("Failed to record screen cast frame: %s", error->message); + if (error) + g_warning ("Failed to record screen cast frame: %s", error->message); spa_buffer->datas[0].chunk->size = 0; spa_buffer->datas[0].chunk->flags = SPA_CHUNK_FLAG_CORRUPTED; }