From 2bf8409565dfc6fc70900fb509a65bff26ca9076 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 9 Sep 2024 14:35:10 +0300 Subject: [PATCH] uriplaylistbin: Properly clean up the pipeline on panics/assertions too Reduces log noise. Part-of: --- utils/uriplaylistbin/tests/uriplaylistbin.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/utils/uriplaylistbin/tests/uriplaylistbin.rs b/utils/uriplaylistbin/tests/uriplaylistbin.rs index 4d6c5648e..49d136ebe 100644 --- a/utils/uriplaylistbin/tests/uriplaylistbin.rs +++ b/utils/uriplaylistbin/tests/uriplaylistbin.rs @@ -78,6 +78,22 @@ struct IterationsChange { iterations: u32, } +struct Pipeline(gst::Pipeline); + +impl std::ops::Deref for Pipeline { + type Target = gst::Pipeline; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl Drop for Pipeline { + fn drop(&mut self) { + let _ = self.0.set_state(gst::State::Null); + } +} + fn test( medias: Vec, n_streams: u32, @@ -93,7 +109,7 @@ fn test( let uris: Vec = medias.iter().map(|t| t.uri.clone()).collect(); - let pipeline = gst::Pipeline::default(); + let pipeline = Pipeline(gst::Pipeline::default()); let playlist = gst::ElementFactory::make("uriplaylistbin") .property("uris", &uris) .property("iterations", iterations)