Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1061)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_header_extension.cc

Issue 2642783006: Move implmentation specific constants out of rtp_header_extension.h (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool RtpHeaderExtensionMap::RegisterByUri(uint8_t id, const std::string& uri) { 89 bool RtpHeaderExtensionMap::RegisterByUri(uint8_t id, const std::string& uri) {
90 for (const ExtensionInfo& extension : kExtensions) 90 for (const ExtensionInfo& extension : kExtensions)
91 if (uri == extension.uri) 91 if (uri == extension.uri)
92 return Register(id, extension.type, extension.value_size, extension.uri); 92 return Register(id, extension.type, extension.value_size, extension.uri);
93 LOG(LS_WARNING) << "Unknown extension uri:'" << uri 93 LOG(LS_WARNING) << "Unknown extension uri:'" << uri
94 << "', id: " << static_cast<int>(id) << '.'; 94 << "', id: " << static_cast<int>(id) << '.';
95 return false; 95 return false;
96 } 96 }
97 97
98 size_t RtpHeaderExtensionMap::GetTotalLengthInBytes() const { 98 size_t RtpHeaderExtensionMap::GetTotalLengthInBytes() const {
99 static constexpr size_t kRtpOneByteHeaderLength = 4;
99 if (total_values_size_bytes_ == 0) 100 if (total_values_size_bytes_ == 0)
100 return 0; 101 return 0;
101 return Word32Align(kRtpOneByteHeaderLength + total_values_size_bytes_); 102 return Word32Align(kRtpOneByteHeaderLength + total_values_size_bytes_);
102 } 103 }
103 104
104 int32_t RtpHeaderExtensionMap::Deregister(RTPExtensionType type) { 105 int32_t RtpHeaderExtensionMap::Deregister(RTPExtensionType type) {
105 if (IsRegistered(type)) { 106 if (IsRegistered(type)) {
106 uint8_t id = GetId(type); 107 uint8_t id = GetId(type);
107 total_values_size_bytes_ -= (ValueSize(type) + 1); 108 total_values_size_bytes_ -= (ValueSize(type) + 1);
108 types_[id] = kInvalidType; 109 types_[id] = kInvalidType;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 142 }
142 RTC_DCHECK(!IsRegistered(type)); 143 RTC_DCHECK(!IsRegistered(type));
143 144
144 types_[id] = type; 145 types_[id] = type;
145 ids_[type] = id; 146 ids_[type] = id;
146 total_values_size_bytes_ += (value_size + 1); 147 total_values_size_bytes_ += (value_size + 1);
147 return true; 148 return true;
148 } 149 }
149 150
150 } // namespace webrtc 151 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_header_extension.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_header_extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698