• rtp包格式


    转载一篇帮助我了解h264 rtp的文档,地址http://www.cppblog.com/czanyou/archive/2009/12/25/67940.html

    当packetization-mode的值为0时或不存在时,必须使用单一NALU单元模式.
    当packetization-mode的值为1时必须使用非交错(non-interleaved)封包模式.
    当packetization-mode的值为2时必须使用交错(interleaved)封包模式.

    每个打包方式允许的NAL单元类型总结(yes =允许, no =不允许, ig =忽略)

    包装模式

      共有三种模式:1)单NAL单元模式 2)非交互模式 3)交互模式
      包装模式可以由可选的packetization-mode MIME参数指定。组包模式决定哪些NAL单元类型允许出现在RTP负载。

    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.  
    
    1. 聚合包:用于聚合多个NAL单元为单个RTP负载。这种包存在四种版本:单时间聚合包(STAP-A),单时间聚合包(STAP-B),多时间聚合包(MTAP)带16位偏移(MTAP16),多时间聚合包(MTAP)带24位偏移(MTAP24). NAL类型号分配给STAP-A,STAP-B,MTAP16和MTAP24分别为24,25,26,27。
    2. 分片包:用于分割单一的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
    

    rfc文档下载地址 :
    http://www.cnpaf.net/plus/search.php?keyword=rtp

    完!
    2012年4月

  • 相关阅读:
    UVA 439 Knight Moves
    UVA 673 Parentheses Balance
    UVa 536 Tree Recovery
    UVA 712 S-Trees
    UVA 12657 Boxes in a Line
    UVA 679 Dropping Balls
    UVA 1603 Square Destroyer
    UVA 1343 The Rotation Game
    UVA 1374 Power Calculus
    UVA 12558 Egyptian Fractions (HARD version)
  • 原文地址:https://www.cnblogs.com/rongpmcu/p/7662088.html
Copyright © 2020-2023  润新知