From b1a45b527a5e35c7682a6931825cc0f396174c68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 11 Apr 2024 01:27:28 +0100 Subject: [PATCH] rtph264depay: minor refactoring of FU handling code Make code easier to follow, and prepare for next commit. Part-of: --- .../gst-plugins-good/gst/rtp/gstrtph264depay.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtph264depay.c b/subprojects/gst-plugins-good/gst/rtp/gstrtph264depay.c index e1697bd62d..10b12cee6f 100644 --- a/subprojects/gst-plugins-good/gst/rtp/gstrtph264depay.c +++ b/subprojects/gst-plugins-good/gst/rtp/gstrtph264depay.c @@ -1344,18 +1344,19 @@ gst_rtp_h264_depay_process (GstRTPBaseDepayload * depayload, GstRTPBuffer * rtp) /* reconstruct NAL header */ nal_header = (payload[0] & 0xe0) | (payload[1] & 0x1f); - /* strip type header, keep FU header, we'll reuse it to reconstruct - * the NAL header. */ - payload += 1; - payload_len -= 1; + /* Strip type header, FU header */ + payload += 2; + payload_len -= 2; - nalu_size = payload_len; + nalu_size = 1 + payload_len; outsize = nalu_size + sizeof (sync_bytes); outbuf = gst_buffer_new_and_alloc (outsize); + /* Sync_bytes or nalu_length will be set later once NALU is complete. + * Need to reconstruct NALU header from type header and FU header. */ gst_buffer_map (outbuf, &map, GST_MAP_WRITE); - memcpy (map.data + sizeof (sync_bytes), payload, nalu_size); map.data[sizeof (sync_bytes)] = nal_header; + memcpy (map.data + sizeof (sync_bytes) + 1, payload, payload_len); gst_buffer_unmap (outbuf, &map); gst_rtp_copy_video_meta (rtph264depay, outbuf, rtp->buffer);