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 13 matching lines...) Expand all Loading... |
24 #ifdef _WIN32 | 24 #ifdef _WIN32 |
25 // Disable warning C4355: 'this' : used in base member initializer list. | 25 // Disable warning C4355: 'this' : used in base member initializer list. |
26 #pragma warning(disable : 4355) | 26 #pragma warning(disable : 4355) |
27 #endif | 27 #endif |
28 | 28 |
29 namespace webrtc { | 29 namespace webrtc { |
30 namespace { | 30 namespace { |
31 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; | 31 const int64_t kRtpRtcpMaxIdleTimeProcessMs = 5; |
32 const int64_t kRtpRtcpRttProcessTimeMs = 1000; | 32 const int64_t kRtpRtcpRttProcessTimeMs = 1000; |
33 const int64_t kRtpRtcpBitrateProcessTimeMs = 10; | 33 const int64_t kRtpRtcpBitrateProcessTimeMs = 10; |
| 34 const int64_t kDefaultExpectedRetransmissionTimeMs = 125; |
34 } // namespace | 35 } // namespace |
35 | 36 |
36 RTPExtensionType StringToRtpExtensionType(const std::string& extension) { | 37 RTPExtensionType StringToRtpExtensionType(const std::string& extension) { |
37 if (extension == RtpExtension::kTimestampOffsetUri) | 38 if (extension == RtpExtension::kTimestampOffsetUri) |
38 return kRtpExtensionTransmissionTimeOffset; | 39 return kRtpExtensionTransmissionTimeOffset; |
39 if (extension == RtpExtension::kAudioLevelUri) | 40 if (extension == RtpExtension::kAudioLevelUri) |
40 return kRtpExtensionAudioLevel; | 41 return kRtpExtensionAudioLevel; |
41 if (extension == RtpExtension::kAbsSendTimeUri) | 42 if (extension == RtpExtension::kAbsSendTimeUri) |
42 return kRtpExtensionAbsoluteSendTime; | 43 return kRtpExtensionAbsoluteSendTime; |
43 if (extension == RtpExtension::kVideoRotationUri) | 44 if (extension == RtpExtension::kVideoRotationUri) |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 const uint8_t* payload_data, | 424 const uint8_t* payload_data, |
424 size_t payload_size, | 425 size_t payload_size, |
425 const RTPFragmentationHeader* fragmentation, | 426 const RTPFragmentationHeader* fragmentation, |
426 const RTPVideoHeader* rtp_video_header, | 427 const RTPVideoHeader* rtp_video_header, |
427 uint32_t* transport_frame_id_out) { | 428 uint32_t* transport_frame_id_out) { |
428 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); | 429 rtcp_sender_.SetLastRtpTime(time_stamp, capture_time_ms); |
429 // Make sure an RTCP report isn't queued behind a key frame. | 430 // Make sure an RTCP report isn't queued behind a key frame. |
430 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { | 431 if (rtcp_sender_.TimeToSendRTCPReport(kVideoFrameKey == frame_type)) { |
431 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); | 432 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpReport); |
432 } | 433 } |
| 434 int64_t expected_retransmission_time_ms = rtt_ms(); |
| 435 if (expected_retransmission_time_ms == 0) { |
| 436 // No rtt available (|kRtpRtcpRttProcessTimeMs| not yet passed?), so try to |
| 437 // poll avg_rtt_ms directly from rtcp receiver. |
| 438 if (rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), nullptr, |
| 439 &expected_retransmission_time_ms, nullptr, |
| 440 nullptr) == -1) { |
| 441 expected_retransmission_time_ms = kDefaultExpectedRetransmissionTimeMs; |
| 442 } |
| 443 } |
433 return rtp_sender_->SendOutgoingData( | 444 return rtp_sender_->SendOutgoingData( |
434 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, | 445 frame_type, payload_type, time_stamp, capture_time_ms, payload_data, |
435 payload_size, fragmentation, rtp_video_header, transport_frame_id_out); | 446 payload_size, fragmentation, rtp_video_header, transport_frame_id_out, |
| 447 expected_retransmission_time_ms); |
436 } | 448 } |
437 | 449 |
438 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, | 450 bool ModuleRtpRtcpImpl::TimeToSendPacket(uint32_t ssrc, |
439 uint16_t sequence_number, | 451 uint16_t sequence_number, |
440 int64_t capture_time_ms, | 452 int64_t capture_time_ms, |
441 bool retransmission, | 453 bool retransmission, |
442 const PacedPacketInfo& pacing_info) { | 454 const PacedPacketInfo& pacing_info) { |
443 return rtp_sender_->TimeToSendPacket(ssrc, sequence_number, capture_time_ms, | 455 return rtp_sender_->TimeToSendPacket(ssrc, sequence_number, capture_time_ms, |
444 retransmission, pacing_info); | 456 retransmission, pacing_info); |
445 } | 457 } |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 StreamDataCountersCallback* | 923 StreamDataCountersCallback* |
912 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 924 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
913 return rtp_sender_->GetRtpStatisticsCallback(); | 925 return rtp_sender_->GetRtpStatisticsCallback(); |
914 } | 926 } |
915 | 927 |
916 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( | 928 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( |
917 const BitrateAllocation& bitrate) { | 929 const BitrateAllocation& bitrate) { |
918 rtcp_sender_.SetVideoBitrateAllocation(bitrate); | 930 rtcp_sender_.SetVideoBitrateAllocation(bitrate); |
919 } | 931 } |
920 } // namespace webrtc | 932 } // namespace webrtc |
OLD | NEW |