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

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

Issue 2501893004: Simplify creating RtpHeaderExtensionMap in EventLogAnalyzer (Closed)
Patch Set: Created 4 years, 1 month 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 65
66 RtpHeaderExtensionMap::RtpHeaderExtensionMap() { 66 RtpHeaderExtensionMap::RtpHeaderExtensionMap() {
67 total_values_size_bytes_ = 0; 67 total_values_size_bytes_ = 0;
68 for (auto& type : types_) 68 for (auto& type : types_)
69 type = kInvalidType; 69 type = kInvalidType;
70 for (auto& id : ids_) 70 for (auto& id : ids_)
71 id = kInvalidId; 71 id = kInvalidId;
72 } 72 }
73 73
74 RtpHeaderExtensionMap::RtpHeaderExtensionMap( 74 RtpHeaderExtensionMap::RtpHeaderExtensionMap(
75 std::initializer_list<RtpExtension> extensions) 75 rtc::ArrayView<const RtpExtension> extensions)
76 : RtpHeaderExtensionMap() { 76 : RtpHeaderExtensionMap() {
77 for (const RtpExtension& extension : extensions) 77 for (const RtpExtension& extension : extensions)
78 RegisterByUri(extension.id, extension.uri); 78 RegisterByUri(extension.id, extension.uri);
79 } 79 }
80 80
81 bool RtpHeaderExtensionMap::RegisterByType(uint8_t id, RTPExtensionType type) { 81 bool RtpHeaderExtensionMap::RegisterByType(uint8_t id, RTPExtensionType type) {
82 for (const ExtensionInfo& extension : kExtensions) 82 for (const ExtensionInfo& extension : kExtensions)
83 if (type == extension.type) 83 if (type == extension.type)
84 return Register(id, extension.type, extension.value_size, extension.uri); 84 return Register(id, extension.type, extension.value_size, extension.uri);
85 RTC_NOTREACHED(); 85 RTC_NOTREACHED();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 } 141 }
142 RTC_DCHECK(!IsRegistered(type)); 142 RTC_DCHECK(!IsRegistered(type));
143 143
144 types_[id] = type; 144 types_[id] = type;
145 ids_[type] = id; 145 ids_[type] = id;
146 total_values_size_bytes_ += (value_size + 1); 146 total_values_size_bytes_ += (value_size + 1);
147 return true; 147 return true;
148 } 148 }
149 149
150 } // namespace webrtc 150 } // 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