OLD | NEW |
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 |
11 #include "webrtc/video/vie_receiver.h" | 11 #include "webrtc/video/vie_receiver.h" |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "webrtc/base/logging.h" | 15 #include "webrtc/base/logging.h" |
| 16 #include "webrtc/config.h" |
16 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 17 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
17 #include "webrtc/modules/rtp_rtcp/include/fec_receiver.h" | 18 #include "webrtc/modules/rtp_rtcp/include/fec_receiver.h" |
18 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" | 19 #include "webrtc/modules/rtp_rtcp/include/receive_statistics.h" |
19 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" | 20 #include "webrtc/modules/rtp_rtcp/include/remote_ntp_time_estimator.h" |
20 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" | 21 #include "webrtc/modules/rtp_rtcp/include/rtp_cvo.h" |
21 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 22 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
22 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" | 23 #include "webrtc/modules/rtp_rtcp/include/rtp_payload_registry.h" |
23 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" | 24 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" |
24 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" | 25 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" |
25 #include "webrtc/modules/video_coding/include/video_coding.h" | 26 #include "webrtc/modules/video_coding/include/video_coding.h" |
(...skipping 19 matching lines...) Expand all Loading... |
45 rtp_feedback, | 46 rtp_feedback, |
46 rtp_payload_registry_.get())), | 47 rtp_payload_registry_.get())), |
47 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), | 48 rtp_receive_statistics_(ReceiveStatistics::Create(clock_)), |
48 fec_receiver_(FecReceiver::Create(this)), | 49 fec_receiver_(FecReceiver::Create(this)), |
49 rtp_rtcp_(NULL), | 50 rtp_rtcp_(NULL), |
50 vcm_(module_vcm), | 51 vcm_(module_vcm), |
51 remote_bitrate_estimator_(remote_bitrate_estimator), | 52 remote_bitrate_estimator_(remote_bitrate_estimator), |
52 ntp_estimator_(new RemoteNtpTimeEstimator(clock_)), | 53 ntp_estimator_(new RemoteNtpTimeEstimator(clock_)), |
53 receiving_(false), | 54 receiving_(false), |
54 restored_packet_in_use_(false), | 55 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) {} | 56 last_packet_log_ms_(-1) {} |
59 | 57 |
60 ViEReceiver::~ViEReceiver() { | 58 ViEReceiver::~ViEReceiver() { |
61 UpdateHistograms(); | 59 UpdateHistograms(); |
62 } | 60 } |
63 | 61 |
64 void ViEReceiver::UpdateHistograms() { | 62 void ViEReceiver::UpdateHistograms() { |
65 FecPacketCounter counter = fec_receiver_->GetPacketCounter(); | 63 FecPacketCounter counter = fec_receiver_->GetPacketCounter(); |
66 if (counter.num_packets > 0) { | 64 if (counter.num_packets > 0) { |
67 RTC_HISTOGRAM_PERCENTAGE( | 65 RTC_HISTOGRAM_PERCENTAGE( |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 void ViEReceiver::RegisterRtpRtcpModules( | 147 void ViEReceiver::RegisterRtpRtcpModules( |
150 const std::vector<RtpRtcp*>& rtp_modules) { | 148 const std::vector<RtpRtcp*>& rtp_modules) { |
151 rtc::CritScope lock(&receive_cs_); | 149 rtc::CritScope lock(&receive_cs_); |
152 // Only change the "simulcast" modules, the base module can be accessed | 150 // 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 | 151 // without a lock whereas the simulcast modules require locking as they can be |
154 // changed in runtime. | 152 // changed in runtime. |
155 rtp_rtcp_simulcast_ = | 153 rtp_rtcp_simulcast_ = |
156 std::vector<RtpRtcp*>(rtp_modules.begin() + 1, rtp_modules.end()); | 154 std::vector<RtpRtcp*>(rtp_modules.begin() + 1, rtp_modules.end()); |
157 } | 155 } |
158 | 156 |
159 bool ViEReceiver::EnableReceiveTimestampOffset(int id) { | 157 void ViEReceiver::EnableReceiveRtpHeaderExtension(const std::string& extension, |
160 return rtp_header_parser_->RegisterRtpHeaderExtension( | 158 int id) { |
161 kRtpExtensionTransmissionTimeOffset, id); | 159 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); |
162 } | 160 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( |
163 | 161 StringToRtpExtensionType(extension), id)); |
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 } | 162 } |
193 | 163 |
194 int32_t ViEReceiver::OnReceivedPayloadData(const uint8_t* payload_data, | 164 int32_t ViEReceiver::OnReceivedPayloadData(const uint8_t* payload_data, |
195 const size_t payload_size, | 165 const size_t payload_size, |
196 const WebRtcRTPHeader* rtp_header) { | 166 const WebRtcRTPHeader* rtp_header) { |
197 RTC_DCHECK(vcm_); | 167 RTC_DCHECK(vcm_); |
198 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; | 168 WebRtcRTPHeader rtp_header_with_ntp = *rtp_header; |
199 rtp_header_with_ntp.ntp_time_ms = | 169 rtp_header_with_ntp.ntp_time_ms = |
200 ntp_estimator_->Estimate(rtp_header->header.timestamp); | 170 ntp_estimator_->Estimate(rtp_header->header.timestamp); |
201 if (vcm_->IncomingPacket(payload_data, | 171 if (vcm_->IncomingPacket(payload_data, |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 rtp_receive_statistics_->GetStatistician(header.ssrc); | 405 rtp_receive_statistics_->GetStatistician(header.ssrc); |
436 if (!statistician) | 406 if (!statistician) |
437 return false; | 407 return false; |
438 // Check if this is a retransmission. | 408 // Check if this is a retransmission. |
439 int64_t min_rtt = 0; | 409 int64_t min_rtt = 0; |
440 rtp_rtcp_->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL); | 410 rtp_rtcp_->RTT(rtp_receiver_->SSRC(), NULL, NULL, &min_rtt, NULL); |
441 return !in_order && | 411 return !in_order && |
442 statistician->IsRetransmitOfOldPacket(header, min_rtt); | 412 statistician->IsRetransmitOfOldPacket(header, min_rtt); |
443 } | 413 } |
444 } // namespace webrtc | 414 } // namespace webrtc |
OLD | NEW |