RFC 7874

WebRTC Audio Codec and Processing Requirements

πŸ“… published May 2016, from ietf

RFC 7874: WebRTC Audio Codec and Processing Requirements πŸŽ€

okay bestie, this one is a Standards Track doc from the IETF, published in May 2016 ✨ It's by JM. Valin (Mozilla) and C. Bran (Plantronics), it's RFC 7874, and its ISSN is 2070-1721. The header doesn't list any RFCs it obsoletes or updates, so it's standing on its own πŸ’…

Abstract

this doc outlines the audio codec and processing requirements for WebRTC endpoints 🎧

Status of This Memo

this is an Internet Standards Track document 🌸

it's a product of the Internet Engineering Task Force (IETF), so it represents the consensus of the IETF community. it got public review and was approved for publication by the Internet Engineering Steering Group (IESG). more info on Internet Standards is in Section 2 of RFC 5741 πŸ“–

for the current status, any errata, and how to give feedback, check http://www.rfc-editor.org/info/rfc7874


Copyright (c) 2016 IETF Trust and the persons identified as the document authors. All rights reserved. πŸ’œ

this document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) as in effect on the date of publication. please read these carefully, because they describe your rights and restrictions for 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 they come without warranty as described in the Simplified BSD License πŸ™ˆ

Table of Contents 🧚

1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
2.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   2
3.  Codec Requirements  . . . . . . . . . . . . . . . . . . . . .   2
4.  Audio Level . . . . . . . . . . . . . . . . . . . . . . . . .   4
5.  Acoustic Echo Cancellation (AEC)  . . . . . . . . . . . . . .   4
6.  Legacy VoIP Interoperability  . . . . . . . . . . . . . . . .   5
7.  Security Considerations . . . . . . . . . . . . . . . . . . .   5
8.  References  . . . . . . . . . . . . . . . . . . . . . . . . .   6
  8.1.  Normative References  . . . . . . . . . . . . . . . . . .   6
  8.2.  Informative References  . . . . . . . . . . . . . . . . .   6
Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .   7
Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .   7

1. Introduction ✨

okay so the whole success of Web Real-Time Communications (WebRTC) depends a lot on voice and video actually working between different WebRTC apps 🫢 this spec lays out the audio processing and codec requirements for WebRTC endpoints.

2. Terminology πŸ“š

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 RFC 2119 [RFC2119] πŸ’…

3. Codec Requirements πŸŽ€

to get a baseline level of interoperability between WebRTC endpoints (main character energy for everyone), there's a minimum set of required codecs listed below. if there are other suitable audio codecs the endpoint can use, it is RECOMMENDED that they also be included in the offer, so the session can get set up without the need for audio transcoding πŸ¦‹

WebRTC endpoints are REQUIRED to implement the following audio codecs:

  • Opus [RFC6716] with the payload format specified in [RFC7587].
  • PCMA and PCMU (as specified in ITU-T Recommendation G.711 [G.711]) with the payload format specified in Section 4.5.14 of [RFC3551].
  • [RFC3389] comfort noise (CN). WebRTC endpoints MUST support [RFC3389] CN for streams encoded with G.711 or any other supported codec that does not provide its own CN. since Opus has its own CN mechanism, using [RFC3389] CN with Opus is NOT RECOMMENDED πŸ™ˆ Use of Discontinuous Transmission (DTX) / CN by senders is OPTIONAL.
  • the 'audio/telephone-event' media type as specified in [RFC4733]. 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 RFC 4733) 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 RFC 4733). WebRTC endpoints are REQUIRED to be able to generate and consume the following events:
+------------+--------------------------------+-----------+
|Event Code  | Event Name                     | Reference |
+------------+--------------------------------+-----------+
| 0          | DTMF digit "0"                 | [RFC4733] |
| 1          | DTMF digit "1"                 | [RFC4733] |
| 2          | DTMF digit "2"                 | [RFC4733] |
| 3          | DTMF digit "3"                 | [RFC4733] |
| 4          | DTMF digit "4"                 | [RFC4733] |
| 5          | DTMF digit "5"                 | [RFC4733] |
| 6          | DTMF digit "6"                 | [RFC4733] |
| 7          | DTMF digit "7"                 | [RFC4733] |
| 8          | DTMF digit "8"                 | [RFC4733] |
| 9          | DTMF digit "9"                 | [RFC4733] |
| 10         | DTMF digit "*"                 | [RFC4733] |
| 11         | DTMF digit "#"                 | [RFC4733] |
| 12         | DTMF digit "A"                 | [RFC4733] |
| 13         | DTMF digit "B"                 | [RFC4733] |
| 14         | DTMF digit "C"                 | [RFC4733] |
| 15         | DTMF digit "D"                 | [RFC4733] |
+------------+--------------------------------+-----------+

