<?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="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-cbran-rtcweb-codec-02"
     ipr="noDerivativesTrust200902">
  <front>
    <title abbrev="WebRTC Codec">WebRTC Codec and Media Processing
    Requirements</title>

    <author fullname="Cary Bran" initials="C." surname="Bran">
      <organization>Plantronics</organization>

      <address>
        <postal>
          <street>345 Encinial Street</street>

          <city>Santa Cruz</city>

          <region>CA</region>

          <code>95060</code>

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

        <phone>+1 206 661-2398</phone>

        <email>cary.bran@plantronics.com</email>
      </address>
    </author>

    <author fullname="Cullen Jennings" initials="C." surname="Jennings">
      <organization>Cisco</organization>

      <address>
        <postal>
          <street>170 West Tasman Drive</street>

          <city>San Jose</city>

          <region>CA</region>

          <code>95134</code>

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

        <phone>+1 408 421-9990</phone>

        <email>fluffy@cisco.com</email>
      </address>
    </author>

 <author initials="JM." surname="Valin" fullname="Jean-Marc Valin">
   <organization>Mozilla</organization>
   <address>
     <postal>
       <street>650 Castro Street</street>
       <city>Mountain View</city>
       <region>CA</region>
       <code>94041</code>
       <country>USA</country>
     </postal>
     <email>jmvalin@jmvalin.ca</email>
   </address>
 </author>

    <date day="12" month="March" year="2012" />

    <abstract>
      <t>This document outlines the codec and media processing requirements
      for WebRTC client application and endpoint devices.</t>
    </abstract>
  </front>

  <middle>
    <section title="Introduction">
      <t>An integral part of the success and adoption of the Web Real Time
      Communications (WebRTC) will be the voice and video interoperability
      between WebRTC applications. This specification will outline the media
      processing and codec requirements for WebRTC client implementations.</t>
    </section>

    <section title="Terminology">
      <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>
    </section>

    <section title="Codec Requirements">
      <t>This section covers the audio and video codec requirements for WebRTC
      client applications. To ensure a baseline level of interoperability
      between WebRTC clients, a minimum set of required codecs are specified
      below. While this section specifies the codecs that will be mandated for
      all WebRTC client implementations, it leaves the question of supporting
      additional codecs to the will of the implementer.</t>

      <section title="Audio Codec Requirements">
        <t>WebRTC clients are REQUIRED to implement the following audio
        codecs.</t>

        <t><list style="symbols">
            <t>PCMA/PCMU - 1 channel with a rate of 8000 Hz and a ptime of 20
            - see section 4.5.14 of <xref target="RFC3551"></xref></t>

            <t>Telephone Event - <xref target="RFC4734"></xref></t>

            <t>Opus [draft-ietf-codec-opus]</t>
          </list></t>
	  <t>
	  For all cases where the client is able to process audio at a sampling rate
	  higher than 8 kHz, it is RECOMMENDED that Opus be offered before PCMA/PCMU.
	  For Opus, all modes MUST be supported, for all ptime values up to 120 ms.
	  Clients MAY use the offer/answer mechanism to signal a preference for a
	  particular mode or ptime.
	</t>

      </section>

      <section title="Video Codec Requirements">
      
        <t>The following feature list applies to all required video
        codecs.</t>

        <t>Required video codecs:</t>

        <t><list style="symbols">
            <t>MUST support at least 10 frames per second (fps) and SHOULD
            support 30 fps</t>

            <t>If VP8 is supported, then it MUST support the bilinear and none
            reconstruction filters</t>

            <t>OPTIONALLY offer support for additional color spaces</t>

            <t>MUST support a minimum resolution of 320X240</t>

            <t>SHOULD support resolutions of 1280x720, 720x480, 1024x768,
            800x600, 640x480, 640 x 360 , 320x240</t>
          </list></t>
      </section>
    </section>


<section anchor="level" title="Audio Level">
<t>
It is desirable to standardize the "on the wire" audio level for speech transmission
to avoid users having to manually adjust the playback and to facilitate
mixing in conferencing applications. It is also desirable to be consistent
with ITU-T recommendations G.169 and G.115, which recommend an active audio level
of -19 dBm0. However, unlike G.169 and G.115, the audio for WebRTC is not
constrained to have a passband specified by G.712 and can in fact be sampled
at any sampling rate from 8 kHz to 48 kHz and up. For this reason, the level
SHOULD be normalized by only considering frequencies above 300 Hz, regardless
of the sampling rate used. The level SHOULD also be adapted to avoid clipping,
either by lowering the gain to a level below -19 dBm0, or through the use of a
compressor. 
</t>

<t>AUTHORS' NOTE: The idea of using the same level as what the ITU-T recommends is that
it should improve inter-operability while at the same time maintaining
sufficient dynamic range and reducing the risk of clipping. The main drawbacks
are that the resulting level is about 12 dB lower than typical "commercial music" levels and it
leaves room for ill-behaved clients to be much louder than a normal client. While using
music-type levels is not really an option (it would require using the same compressor-limitors
that studios use), it would be possible to have a level slightly higher (e.g. 3 dB) than what is
recommended above without causing interoperability problems. 
</t>
 
