From d1ea4c93d33e35ef6552ca4735992e48c602041b Mon Sep 17 00:00:00 2001 From: Minyue Li Date: Thu, 31 Oct 2019 10:59:18 +0100 Subject: [PATCH] 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 Reviewed-by: Johannes Kron Reviewed-by: Henrik Lundin Cr-Commit-Position: refs/heads/master@{#29666} --- .../rtp_rtcp/source/rtp_header_extensions.cc | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/rtp_rtcp/source/rtp_header_extensions.cc b/modules/rtp_rtcp/source/rtp_header_extensions.cc index 6a0d5513bd..e1a30c145e 100644 --- a/modules/rtp_rtcp/source/rtp_header_extensions.cc +++ b/modules/rtp_rtcp/source/rtp_header_extensions.cc @@ -143,16 +143,24 @@ bool AbsoluteCaptureTimeExtension::Write(rtc::ArrayView data, // 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: // -// 0 1 -// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -// | ID | len=0 |V| level | -// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +// 0 1 +// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +// | 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 uint8_t AudioLevel::kValueSizeBytes; constexpr const char AudioLevel::kUri[]; @@ -160,6 +168,7 @@ constexpr const char AudioLevel::kUri[]; bool AudioLevel::Parse(rtc::ArrayView data, bool* voice_activity, uint8_t* audio_level) { + // One-byte and two-byte format share the same data definition. if (data.size() != 1) return false; *voice_activity = (data[0] & 0x80) != 0; @@ -170,6 +179,7 @@ bool AudioLevel::Parse(rtc::ArrayView data, bool AudioLevel::Write(rtc::ArrayView data, bool voice_activity, uint8_t audio_level) { + // One-byte and two-byte format share the same data definition. RTC_DCHECK_EQ(data.size(), 1); RTC_CHECK_LE(audio_level, 0x7f); data[0] = (voice_activity ? 0x80 : 0x00) | audio_level;