| 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 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 uint32_t ViEReceiver::GetRemoteSsrc() const { | 119 uint32_t ViEReceiver::GetRemoteSsrc() const { |
| 120 return rtp_receiver_->SSRC(); | 120 return rtp_receiver_->SSRC(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 int ViEReceiver::GetCsrcs(uint32_t* csrcs) const { | 123 int ViEReceiver::GetCsrcs(uint32_t* csrcs) const { |
| 124 return rtp_receiver_->CSRCs(csrcs); | 124 return rtp_receiver_->CSRCs(csrcs); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void ViEReceiver::Init(const std::vector<RtpRtcp*>& modules) { | 127 void ViEReceiver::Init(RtpRtcp* rtp_rtcp) { |
| 128 rtp_rtcp_ = modules; | 128 rtp_rtcp_ = rtp_rtcp; |
| 129 } | 129 } |
| 130 | 130 |
| 131 RtpReceiver* ViEReceiver::GetRtpReceiver() const { | 131 RtpReceiver* ViEReceiver::GetRtpReceiver() const { |
| 132 return rtp_receiver_.get(); | 132 return rtp_receiver_.get(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void ViEReceiver::EnableReceiveRtpHeaderExtension(const std::string& extension, | 135 void ViEReceiver::EnableReceiveRtpHeaderExtension(const std::string& extension, |
| 136 int id) { | 136 int id) { |
| 137 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); | 137 RTC_DCHECK(RtpExtension::IsSupportedForVideo(extension)); |
| 138 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( | 138 RTC_CHECK(rtp_header_parser_->RegisterRtpHeaderExtension( |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 rtp_header.type.Video.rotation = kVideoRotation_0; | 311 rtp_header.type.Video.rotation = kVideoRotation_0; |
| 312 if (header.extension.hasVideoRotation) { | 312 if (header.extension.hasVideoRotation) { |
| 313 rtp_header.type.Video.rotation = | 313 rtp_header.type.Video.rotation = |
| 314 ConvertCVOByteToVideoRotation(header.extension.videoRotation); | 314 ConvertCVOByteToVideoRotation(header.extension.videoRotation); |
| 315 } | 315 } |
| 316 OnReceivedPayloadData(nullptr, 0, &rtp_header); | 316 OnReceivedPayloadData(nullptr, 0, &rtp_header); |
| 317 } | 317 } |
| 318 | 318 |
| 319 bool ViEReceiver::DeliverRtcp(const uint8_t* rtcp_packet, | 319 bool ViEReceiver::DeliverRtcp(const uint8_t* rtcp_packet, |
| 320 size_t rtcp_packet_length) { | 320 size_t rtcp_packet_length) { |
| 321 // Should be set by owner at construction time. | |
| 322 RTC_DCHECK(!rtp_rtcp_.empty()); | |
| 323 { | 321 { |
| 324 rtc::CritScope lock(&receive_cs_); | 322 rtc::CritScope lock(&receive_cs_); |
| 325 if (!receiving_) { | 323 if (!receiving_) { |
| 326 return false; | 324 return false; |
| 327 } | 325 } |
| 328 } | 326 } |
| 329 | 327 |
| 330 for (RtpRtcp* rtp_rtcp : rtp_rtcp_) | 328 rtp_rtcp_->IncomingRtcpPacket(rtcp_packet, rtcp_packet_length); |
| 331 rtp_rtcp->IncomingRtcpPacket(rtcp_packet, rtcp_packet_length); | |
| 332 | 329 |
| 333 int64_t rtt = 0; | 330 int64_t rtt = 0; |
| 334 rtp_rtcp_[0]->RTT(rtp_receiver_->SSRC(), &rtt, nullptr, nullptr, nullptr); | 331 rtp_rtcp_->RTT(rtp_receiver_->SSRC(), &rtt, nullptr, nullptr, nullptr); |
| 335 if (rtt == 0) { | 332 if (rtt == 0) { |
| 336 // Waiting for valid rtt. | 333 // Waiting for valid rtt. |
| 337 return true; | 334 return true; |
| 338 } | 335 } |
| 339 uint32_t ntp_secs = 0; | 336 uint32_t ntp_secs = 0; |
| 340 uint32_t ntp_frac = 0; | 337 uint32_t ntp_frac = 0; |
| 341 uint32_t rtp_timestamp = 0; | 338 uint32_t rtp_timestamp = 0; |
| 342 if (rtp_rtcp_[0]->RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr, | 339 if (rtp_rtcp_->RemoteNTP(&ntp_secs, &ntp_frac, nullptr, nullptr, |
| 343 &rtp_timestamp) != 0) { | 340 &rtp_timestamp) != 0) { |
| 344 // Waiting for RTCP. | 341 // Waiting for RTCP. |
| 345 return true; | 342 return true; |
| 346 } | 343 } |
| 347 ntp_estimator_.UpdateRtcpTimestamp(rtt, ntp_secs, ntp_frac, rtp_timestamp); | 344 ntp_estimator_.UpdateRtcpTimestamp(rtt, ntp_secs, ntp_frac, rtp_timestamp); |
| 348 | 345 |
| 349 return true; | 346 return true; |
| 350 } | 347 } |
| 351 | 348 |
| 352 void ViEReceiver::StartReceive() { | 349 void ViEReceiver::StartReceive() { |
| 353 rtc::CritScope lock(&receive_cs_); | 350 rtc::CritScope lock(&receive_cs_); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 375 bool in_order) const { | 372 bool in_order) const { |
| 376 // Retransmissions are handled separately if RTX is enabled. | 373 // Retransmissions are handled separately if RTX is enabled. |
| 377 if (rtp_payload_registry_.RtxEnabled()) | 374 if (rtp_payload_registry_.RtxEnabled()) |
| 378 return false; | 375 return false; |
| 379 StreamStatistician* statistician = | 376 StreamStatistician* statistician = |
| 380 rtp_receive_statistics_->GetStatistician(header.ssrc); | 377 rtp_receive_statistics_->GetStatistician(header.ssrc); |
| 381 if (!statistician) | 378 if (!statistician) |
| 382 return false; | 379 return false; |
| 383 // Check if this is a retransmission. | 380 // Check if this is a retransmission. |
| 384 int64_t min_rtt = 0; | 381 int64_t min_rtt = 0; |
| 385 rtp_rtcp_[0]->RTT(rtp_receiver_->SSRC(), nullptr, nullptr, &min_rtt, nullptr); | 382 rtp_rtcp_->RTT(rtp_receiver_->SSRC(), nullptr, nullptr, &min_rtt, nullptr); |
| 386 return !in_order && | 383 return !in_order && |
| 387 statistician->IsRetransmitOfOldPacket(header, min_rtt); | 384 statistician->IsRetransmitOfOldPacket(header, min_rtt); |
| 388 } | 385 } |
| 389 } // namespace webrtc | 386 } // namespace webrtc |
| OLD | NEW |