From 1454669c1d7af844b534b4299b860d3cc889a52d Mon Sep 17 00:00:00 2001 From: danilchap Date: Thu, 1 Dec 2016 08:39:35 -0800 Subject: [PATCH] Cleanup RtpHeaderExtensionMap removing use of two legacy functions BUG=webrtc:1994 Review-Url: https://codereview.webrtc.org/2491273002 Cr-Commit-Position: refs/heads/master@{#15366} --- webrtc/modules/rtp_rtcp/source/rtp_header_extension.h | 5 ----- webrtc/modules/rtp_rtcp/source/rtp_header_parser.cc | 4 ++-- webrtc/modules/rtp_rtcp/source/rtp_utility.cc | 9 +++++---- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h b/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h index 1ec411dbcc..777155b3a6 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h +++ b/webrtc/modules/rtp_rtcp/source/rtp_header_extension.h @@ -77,11 +77,6 @@ class RtpHeaderExtensionMap { return RegisterByType(id, type) ? 0 : -1; } int32_t Deregister(RTPExtensionType type); - int32_t GetType(uint8_t id, RTPExtensionType* type) const { - *type = GetType(id); - return *type == kInvalidType ? -1 : 0; - } - void GetCopy(RtpHeaderExtensionMap* copy) const { *copy = *this; } private: static constexpr uint8_t kMinId = 1; diff --git a/webrtc/modules/rtp_rtcp/source/rtp_header_parser.cc b/webrtc/modules/rtp_rtcp/source/rtp_header_parser.cc index 2cec8a3e0f..ac0aeb1768 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_header_parser.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_header_parser.cc @@ -53,7 +53,7 @@ bool RtpHeaderParserImpl::Parse(const uint8_t* packet, RtpHeaderExtensionMap map; { rtc::CritScope cs(&critical_section_); - rtp_header_extension_map_.GetCopy(&map); + map = rtp_header_extension_map_; } const bool valid_rtpheader = rtp_parser.Parse(header, &map); @@ -66,7 +66,7 @@ bool RtpHeaderParserImpl::Parse(const uint8_t* packet, bool RtpHeaderParserImpl::RegisterRtpHeaderExtension(RTPExtensionType type, uint8_t id) { rtc::CritScope cs(&critical_section_); - return rtp_header_extension_map_.Register(type, id) == 0; + return rtp_header_extension_map_.RegisterByType(id, type); } bool RtpHeaderParserImpl::DeregisterRtpHeaderExtension(RTPExtensionType type) { diff --git a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc index 749539ec03..098fdc88f0 100644 --- a/webrtc/modules/rtp_rtcp/source/rtp_utility.cc +++ b/webrtc/modules/rtp_rtcp/source/rtp_utility.cc @@ -336,8 +336,8 @@ void RtpHeaderParser::ParseOneByteExtensionHeader( return; } - RTPExtensionType type; - if (ptrExtensionMap->GetType(id, &type) != 0) { + RTPExtensionType type = ptrExtensionMap->GetType(id); + if (type == RtpHeaderExtensionMap::kInvalidType) { // If we encounter an unknown extension, just skip over it. LOG(LS_WARNING) << "Failed to find extension id: " << id; } else { @@ -444,8 +444,9 @@ void RtpHeaderParser::ParseOneByteExtensionHeader( max_playout_delay * kPlayoutDelayGranularityMs; break; } - default: { - LOG(LS_WARNING) << "Extension type not implemented: " << type; + case kRtpExtensionNone: + case kRtpExtensionNumberOfExtensions: { + RTC_NOTREACHED() << "Invalid extension type: " << type; return; } }