解码器如何确定H264解码中Single NAL Unit的大小

How does a decoder determines the size of Single NAL Unit in H264 decoding

如 RFC 6184 https://www.rfc-editor.org/rfc/rfc6184#section-5.6 第 5.6 节所述,单个 NAL 单元数据包只能包含一个 NAL 单元。

我的问题是现在接收端的解码器如何识别此单个 NAL 单元的大小或知道单个 NAL 单元数据包中 NAL 单元的结尾。

然而,在 STAP 等其他打包模式中,NAL 单元的大小作为 RTP 有效载荷的一部分存在。

My question is how does an decoder now at the receiving end identifies the size of this Single NAL unit or knows end of NAL unit in the Single NAL unit packet.

OS/socket API 告诉您收到的 UDP (RTP) 数据包的大小。在 TCP 流式传输的情况下,RTP 数据包的大小通常附加在 RTP 数据包之前(都在 RTSP and RFC4571 中)。 处理完 RTP header, the payload is the NAL unit in single nal unit mode.

虽然典型的 RTP header 是 12 字节,您应该根据 RFC3550 解析它,因为大小取决于 CSRC 和 RTP header 扩展。

在 STAP 的情况下,您需要知道大小,因为单个 RTP 数据包中有多个 NALU。因此,您必须通过读取大小来解析每个。