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
     
          
     

     
     
     
     


     

    

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章