From b9f8315b4270c269fe134b67a5b04928fb54056d Mon Sep 17 00:00:00 2001 From: Dave Patrick Caberto Date: Tue, 23 Jul 2024 08:41:37 +0800 Subject: [PATCH] Revert "perf: use dmabuf if possible" This reverts commit 8cb96a0968af756179ac9f681c706886ab5e33f5. Dmabuf path is never crossed due to videoflip. --- src/pipeline.rs | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/src/pipeline.rs b/src/pipeline.rs index 22557890..1a628cdc 100644 --- a/src/pipeline.rs +++ b/src/pipeline.rs @@ -269,11 +269,9 @@ pub fn make_videosrc_bin( let videorate_capsfilter = gst::ElementFactory::make("capsfilter") .property( "caps", - &optional_dmabuf_feature_caps( - gst::Structure::builder("video/x-raw") - .field("framerate", framerate) - .build(), - ), + gst::Caps::builder("video/x-raw") + .field("framerate", framerate) + .build(), ) .build()?; bin.add_many([&videorate, &videorate_capsfilter])?; @@ -297,10 +295,7 @@ pub fn make_videosrc_bin( let pipewiresrc = make_pipewiresrc(fd, &stream.node_id().to_string())?; let videoflip = make_videoflip()?; bin.add_many([&pipewiresrc, &videoflip])?; - pipewiresrc.link_filtered( - &videoflip, - &optional_dmabuf_feature_caps(gst::Structure::builder("video/x-raw").build()), - )?; + pipewiresrc.link(&videoflip)?; let compositor_sink_pad = compositor .request_pad_simple("sink_%u") @@ -415,23 +410,6 @@ fn make_audiosrc_bin<'a>( Ok(bin) } -/// Creates a caps with the given structure and adds the same structure but with `memory:DMABuf` feature. -fn optional_dmabuf_feature_caps(original: gst::Structure) -> gst::Caps { - let dmabuf_feature = gst::CapsFeatures::new(["memory:DMABuf"]); - - let with_dma_drm_format = { - let mut s = original.clone(); - s.set("format", "DMA_DRM"); - s - }; - - gst::Caps::builder_full() - .structure_with_features(with_dma_drm_format, dmabuf_feature.clone()) - .structure_with_features(original.clone(), dmabuf_feature) - .structure(original) - .build() -} - fn round_to_even(number: i32) -> i32 { number / 2 * 2 }