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

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

Issue 2795723002: Simplify RTPSender::RegisterRtpHeaderExtension (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 180
181 uint32_t RTPSender::NackOverheadRate() const { 181 uint32_t RTPSender::NackOverheadRate() const {
182 rtc::CritScope cs(&statistics_crit_); 182 rtc::CritScope cs(&statistics_crit_);
183 return nack_bitrate_sent_.Rate(clock_->TimeInMilliseconds()).value_or(0); 183 return nack_bitrate_sent_.Rate(clock_->TimeInMilliseconds()).value_or(0);
184 } 184 }
185 185
186 int32_t RTPSender::RegisterRtpHeaderExtension(RTPExtensionType type, 186 int32_t RTPSender::RegisterRtpHeaderExtension(RTPExtensionType type,
187 uint8_t id) { 187 uint8_t id) {
188 rtc::CritScope lock(&send_critsect_); 188 rtc::CritScope lock(&send_critsect_);
189 switch (type) { 189 return rtp_header_extension_map_.RegisterByType(id, type) ? 0 : -1;
190 case kRtpExtensionVideoRotation:
191 case kRtpExtensionPlayoutDelay:
192 case kRtpExtensionTransmissionTimeOffset:
193 case kRtpExtensionAbsoluteSendTime:
194 case kRtpExtensionAudioLevel:
195 case kRtpExtensionTransportSequenceNumber:
196 return rtp_header_extension_map_.Register(type, id);
197 case kRtpExtensionNone:
198 case kRtpExtensionNumberOfExtensions:
199 LOG(LS_ERROR) << "Invalid RTP extension type for registration.";
200 return -1;
201 }
202 return -1;
203 } 190 }
204 191
205 bool RTPSender::IsRtpHeaderExtensionRegistered(RTPExtensionType type) const { 192 bool RTPSender::IsRtpHeaderExtensionRegistered(RTPExtensionType type) const {
206 rtc::CritScope lock(&send_critsect_); 193 rtc::CritScope lock(&send_critsect_);
207 return rtp_header_extension_map_.IsRegistered(type); 194 return rtp_header_extension_map_.IsRegistered(type);
208 } 195 }
209 196
210 int32_t RTPSender::DeregisterRtpHeaderExtension(RTPExtensionType type) { 197 int32_t RTPSender::DeregisterRtpHeaderExtension(RTPExtensionType type) {
211 rtc::CritScope lock(&send_critsect_); 198 rtc::CritScope lock(&send_critsect_);
212 return rtp_header_extension_map_.Deregister(type); 199 return rtp_header_extension_map_.Deregister(type);
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) { 1257 if (rtp_overhead_bytes_per_packet_ == packet.headers_size()) {
1271 return; 1258 return;
1272 } 1259 }
1273 rtp_overhead_bytes_per_packet_ = packet.headers_size(); 1260 rtp_overhead_bytes_per_packet_ = packet.headers_size();
1274 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_; 1261 overhead_bytes_per_packet = rtp_overhead_bytes_per_packet_;
1275 } 1262 }
1276 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet); 1263 overhead_observer_->OnOverheadChanged(overhead_bytes_per_packet);
1277 } 1264 }
1278 1265
1279 } // namespace webrtc 1266 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698