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

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc

Issue 1198853004: Add statistics gathering for packet loss. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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
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 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 604 }
605 return 0; 605 return 0;
606 } 606 }
607 607
608 void ModuleRtpRtcpImpl::GetSendStreamDataCounters( 608 void ModuleRtpRtcpImpl::GetSendStreamDataCounters(
609 StreamDataCounters* rtp_counters, 609 StreamDataCounters* rtp_counters,
610 StreamDataCounters* rtx_counters) const { 610 StreamDataCounters* rtx_counters) const {
611 rtp_sender_.GetDataCounters(rtp_counters, rtx_counters); 611 rtp_sender_.GetDataCounters(rtp_counters, rtx_counters);
612 } 612 }
613 613
614 void ModuleRtpRtcpImpl::GetRtpPacketLossStats(
615 struct RtpPacketLossStats* incoming_loss,
616 struct RtpPacketLossStats* outgoing_loss) const {
617 if (incoming_loss) {
618 incoming_loss->single_packet_loss_count =
619 receive_loss_stats_.GetSingleLossCount();
620 incoming_loss->multiple_packet_loss_event_count =
621 receive_loss_stats_.GetMultipleLossEventCount();
622 incoming_loss->multiple_packet_loss_packet_count =
623 receive_loss_stats_.GetMultipleLossPacketCount();
624 }
625 if (outgoing_loss) {
626 outgoing_loss->single_packet_loss_count =
627 send_loss_stats_.GetSingleLossCount();
628 outgoing_loss->multiple_packet_loss_event_count =
629 send_loss_stats_.GetMultipleLossEventCount();
630 outgoing_loss->multiple_packet_loss_packet_count =
631 send_loss_stats_.GetMultipleLossPacketCount();
632 }
633 }
634
614 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) { 635 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) {
615 return rtcp_receiver_.SenderInfoReceived(sender_info); 636 return rtcp_receiver_.SenderInfoReceived(sender_info);
616 } 637 }
617 638
618 // Received RTCP report. 639 // Received RTCP report.
619 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat( 640 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(
620 std::vector<RTCPReportBlock>* receive_blocks) const { 641 std::vector<RTCPReportBlock>* receive_blocks) const {
621 return rtcp_receiver_.StatisticsReceived(receive_blocks); 642 return rtcp_receiver_.StatisticsReceived(receive_blocks);
622 } 643 }
623 644
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 698
678 // Enable or disable a retransmission mode, which decides which packets will 699 // Enable or disable a retransmission mode, which decides which packets will
679 // be retransmitted if NACKed. 700 // be retransmitted if NACKed.
680 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) { 701 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) {
681 return rtp_sender_.SetSelectiveRetransmissions(settings); 702 return rtp_sender_.SetSelectiveRetransmissions(settings);
682 } 703 }
683 704
684 // Send a Negative acknowledgment packet. 705 // Send a Negative acknowledgment packet.
685 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, 706 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
686 const uint16_t size) { 707 const uint16_t size) {
708 for (int i = 0; i < size; ++i) {
709 receive_loss_stats_.AddLostPacket(nack_list[i]);
710 }
687 uint16_t nack_length = size; 711 uint16_t nack_length = size;
688 uint16_t start_id = 0; 712 uint16_t start_id = 0;
689 int64_t now = clock_->TimeInMilliseconds(); 713 int64_t now = clock_->TimeInMilliseconds();
690 if (TimeToSendFullNackList(now)) { 714 if (TimeToSendFullNackList(now)) {
691 nack_last_time_sent_full_ = now; 715 nack_last_time_sent_full_ = now;
692 nack_last_time_sent_full_prev_ = now; 716 nack_last_time_sent_full_prev_ = now;
693 } else { 717 } else {
694 // Only send extended list. 718 // Only send extended list.
695 if (nack_last_seq_number_sent_ == nack_list[size - 1]) { 719 if (nack_last_seq_number_sent_ == nack_list[size - 1]) {
696 // Last sequence number is the same, do not send list. 720 // Last sequence number is the same, do not send list.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 return rtcp_sender_.SendTimeOfSendReport(send_report); 916 return rtcp_sender_.SendTimeOfSendReport(send_report);
893 } 917 }
894 918
895 bool ModuleRtpRtcpImpl::SendTimeOfXrRrReport( 919 bool ModuleRtpRtcpImpl::SendTimeOfXrRrReport(
896 uint32_t mid_ntp, int64_t* time_ms) const { 920 uint32_t mid_ntp, int64_t* time_ms) const {
897 return rtcp_sender_.SendTimeOfXrRrReport(mid_ntp, time_ms); 921 return rtcp_sender_.SendTimeOfXrRrReport(mid_ntp, time_ms);
898 } 922 }
899 923
900 void ModuleRtpRtcpImpl::OnReceivedNACK( 924 void ModuleRtpRtcpImpl::OnReceivedNACK(
901 const std::list<uint16_t>& nack_sequence_numbers) { 925 const std::list<uint16_t>& nack_sequence_numbers) {
926 for (uint16_t nack_sequence_number : nack_sequence_numbers) {
927 send_loss_stats_.AddLostPacket(nack_sequence_number);
928 }
902 if (!rtp_sender_.StorePackets() || 929 if (!rtp_sender_.StorePackets() ||
903 nack_sequence_numbers.size() == 0) { 930 nack_sequence_numbers.size() == 0) {
904 return; 931 return;
905 } 932 }
906 // Use RTT from RtcpRttStats class if provided. 933 // Use RTT from RtcpRttStats class if provided.
907 int64_t rtt = rtt_ms(); 934 int64_t rtt = rtt_ms();
908 if (rtt == 0) { 935 if (rtt == 0) {
909 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); 936 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
910 } 937 }
911 rtp_sender_.OnReceivedNACK(nack_sequence_numbers, rtt); 938 rtp_sender_.OnReceivedNACK(nack_sequence_numbers, rtt);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( 1003 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
977 StreamDataCountersCallback* callback) { 1004 StreamDataCountersCallback* callback) {
978 rtp_sender_.RegisterRtpStatisticsCallback(callback); 1005 rtp_sender_.RegisterRtpStatisticsCallback(callback);
979 } 1006 }
980 1007
981 StreamDataCountersCallback* 1008 StreamDataCountersCallback*
982 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 1009 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
983 return rtp_sender_.GetRtpStatisticsCallback(); 1010 return rtp_sender_.GetRtpStatisticsCallback();
984 } 1011 }
985 } // namespace webrtc 1012 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698