rtpav1depay: Implement srcpad set_caps

Without this auto-pluggers such as decodebin or parsebin will be unable to
process AV1 RTP payloads.

Tested with: `videotestsrc num-buffers=50 ! videoconvert ! av1enc ! av1parse ! rtpav1pay ! queue ! decodebin3 ! videoconvert ! queue ! autovideosink`

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1034>
This commit is contained in:
Philippe Normand 2023-01-03 16:07:20 +00:00 committed by Sebastian Dröge
parent af9d9c0a5c
commit 0fd63ece7d

View file

@ -8,6 +8,7 @@
// SPDX-License-Identifier: MPL-2.0
use gst::{glib, subclass::prelude::*};
use gst_rtp::prelude::*;
use gst_rtp::subclass::prelude::*;
use std::{
cmp::Ordering,
@ -142,6 +143,15 @@ impl ElementImpl for RTPAv1Depay {
}
impl RTPBaseDepayloadImpl for RTPAv1Depay {
fn set_caps(&self, _caps: &gst::Caps) -> Result<(), gst::LoggableError> {
let element = self.obj();
let src_pad = element.src_pad();
let src_caps = src_pad.pad_template_caps();
src_pad.push_event(gst::event::Caps::builder(&src_caps).build());
Ok(())
}
fn handle_event(&self, event: gst::Event) -> bool {
match event.view() {
gst::EventView::Eos(_) | gst::EventView::FlushStop(_) => {
@ -445,7 +455,6 @@ impl RTPAv1Depay {
#[rustfmt::skip]
mod tests {
use super::*;
use gst_rtp::prelude::*;
use std::io::Cursor;
#[test]