From 17e61256c591e4cfe51641d1f1c416fd321a9914 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 21 Apr 2026 20:16:19 +0100 Subject: [PATCH] gst: skip invalid crop metadata in pipewiresrc META_VideoCrop is present on every buffer negotiated through the adapter, even when the producer never sets a meaningful crop region. Before commit c634ef961, gst_buffer_get_video_crop_meta returned NULL on new GstBuffers so the zero values were never applied. After that commit, gst_buffer_add_video_crop_meta always succeeds, and an invalid crop produces black frames. Without this, the following produces black frames, Producer: gst-launch-1.0 videotestsrc is-live=true ! \ video/x-raw,format=I420,width=1280,height=720,framerate=24/1 ! \ pipewiresink mode=provide \ stream-properties="properties,media.class=Video/Source,media.role=Camera" \ client-name=VirtualCam Consumer: gst-launch-1.0 pipewiresrc path= ! videoconvert ! autovideosink --- src/gst/gstpipewiresrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 3c57028b4..fa61b5ea6 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -781,7 +781,7 @@ static GstBuffer *dequeue_buffer(GstPipeWireSrc *pwsrc) } crop = data->crop; - if (crop) { + if (crop && spa_meta_region_is_valid(crop)) { GstVideoCropMeta *meta = gst_buffer_add_video_crop_meta(buf); if (meta) { meta->x = crop->region.position.x;