Skip to content

Commit

Permalink
Revert "perf: use dmabuf if possible"
Browse files Browse the repository at this point in the history
This reverts commit 8cb96a0.

Dmabuf path is never crossed due to videoflip.
  • Loading branch information
SeaDve committed Jul 23, 2024
1 parent df07762 commit b9f8315
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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])?;
Expand All @@ -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")
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit b9f8315

Please sign in to comment.