From f0824e4f28fd6ba25029a075dba9a5122a38659a Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Wed, 12 Mar 2025 09:33:13 -0300 Subject: [PATCH] base: Lower debug logging on allocation query errors This happens often and is not fatal Part-of: --- gstreamer-base/src/subclass/base_sink.rs | 2 +- gstreamer-base/src/subclass/base_transform.rs | 2 +- gstreamer/src/error.rs | 25 +++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/gstreamer-base/src/subclass/base_sink.rs b/gstreamer-base/src/subclass/base_sink.rs index ede120ad2..7fef899cf 100644 --- a/gstreamer-base/src/subclass/base_sink.rs +++ b/gstreamer-base/src/subclass/base_sink.rs @@ -572,7 +572,7 @@ unsafe extern "C" fn base_sink_propose_allocation( match imp.propose_allocation(query) { Ok(()) => true, Err(err) => { - err.log_with_imp(imp); + err.log_with_imp_and_level(imp, gst::DebugLevel::Info); false } } diff --git a/gstreamer-base/src/subclass/base_transform.rs b/gstreamer-base/src/subclass/base_transform.rs index b4e71db9d..dfcf9610e 100644 --- a/gstreamer-base/src/subclass/base_transform.rs +++ b/gstreamer-base/src/subclass/base_transform.rs @@ -1166,7 +1166,7 @@ unsafe extern "C" fn base_transform_propose_allocation( match imp.propose_allocation(decide_query, query) { Ok(()) => true, Err(err) => { - err.log_with_imp(imp); + err.log_with_imp_and_level(imp, gst::DebugLevel::Info); false } } diff --git a/gstreamer/src/error.rs b/gstreamer/src/error.rs index 74d130455..48519ea64 100644 --- a/gstreamer/src/error.rs +++ b/gstreamer/src/error.rs @@ -111,10 +111,15 @@ impl LoggableError { #[inline(never)] fn log_with_object_internal(&self, obj: &glib::Object) { + self.log_with_object_internal_and_level(obj, crate::DebugLevel::Error); + } + + #[inline(never)] + fn log_with_object_internal_and_level(&self, obj: &glib::Object, level: crate::DebugLevel) { self.bool_error.filename.run_with_gstr(|filename| { self.category.log( Some(obj), - crate::DebugLevel::Error, + level, filename, self.bool_error.function, self.bool_error.line, @@ -126,7 +131,23 @@ impl LoggableError { pub fn log_with_imp(&self, imp: &impl glib::subclass::types::ObjectSubclass) { use glib::subclass::prelude::*; - self.log_with_object_internal(unsafe { imp.obj().unsafe_cast_ref::() }); + self.log_with_object_internal_and_level( + unsafe { imp.obj().unsafe_cast_ref::() }, + crate::DebugLevel::Error, + ); + } + + pub fn log_with_imp_and_level( + &self, + imp: &impl glib::subclass::types::ObjectSubclass, + level: crate::DebugLevel, + ) { + use glib::subclass::prelude::*; + + self.log_with_object_internal_and_level( + unsafe { imp.obj().unsafe_cast_ref::() }, + level, + ); } pub fn category(&self) -> crate::DebugCategory {