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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Process RTT if we have received a receiver report and we haven't | 152 // Process RTT if we have received a receiver report and we haven't |
153 // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds. | 153 // processed RTT for at least |kRtpRtcpRttProcessTimeMs| milliseconds. |
154 if (rtcp_receiver_.LastReceivedReceiverReport() > | 154 if (rtcp_receiver_.LastReceivedReceiverReport() > |
155 last_rtt_process_time_ && process_rtt) { | 155 last_rtt_process_time_ && process_rtt) { |
156 std::vector<RTCPReportBlock> receive_blocks; | 156 std::vector<RTCPReportBlock> receive_blocks; |
157 rtcp_receiver_.StatisticsReceived(&receive_blocks); | 157 rtcp_receiver_.StatisticsReceived(&receive_blocks); |
158 int64_t max_rtt = 0; | 158 int64_t max_rtt = 0; |
159 for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin(); | 159 for (std::vector<RTCPReportBlock>::iterator it = receive_blocks.begin(); |
160 it != receive_blocks.end(); ++it) { | 160 it != receive_blocks.end(); ++it) { |
161 int64_t rtt = 0; | 161 int64_t rtt = 0; |
162 rtcp_receiver_.RTT(it->remoteSSRC, &rtt, NULL, NULL, NULL); | 162 rtcp_receiver_.RTT(it->remoteSSRC, &rtt, nullptr, nullptr, nullptr); |
163 max_rtt = (rtt > max_rtt) ? rtt : max_rtt; | 163 max_rtt = (rtt > max_rtt) ? rtt : max_rtt; |
164 } | 164 } |
165 // Report the rtt. | 165 // Report the rtt. |
166 if (rtt_stats_ && max_rtt != 0) | 166 if (rtt_stats_ && max_rtt != 0) |
167 rtt_stats_->OnRttUpdate(max_rtt); | 167 rtt_stats_->OnRttUpdate(max_rtt); |
168 } | 168 } |
169 | 169 |
170 // Verify receiver reports are delivered and the reported sequence number | 170 // Verify receiver reports are delivered and the reported sequence number |
171 // is increasing. | 171 // is increasing. |
172 int64_t rtcp_interval = RtcpReportInterval(); | 172 int64_t rtcp_interval = RtcpReportInterval(); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 StreamDataCounters* rtp_counters, | 555 StreamDataCounters* rtp_counters, |
556 StreamDataCounters* rtx_counters) const { | 556 StreamDataCounters* rtx_counters) const { |
557 rtp_sender_.GetDataCounters(rtp_counters, rtx_counters); | 557 rtp_sender_.GetDataCounters(rtp_counters, rtx_counters); |
558 } | 558 } |
559 | 559 |
560 void ModuleRtpRtcpImpl::GetRtpPacketLossStats( | 560 void ModuleRtpRtcpImpl::GetRtpPacketLossStats( |
561 bool outgoing, | 561 bool outgoing, |
562 uint32_t ssrc, | 562 uint32_t ssrc, |
563 struct RtpPacketLossStats* loss_stats) const { | 563 struct RtpPacketLossStats* loss_stats) const { |
564 if (!loss_stats) return; | 564 if (!loss_stats) return; |
565 const PacketLossStats* stats_source = NULL; | 565 const PacketLossStats* stats_source = nullptr; |
566 if (outgoing) { | 566 if (outgoing) { |
567 if (SSRC() == ssrc) { | 567 if (SSRC() == ssrc) { |
568 stats_source = &send_loss_stats_; | 568 stats_source = &send_loss_stats_; |
569 } | 569 } |
570 } else { | 570 } else { |
571 if (rtcp_receiver_.RemoteSSRC() == ssrc) { | 571 if (rtcp_receiver_.RemoteSSRC() == ssrc) { |
572 stats_source = &receive_loss_stats_; | 572 stats_source = &receive_loss_stats_; |
573 } | 573 } |
574 } | 574 } |
575 if (stats_source) { | 575 if (stats_source) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 void ModuleRtpRtcpImpl::SendNack( | 692 void ModuleRtpRtcpImpl::SendNack( |
693 const std::vector<uint16_t>& sequence_numbers) { | 693 const std::vector<uint16_t>& sequence_numbers) { |
694 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpNack, sequence_numbers.size(), | 694 rtcp_sender_.SendRTCP(GetFeedbackState(), kRtcpNack, sequence_numbers.size(), |
695 sequence_numbers.data()); | 695 sequence_numbers.data()); |
696 } | 696 } |
697 | 697 |
698 bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const { | 698 bool ModuleRtpRtcpImpl::TimeToSendFullNackList(int64_t now) const { |
699 // Use RTT from RtcpRttStats class if provided. | 699 // Use RTT from RtcpRttStats class if provided. |
700 int64_t rtt = rtt_ms(); | 700 int64_t rtt = rtt_ms(); |
701 if (rtt == 0) { | 701 if (rtt == 0) { |
702 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); | 702 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), nullptr, &rtt, nullptr, |
| 703 nullptr); |
703 } | 704 } |
704 | 705 |
705 const int64_t kStartUpRttMs = 100; | 706 const int64_t kStartUpRttMs = 100; |
706 int64_t wait_time = 5 + ((rtt * 3) >> 1); // 5 + RTT * 1.5. | 707 int64_t wait_time = 5 + ((rtt * 3) >> 1); // 5 + RTT * 1.5. |
707 if (rtt == 0) { | 708 if (rtt == 0) { |
708 wait_time = kStartUpRttMs; | 709 wait_time = kStartUpRttMs; |
709 } | 710 } |
710 | 711 |
711 // Send a full NACK list once within every |wait_time|. | 712 // Send a full NACK list once within every |wait_time|. |
712 if (rtt_stats_) { | 713 if (rtt_stats_) { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 for (uint16_t nack_sequence_number : nack_sequence_numbers) { | 837 for (uint16_t nack_sequence_number : nack_sequence_numbers) { |
837 send_loss_stats_.AddLostPacket(nack_sequence_number); | 838 send_loss_stats_.AddLostPacket(nack_sequence_number); |
838 } | 839 } |
839 if (!rtp_sender_.StorePackets() || | 840 if (!rtp_sender_.StorePackets() || |
840 nack_sequence_numbers.size() == 0) { | 841 nack_sequence_numbers.size() == 0) { |
841 return; | 842 return; |
842 } | 843 } |
843 // Use RTT from RtcpRttStats class if provided. | 844 // Use RTT from RtcpRttStats class if provided. |
844 int64_t rtt = rtt_ms(); | 845 int64_t rtt = rtt_ms(); |
845 if (rtt == 0) { | 846 if (rtt == 0) { |
846 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); | 847 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), nullptr, &rtt, nullptr, |
| 848 nullptr); |
847 } | 849 } |
848 rtp_sender_.OnReceivedNack(nack_sequence_numbers, rtt); | 850 rtp_sender_.OnReceivedNack(nack_sequence_numbers, rtt); |
849 } | 851 } |
850 | 852 |
851 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( | 853 void ModuleRtpRtcpImpl::OnReceivedRtcpReportBlocks( |
852 const ReportBlockList& report_blocks) { | 854 const ReportBlockList& report_blocks) { |
853 rtp_sender_.OnReceivedRtcpReportBlocks(report_blocks); | 855 rtp_sender_.OnReceivedRtcpReportBlocks(report_blocks); |
854 } | 856 } |
855 | 857 |
856 bool ModuleRtpRtcpImpl::LastReceivedNTP( | 858 bool ModuleRtpRtcpImpl::LastReceivedNTP( |
857 uint32_t* rtcp_arrival_time_secs, // When we got the last report. | 859 uint32_t* rtcp_arrival_time_secs, // When we got the last report. |
858 uint32_t* rtcp_arrival_time_frac, | 860 uint32_t* rtcp_arrival_time_frac, |
859 uint32_t* remote_sr) const { | 861 uint32_t* remote_sr) const { |
860 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). | 862 // Remote SR: NTP inside the last received (mid 16 bits from sec and frac). |
861 uint32_t ntp_secs = 0; | 863 uint32_t ntp_secs = 0; |
862 uint32_t ntp_frac = 0; | 864 uint32_t ntp_frac = 0; |
863 | 865 |
864 if (!rtcp_receiver_.NTP(&ntp_secs, | 866 if (!rtcp_receiver_.NTP(&ntp_secs, &ntp_frac, rtcp_arrival_time_secs, |
865 &ntp_frac, | 867 rtcp_arrival_time_frac, nullptr)) { |
866 rtcp_arrival_time_secs, | |
867 rtcp_arrival_time_frac, | |
868 NULL)) { | |
869 return false; | 868 return false; |
870 } | 869 } |
871 *remote_sr = | 870 *remote_sr = |
872 ((ntp_secs & 0x0000ffff) << 16) + ((ntp_frac & 0xffff0000) >> 16); | 871 ((ntp_secs & 0x0000ffff) << 16) + ((ntp_frac & 0xffff0000) >> 16); |
873 return true; | 872 return true; |
874 } | 873 } |
875 | 874 |
876 // Called from RTCPsender. | 875 // Called from RTCPsender. |
877 std::vector<rtcp::TmmbItem> ModuleRtpRtcpImpl::BoundingSet(bool* tmmbr_owner) { | 876 std::vector<rtcp::TmmbItem> ModuleRtpRtcpImpl::BoundingSet(bool* tmmbr_owner) { |
878 return rtcp_receiver_.BoundingSet(tmmbr_owner); | 877 return rtcp_receiver_.BoundingSet(tmmbr_owner); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
911 StreamDataCountersCallback* | 910 StreamDataCountersCallback* |
912 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { | 911 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { |
913 return rtp_sender_.GetRtpStatisticsCallback(); | 912 return rtp_sender_.GetRtpStatisticsCallback(); |
914 } | 913 } |
915 | 914 |
916 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( | 915 void ModuleRtpRtcpImpl::SetVideoBitrateAllocation( |
917 const BitrateAllocation& bitrate) { | 916 const BitrateAllocation& bitrate) { |
918 rtcp_sender_.SetVideoBitrateAllocation(bitrate); | 917 rtcp_sender_.SetVideoBitrateAllocation(bitrate); |
919 } | 918 } |
920 } // namespace webrtc | 919 } // namespace webrtc |
OLD | NEW |