<t>
Assuming 16-bit PCM with a value of +/-32767, -19 dBm0 corresponds to a 
root mean square (RMS) level of 2600. Only active speech should be considered 
in the RMS calculation. If the client has control over the entire audio capture
path, as is typically the case for a regular phone, then it is RECOMMENDED that
the gain be adjusted in such a way that active speech have a level of 2600 (-19 dBm0)
for an average speaker. If the client does not have control over the entire audio
capture, as is typically the case for a software client, then the client
SHOULD use automatic gain control (AGC) to dynamically adjust the level to 2600 
(-19 dBm0) +/- 6 dB. For music or desktop sharing applications, the level 
SHOULD NOT be automatically adjusted and the client SHOULD allow the user to set
the gain manually.
</t>

<t>The RECOMMENDED filter for normalizing the signal energy is a second-order
Butterworth filter with a 300 Hz cutoff frequency. 
</t>
 
<t>
It is common for the audio output on some devices to be "calibrated" for playing
back pre-recorded "commercial" music, which is typically around 12 dB louder than the level
recommended in this section. Because of this, clients MAY increase
the gain before playback.
</t>


</section>

<section anchor="aec" title="Acoustic Echo Cancellation (AEC)">
<t>
   It is plausible that the dominant near to mid-term WebRTC usage model
   will be people using the interactive audio and video capabilities to
   communicate with each other via web browsers running on a notebook
   computer that has built-in microphone and speakers.  The notebook-as-
   communication-device paradigm presents challenging echo cancellation
   problems, the specific remedy of which will not be
   mandated here.  However, while no specific algorithm or standard will
   be required by WebRTC compatible clients, echo cancellation will improve the
   user experience and should be implemented by the endpoint device.
</t>

<t>
 SHOULD include an AEC and if not, SHOULD ensure that the speaker-to-microphone
 gain is below unity at all frequencies to avoid instability when none of the
 client has echo cancellation. For clients that do not control the audio capture
 and playback devices directly, it is RECOMMENDED to support echo cancellation
 between devices running at slight different sampling rates, such as when a webcam
 is used for microphone.
</t>

<t>
 The client SHOULD allow either the entire AEC or the non-linear
 processing (NLP) to be turned off for applications, such as music, that 
 do not behave well with the spectral attenuation methods typically used
 in NLPs. It SHOULD have the ability to detect the presence of a headset and disable
echo cancellation. 
</t>

<t>
For some applications where the remote client may not have an echo canceller, the local client MAY include a far-end echo canceller, but if that it the case, it SHOULD be disabled by default.
</t>

<t>Call control event notification to connected devices such as headsets (what's that exactly?)</t>
      
</section>


    <section title="Legacy VoIP Interoperability">
      <t>The codec requirements above will ensure, at a minimum, voice
      interoperability capabilities between WebRTC client applications and
      legacy phone systems.</t>

  
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document makes no request of IANA.</t>

      <t>Note to RFC Editor: this section may be removed on publication as an
      RFC.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The codec requirements have no additional security considerations
      other than those captured in <xref
      target="I-D.ekr-security-considerations-for-rtc-web"></xref>.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>This draft incorporates ideas and text from various other drafts. In
      particularly we would like to acknowledge, and say thanks for, work we
      incorporated from Harald Alvestrand.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml"?>

      <?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.3551.xml'?>

      <?rfc include='http://xml.resource.org/public/rfc/bibxml/reference.RFC.4734.xml'?>

      <reference anchor="I-D.ekr-security-considerations-for-rtc-web">
        <front>
          <title abbrev="RTC-Web Security">Security Considerations for
          RTC-Web</title>

          <author fullname="Eric Rescorla" initials="E.K." surname="Rescorla">
            <organization>RTFM, Inc.</organization>

            <address>
              <postal>
                <street>2064 Edgewood Drive</street>

                <city>Palo Alto</city>

                <region>CA</region>

                <code>94303</code>

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

              <phone>+1 650 678 2350</phone>

              <email>ekr@rtfm.com</email>
            </address>
          </author>

          <date day="30" month="May" year="2011" />

          <area>RAI</area>

          <workgroup>RTC-Web</workgroup>

          <abstract>
            <t>The Real-Time Communications on the Web (RTC-Web) working group
            is tasked with standardizing protocols for real-time
            communications between Web browsers. The two major use cases for
            RTC-Web technology are real-time audio and/or video calls and
            direct data transfer. Unlike most conventional real-time systems
            (e.g., SIP-based soft phones) RTC-Web communications are directly
            controlled by some Web server, which poses new security
            challenges. For instance, a Web browser might expose a JavaScript
            API which allows a server to place a video call. Unrestricted
            access to such an API would allow any site which a user visited to
            "bug" a user's computer, capturing any activity which passed in
            front of their camera. This document defines the RTC-Web threat
            model and defines an architecture which provides security within
            that threat model.</t>
          </abstract>

          <note title="Legal">
            <t>THIS DOCUMENT AND THE INFORMATION CONTAINED THEREIN ARE
            PROVIDED ON AN &ldquo;AS IS&rdquo; BASIS AND THE CONTRIBUTOR, THE
            ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE
            INTERNET SOCIETY, THE IETF TRUST, AND THE INTERNET ENGINEERING
            TASK FORCE, DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
            BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
            THEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
            MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.</t>
          </note>
        </front>
      </reference>

      <reference anchor="I-D.webm">
        <front>
          <title>VP8 Data Format and Decoding Guide</title>

          <author fullname="Google, Inc." surname="Google, Inc.">
            <organization></organization>
          </author>

          <date month="July" year="2010" />

          <note title="Link to WebM Project">
            <t>http://www.webmproject.org</t>
          </note>
        </front>
      </reference>
    </references>
  </back>
</rfc>
