7874
PROPOSED STANDARD
WebRTC Audio Codec and Processing Requirements
Authors: JM. Valin, C. Bran
Date: May 2016
Area: wit
Working Group: rtcweb
Stream: IETF
Abstract
This document outlines the audio codec and processing requirements for WebRTC endpoints.
RFC 7874
PROPOSED STANDARD
Internet Engineering Task Force (IETF) JM. Valin
Request for Comments: 7874 Mozilla
Category: Standards Track C. Bran
ISSN: 2070-1721 Plantronics
May 2016
<span class="h1">WebRTC Audio Codec and Processing Requirements</span>
Abstract
This document outlines the audio codec and processing requirements
for WebRTC endpoints.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force
(IETF). It represents the consensus of the IETF community. It has
received public review and has been approved for publication by the
Internet Engineering Steering Group (IESG). Further information on
Internet Standards is available in <a href="./rfc5741#section-2">Section 2 of RFC 5741</a>.
Information about the current status of this document, any errata,
and how to provide feedback on it may be obtained at
<a href="https://www.rfc-editor.org/info/rfc7874">http://www.rfc-editor.org/info/rfc7874</a>.
Copyright Notice
Copyright (c) 2016 IETF Trust and the persons identified as the
document authors. All rights reserved.
This document is subject to <a href="https://www.rfc-editor.org/bcp/bcp78">BCP 78</a> and the IETF Trust's Legal
Provisions Relating to IETF Documents
(<a href="http://trustee.ietf.org/license-info">http://trustee.ietf.org/license-info</a>) in effect on the date of
publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License.
<span class="grey">Valin & Bran Standards Track [Page 1]</span>
<span id="page-2" ></span>
<span class="grey"><a href="./rfc7874">RFC 7874</a> WebRTC Audio May 2016</span>
Table of Contents
<a href="#section-1">1</a>. Introduction . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-2">2</a>. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-3">3</a>. Codec Requirements . . . . . . . . . . . . . . . . . . . . . <a href="#page-2">2</a>
<a href="#section-4">4</a>. Audio Level . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-5">5</a>. Acoustic Echo Cancellation (AEC) . . . . . . . . . . . . . . <a href="#page-4">4</a>
<a href="#section-6">6</a>. Legacy VoIP Interoperability . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-7">7</a>. Security Considerations . . . . . . . . . . . . . . . . . . . <a href="#page-5">5</a>
<a href="#section-8">8</a>. References . . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
<a href="#section-8.1">8.1</a>. Normative References . . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
<a href="#section-8.2">8.2</a>. Informative References . . . . . . . . . . . . . . . . . <a href="#page-6">6</a>
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-7">7</a>
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . <a href="#page-7">7</a>
<span class="h2"><a class="selflink" id="section-1" href="#section-1">1</a>. Introduction</span>
An integral part of the success and adoption of Web Real-Time
Communications (WebRTC) will be the voice and video interoperability
between WebRTC applications. This specification will outline the
audio processing and codec requirements for WebRTC endpoints.
<span class="h2"><a class="selflink" id="section-2" href="#section-2">2</a>. Terminology</span>
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in <a href="./rfc2119">RFC</a>
<a href="./rfc2119">2119</a> [<a href="./rfc2119" title=""Key words for use in RFCs to Indicate Requirement Levels"">RFC2119</a>].
<span class="h2"><a class="selflink" id="section-3" href="#section-3">3</a>. Codec Requirements</span>
To ensure a baseline level of interoperability between WebRTC
endpoints, a minimum set of required codecs are specified below. If
other suitable audio codecs are available for the WebRTC endpoint to
use, it is RECOMMENDED that they also be included in the offer in
order to maximize the possibility of establishing the session without
the need for audio transcoding.
WebRTC endpoints are REQUIRED to implement the following audio
codecs:
o Opus [<a href="./rfc6716" title=""Definition of the Opus Audio Codec"">RFC6716</a>] with the payload format specified in [<a href="./rfc7587" title=""RTP Payload Format for the Opus Speech and Audio Codec"">RFC7587</a>].
o PCMA and PCMU (as specified in ITU-T Recommendation G.711 [<a href="#ref-G.711" title=""Pulse code modulation (PCM) of voice frequencies"">G.711</a>])
with the payload format specified in <a href="./rfc3551#section-4.5.14">Section 4.5.14 of [RFC3551]</a>.
<span class="grey">Valin & Bran Standards Track [Page 2]</span>
<span id="page-3" ></span>
<span class="grey"><a href="./rfc7874">RFC 7874</a> WebRTC Audio May 2016</span>
o [<a href="./rfc3389" title=""Real-time Transport Protocol (RTP) Payload for Comfort Noise (CN)"">RFC3389</a>] comfort noise (CN). WebRTC endpoints MUST support
[<a href="./rfc3389" title=""Real-time Transport Protocol (RTP) Payload for Comfort Noise (CN)"">RFC3389</a>] CN for streams encoded with G.711 or any other supported
codec that does not provide its own CN. Since Opus provides its
own CN mechanism, the use of [<a href="./rfc3389" title=""Real-time Transport Protocol (RTP) Payload for Comfort Noise (CN)"">RFC3389</a>] CN with Opus is NOT
RECOMMENDED. Use of Discontinuous Transmission (DTX) / CN by
senders is OPTIONAL.
o the 'audio/telephone-event' media type as specified in [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>].
The endpoints MAY send DTMF events at any time and SHOULD suppress
in-band dual-tone multi-frequency (DTMF) tones, if any. DTMF
events generated by a WebRTC endpoint MUST have a duration of no
more than 8000 ms and no less than 40 ms. The recommended default
duration is 100 ms for each tone. The gap between events MUST be
no less than 30 ms; the recommended default gap duration is 70 ms.
WebRTC endpoints are not required to do anything with tones (as
specified in <a href="./rfc4733">RFC 4733</a>) sent to them, except gracefully drop them.
There is currently no API to inform JavaScript about the received
DTMF or other tones (as specified in <a href="./rfc4733">RFC 4733</a>). WebRTC endpoints
are REQUIRED to be able to generate and consume the following
events:
+------------+--------------------------------+-----------+
|Event Code | Event Name | Reference |
+------------+--------------------------------+-----------+
| 0 | DTMF digit "0" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 1 | DTMF digit "1" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 2 | DTMF digit "2" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 3 | DTMF digit "3" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 4 | DTMF digit "4" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 5 | DTMF digit "5" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 6 | DTMF digit "6" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 7 | DTMF digit "7" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 8 | DTMF digit "8" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 9 | DTMF digit "9" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 10 | DTMF digit "*" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 11 | DTMF digit "#" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 12 | DTMF digit "A" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 13 | DTMF digit "B" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 14 | DTMF digit "C" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
| 15 | DTMF digit "D" | [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>] |
+------------+--------------------------------+-----------+
For all cases where the endpoint 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 on
the decoder side. The choice of encoder-side modes is left to the
implementer. Endpoints MAY use the offer/answer mechanism to signal
a preference for a particular mode or ptime.
<span class="grey">Valin & Bran Standards Track [Page 3]</span>
<span id="page-4" ></span>
<span class="grey"><a href="./rfc7874">RFC 7874</a> WebRTC Audio May 2016</span>
For additional information on implementing codecs other than the
mandatory-to-implement codecs listed above, refer to [<a href="./rfc7875" title=""Additional WebRTC Audio Codecs for Interoperability"">RFC7875</a>].
<span class="h2"><a class="selflink" id="section-4" href="#section-4">4</a>. Audio Level</span>
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 to 48 kHz and higher. 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.
Assuming linear 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 endpoint
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 an average speaker would have a level of
2600 (-19 dBm0) for active speech. If the endpoint does not have
control over the entire audio capture, as is typically the case for a
software endpoint, then the endpoint 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 endpoint SHOULD allow the user
to set the gain manually.
The RECOMMENDED filter for normalizing the signal energy is a second-
order Butterworth filter with a 300 Hz cutoff frequency.
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, endpoints MAY increase the gain before playback.
<span class="h2"><a class="selflink" id="section-5" href="#section-5">5</a>. Acoustic Echo Cancellation (AEC)</span>
It is plausible that the dominant near-to-medium-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 a built-in microphone and speakers.
The notebook-as-communication-device paradigm presents challenging
<span class="grey">Valin & Bran Standards Track [Page 4]</span>
<span id="page-5" ></span>
<span class="grey"><a href="./rfc7874">RFC 7874</a> WebRTC Audio May 2016</span>
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 endpoints, echo cancellation will
improve the user experience and should be implemented by the endpoint
device.
WebRTC endpoints SHOULD include an AEC or some other form of echo
control. On general-purpose platforms (e.g., a PC), it is common for
the analog-to-digital converter (ADC) for audio capture and the
digital-to-analog converter (DAC) for audio playback to use different
clocks. In these cases, such as when a webcam is used for capture
and a separate soundcard is used for playback, the sampling rates are
likely to differ slightly. Endpoint AECs SHOULD be robust to such
conditions, unless they are shipped along with hardware that
guarantees capture and playback to be sampled from the same clock.
Endpoints SHOULD allow the entire AEC and/or the nonlinear processing
(NLP) to be turned off for applications, such as music, that do not
behave well with the spectral attenuation methods typically used in
NLP. Similarly, endpoints SHOULD have the ability to detect the
presence of a headset and disable echo cancellation.
For some applications where the remote endpoint may not have an echo
canceller, the local endpoint MAY include a far-end echo canceller,
but when included, it SHOULD be disabled by default.
<span class="h2"><a class="selflink" id="section-6" href="#section-6">6</a>. Legacy VoIP Interoperability</span>
The codec requirements above will ensure, at a minimum, voice
interoperability capabilities between WebRTC endpoints and legacy
phone systems that support G.711.
<span class="h2"><a class="selflink" id="section-7" href="#section-7">7</a>. Security Considerations</span>
For security considerations regarding the codecs themselves, please
refer to their specifications, including [<a href="./rfc6716" title=""Definition of the Opus Audio Codec"">RFC6716</a>], [<a href="./rfc7587" title=""RTP Payload Format for the Opus Speech and Audio Codec"">RFC7587</a>],
[<a href="./rfc3551" title=""RTP Profile for Audio and Video Conferences with Minimal Control"">RFC3551</a>], [<a href="./rfc3389" title=""Real-time Transport Protocol (RTP) Payload for Comfort Noise (CN)"">RFC3389</a>], and [<a href="./rfc4733" title=""RTP Payload for DTMF Digits, Telephony Tones, and Telephony Signals"">RFC4733</a>]. Likewise, consult the RTP base
specification for RTP-based security considerations. WebRTC security
is further discussed in [<a href="#ref-WebRTC-SEC">WebRTC-SEC</a>], [<a href="#ref-WebRTC-SEC-ARCH">WebRTC-SEC-ARCH</a>], and
[<a href="#ref-WebRTC-RTP-USAGE">WebRTC-RTP-USAGE</a>].
Using the guidelines in [<a href="./rfc6562" title=""Guidelines for the Use of Variable Bit Rate Audio with Secure RTP"">RFC6562</a>], implementers should consider
whether the use of variable bitrate is appropriate for their
application. Encryption and authentication issues are beyond the
scope of this document.
<span class="grey">Valin & Bran Standards Track [Page 5]</span>
<span id="page-6" ></span>
<span class="grey"><a href="./rfc7874">RFC 7874</a> WebRTC Audio May 2016</span>
<span class="h2"><a class="selflink" id="section-8" href="#section-8">8</a>. References</span>
<span class="h3"><a class="selflink" id="section-8.1" href="#section-8.1">8.1</a>. Normative References</span>
[<a id="ref-RFC2119">RFC2119</a>] Bradner, S., "Key words for use in RFCs to Indicate
Requirement Levels", <a href="https://www.rfc-editor.org/bcp/bcp14">BCP 14</a>, <a href="./rfc2119">RFC 2119</a>,
DOI 10.17487/RFC2119, March 1997,
<<a href="https://www.rfc-editor.org/info/rfc2119">http://www.rfc-editor.org/info/rfc2119</a>>.
[<a id="ref-RFC3551">RFC3551</a>] Schulzrinne, H. and S. Casner, "RTP Profile for Audio and
Video Conferences with Minimal Control", STD 65, <a href="./rfc3551">RFC 3551</a>,
DOI 10.17487/RFC3551, July 2003,
<<a href="https://www.rfc-editor.org/info/rfc3551">http://www.rfc-editor.org/info/rfc3551</a>>.
[<a id="ref-RFC3389">RFC3389</a>] Zopf, R., "Real-time Transport Protocol (RTP) Payload for
Comfort Noise (CN)", <a href="./rfc3389">RFC 3389</a>, DOI 10.17487/RFC3389,
September 2002, <<a href="https://www.rfc-editor.org/info/rfc3389">http://www.rfc-editor.org/info/rfc3389</a>>.
[<a id="ref-RFC4733">RFC4733</a>] Schulzrinne, H. and T. Taylor, "RTP Payload for DTMF
Digits, Telephony Tones, and Telephony Signals", <a href="./rfc4733">RFC 4733</a>,
DOI 10.17487/RFC4733, December 2006,
<<a href="https://www.rfc-editor.org/info/rfc4733">http://www.rfc-editor.org/info/rfc4733</a>>.
[<a id="ref-RFC6716">RFC6716</a>] Valin, JM., Vos, K., and T. Terriberry, "Definition of the
Opus Audio Codec", <a href="./rfc6716">RFC 6716</a>, DOI 10.17487/RFC6716,
September 2012, <<a href="https://www.rfc-editor.org/info/rfc6716">http://www.rfc-editor.org/info/rfc6716</a>>.
[<a id="ref-RFC6562">RFC6562</a>] Perkins, C. and JM. Valin, "Guidelines for the Use of
Variable Bit Rate Audio with Secure RTP", <a href="./rfc6562">RFC 6562</a>,
DOI 10.17487/RFC6562, March 2012,
<<a href="https://www.rfc-editor.org/info/rfc6562">http://www.rfc-editor.org/info/rfc6562</a>>.
[<a id="ref-RFC7587">RFC7587</a>] Spittka, J., Vos, K., and JM. Valin, "RTP Payload Format
for the Opus Speech and Audio Codec", <a href="./rfc7587">RFC 7587</a>,
DOI 10.17487/RFC7587, June 2015,
<<a href="https://www.rfc-editor.org/info/rfc7587">http://www.rfc-editor.org/info/rfc7587</a>>.
[<a id="ref-G.711">G.711</a>] ITU-T, "Pulse code modulation (PCM) of voice frequencies",
ITU-T Recommendation G.711, November 1988,
<<a href="http://www.itu.int/rec/T-REC-G.711-198811-I/en">http://www.itu.int/rec/T-REC-G.711-198811-I/en</a>>.
<span class="h3"><a class="selflink" id="section-8.2" href="#section-8.2">8.2</a>. Informative References</span>
[<a id="ref-WebRTC-SEC">WebRTC-SEC</a>]
Rescorla, E., <a style="text-decoration: none" href='https://www.google.com/search?sitesearch=datatracker.ietf.org%2Fdoc%2Fhtml%2F&q=inurl:draft-+%22Security+Considerations+for+WebRTC%22'>"Security Considerations for WebRTC"</a>, Work
in Progress, <a href="./draft-ietf-rtcweb-security-08">draft-ietf-rtcweb-security-08</a>, February 2015.
<span class="grey">Valin & Bran Standards Track [Page 6]</span>
<span id="page-7" ></span>
<span class="grey"><a href="./rfc7874">RFC 7874</a> WebRTC Audio May 2016</span>
[<a id="ref-WebRTC-SEC-ARCH">WebRTC-SEC-ARCH</a>]
Rescorla, E., <a style="text-decoration: none" href='https://www.google.com/search?sitesearch=datatracker.ietf.org%2Fdoc%2Fhtml%2F&q=inurl:draft-+%22WebRTC+Security+Architecture%22'>"WebRTC Security Architecture"</a>, Work in
Progress, <a href="./draft-ietf-rtcweb-security-arch-11">draft-ietf-rtcweb-security-arch-11</a>, March 2015.
[<a id="ref-WebRTC-RTP-USAGE">WebRTC-RTP-USAGE</a>]
Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time
Communication (WebRTC): Media Transport and Use of RTP",
Work in Progress, <a href="./draft-ietf-rtcweb-rtp-usage-26">draft-ietf-rtcweb-rtp-usage-26</a>, March
2016.
[<a id="ref-RFC7875">RFC7875</a>] Proust, S., Ed., "Additional WebRTC Audio Codecs for
Interoperability", <a href="./rfc7875">RFC 7875</a>, DOI 10.17487/RFC7875, May
2016, <<a href="https://www.rfc-editor.org/info/rfc7875">http://www.rfc-editor.org/info/rfc7875</a>>.
Acknowledgements
This document incorporates ideas and text from various other
documents. In particular, we would like to acknowledge, and say
thanks for, work we incorporated from Harald Alvestrand and Cullen
Jennings.
Authors' Addresses
Jean-Marc Valin
Mozilla
331 E. Evelyn Avenue
Mountain View, CA 94041
United States
Email: [email protected]
Cary Bran
Plantronics
345 Encinial Street
Santa Cruz, CA 95060
United States
Phone: +1 206 661-2398
Email: [email protected]
Valin & Bran Standards Track [Page 7]
Annotations
Select text to annotate