RTP in WebRTC
WebRTC中的RTP
WebRTC uses the RTP protocol described in RFC3550 for transporting audio and video. Media is encrypted using SRTP.
WebRTC使用RFC3550中描述的RTP协议来传输音频和视频。媒体使用SRTP进行加密。
Allocation of payload types
有效载荷类型的分配
RTP packets have a payload type field that describes which media codec can be used to handle a packet. For some (older) codecs like PCMU the payload type is assigned statically as described in RFC3551. For others, it is assigned dynamically through the SDP. Note: there are no guarantees on the stability of a payload type assignment.
RTP分组具有有效载荷类型字段,该字段描述可以使用哪个媒体编解码器来处理分组。对于一些(较旧的)编解码器,如PCMU,有效载荷类型是静态分配的,如RFC3551中所述。对于其他情况,它是通过SDP动态分配的。注意:不能保证有效载荷类型分配的稳定性。
For this allocation, the range from 96 to 127 is used. When this range is exhausted, the allocation falls back to the range from 35 to 63 as permitted by section 5.1 of RFC3550. Note that older versions of WebRTC failed to recognize payload types in the lower range. Newer codecs (such as flexfec-03 and AV1) will by default be allocated in that range.
对于这种分配,使用从96到127的范围。当这个范围用完时,分配回落到RFC3550第5.1节允许的35到63的范围。请注意,旧版本的WebRTC无法识别较低范围内的有效负载类型。默认情况下,较新的编解码器(如flexfec-03和AV1)将在该范围内分配。
Payload types in the range 64 to 95 are not used to avoid confusion with RTCP as described in RFC5761.
范围64到95中的有效载荷类型不用于避免与RFC5761中描述的RTCP混淆。
Allocation of audio payload types
音频有效载荷类型的分配
Audio payload types are assigned from a table by the PayloadTypeMapper class. New audio codecs should be allocated in the lower dynamic range [35,63], starting at 63, to reduce collisions with payload types
音频有效载荷类型是由PayloadTypeMapper类从表中分配的。新的音频编解码器应从63开始在较低的动态范围[35,63]中分配,以减少与有效载荷类型的冲突
Allocation of video payload types
视频有效载荷类型的分配
Video payload types are allocated by the GetPayloadTypesAndDefaultCodecs method. The set of codecs depends on the platform, in particular for H264 codecs and their different profiles. Payload numbers are assigned ascending from 96 for video codecs and their associated retransmission format. Some codecs like flexfec-03 and AV1 are assigned to the lower range [35,63] for reasons explained above. When the upper range [96,127] is exhausted, payload types are assigned to the lower range [35,63], starting at 35.
视频有效载荷类型由GetPayloadTypesAndDefaultCodecs方法分配。编解码器的集合取决于平台,特别是H264编解码器及其不同的配置文件。为视频编解码器及其相关联的重传格式分配从96开始递增的有效载荷编号。由于上述原因,一些编解码器如flexfec-03和AV1被分配到较低范围[35,63]。当上量程[96,127]耗尽时,有效载荷类型分配给下量程[35,63],从35开始。
Handling of payload type collisions
有效载荷类型碰撞的处理
Due to the requirement that payload types must be uniquely identifiable when using BUNDLE collisions between the assignments of the audio and video payload types may arise. These are resolved by the UsedPayloadTypes class which will reassign payload type numbers descending from 127.
由于要求在使用BUNDLE时有效载荷类型必须是唯一可识别的,音频和视频有效载荷类型的分配之间可能会发生冲突。这些问题由UsedPayloadTypes类解决,该类将重新分配从127开始递减的有效载荷类型编号。