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

Side by Side Diff: webrtc/video/vie_receiver.cc

Issue 1740133002: Simplify registration of RTP-header extensions. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: DCHECK video extension availability Created 4 years, 9 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 | « webrtc/video/vie_receiver.h ('k') | 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 rtp_feedback, 45 rtp_feedback,
46 rtp_payload_registry_.get())), 46 rtp_payload_registry_.get())),
47 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), 47 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)),
48 fec_receiver_(FecReceiver::Create(this)), 48 fec_receiver_(FecReceiver::Create(this)),
49 rtp_rtcp_(NULL), 49 rtp_rtcp_(NULL),
50 vcm_(module_vcm), 50 vcm_(module_vcm),
51 remote_bitrate_estimator_(remote_bitrate_estimator), 51 remote_bitrate_estimator_(remote_bitrate_estimator),
52 ntp_estimator_(new RemoteNtpTimeEstimator(clock_)), 52 ntp_estimator_(new RemoteNtpTimeEstimator(clock_)),
53 receiving_(false), 53 receiving_(false),
54 restored_packet_in_use_(false), 54 restored_packet_in_use_(false),
55 receiving_ast_enabled_(false),
56 receiving_cvo_enabled_(false),
57 receiving_tsn_enabled_(false),
58 last_packet_log_ms_(-1) {} 55 last_packet_log_ms_(-1) {}
59 56
60 ViEReceiver::~ViEReceiver() { 57 ViEReceiver::~ViEReceiver() {
61 UpdateHistograms(); 58 UpdateHistograms();
62 } 59 }
63 60
64 void ViEReceiver::UpdateHistograms() { 61 void ViEReceiver::UpdateHistograms() {
65 FecPacketCounter counter = fec_receiver_->GetPacketCounter(); 62 FecPacketCounter counter = fec_receiver_->GetPacketCounter();
66 if (counter.num_packets > 0) { 63 if (counter.num_packets > 0) {
67 RTC_HISTOGRAM_PERCENTAGE( 64 RTC_HISTOGRAM_PERCENTAGE(
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void ViEReceiver::RegisterRtpRtcpModules( 146 void ViEReceiver::RegisterRtpRtcpModules(
150 const std::vector<RtpRtcp*>& rtp_modules) { 147 const std::vector<RtpRtcp*>& rtp_modules) {
151 rtc::CritScope lock(&receive_cs_); 148 rtc::CritScope lock(&receive_cs_);
152 // Only change the "simulcast" modules, the base module can be accessed 149 // Only change the "simulcast" modules, the base module can be accessed
153 // without a lock whereas the simulcast modules require locking as they can be 150 // without a lock whereas the simulcast modules require locking as they can be
154 // changed in runtime. 151 // changed in runtime.
155 rtp_rtcp_simulcast_ = 152 rtp_rtcp_simulcast_ =
156 std::vector<RtpRtcp*>(rtp_modules.begin() + 1, rtp_modules.end()); 153 std::vector<RtpRtcp*>(rtp_modules.begin() + 1, rtp_modules.end());
157 } 154 }
158 155
159 bool ViEReceiver::EnableReceiveTimestampOffset(int id) { 156 void ViEReceiver::EnableReceiveRtpHeaderExtension(const std::string& extension,
160 return rtp_header_parser_->RegisterRtpHeaderExtension( 157 int id) {
161 kRtpExtensionTransmissionTimeOffset, id); 158 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension(
162 } 159 StringToRtpExtensionType(extension), id));
stefan-webrtc 2016/02/26 15:19:18 Verify that this is a valid video extension.
pbos-webrtc 2016/02/26 15:20:48 Done.
163
164 bool ViEReceiver::EnableReceiveAbsoluteSendTime(int id) {
165 if (rtp_header_parser_->RegisterRtpHeaderExtension(
166 kRtpExtensionAbsoluteSendTime, id)) {
167 receiving_ast_enabled_ = true;
168 return true;
169 } else {
170 return false;
171 }
172 }
173
174 bool ViEReceiver::EnableReceiveVideoRotation(int id) {
175 if (rtp_header_parser_->RegisterRtpHeaderExtension(
176 kRtpExtensionVideoRotation, id)) {
177 receiving_cvo_enabled_ = true;
178 return true;
179 } else {
180 return false;
181 }
182 }
183
184 bool ViEReceiver::EnableReceiveTransportSequenceNumber(int id) {
185 if (rtp_header_parser_->RegisterRtpHeaderExtension(
186 kRtpExtensionTransportSequenceNumber, id)) {
187 receiving_tsn_enabled_ = true;
188 return true;
189 } else {
190 return false;
191 }
192 } 160 }
193 161
194 int32_t ViEReceiver::OnReceivedPayloadData(const uint8_t* payload_data, 162 int32_t ViEReceiver::OnReceivedPayloadData(const uint8_t* payload_data,
195 const size_t payload_size, 163 const size_t payload_size,
196 const WebRtcRTPHeader* rtp_header) { 164 const WebRtcRTPHeader* rtp_header) {
197 RTC_DCHECK(vcm_); 165 RTC_DCHECK(vcm_);
198 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; 166 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header;
199 rtp_header_with_ntp.ntp_time_ms = 167 rtp_header_with_ntp.ntp_time_ms =
200 ntp_estimator_->Estimate(rtp_header->header.timestamp); 168 ntp_estimator_->Estimate(rtp_header->header.timestamp);
201 if (vcm_->IncomingPacket(payload_data, 169 if (vcm_->IncomingPacket(payload_data,
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 rtp_receive_statistics_->GetStatistician(header.ssrc); 403 rtp_receive_statistics_->GetStatistician(header.ssrc);
436 if (!statistician) 404 if (!statistician)
437 return false; 405 return false;
438 // Check if this is a retransmission. 406 // Check if this is a retransmission.
439 int64_t min_rtt = 0; 407 int64_t min_rtt = 0;
440 rtp_rtcp_->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL); 408 rtp_rtcp_->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL);
441 return !in_order && 409 return !in_order &&
442 statistician->IsRetransmitOfOldPacket(header, min_rtt); 410 statistician->IsRetransmitOfOldPacket(header, min_rtt);
443 } 411 }
444 } // namespace webrtc 412 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/vie_receiver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698