onvifmetadatapay: Set output caps earlier

As soon as input caps arrive, we can set output
caps. This means upstream can send gap events earlier,
before there is any actual metadata to send

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1779>
This commit is contained in:
Jan Schmidt 2024-09-17 21:54:14 +10:00
parent 6a23ae168f
commit 7905626a5f

View file

@ -4,6 +4,14 @@ use gst_rtp::prelude::*;
use gst_rtp::subclass::prelude::*; use gst_rtp::subclass::prelude::*;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
static CAT: Lazy<gst::DebugCategory> = Lazy::new(|| {
gst::DebugCategory::new(
"rtponvifmetadatapay",
gst::DebugColorFlags::empty(),
Some("RTP ONVIF metadata payloader"),
)
});
#[derive(Default)] #[derive(Default)]
pub struct OnvifMetadataPay {} pub struct OnvifMetadataPay {}
@ -186,7 +194,8 @@ impl RTPBasePayloadImpl for OnvifMetadataPay {
fn set_caps(&self, _caps: &gst::Caps) -> Result<(), gst::LoggableError> { fn set_caps(&self, _caps: &gst::Caps) -> Result<(), gst::LoggableError> {
self.obj() self.obj()
.set_options("application", true, "VND.ONVIF.METADATA", 90000); .set_options("application", true, "VND.ONVIF.METADATA", 90000);
self.obj()
Ok(()) .set_outcaps(None)
.map_err(|_| gst::loggable_error!(CAT, "Failed to set output caps"))
} }
} }