Update comments on Audio Level RTP header extension.
Bug: None Change-Id: Id9f10ea2236ba4a154cd82f2e2b05e3fa03442f3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/158745 Commit-Queue: Minyue Li <minyue@webrtc.org> Reviewed-by: Johannes Kron <kron@webrtc.org> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29666}
This commit is contained in:
@ -143,7 +143,7 @@ bool AbsoluteCaptureTimeExtension::Write(rtc::ArrayView<uint8_t> data,
|
|||||||
|
|
||||||
// An RTP Header Extension for Client-to-Mixer Audio Level Indication
|
// An RTP Header Extension for Client-to-Mixer Audio Level Indication
|
||||||
//
|
//
|
||||||
// https://datatracker.ietf.org/doc/draft-lennox-avt-rtp-audio-level-exthdr/
|
// https://tools.ietf.org/html/rfc6464
|
||||||
//
|
//
|
||||||
// The form of the audio level extension block:
|
// The form of the audio level extension block:
|
||||||
//
|
//
|
||||||
@ -152,7 +152,15 @@ bool AbsoluteCaptureTimeExtension::Write(rtc::ArrayView<uint8_t> data,
|
|||||||
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
// | ID | len=0 |V| level |
|
// | ID | len=0 |V| level |
|
||||||
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
// Sample Audio Level Encoding Using the One-Byte Header Format
|
||||||
//
|
//
|
||||||
|
// 0 1 2
|
||||||
|
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
|
||||||
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
// | ID | len=1 |V| level |
|
||||||
|
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||||
|
// Sample Audio Level Encoding Using the Two-Byte Header Format
|
||||||
|
|
||||||
constexpr RTPExtensionType AudioLevel::kId;
|
constexpr RTPExtensionType AudioLevel::kId;
|
||||||
constexpr uint8_t AudioLevel::kValueSizeBytes;
|
constexpr uint8_t AudioLevel::kValueSizeBytes;
|
||||||
constexpr const char AudioLevel::kUri[];
|
constexpr const char AudioLevel::kUri[];
|
||||||
@ -160,6 +168,7 @@ constexpr const char AudioLevel::kUri[];
|
|||||||
bool AudioLevel::Parse(rtc::ArrayView<const uint8_t> data,
|
bool AudioLevel::Parse(rtc::ArrayView<const uint8_t> data,
|
||||||
bool* voice_activity,
|
bool* voice_activity,
|
||||||
uint8_t* audio_level) {
|
uint8_t* audio_level) {
|
||||||
|
// One-byte and two-byte format share the same data definition.
|
||||||
if (data.size() != 1)
|
if (data.size() != 1)
|
||||||
return false;
|
return false;
|
||||||
*voice_activity = (data[0] & 0x80) != 0;
|
*voice_activity = (data[0] & 0x80) != 0;
|
||||||
@ -170,6 +179,7 @@ bool AudioLevel::Parse(rtc::ArrayView<const uint8_t> data,
|
|||||||
bool AudioLevel::Write(rtc::ArrayView<uint8_t> data,
|
bool AudioLevel::Write(rtc::ArrayView<uint8_t> data,
|
||||||
bool voice_activity,
|
bool voice_activity,
|
||||||
uint8_t audio_level) {
|
uint8_t audio_level) {
|
||||||
|
// One-byte and two-byte format share the same data definition.
|
||||||
RTC_DCHECK_EQ(data.size(), 1);
|
RTC_DCHECK_EQ(data.size(), 1);
|
||||||
RTC_CHECK_LE(audio_level, 0x7f);
|
RTC_CHECK_LE(audio_level, 0x7f);
|
||||||
data[0] = (voice_activity ? 0x80 : 0x00) | audio_level;
|
data[0] = (voice_activity ? 0x80 : 0x00) | audio_level;
|
||||||
|
Reference in New Issue
Block a user