for any endpoint that can 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 🌈

for more on implementing codecs other than the mandatory-to-implement ones listed above, check [RFC7875] 🧚

4. Audio Level πŸ”Š

it's desirable to standardize the "on the wire" audio level for speech transmission, so users don't have to manually adjust playback and mixing in conferencing apps stays smooth ✨ it's also desirable to be consistent with ITU-T Recommendations G.169 and G.115, which recommend an active audio level of -19 dBm0. but unlike G.169 and G.115, WebRTC audio isn't constrained to a passband specified by G.712. it can be sampled at any rate from 8 to 48 kHz and higher. so 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 by using 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 (typical for a regular phone), then it is RECOMMENDED that the gain be adjusted so an average speaker has a level of 2600 (-19 dBm0) for active speech 🎧 if the endpoint does NOT have control over the entire audio capture (typical 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 apps, 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's common for the audio output on some devices to be "calibrated" for playing back pre-recorded "commercial" music, which is usually around 12 dB louder than the level recommended in this section. because of that, endpoints MAY increase the gain before playback πŸ”₯

5. Acoustic Echo Cancellation (AEC) πŸŽ™οΈ

it's plausible that the dominant near-to-medium-term WebRTC usage will be people using interactive audio and video to talk to each other in web browsers on a notebook with a built-in mic and speakers. the notebook-as-communication-device setup presents challenging echo cancellation problems, and the specific fix won't be mandated here. still, even though no specific algorithm or standard is required of 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 (a PC, for example), it's common for the analog-to-digital converter (ADC) for capture and the digital-to-analog converter (DAC) for playback to use different clocks. this happens when, say, a webcam is used for capture and a separate soundcard for playback, and then the sampling rates are likely to differ slightly 🌸 Endpoint AECs SHOULD be robust to such conditions, unless they ship with hardware that guarantees capture and playback are sampled from the same clock.

Endpoints SHOULD allow the entire AEC and/or the nonlinear processing (NLP) to be turned off for apps, such as music, that don't 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 it does, it SHOULD be disabled by default πŸ™ˆ

6. Legacy VoIP Interoperability πŸ“ž

the codec requirements above will ensure, at a minimum, voice interoperability between WebRTC endpoints and legacy phone systems that support G.711 🫢

7. Security Considerations πŸ”

for security considerations about the codecs themselves, please refer to their specifications, including [RFC6716], [RFC7587], [RFC3551], [RFC3389], and [RFC4733]. likewise, check the RTP base specification for RTP-based security considerations. WebRTC security is discussed further in [WebRTC-SEC], [WebRTC-SEC-ARCH], and [WebRTC-RTP-USAGE] πŸ’€

using the guidelines in [RFC6562], implementers should consider whether variable bitrate is appropriate for their application. Encryption and authentication issues are beyond the scope of this document πŸ”

8. References πŸ“š

8.1. Normative References πŸ“š

okay bestie, these are the docs you need to read before this one makes sense 🫢

8.2. Informative References 🌸

these ones are extra reading, lowkey super useful if you wanna go deeper 🧚

  • [WebRTC-SEC] Rescorla, E., "Security Considerations for WebRTC", Work in Progress, draft-ietf-rtcweb-security-08, February 2015.
  • [WebRTC-SEC-ARCH] Rescorla, E., "WebRTC Security Architecture", Work in Progress, draft-ietf-rtcweb-security-arch-11, March 2015.
  • [WebRTC-RTP-USAGE] Perkins, C., Westerlund, M., and J. Ott, "Web Real-Time Communication (WebRTC): Media Transport and Use of RTP", Work in Progress, draft-ietf-rtcweb-rtp-usage-26, March 2016.
  • [RFC7875] Proust, S., Ed., "Additional WebRTC Audio Codecs for Interoperability", RFC 7875, DOI 10.17487/RFC7875, May 2016, <http://www.rfc-editor.org/info/rfc7875>.

Acknowledgements πŸ’–

this doc is a little mashup of ideas and text from other docs, so big thank yous 🫢 we especially want to shout out Harald Alvestrand and Cullen Jennings for the work we pulled in from them. they're iconic, periodt ✨

Authors' Addresses πŸŽ€

meet the authors, bestie πŸ‘‘

Jean-Marc Valin
Mozilla
331 E. Evelyn Avenue
Mountain View, CA  94041
United States

Email: jmvalin@jmvalin.ca


Cary Bran
Plantronics
345 Encinial Street
Santa Cruz, CA  95060
United States

Phone: +1 206 661-2398
Email: cary.bran@plantronics.com
πŸ“¦ where this page comes from