RFC3984中关于H.264的rtp包格式

最近开始在公司做H.264项目,需要看一些相关的RFC,摘录一些跟项目相关的

 

RFC3984
一、包装模式
      共有三种模式:1)单NAL单元模式 2)非交互模式 3)交互模式
      包装模式可以由可选的packetization-mode MIME参数指定。组包模式决定哪些NAL单元类型允许出现在RTP负载。
      如表3:
         Table 3.  Summary of allowed NAL unit types for each packetization
      mode (yes = allowed, no = disallowed, ig = ignore)

      Type   Packet    Single NAL    Non-Interleaved    Interleaved
                       Unit Mode           Mode             Mode
      -------------------------------------------------------------

      0      undefined     ig               ig               ig
      1-23   NAL unit     yes              yes               no
      24     STAP-A        no              yes               no
      25     STAP-B        no               no              yes
      26     MTAP16        no               no              yes
      27     MTAP24        no               no              yes
      28     FU-A          no              yes              yes
      29     FU-B          no               no              yes
      30-31  undefined     ig               ig               ig
     
二、包的格式     
 负载格式定义了三种不同的基本负载结构。
 1)单NAL单元包(Single NAL Unit Packet):负载中只包含单一的NAL单元。NAL头的类型等同于原始的NAL单元类型,
   也就是,1~23的范围。
   此种包必须只包含单个NAL单元,聚合包和分片单元都不能在这种包内使用。必须按解码顺序发送.
   Informative note: The first byte of a NAL unit co-serves as the
         RTP payload header.

 2)聚合包():用于聚合多个NAL单元为单个RTP负载。这种包存在四种版本:单时间聚合包(STAP-A),单时间聚合包(STAP-B),
     多时间聚合包(MTAP)带16位偏移(MTAP16),多时间聚合包(MTAP)带24位偏移(MTAP24).
     NAL类型号分配给STAP-A,STAP-B,MTAP16和MTAP24分别为24,25,26,27
 3)分片包:用于分割单一的NAL单元为多个RTP包,共有两个版本,FU-A和FU-B. 它们的NAL类型号分别为28,29.
      分片的原因是为了传输大于64KB的NAL单元。
      分片针对单个NAL单元,而不是聚合包。
      FU不能嵌套。
      FU的时戳设置为被分片NAL单元的NALU时间
      FU-A包括一个字节的FU indicator+一个字节的FU header+FU payload
     
      FU-B比FU-A多了一个字节的decoding order number(DON).
          FU-B必须只被用在交叉包装模式下NAL分片的第一片。换句话说,
          在交叉包装模式,每个NALU被分片为FU-B+FU-A+FU-A+...+FU-A
       FU indicator格式如下图:Type = 28(FU-A), 29(FU-B)、 F=0、NRI设为同NALU的NRI
        +---------------+
        |0|1|2|3|4|5|6|7|
        +-+-+-+-+-+-+-+-+
        |F|NRI|  Type   |
        +---------------+
       FU header格式如下图:第一分片S=1,E=0,R=0,Type=NALU的实际Type
             中间分片S=0,E=0,R=0,Type=NALU的实际Type
             最后分片S=0,E=1,R=0,Type=NALU的实际Type
             分片的NAL单元不可以在单个FU中传输,也就是Start bit和End bit不可以同时为0
               +---------------+
               |0|1|2|3|4|5|6|7|
               +-+-+-+-+-+-+-+-+
               |S|E|R|  Type   |
                +---------------+
        如果一个分片单元丢失了,接收者应丢弃之后收到的所属NALU的所有分片。
       
       
      Type   Packet    Type name                        Section
      ---------------------------------------------------------
      0      undefined                                    -
      1-23   NAL unit  Single NAL unit packet per H.264   5.6
      24     STAP-A    Single-time aggregation packet     5.7.1
      25     STAP-B    Single-time aggregation packet     5.7.1
      26     MTAP16    Multi-time aggregation packet      5.7.2
      27     MTAP24    Multi-time aggregation packet      5.7.2
      28     FU-A      Fragmentation unit                 5.8
      29     FU-B      Fragmentation unit                 5.8
      30-31  undefined   
     
      Table 1.  Summary of NAL unit types and their payload structures     
       
                                                    
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |F|NRI|  type   |                                               |
      +-+-+-+-+-+-+-+-+                                               |
      |                                                               |
      |               Bytes 2..n of a Single NAL unit                 |
      |                                                               |
      |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                               :...OPTIONAL RTP padding        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Figure 2.  RTP payload format for single NAL unit packet
     
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | FU indicator  |   FU header   |                               |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
      |                                                               |
      |                         FU payload                            |
      |                                                               |
      |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                               :...OPTIONAL RTP padding        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Figure 14.  RTP payload format for FU-A
        
       0                   1                   2                   3
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      | FU indicator  |   FU header   |               DON             |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-|
      |                                                               |
      |                         FU payload                            |
      |                                                               |
      |                               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |                               :...OPTIONAL RTP padding        |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

      Figure 15.  RTP payload format for FU-B
 
      
      注意:由于UDP的限制,任何包的大小不应超过65535
     
          
     

     
     
     
     


     

    

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值