in an aggregation unit. Please see below for the four different
aggregation units and their characteristics.
The structure of the RTP payload format for aggregation packets is
presented in Figure 3.
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 | |
+-+-+-+-+-+-+-+-+ |
| |
| one or more aggregation units |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :...OPTIONAL RTP padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 3. RTP payload format for aggregation packets
MTAPs and STAPs share the following packetization rules: The RTP
timestamp MUST be set to the earliest of the NALU times of all the
NAL units to be aggregated. The type field of the NAL unit type
octet MUST be set to the appropriate value, as indicated in Table 4.
The F bit MUST be cleared if all F bits of the aggregated NAL units
are zero; otherwise, it MUST be set. The value of NRI MUST be the
maximum of all the NAL units carried in the aggregation packet.
Table 4. Type field for STAPs and MTAPs
Type Packet Timestamp offset DON related fields
field length (DON, DONB, DOND)
(in bits) present
--------------------------------------------------------
24 STAP-A 0 no
25 STAP-B 0 yes
26 MTAP16 16 yes
27 MTAP24 24 yes
The marker bit in the RTP header is set to the value that the marker
bit of the last NAL unit of the aggregated packet would have if it
were transported in its own RTP packet.
The payload of an aggregation packet consists of one or more
aggregation units. See sections 5.7.1 and 5.7.2 for the four
different types of aggregation units. An aggregation packet can
carry as many aggregation units as necessary; however, the total
amount of data in an aggregation packet obviously MUST fit into an IP
packet, and the size SHOULD be chosen so that the resulting IP packet
is smaller than the MTU size. An aggregation packet MUST NOT contain
fragmentation units specified in section 5.8. Aggregation packets
MUST NOT be nested; i.e., an aggregation packet MUST NOT contain
another aggregation packet.
5.7.1. Single-Time Aggregation Packet
Single-time aggregation packet (STAP) SHOULD be used whenever NAL
units are aggregated that all share the same NALU-time. The payload
of an STAP-A does not include DON and consists of at least one
single-time aggregation unit, as presented in Figure 4. The payload
of an STAP-B consists of a 16-bit unsigned decoding order number
(DON) (in network byte order) followed by at least one single-time
aggregation unit, as presented in Figure 5.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: |
+-+-+-+-+-+-+-+-+ |
| |
| single-time aggregation units |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 4. Payload format for STAP-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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: decoding order number (DON) | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| |
| single-time aggregation units |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 5. Payload format for STAP-B
The DON field specifies the value of DON for the first NAL unit in an
STAP-B in transmission order. For each successive NAL unit in
appearance order in an STAP-B, the value of DON is equal to (the
value of DON of the previous NAL unit in the STAP-B + 1) % 65536, in
which ’%’ stands for the modulo operation.
A single-time aggregation unit consists of 16-bit unsigned size
information (in network byte order) that indicates the size of the
following NAL unit in bytes (excluding these two octets, but
including the NAL unit type octet of the NAL unit), followed by the
NAL unit itself, including its NAL unit type byte. A single-time
aggregation unit is byte aligned within the RTP payload, but it may
not be aligned on a 32-bit word boundary. Figure 6 presents the
structure of the single-time aggregation unit.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: NAL unit size | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| |
| NAL unit |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 6. Structure for single-time aggregation unit
Figure 7 presents an example of an RTP packet that contains an STAP-
A. The STAP contains two single-time aggregation units, labeled as 1
and 2 in the figure.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RTP Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|STAP-A NAL HDR | NALU 1 Size | NALU 1 HDR |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NALU 1 Data |
: :
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | NALU 2 Size | NALU 2 HDR |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NALU 2 Data |
: :
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :...OPTIONAL RTP padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 7. An example of an RTP packet including an STAP-A and two
single-time aggregation units
Figure 8 presents an example of an RTP packet that contains an STAP-
B. The STAP contains two single-time aggregation units, labeled as 1
and 2 in the figure.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RTP Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|STAP-B NAL HDR | DON | NALU 1 Size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NALU 1 Size | NALU 1 HDR | NALU 1 Data |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
: :
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | NALU 2 Size | NALU 2 HDR |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NALU 2 Data |
: :
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :...OPTIONAL RTP padding |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 8. An example of an RTP packet including an STAP-B and two
single-time aggregation units
5.7.2. Multi-Time Aggregation Packets (MTAPs)
The NAL unit payload of MTAPs consists of a 16-bit unsigned decoding
order number base (DONB) (in network byte order) and one or more
multi-time aggregation units, as presented in Figure 9. DONB MUST
contain the value of DON for the first NAL unit in the NAL unit
decoding order among the NAL units of the MTAP.
Informative note: The first NAL unit in the NAL unit decoding
order is not necessarily the first NAL unit in the order in which
the NAL units are encapsulated in an MTAP.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: decoding order number base | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| |
| multi-time aggregation units |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 9. NAL unit payload format for MTAPs
Two different multi-time aggregation units are defined in this
specification. Both of them consist of 16 bits unsigned size
information of the following NAL unit (in network byte order), an 8-
bit unsigned decoding order number difference (DOND), and n bits (in
network byte order) of timestamp offset (TS offset) for this NAL
unit, whereby n can be 16 or 24. The choice between the different
MTAP types (MTAP16 and MTAP24) is application dependent: the larger
the timestamp offset is, the higher the flexibility of the MTAP, but
the overhead is also higher.
The structure of the multi-time aggregation units for MTAP16 and
MTAP24 are presented in Figures 10 and 11, respectively. The
starting or ending position of an aggregation unit within a packet is
NOT REQUIRED to be on a 32-bit word boundary. The DON of the
following NAL unit is equal to (DONB + DOND) % 65536, in which %
denotes the modulo operation. This memo does not specify how the NAL
units within an MTAP are ordered, but, in most cases, NAL unit
decoding order SHOULD be used.
The timestamp offset field MUST be set to a value equal to the value
of the following formula: If the NALU-time is larger than or equal to
the RTP timestamp of the packet, then the timestamp offset equals
(the NALU-time of the NAL unit - the RTP timestamp of the packet).
If the NALU-time is smaller than the RTP timestamp of the packet,
then the timestamp offset is equal to the NALU-time + (2^32 - the RTP
timestamp of the 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: NAL unit size | DOND | TS offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TS offset | |
+-+-+-+-+-+-+-+-+ NAL unit |
| |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 10. Multi-time aggregation unit for MTAP16
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
: NALU unit size | DOND | TS offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| TS offset | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| NAL unit |
| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Figure 11. Multi-time aggregation unit for MTAP24
For the "earliest" multi-time aggregation unit in an MTAP the
timestamp offset MUST be zero. Hence, the RTP timestamp of the MTAP
itself is identical to the earliest NALU-time.
Informative note: The "earliest" multi-time aggregation unit is
the one that would have the smallest extended RTP timestamp among
all the aggregation units of an MTAP if the aggregation units were
encapsulated in single NAL unit packets. An extended timestamp is
a timestamp that has more than 32 bits and is capable of counting
the wraparound of the timestamp field, thus enabling one to
determine the smallest value if the timestamp wraps. Such an
"earliest" aggregation unit may not be the first one in the order
in which the aggregation units are encapsulated in an MTAP. The
"earliest" NAL unit need not be the same as the first NAL unit in
the NAL unit decoding order either.
Figure 12 presents an example of an RTP packet that contains a
multi-time aggregation packet of type MTAP16 that contains two
multi-time aggregation units, labeled as 1 and 2 in the figure.
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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| RTP Header |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|MTAP16 NAL HDR | decoding order number base | NALU 1 Size |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NALU 1 Size | NALU 1 DOND | NALU 1 TS offset |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NALU 1 HDR | NALU 1 DATA |
+-+-+-+-+-+-+-+-+ +
: :
+ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| | NALU 2 SIZE | NALU 2 DOND |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| NALU 2 TS offset | NALU 2 HDR | NALU 2 DATA |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |