From 2b4ec75bc54347dfbbf438a6330a21b985fa4348 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 4 Jan 2024 11:39:31 +0200 Subject: [PATCH] rtpbin2: Add support for receiving rtcp-mux packets Part-of: --- net/rtp/src/rtpbin2/imp.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/rtp/src/rtpbin2/imp.rs b/net/rtp/src/rtpbin2/imp.rs index 041d0aac..c9e0aa6b 100644 --- a/net/rtp/src/rtpbin2/imp.rs +++ b/net/rtp/src/rtpbin2/imp.rs @@ -639,7 +639,15 @@ impl RtpBin2 { let rtp = match rtp_types::RtpPacket::parse(&mapped) { Ok(rtp) => rtp, Err(e) => { - // TODO: handle if it's a valid rtcp-muxed RTCP packet + // If this is a valid RTCP packet then it was muxed with the RTP stream and can be + // handled just fine. + if rtcp_types::Compound::parse(&mapped).map_or(false, |mut rtcp| { + rtcp.next().map_or(false, |rtcp| rtcp.is_ok()) + }) { + drop(mapped); + return Self::rtcp_recv_sink_chain(self, id, buffer); + } + gst::error!(CAT, imp: self, "Failed to parse input as valid rtp packet: {e:?}"); return Ok(gst::FlowSuccess::Ok); }