<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="nog/8."?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-ietf-avt-rtp-isac-02" ipr="trust200902">
  <front>
    <title abbrev="iSAC">RTP Payload Format for the iSAC Codec</title>

    <author fullname="Tina le Grand" initials="T." surname="le Grand">
      <organization>Google</organization>

      <address>
        <postal>
          <street>Kungsbron 2</street>

          <city>Stockholm</city>

          <region></region>

          <code>11122</code>

          <country>Sweden</country>
        </postal>
      </address>
    </author>

    <author fullname="Paul E. Jones" initials="P." surname="Jones">
      <organization>Cisco Systems</organization>

      <address>
        <postal>
          <street>7025 Kit Creek Rd.</street>

          <city>Research Triangle Park</city>

          <region>NC</region>

          <code>27709</code>

          <country>USA</country>
        </postal>

        <phone>+1 919 476 2048</phone>

        <facsimile></facsimile>

        <email>paulej@packetizer.com</email>

        <uri></uri>
      </address>
    </author>

    <author fullname="Pascal Huart" initials="P." surname="Huart">
      <organization>Cisco Systems</organization>

      <address>
        <postal>
          <street>400, Avenue Roumanille, Batiment T3</street>

          <city>Biot - Sophia Antipolis</city>

          <region></region>

          <code>06410</code>

          <country>France</country>
        </postal>

        <phone>+33 4 9723 2643</phone>

        <facsimile></facsimile>

        <email>phuart@cisco.com</email>

        <uri></uri>
      </address>
    </author>

    <author fullname="Turaj Zakizadeh Shabestary" initials="T."
            surname="Shabestary">
      <organization>Google</organization>

      <address>
        <postal>
          <street>1950 Charleston Road</street>

          <city>Mountain View</city>

          <region>CA</region>

          <code>94043</code>

          <country>USA</country>
        </postal>

        <phone></phone>

        <facsimile></facsimile>

        <email>turajs@google.com</email>

        <uri></uri>
      </address>
    </author>

    <author fullname="Harald Alvestrand" initials="H. T." role="editor"
            surname="Alvestrand">
      <organization>Google</organization>

      <address>
        <postal>
          <street>Kungsbron 2</street>

          <city>Stockholm</city>

          <region></region>

          <code>11122</code>

          <country>Sweden</country>
        </postal>

        <phone></phone>

        <facsimile></facsimile>

        <email>hta@google.com</email>

        <uri></uri>
      </address>
    </author>

    <date day="18" month="October" year="2012" />

    <abstract>
      <t>iSAC is a proprietary wideband speech and audio codec developed by
      Global IP Solutions (now part of Google), suitable for use in Voice over
      IP applications. This document describes the payload format for iSAC
      generated bit streams within a Real-Time Protocol (RTP) packet. Also
      included here are the necessary details for the use of iSAC with the
      Session Description Protocol (SDP).</t>
    </abstract>

    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC2119">RFC 2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>This document gives a general description of the iSAC wideband speech
      codec and specifies the iSAC payload format for usage in RTP packets.
      Also included here are the necessary details for the use of iSAC with
      the Session Description Protocol (SDP).</t>
    </section>

    <section title="iSAC Codec Description">
      <t>The iSAC codec is an adaptive wideband/superwideband speech and audio
      codec that operates with short delay, making it suitable for high
      quality real time communication. It is specially designed to deliver
      wideband speech quality in both low and medium bit rate applications. It
      also handles non-speech audio well, such as music and background noise
      <xref target="isac"></xref>.</t>

      <t>The iSAC codec compresses speech frames of 16 kHz, 16-bit sampled
      input speech, each frame containing 30 or 60 ms of speech. It also has a
      superwideband mode which allows a 32 kHz sampling rate. In
      super-wideband mode the input signal is split into wideband (0-8 kHz)
      and upper (8-16 kHz) signal. Each sub-band is encoded independently, and
      their associated payloads concatenated, c.f. Figure 2, to construct the
      overall iSAC super-wideband RTP payload. Note that the same
      encoder/decoder is used for the wideband part for both wideband and
      super-wideband modes. </t>

      <t>The codec runs in one of two different modes called channel-adaptive
      mode and channel-independent mode. In both modes iSAC is aiming at a
      target bit rate, which is neither the average nor the maximum bit rate
      that will be reach by iSAC, but corresponds to the average bit rate
      during peaks in speech activity. The bit rate will sometimes exceed the
      target bit rate, but most of the time will be below. The average bit
      rate obtained is on average about a factor of 1.2 times lower than the
      target bit rate on continuous speech, and will be lower on speech with
      pauses.</t>

      <t>In channel-adaptive mode the target bit rate is adapted to give a bit
      rate corresponding to the available bandwidth on the channel. The
      available bandwidth is continuously estimated at the receiving iSAC and
      signaled in-band in the iSAC bit stream. Even at dial-up modem data
      rates (including IP, UDP, and RTP overhead) iSAC delivers high quality
      by automatically adjusting transmission rates to give the best possible
      listening experience over the available bandwidth. The default initial
      target bit rate is 20000 bits per second in channel-adaptive mode.</t>

      <t>In channel-independent mode a target bit rate has to be provided to
      iSAC prior to encoding; the target bit rate can be changed over the time
      of the call.</t>

      <t>After encoding the speech signal the iSAC coder uses lossless coding
      to further reduce the size of each packet, and hence the total bit rate
      used.</t>

      <t>The adaptation and the lossless coding described above both result in
      a variation of packet size, depending both of the nature of speech and
      the available bandwidth. Therefore, the iSAC codec, in wideband mode,
      operates at transmission rates from about 10 kbps to about 32 kbps. In
      super-wideband mode, the transmission rate is in the range of 10 kbps to
      56 kbps. If operating in super-wideband mode, the iSAC codec
      automatically adjusts the effective encoded audio bandwidth for the best
      experience.</t>

      <figure>
        <artwork><![CDATA[
Bit Rate  | 10 - 32  |  32 - 38   | 38 - 45 | 45 - 50    | 50 - 56
 [kbps]   |          |            |         |            | 
----------+----------+------------+----------------------+---------
Effective |          |  0 - 8     | 0 - 12  | 0 - 12     | 0 - 16
Bandwidth | 0 - 8 kHz| operating  |         | operating  |
 [kHz]    |          | at 32 kbps |         | at 45 kbps |

]]></artwork>
      </figure>

      <t>The main characteristics can be summarized as follows:</t>

      <t><list style="symbols">
          <t>Wideband or superwideband, 16 kHz or 32 kHz respectively, speech
          and audio codec</t>

          <t>Variable bit rate, which depends on the input signal</t>

          <t>Adaptive rate with two modes: channel-adaptive or
          channel-independent mode</t>

          <t>Bit rate range from around 10 kbps to 32 kbps when operating on
          wideband input. For input audio sampled at 32 kHz, the bit rate
          range 10 kbps to 56 kbps. </t>

          <t>Operates on 30 or 60 ms of speech for wideband inputs, and only
          30 ms for super-wideband inputs.</t>

          <t> In super-wideband mode, depending on the target bit rate, the
          effective bandwidth is adjusted for the optimal experience.</t>
        </list></t>
    </section>

    <section title="RTP Payload Format">
      <t>The iSAC codec in wideband mode uses a sampling rate clock of 16 kHz,
      so the RTP timestamp MUST be in units of 1/16000 of a second. In
      super-wideband mode, the iSAC codec uses a sampling rate clock of 32
      kHz, so the RTP timestamp MUST be in units of 1/32000 of a second.</t>

      <t>The RTP payload for iSAC has the format shown in Figure 1. No
      additional header fields specific to this payload format are required.
      For RTP based transportation of iSAC encoded audio, the standard RTP
      header <xref target="RFC3550"></xref> is followed by one payload data
      block.</t>

      <figure>
        <artwork><![CDATA[
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                               |
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
|                                                               |
+                    iSAC Payload Block                         +
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+]]></artwork>

        <postamble>Figure 1: RTP packet format for iSAC</postamble>
      </figure>

      <t></t>

      <section title="iSAC Wideband Payload Format">
        <t>The iSAC payload block consists of a payload header and one or two
        encoded 30 ms speech frames. The iSAC payload is generated in the
        following manner:</t>

        <t><list style="symbols">
            <t>Parameters representing one or two 30 ms frames of speech data
            are determined by the encoder. The parameters are quantized to
            generate encoded data corresponding to the one or two speech
            frames. The length of the encoded data is variable and depends on
            the signal characteristics and the target bit rate.</t>

            <t>The payload header is generated (described in Section 3.2) and
            added before the encoded parameter data for the speech
            frame(s).</t>

            <t>Lossless coding is applied to the complete iSAC payload block,
            including payload header, to generate a compressed payload. The
            length depends on the length of the data generated to represent
            the speech and the effectiveness of the lossless coding.</t>
          </list>No part of the payload header or the encoded speech data can
        be retrieved without partly or fully decoding the packet.</t>

        <t>The following figure shows an iSAC payload block containing 60 ms
        of encoded speech data.</t>

        <figure>
          <artwork><![CDATA[
+--------+--------+--------+--------+--------+--------+------+ 
|Payload |       30 ms Encoded      |     30 ms Encoded      |
|Header  |         Speech Data      |       Speech Data      |
+--------+--------+--------+--------+--------+--------+------+]]></artwork>

          <postamble>Figure 2: Payload format for iSAC</postamble>
        </figure>
      </section>

      <section title="Payload Header">
        <t>The payload header holds information for the receiver about the
        available bandwidth, in the form of a Bandwidth Estimation Index
        (BEI), and the length of the speech data in the current payload (frame
        length, FL). The header has the format defined in Figure 3. Note that
        the size of the header can vary due to the lossless encoding described
        in section 2 and in section 3.1. Also note that the BEI is always
        estimated and transmitted, even if iSAC runs in channel-independent
        mode.</t>

        <figure>
          <artwork><![CDATA[
+-+-+-+-+-+-+
| BEI |  FL |
+-+-+-+-+-+-+]]></artwork>

          <postamble>Figure 3: Payload Header</postamble>
        </figure>

        <t><list style="symbols">
            <t>BEI: Bandwidth Estimation Index. The bandwidth estimate is
            quantized into one out of 24 values. Valid values are 0 to 23.</t>

            <t>FL: The length of the speech data (Frame Length) present in the
            payload, given in number of speech samples. Valid frame lengths
            are 480 (30 ms) and 960 (60 ms) samples.</t>
          </list></t>
      </section>

      <section title="Encoded Speech Data">
        <t>The iSAC encoded speech data consist of parameters representing one
        or two frames of 30 ms speech. The length of the speech data is
        signaled in the header (in number of samples), and the length may
        change at any time during a session. In channel-adaptive mode the
        length is changed to best utilize the available bandwidth, and extra
        padding is added to some packets as a bandwidth probe.</t>

        <t>The iSAC payload is padded to whole octets, and has a variable
        length depending on the input source signal, number of 30 ms speech
        frames, and target bit rate.</t>

        <t>The number of octets used to describe one frame of 30 ms speech
        typically varies from around 50 to around 120 octets. For the case of
        60 ms speech (two 30 ms speech frames), the number of octets varies
        from around 100 to around 240 octets. The absolute maximum allowed
        payload length is 400 octets. The user can choose to lower the maximum
        allowed payload length. Minimum value is 100 octets. It is possible
        for the user to choose a maximum bit rate (averaged over a frame)
        instead of a maximum payload length. The maximum payload length is
        then dependent on the length of the speech data represented in the
        payload (30 or 60 ms). Possible maximum rates are in the range of
        32000 to 53400 bits per second.</t>

        <t>The sensitivity to bit errors is equal for all bits in the
        payload.</t>
      </section>

      <section title="iSAC Superwideband Payload Format">
        <t>In super-wideband mode, payloads associated with each sub-band
        (wideband 0-8 kHz and upper-band 8-16 kHz) are constructed
        independently and concatenated as depicted in Figure 2. Note that in
        super-wideband mode only one 30 ms frame is encoded in each
        payload.</t>

        <figure>
          <artwork><![CDATA[
+--------------------------------+---+------------------------+-----+
| Payload +30 ms Encoded wideband|LEN|30 ms Encoded upper-band| CRC |
| Header   speech data           |   |speech data             |check|
+--------------------------------+---+------------------------+-----+ 
                                     |<--- CRC checked data ->|
   ]]></artwork>

          <postamble>Figure 4: Super-Wideband payload format</postamble>
        </figure>

        <t></t>

        <t>Payloads of wideband and upper-band are encoded independently,
        allowing the encoder to simply concatenate two payloads to construct
        one iSAC super-wideband payload. The RTP payload of the iSAC
        super-wideband codec starts with the payload of the wideband part,
        which is padded to whole octets, followed by one byte (LEN in Figure
        4) representing the length of the remaining sequence, payload of the
        upper-band plus 4 bytes for CRC sequence.</t>

        <t>If LEN_UB denotes the length of the upper-band payload, then LEN =
        1 + LEN_UB + 4. This value should not exceed 255, otherwise upper-band
        payload is omitted.</t>

        <t>The CRC check is added to distinguish between upper-band payload
        and random bit-stream padding that can be added for probing available
        network bandwidth.</t>

        <t>At the receive side, a super-wideband payload is first given to the
        wideband decoder. The wideband decoder decodes as many parameters as
        required to uniquely reproduce the encoded wideband audio. The next
        byte in the payload should hold the value of LEN. This provides a
        sanity check that the decoding process has not failed. Thereafter, the
        receiver runs a CRC check over the upper-band payload and compares the
        results with the last 4 bytes in the packet.</t>

        <t>If the computed CRC and the last four bytes of the payload don't
        match, the remaining bits are assumed to be added for probing the
        network. Hence, the upper-band signal is replaced by zeros and
        combined with the wideband signal to generate the super-wideband
        signal.</t>

        <t>If the two CRCs match, then the upper-band payload is given to the
        upper-band decoder. Thereby, the output of the upper-band decoder is
        combined with the wide-band decoded audio to generate the
        super-wideband signal.</t>

        <t>It might be that for a given packet, the wideband decoder uses all
        the given payload. This can be the case when a super-wideband encoder
        is operating at low rates and has adjusted the effective bandwidth to
        wideband. In this case, the decoder inserts zeros as the reconstructed
        upper-band and combines both bands to reproduce the super-wideband
        signal.</t>
      </section>

      <section title="Encoded Upper-band Speech Data">
        <t>The iSAC encoded upper-band speech data consists of parameters
        representing one frame of 30 ms speech. Depending on the target rate
        the upper-band encoder might choose to only encode the sub-band of 8
        kHz to 12 kHz. This is signaled inband to the receiver.</t>
      </section>

      <section title="Padding">
        <t>Padding, which consists of randomly generated bits, may be added at
        the end of the payload in both wideband and superwideband modes. It
        can be used by the sender for bandwidth probing, and is always ignored
        by the receiver.</t>

        <t>In wideband mode, padding simply follows the payload, preceded by a
        length field.</t>

        <figure>
          <artwork><![CDATA[
+----------+---+--------+
| Wideband |LEN|Padding |
| payload  |   |        |
+----------+---+--------+
  ]]></artwork>

          <postamble>Figure 5: Wideband payload format with
          padding.</postamble>
        </figure>

        <t>LEN is the length of the padding in bytes + 1: LEN = LEN_PAD +
        1</t>

        <t>In superwideband mode, the format of a packet with padding looks
        like the following.</t>

        <figure>
          <artwork><![CDATA[
+----------+---+-------------+--+--------+-----+
| Wideband |LEN|Upper-band   |L2|Padding |CRC  |
| payload  |   |speech data  |  |        |check|
+----------+---+-------------+--+--------+-----+
               |<-- CRC checked data --->|
  ]]></artwork>

          <postamble>Figure 6: Super-Wideband payload format</postamble>
        </figure>

        <t></t>

        <t>LEN is 1 + LEN_UB + 1 + LEN_PAD + 4, where LEN_UB is the length of
        the upper-band speech data in bytes, and LEN_PAD is the length of the
        padding in bytes.</t>

        <t>L2 is LEN_PAD + 1.</t>

        <t>The CRC check runs over the upper-band speech data, L2 and the
        padding.</t>
      </section>

      <section title="Multiple iSAC frames in an RTP packet">
        <t>More than one iSAC payload block MUST NOT be included in an RTP
        packet by a sender.</t>

        <t>Further, iSAC payload blocks MUST NOT be split between RTP
        packets.</t>
      </section>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document defines the iSAC media type, and requests IANA to
      register it.</t>

      <t><list style="hanging">
          <t></t>

          <t hangText="Media type name: ">audio</t>

          <t hangText="Media subtype: ">isac</t>

          <t hangText="Required parameters:">None</t>

          <t hangText="Optional parameters:"><vspace blankLines="0" /><list
              style="symbols">
              <t>ibitrate: The parameter indicates the upper bound of the
              initial target bit rate the device would like to receive. For
              channel-adaptive mode, the target bit rate may vary with time;
              for channel-independent mode, the target bit rate will remain at
              that level unless instructed otherwise.&nbsp; An acceptable
              value for ibitrate is in the range of 20000 to 32000 (bits per
              second).</t>

              <t>maxbitrate: The parameter indicates the maximum bit rate the
              endpoint expects to receive.&nbsp; The recipient of this
              parameter SHOULD NOT transmit at a higher bit rate.</t>
            </list></t>

          <t hangText="Encoding considerations: "><vspace
          blankLines="0" />This media format is framed and binary.</t>

          <t hangText="Security considerations:">See <xref
          target="Security"></xref></t>

          <t hangText="Interoperability considerations:">None</t>

          <t hangText="Published specification:">RFC XXXX</t>

          <t hangText="Applications which use this media type:"><vspace
          blankLines="0" />This media type is suitable for use in numerous
          applications needing to transport encoded voice or other audio. Some
          examples include Voice over IP, Streaming Media, Voice Messaging,
          and Conferencing.</t>

          <t hangText="Additional information:">None</t>

          <t hangText="Intended usage:">COMMON</t>

          <t hangText="Other Information/General Comment:"><vspace
          blankLines="0" />iSAC is a proprietary speech and audio codec owned
          by Google. The codec operates on 30 or 60 ms speech frames at a
          sampling rate clock of 16 kHz or 32 kHz.</t>

          <t hangText="Person to contact for further information:"><vspace
          blankLines="0" />Tina le Grand [tlegrand@google.com]</t>

          <t hangText="Restrictions on usage:"><vspace blankLines="0" />This
          media type depends on RTP framing, and hence is only defined for
          transfer via RTP <xref target="RFC3550"></xref>. Transport within
          other framing protocols is not defined at this time.</t>

          <t hangText="Change controller:"><vspace blankLines="0" />IETF
          Audio/Video Transport working group delegated from the IESG.</t>
        </list>Note to the RFC Editor / IANA: Please replace "RFC XXXX" above
      with the number of this RFC when published, and remove this note.</t>
    </section>

    <section title="Mapping to SDP Parameters">
      <t>The information carried in the media type specification has a
      specific mapping to fields in the Session Description Protocol (SDP)
      <xref target="RFC4566"></xref>, which is commonly used to describe RTP
      sessions. When SDP is used to specify sessions employing the iSAC codec,
      the mapping is as follows:</t>

      <t><list style="symbols">
          <t>The media type ("audio") goes in SDP "m=" as the media name.</t>

          <t>The media subtype (payload format name) goes in SDP "a=rtpmap" as
          the encoding name.</t>

          <t>Any remaining parameters go in the SDP "a=fmtp" attribute by
          copying them directly from the media type string as a semicolon
          separated list of parameter=value pairs.</t>
        </list>The optional parameter ibitrate MUST NOT be higher than the
      parameter maxbitrate.</t>

      <t>The iSAC parameters in an SDP offer are completely independent from
      those in the SDP answer. For both ibitrate and maxbitrate it is legal
      for the answer to contain a value that is different than what is
      provided in an offer.&nbsp; The parameter may be present in the answer,
      even if absent in the offer.</t>

      <t>When conveying information by SDP, the encoding name SHALL be "isac"
      (the same as the media subtype).</t>

      <t></t>

      <section title="Example Initial Target Bit Rate">
        <t>The offer indicates that it wishes to receive a wideband bitstream
        with an initial target rate of 20000 bits per second. The remote party
        MAY change its initial target rate to the requested value.</t>

        <figure>
          <artwork><![CDATA[m=audio 10000 RTP/AVP 98
a=rtpmap: 98 isac/16000
a=fmtp:98 ibitrate=20000

]]></artwork>
        </figure>
      </section>

      <section title="Example Max Bit Rate">
        <t>The offer indicates that it wishes to receive a superwideband
        bitstream with an initial target rate of 20000 bits per second, and a
        maximum bit rate of 45000 bits per second. The remote party MAY change
        its initial target rate and SHOULD NOT transmit at a higher rate than
        45000.</t>

        <figure>
          <artwork><![CDATA[m=audio 10000 RTP/AVP 98
a=rtpmap: 98 isac/32000
a=fmtp:98 ibitrate=20000;maxbitrate=45000

]]></artwork>
        </figure>

        <t></t>
      </section>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>RTP packets using the payload format defined in this specification
      are subject to the general security considerations discussed in RFC 3550
      section 8.1.</t>

      <t>As this format transports encoded speech, the main security issues
      include confidentiality and authentication of the speech itself. The
      payload format itself does not have any built-in security mechanisms.
      External mechanisms, such as SRTP <xref target="RFC3711"></xref>, MAY be
      used.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgments">
      <t>This document was originally prepared using
      2-Word-v2.0.template.dot.</t>

      <t>The present version is prepared using xml2rfc and xxe-xml2rfc.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include='reference.RFC.3550'?>

      <?rfc include='reference.RFC.3711'?>

      <?rfc include='reference.RFC.4566'?>
    </references>

    <references title="Informative References">
      <reference anchor="isac">
        <front>
          <title>iSAC reference implementation</title>

          <author>
            <organization>GIPS / Google</organization>
          </author>

          <date />
        </front>

        <annotation>Available at http://code.google.com/p/webrtc/source -
        directory src/modules/audio_coding/codecs/isac</annotation>
      </reference>
    </references>
  </back>
</rfc>
