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