xref: /aosp_15_r20/external/webrtc/docs/native-code/rtp-hdrext/inband-cn/README.md (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1*d9f75844SAndroid Build Coastguard Worker# Inband Comfort Noise
2*d9f75844SAndroid Build Coastguard Worker
3*d9f75844SAndroid Build Coastguard Worker**Name:** "Inband Comfort Noise" ; "RTP Header Extension to signal inband comfort noise"
4*d9f75844SAndroid Build Coastguard Worker
5*d9f75844SAndroid Build Coastguard Worker**Formal name:** <http://www.webrtc.org/experiments/rtp-hdrext/inband-cn>
6*d9f75844SAndroid Build Coastguard Worker
7*d9f75844SAndroid Build Coastguard Worker**Status:** This extension is defined here to allow for experimentation. Once experience has shown that it is useful, we intend to make a proposal based on it for standardization in the IETF.
8*d9f75844SAndroid Build Coastguard Worker
9*d9f75844SAndroid Build Coastguard Worker## Introduction
10*d9f75844SAndroid Build Coastguard Worker
11*d9f75844SAndroid Build Coastguard WorkerComfort noise \(CN\) is widely used in real time communication, as it significantly reduces the frequency of RTP packets, and thus saves the network bandwidth, when participants in the communication are constantly actively speaking.
12*d9f75844SAndroid Build Coastguard Worker
13*d9f75844SAndroid Build Coastguard WorkerOne way of deploying CN is through \[RFC 3389\]. It defines CN as a special payload, which needs to be encoded and decoded independently from the codec\(s\) applied to active speech signals. This deployment is referred to as outband CN in this context.
14*d9f75844SAndroid Build Coastguard Worker
15*d9f75844SAndroid Build Coastguard WorkerSome codecs, for example RFC 6716: Definition of the Opus Audio Codec, implement their own CN schemes. Basically, the encoder can notify that a CN packet is issued and/or no packet needs to be transmitted.
16*d9f75844SAndroid Build Coastguard Worker
17*d9f75844SAndroid Build Coastguard WorkerSince CN packets have their particularities, cloud and client may need to identify them and treat them differently. Special treatments on CN packets include but are not limited to
18*d9f75844SAndroid Build Coastguard Worker
19*d9f75844SAndroid Build Coastguard Worker* Upon receiving multiple streams of CN packets, choose only one to relay or mix.
20*d9f75844SAndroid Build Coastguard Worker* Adapt jitter buffer wisely according to the discontinuous transmission nature of CN packets.
21*d9f75844SAndroid Build Coastguard Worker
22*d9f75844SAndroid Build Coastguard WorkerWhile RTP packets that contain outband CN can be easily identified as they bear a different payload type, inband CN cannot. Some codecs may be able to extract the information by decoding the packet, but that depends on codec implementation, not even mentioning that decoding packets is not always feasible. This document proposes using an RTP header extension to signal the inband CN.
23*d9f75844SAndroid Build Coastguard Worker
24*d9f75844SAndroid Build Coastguard Worker## RTP header extension format
25*d9f75844SAndroid Build Coastguard Worker
26*d9f75844SAndroid Build Coastguard WorkerThe inband CN extension can be encoded using either the one-byte or two-byte header defined in \[RFC 5285\]. Figures 1 and 2 show encodings with each of these header formats.
27*d9f75844SAndroid Build Coastguard Worker
28*d9f75844SAndroid Build Coastguard Worker     0                   1
29*d9f75844SAndroid Build Coastguard Worker     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
30*d9f75844SAndroid Build Coastguard Worker    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
31*d9f75844SAndroid Build Coastguard Worker    |  ID   | len=0 |N| noise level |
32*d9f75844SAndroid Build Coastguard Worker    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
33*d9f75844SAndroid Build Coastguard Worker
34*d9f75844SAndroid Build Coastguard WorkerFigure 1. Encoding Using the One-Byte Header Format
35*d9f75844SAndroid Build Coastguard Worker
36*d9f75844SAndroid Build Coastguard Worker     0                   1                   2
37*d9f75844SAndroid Build Coastguard Worker     0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
38*d9f75844SAndroid Build Coastguard Worker    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
39*d9f75844SAndroid Build Coastguard Worker    |      ID       |     len=1     |N| noise level |
40*d9f75844SAndroid Build Coastguard Worker    +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
41*d9f75844SAndroid Build Coastguard Worker
42*d9f75844SAndroid Build Coastguard WorkerFigure 2. Encoding Using the Two-Byte Header Format
43*d9f75844SAndroid Build Coastguard Worker
44*d9f75844SAndroid Build Coastguard WorkerNoise level is an optional data. The bit "N" being 1 indicates that there is a noise level. The noise level is defined the same way as the audio level in \[RFC 6464\] and therefore can be used to avoid the Audio Level Header Extension on the same RTP packet. This also means that this level is defined the same as the noise level in \[RFC 3389\] and therfore can be compared against outband CN.
45*d9f75844SAndroid Build Coastguard Worker
46*d9f75844SAndroid Build Coastguard Worker## Further details
47*d9f75844SAndroid Build Coastguard Worker
48*d9f75844SAndroid Build Coastguard WorkerThe existence of this header extension in an RTP packet indicates that it has inband CN, and therefore it will be used sparsely, and results in very small transmission cost.
49*d9f75844SAndroid Build Coastguard Worker
50*d9f75844SAndroid Build Coastguard WorkerThe end receiver can utilize this RTP header extension to get notified about an upcoming discontinuous transmission. This can be useful for its jitter buffer management. This RTP header extension signals comfort noise, it can also be used by audio mixer to mix streams wisely. As an example, it can avoid mixing multiple comfort noises together.
51*d9f75844SAndroid Build Coastguard Worker
52*d9f75844SAndroid Build Coastguard WorkerCloud may have the benefits of this RTP header extension as an end receiver, if it does transcoding. It may also utilize this RTP header extension to prioritize RTP packets if it does packet filtering. In both cases, this RTP header extension should not be encrypted.
53*d9f75844SAndroid Build Coastguard Worker
54*d9f75844SAndroid Build Coastguard Worker## References
55*d9f75844SAndroid Build Coastguard Worker* \[RFC 3389\] Zopf, R., "Real-time Transport Protocol \(RTP\) Payload for Comfort Noise \(CN\)", RFC 3389, September 2002.
56*d9f75844SAndroid Build Coastguard Worker* \[RFC 6465\] Ivov, E., Ed., Marocco, E., Ed., and J. Lennox, "A Real-time Transport Protocol \(RTP\) Header Extension for Mixer-to-Client Audio Level Indication", RFC 6465, December 2011.
57*d9f75844SAndroid Build Coastguard Worker* \[RFC 5285\] Singer, D. and H. Desineni, "A General Mechanism for RTP Header Extensions", RFC 5285, July 2008.
58