From 5ccef7a453c3d0005a976c887c2ce0a64c06e047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 19 Jan 2025 19:17:31 +0000 Subject: [PATCH] rtpac3depay2: fix handling of non-fragmented payloads The frames of a non-fragmented payload would contain an extra two bytes before the frame sync and then missing two bytes at the end which which would cause decoding errors on the last block and/or frame crc check failures. This happened because we didn't take into account the 2-byte packet payload header when creating output sub-buffers, as the offsets we were using were in relation to the payload data after the headers. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/645 Part-of: --- net/rtp/src/ac3/depay/imp.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/rtp/src/ac3/depay/imp.rs b/net/rtp/src/ac3/depay/imp.rs index cd1a95e83..75d6ec66a 100644 --- a/net/rtp/src/ac3/depay/imp.rs +++ b/net/rtp/src/ac3/depay/imp.rs @@ -346,8 +346,9 @@ impl RtpBaseDepay2Impl for RtpAc3Depay { gst::trace!(CAT, imp = self, "Getting frame @ {offset}+{frame_len}"); + // The packet has a 2-byte payload header that we need to skip here too let mut outbuf = - packet.payload_subbuffer_from_offset_with_length(offset, frame_len); + packet.payload_subbuffer_from_offset_with_length(2 + offset, frame_len); let outbuf_ref = outbuf.get_mut().unwrap();