Skip to content

Commit

Permalink
Actually fix caps negotiation issue (I hope)
Browse files Browse the repository at this point in the history
It seems to be some sort of race condition/flakiness with nvh264dec.
  • Loading branch information
valadaptive committed Nov 2, 2024
1 parent 3a77cce commit 6599522
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
8 changes: 8 additions & 0 deletions crates/gui/src/gst_utils/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,13 @@ pub fn initialize_gstreamer() -> Result<(), GstreamerError> {
sink.set_rank(gstreamer::Rank::NONE);
}

// nvh264dec is flaky and seemingly creates spurious caps events with memory:CUDAMemory late in the caps negotiation
// progress, causing caps negotiation to fail (see
// https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2644). This doesn't occur all the time and points to
// some sort of race condition.
if let Some(dec) = gstreamer::ElementFactory::find("nvh264dec") {
dec.set_rank(gstreamer::Rank::NONE);
}

Ok(())
}
9 changes: 4 additions & 5 deletions crates/gui/src/gst_utils/ntsc_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,9 @@ impl NtscPipeline {
gstreamer_video::VideoOrientationMethod::Auto,
)
.build()?;*/
let video_rate = gstreamer::ElementFactory::make("videorate")
.name("video_rate")
.build()?;

let video_scale = gstreamer::ElementFactory::make("videoscale")
.name("video_scale")
Expand All @@ -261,10 +264,6 @@ impl NtscPipeline {
let caps_filter = gstreamer::ElementFactory::make("capsfilter")
.name("caps_filter")
.build()?;

let video_rate = gstreamer::ElementFactory::make("videorate")
.name("video_rate")
.build()?;
let framerate_caps_filter =
gstreamer::ElementFactory::make("capsfilter")
.name("framerate_caps_filter")
Expand All @@ -274,9 +273,9 @@ impl NtscPipeline {
&video_queue,
//&video_flip,
&video_convert,
&video_rate,
&video_scale,
&caps_filter,
&video_rate,
&framerate_caps_filter,
];
pipeline.add_many(video_elements)?;
Expand Down

0 comments on commit 6599522

Please sign in to comment.