RFC 4352 - RTP Payload Format for the Extended Adaptive Mult(2)

时间:2006-11-02 来源: 作者: 点击:
end-to-enddelayandsetshigherbufferingrequirements.Therefore, interleavingisnotappropriateforallusecasesordevices. Streamingapplicationsshouldmostlikelybeabletoexploit interleavingtoimproveaudioqualit
  
   end-to-end delay and sets higher buffering requirements.  Therefore,
   interleaving is not appropriate for all use cases or devices.
   Streaming applications should most likely be able to exploit
   interleaving to improve audio quality in lossy transmission
   conditions.

   Note that this payload design supports the use of frame interleaving
   as an option.  The usage of this feature needs to be negotiated in
   the session setup.

   The interleaving supported by this format is rather flexible.  For
   example, a continuous pattern can be defined, as depicted in Figure
   2.

   --+--------+--------+--------+--------+--------+--------+--------+--
     | f(n-2) | f(n-1) |  f(n)  | f(n+1) | f(n+2) | f(n+3) | f(n+4) |
   --+--------+--------+--------+--------+--------+--------+--------+--

              [ P(n)   ]
     [ P(n+1) ]                 [ P(n+1) ]
                       [ P(n+2) ]                 [ P(n+2) ]
                                         [ P(n+3) ]                 [P(
                                                           [ P(n+4) ]

   Figure 2: An example of interleaving pattern that has constant delay

   In Figure 2 the consecutive frames, denoted f(n-2) to f(n+4), are
   aggregated into packets P(n) to P(n+4), each packet carrying two
   frames.  This approach provides an interleaving pattern that allows
   for constant delay in both the interleaving and deinterleaving
   processes.  The deinterleaving buffer needs to have room for at least
   three frames, including the one that is ready to be consumed.  The
   storage space for three frames is needed, for example, when f(n) is
   the next frame to be decoded: since frame f(n) was received in packet
   P(n+2), which also carried frame f(n+3), both these frames are stored
   in the buffer.  Furthermore, frame f(n+1) received in the previous
   packet, P(n+1), is also in the deinterleaving buffer.  Note also that
   in this example the buffer occupancy varies: when frame f(n+1) is the
   next one to be decoded, there are only two frames, f(n+1) and f(n+3),
   in the buffer.

3.7.  AMR-WB+ Audio over IP Scenarios

   Since the primary target application for the AMR-WB+ codec is
   streaming over packet networks, the most relevant usage scenario for
   this payload format is IP end-to-end between a server and a terminal,
   as shown in Figure 3.

              +----------+                          +----------+
              |          |    IP/UDP/RTP/AMR-WB+    |          |
              |  SERVER  |<------------------------>| TERMINAL |
              |          |                          |          |
              +----------+                          +----------+

               Figure 3: Server to terminal IP scenario

3.8.  Out-of-Band Signaling

   Some of the options of this payload format remain constant throughout
   a session.  Therefore, they can be controlled/negotiated at the
   session setup.  Throughout this specification, these options and
   variables are denoted as "parameters to be established through out-

   of-band means".  In Section 7, all the parameters are formally
   specified in the form of media type registration for the AMR-WB+
   encoding.  The method used to signal these parameters at session
   setup or to arrange prior agreement of the participants is beyond the
   scope of this document; however, Section 7.2 provides a mapping of
   the parameters into the Session Description Protocol (SDP) [6] for
   those applications that use SDP.

4.  RTP Payload Format for AMR-WB+

   The main emphasis in the payload design for AMR-WB+ has been to
   minimize the overhead in typical use cases, while providing full
   flexibility with a slightly higher overhead.  In order to keep the
   specification reasonably simple, we refrained from defining frame-
   specific parameters for each frame type.  Instead, a few common
   parameters were specified that cover all types of frames.

   The payload format has two modes: basic mode and interleaved mode.
   The main structural difference between the two modes is the extension
   of the table of content entries with frame displacement fields when
   operating in the interleaved mode.  The basic mode supports
   aggregation of multiple consecutive frames in a payload.  The
   interleaved mode supports aggregation of multiple frames that are
   non-consecutive in time.  In both modes it is possible to have frames
   encoded with different frame types in the same payload.  The ISF must
   remain constant throughout the payload of a single packet.

   The payload format is designed around the property of AMR-WB+ frames
   that the frames are consecutive in time and share the same frame
   duration (in the absence of an ISF change).  This enables the
   receiver to derive the timestamp for an individual frame within a
   payload.  In basic mode, the deriving process is based on the order
   of frames.  In interleaved mode, it is based on the compact
   displacement fields.  The frame timestamps are used to regenerate the
   correct order of frames after reception, identify duplicates, and
   detect lost frames that require concealment.

   The interleaving scheme of this payload format is significantly more
   flexible than the one specified in RFC 3267.  The AMR and AMR-WB
   payload format is only capable of using periodic patterns with frames
   taken from an interleaving group at fixed intervals.  The
   interleaving scheme of this specification, in contrast, allows for
   any interleaving pattern, as long as the distance in decoding order
   between any two adjacent frames is not more than 256 frames.  Note
   that even at the highest ISF this allows an interleaving depth of up
   to 3.41 seconds.

   To allow for error resiliency through redundant transmission, the
   periods covered by multiple packets MAY overlap in time.  A receiver
   MUST be prepared to receive any audio frame multiple times.  All
   redundantly sent frames MUST use the same frame type and ISF, and
   MUST have the same RTP timestamp, or MUST be a NO_DATA frame (FT=15).

   The payload consists of octet-aligned elements (header, ToC, and
   audio frames).  Only the audio frames for AMR-WB frame types (0-9)
   require padding for octet alignment.  If additional padding is
   desired, then the P bit in the RTP header MAY be set, and padding MAY
   be appended as specified in [3].

4.1.  RTP Header Usage

   The format of the RTP header is specified in [3].  This payload
   format uses the fields of the header in a manner consistent with that
   specification.

   The RTP timestamp corresponds to the sampling instant of the first
   sample encoded for the first frame in the packet.  The timestamp
   clock frequency SHALL be 72000 Hz.  This frequency allows the frame
   duration to be integer RTP timestamp ticks for the ISFs specified in
   Table 1.  It also provides reasonable conversion factors to the
   input/output audio sampling frequencies supported by the codec.  See
   Section 4.3.2.3 for guidance on how to derive the RTP timestamp for
   any audio frame beyond the first one.

   The RTP header marker bit (M) SHALL be set to 1 whenever the first
   frame carried in the packet is the first frame in a talkspurt (see
   the definition of talkspurt in Section 4.1 of [9]).  For all other
   packets, the marker bit SHALL be set to zero (M=0).

   The assignment of an RTP payload type for the format defined in this
   memo is outside the scope of this document.  The RTP profile in use
   either assigns a static payload type or mandates binding the payload
   type dynamically.

   The media type parameter "channels" is used to indicate the maximum
   number of channels allowed for a given payload type.  A payload type
   where channels=1 (mono) SHALL only carry mono content.  A payload
   type for which channels=2 has been declared MAY carry both mono and
   stereo content.  Note that this definition is different from the one
   in RFC 3551 [9].  As mentioned before, the AMR-WB+ codec handles the
   support of stereo content and the (eventual) downmixing of stereo to
   mono internally.  This makes it unnecessary to negotiate for the
   number of channels for reasons other than bit-rate efficiency.

4.2.  Payload Structure

   The payload consists of a payload header, a table of contents, and
   the audio data representing one or more audio frames.  The following
   diagram shows the general payload format layout:

   +----------------+-------------------+----------------
   | payload header | table of contents | audio data ...
   +----------------+-------------------+----------------

   Payloads containing more than one audio frame are called compound
   payloads.

   The following sections describe the variations taken by the payload
   format depending on the mode in use: basic mode or interleaved mode.

4.3.  Payload Definitions

4.3.1.  Payload Header

   The payload header carries data that is common for all frames in the
   payload.  The structure of the payload header is described below.

    0 1 2 3 4 5 6 7
   +-+-+-+-+-+-+-+-+
   |   ISF   |TFI|L|
   +-+-+-+-+-+-+-+-+

   ISF (5 bits): Indicates the Internal Sampling Frequency employed for
      all frames in this payload.  The index value corresponds to
      internal sampling frequency as specified in Table 24 in [1].  This
      field SHALL be set to 0 for payloads containing frames with Frame
      Type values 0-13.

   TFI (2 bits): Transport Frame Index, from 0 (first) to 3 (last),
      indicating the position of the first transport frame of this
      payload in the AMR-WB+ super-frame structure.  For payloads with
      frames of only Frame Type values 0-9, this field SHALL be set to 0
      by the sender.  The TFI value for a frame of type 0-9 SHALL be
      ignored by the receiver.  Note that the frame type is coded in the
      table of contents (as discussed later); hence, the mentioned
      dependencies of the frame type can be applied easily by
      interpreting only values carried in the payload header.  It is not
      necessary to interpret the audio bit stream itself.

   L (1 bit): Long displacement field flag for payloads in interleaved
      mode.  If set to 0, four-bit displacement fields are used to
      indicate interleaving offset; if set to 1, displacement fields of
      eight bits are used (see Section 4.3.2.2).  For payloads in the
      basic mode, this bit SHALL be set to 0 and SHALL be ignored by the
      receiver.

   Note that frames employing different ISF values require encapsulation
   in separate packets.  Thus, special considerations apply when
   generating interleaved packets and an ISF change is executed.  In
   particular, frames that, according to the previously used
   interleaving pattern, would be aggregated into a single packet have
   to be separated into different packets, so that the aforementioned
   condition (all frames in a packet share the ISF) remains true.  A
   naive implementation that splits the frames with different ISF into
   different packets can result in up to twice the number of RTP
   packets, when compared to an optimal interleaved solution.
   Alteration of the interleaving before and after the ISF change may
   reduce the need for extra RTP packets.

4.3.2.  The Payload Table of Contents

   The table of contents (ToC) consists of a list of entries, each entry
   corresponds to a group of audio frames carried in the payload, as
   depicted below.

   +----------------+----------------+- ... -+----------------+
   |  ToC entry #1  |  ToC entry #2  |          ToC entry #N  |
   +----------------+----------------+- ... -+----------------+

   When multiple groups of frames are present in a payload, the ToC
   entries SHALL be placed in the packet in order of increasing RTP
   timestamp value (modulo 2^32) of the first transport frame the TOC
   entry represents.

4.3.2.1.  ToC Entry in the Basic Mode

   A ToC entry of a payload in the basic mode has the following format:

    0                   1
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |F| Frame Type  |    #frames    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   F (1 bit): If set to 1, indicates that this ToC entry is followed by
      another ToC entry; if set to 0, indicates that this ToC entry is
      the last one in the ToC.

   Frame Type (FT) (7 bits): Indicates the audio codec frame type used
      for the group of frames referenced by this ToC entry.  FT
      designates the combination of AMR-WB+ core and stereo rate, one of
      the special AMR-WB+ frame types, the AMR-WB rate, or comfort
      noise, as specified by Table 25 in [1].

   #frames (8 bits): Indicates the number of frames in the group
      referenced by this ToC entry.  ToC entries with this field equal
      to 0 (which would indicate zero frames) SHALL NOT be used, and
      received packets with such a TOC entry SHALL be discarded.

4.3.2.2.  ToC Entry in the Interleaved Mode

   Two different ToC entry formats are defined in interleaved mode.
   They differ in the length of the displacement field, 4 bits or 8
   bits.  The L-bit in the payload header differentiates between the two
   modes.

   If L=0, a ToC entry has the following format:

    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| Frame Type  |    #frames    |  DIS1 |  ...  |  DISi |  ...  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  ...  |  ...  |  DISn |  Padd |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   F (1 bit): See definition in 4.3.2.1.

   Frame Type (FT) (7 bits): See definition in 4.3.2.1.

   #frames (8 bits): See definition in 4.3.2.1.

   DIS1...DISn (4 bits): A list of n (n=#frames) displacement fields
      indicating the displacement of the i:th (i=1..n) audio frame
      relative to the preceding audio frame in the payload, in units of
      frames.  The four-bit unsigned integer displacement values may be
      between 0 and 15, indicating the number of audio frames in
      decoding order between the (i-1):th and the i:th frame in the
      payload.  Note that for the first ToC entry of the payload, the
      value of DIS1 is meaningless.  It SHALL be set to zero by a sender
      and SHALL be ignored by a receiver.  This frame’s location in the
      decoding order is uniquely defined by the RTP timestamp and TFI in
      the payload header.  Note also that for subsequent ToC entries,
      DIS1 indicates the number of frames between the last frame of the
      previous group and the first frame of this group.

   Padd (4 bits): To ensure octet alignment, four padding bits SHALL be
      included at the end of the ToC entry in case there is odd number
      of frames in the group referenced by this entry.  These bits SHALL
      be set to zero and SHALL be ignored by the receiver.  If a group
      containing an even number of frames is referenced by this ToC
      entry, these padding bits SHALL NOT be included in the payload.

   If L=1, a ToC entry has the following format:

    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| Frame Type  |    #frames    |      DIS1     |      ...      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      ...      |     DISn      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   F (1 bit): See definition in 4.3.2.1.

   Frame Type (FT) (7 bits): See definition in 4.3.2.1.

   #frames (8 bits): See definition in 4.3.2.1.

   DIS1...DISn (8 bits): A list of n (n=#frames) displacement fields
      indicating the displacement of the i:th (i=1..n) audio frame
      relative to the preceding audio frame in the payload, in units of
      frames.  The eight-bit unsigned integer displacement values may be
      between 0 and 255, indicating the number of audio frames in
      decoding order between the (i-1):th and the i:th frame in the
      payload.  Note that for the first ToC entry of the payload, the
      value of DIS1 is meaningless.  It SHALL be set to zero by a sender
      and SHALL be ignored by a receiver.  This frame’s location in the
      decoding order is uniquely defined by the RTP timestamp and TFI in
      the payload header.  Note also that for subsequent ToC entries,
      DIS1 indicates the displacement between the last frame of the
      previous group and the first frame of this group.

4.3.2.3.  RTP Timestamp Derivation

   The RTP Timestamp value for a frame SHALL be the timestamp value of
   the first audio sample encoded in the frame.  The timestamp value for
   a frame is derived differently depending on the payload mode, basic
   or interleaved.  In both cases, the first frame in a compound packet
   has an RTP timestamp equal to the one received in the RTP header.  In
   the basic mode, the RTP time for any subsequent frame is derived in
   two steps.  First, the sum of the frame durations (see Table 1) of
   all the preceding frames in the payload is calculated.  Then, this
   sum is added to the RTP header timestamp value.  For example, let’s

   assume that the RTP Header timestamp value is 12345, the payload
   carries four frames, and the frame duration is 16 ms (ISF = 32 kHz)
   corresponding to 1152 timestamp ticks.  Then the RTP timestamp of the
   fourth frame in the payload is 12345 + 3 * 1152 = 15801.

   In interleaved mode, the RTP timestamp for each frame in the payload
   is derived from the RTP header timestamp and the sum of the time
   offsets of all preceding frames in this payload.  The frame
   timestamps are computed based on displacement fields and the frame
   duration derived from the ISF value.  Note that the displacement in
   time between frame i-1 and frame i is (DISi + 1) * frame duration
   because the duration of the (i-1):th must also be taken into account.
   The timestamp of the first frame of the first group of frames (TS(1))
   (i.e., the first frame of the payload) is the RTP header timestamp.
   For subsequent frames in the group, the timestamp is computed by

      TS(i) = TS(i-1) + (DISi + 1) * frame duration,    2 < i < n

   For subsequent groups of frames, the timestamp of the first frame is
   computed by

      TS(1) = TSprev + (DIS1 + 1) * frame duration,

   where TSprev denotes the timestamp of the last frame in the previous
   group.  The timestamps of the subsequent frames in the group are
   computed in the same way as for the first group.

   The following example derives the RTP timestamps for the frames in an
   interleaved mode payload having the following header and ToC
   information:

   RTP header timestamp: 12345
   ISF = 32 kHz
   Frame 1 displacement field: DIS1 = 0
   Frame 2 displacement field: DIS2 = 6
   Frame 3 displacement field: DIS3 = 4
   Frame 4 displacement field: DIS4 = 7

   Assuming an ISF of 32 kHz, which implies a frame duration of 16 ms,
   one frame lasts 1152 ticks.  The timestamp of the first frame in the
   payload is the RTP timestamp, i.e., TS(1) = RTP TS.  Note that the
   displacement field value for this frame must be ignored.  For the
   second frame in the payload, the timestamp can be calculated as TS(2)
   = TS(1) + (DIS2 + 1) * 1152 = 20409.  For the third frame, the
   timestamp is TS(3) = TS(2) + (DIS3 + 1) * 1152 = 26169.  Finally, for
   the fourth frame of the payload, we have TS(4) = TS(3) + (DIS4 + 1) *
   1152 = 35385.

4.3.2.4.  Frame Type Considerations

   The value of Frame Type (FT) is defined in Table 25 in [1].  FT=14
   (AUDIO_LOST) is used to denote frames that are lost.  A NO_DATA
   (FT=15) frame could result from two situations: First, that no data
   has been produced by the audio encoder; and second, that no data is
   transmitted in the current payload.  An example for the latter would
   be that the frame in question has been or will be sent in an earlier
   or later packet.  The duration for these non-included frames is
   dependent on the internal sampling frequency indicated by the ISF
   field.

   For frame types with index 0-13, the ISF field SHALL be set 0.  The
   frame duration for these frame types is fixed to 20 ms in time, i.e.,
   1440 ticks in 72 kHz.  For payloads containing only frames of type
   0-9, the TFI field SHALL be set to 0 and SHALL be ignored by the
   receiver.  In a payload combining frames of type 0-9 and 10-13, the
   TFI values need to be set to match the transport frames of type
   10-13.  Thus, frames of type 0-9 will also have a derived TFI, which
   is ignored.

4.3.2.5.  Other TOC Considerations

   If a ToC entry with an undefined FT value is received, the whole
   packet SHALL be discarded.  This is to avoid the loss of data
   synchronization in the depacketization process, which can result in a
   severe degradation in audio quality.

   Packets containing only NO_DATA frames SHOULD NOT be transmitted.
   Also, NO_DATA frames at the end of a frame sequence to be carried in
   a payload SHOULD NOT be included in the transmitted packet.  The
   AMR-WB+ SCR/DTX is identical with AMR-WB SCR/DTX described in [5] and
   can only be used in combination with the AMR-WB frame types (0-8).

   When multiple groups of frames are present, their ToC entries SHALL
   be placed in the ToC in order of increasing RTP timestamp value
   (modulo 2^32) of the first transport frame the TOC entry represents,
   independent of the payload mode.  In basic mode, the frames SHALL be
   consecutive in time, while in interleaved mode the frames MAY not
   only be non-consecutive in time but MAY even have varying inter-frame
   distances.

4.3.2.6.  ToC Examples

   The following example illustrates a ToC for three audio frames in
   basic mode.  Note that in this case all audio frames are encoded
   using the same frame type, i.e., there is only one ToC entry.

    0                   1
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0| Frame Type1 |  #frames = 3  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   The next example depicts a ToC of three entries in basic mode.  Note
   that in this case the payload also carries three frames, but three
   ToC entries are needed because the frames of the payload are encoded
   using different frame types.

    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
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |1| Frame Type1 |  #frames = 1  |1| Frame Type2 |  #frames = 1  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |0| Frame Type3 |  #frames = 1  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   The following example illustrates a ToC with two entries in
   interleaved mode using four-bit displacement fields.  The payload
   includes two groups of frames, the first one including a single
------分隔线----------------------------
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
最新评论 查看所有评论
发表评论 查看所有评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 密码: 验证码:
推荐内容