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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/2044>
This commit is contained in:
Tim-Philipp Müller 2025-01-19 19:17:31 +00:00 committed by GStreamer Marge Bot
parent cf40739da9
commit 5ccef7a453

View file

@ -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();