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

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: Another hopeful Mac build fix Created 5 years, 5 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 bool outgoing,
616 uint32_t ssrc,
617 struct RtpPacketLossStats* loss_stats) const {
618 if (!loss_stats) return;
619 const PacketLossStats* stats_source = NULL;
620 if (outgoing) {
621 if (SSRC() == ssrc) {
622 stats_source = &send_loss_stats_;
623 }
624 } else {
625 if (rtcp_receiver_.RemoteSSRC() == ssrc) {
626 stats_source = &receive_loss_stats_;
627 }
628 }
629 if (stats_source) {
630 loss_stats->single_packet_loss_count =
631 stats_source->GetSingleLossCount();
632 loss_stats->multiple_packet_loss_event_count =
633 stats_source->GetMultipleLossEventCount();
634 loss_stats->multiple_packet_loss_packet_count =
635 stats_source->GetMultipleLossPacketCount();
636 }
637 }
638
614 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) { 639 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(RTCPSenderInfo* sender_info) {
615 return rtcp_receiver_.SenderInfoReceived(sender_info); 640 return rtcp_receiver_.SenderInfoReceived(sender_info);
616 } 641 }
617 642
618 // Received RTCP report. 643 // Received RTCP report.
619 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat( 644 int32_t ModuleRtpRtcpImpl::RemoteRTCPStat(
620 std::vector<RTCPReportBlock>* receive_blocks) const { 645 std::vector<RTCPReportBlock>* receive_blocks) const {
621 return rtcp_receiver_.StatisticsReceived(receive_blocks); 646 return rtcp_receiver_.StatisticsReceived(receive_blocks);
622 } 647 }
623 648
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 702
678 // Enable or disable a retransmission mode, which decides which packets will 703 // Enable or disable a retransmission mode, which decides which packets will
679 // be retransmitted if NACKed. 704 // be retransmitted if NACKed.
680 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) { 705 int ModuleRtpRtcpImpl::SetSelectiveRetransmissions(uint8_t settings) {
681 return rtp_sender_.SetSelectiveRetransmissions(settings); 706 return rtp_sender_.SetSelectiveRetransmissions(settings);
682 } 707 }
683 708
684 // Send a Negative acknowledgment packet. 709 // Send a Negative acknowledgment packet.
685 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list, 710 int32_t ModuleRtpRtcpImpl::SendNACK(const uint16_t* nack_list,
686 const uint16_t size) { 711 const uint16_t size) {
712 for (int i = 0; i < size; ++i) {
713 receive_loss_stats_.AddLostPacket(nack_list[i]);
714 }
687 uint16_t nack_length = size; 715 uint16_t nack_length = size;
688 uint16_t start_id = 0; 716 uint16_t start_id = 0;
689 int64_t now = clock_->TimeInMilliseconds(); 717 int64_t now = clock_->TimeInMilliseconds();
690 if (TimeToSendFullNackList(now)) { 718 if (TimeToSendFullNackList(now)) {
691 nack_last_time_sent_full_ = now; 719 nack_last_time_sent_full_ = now;
692 nack_last_time_sent_full_prev_ = now; 720 nack_last_time_sent_full_prev_ = now;
693 } else { 721 } else {
694 // Only send extended list. 722 // Only send extended list.
695 if (nack_last_seq_number_sent_ == nack_list[size - 1]) { 723 if (nack_last_seq_number_sent_ == nack_list[size - 1]) {
696 // Last sequence number is the same, do not send list. 724 // 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); 920 return rtcp_sender_.SendTimeOfSendReport(send_report);
893 } 921 }
894 922
895 bool ModuleRtpRtcpImpl::SendTimeOfXrRrReport( 923 bool ModuleRtpRtcpImpl::SendTimeOfXrRrReport(
896 uint32_t mid_ntp, int64_t* time_ms) const { 924 uint32_t mid_ntp, int64_t* time_ms) const {
897 return rtcp_sender_.SendTimeOfXrRrReport(mid_ntp, time_ms); 925 return rtcp_sender_.SendTimeOfXrRrReport(mid_ntp, time_ms);
898 } 926 }
899 927
900 void ModuleRtpRtcpImpl::OnReceivedNACK( 928 void ModuleRtpRtcpImpl::OnReceivedNACK(
901 const std::list<uint16_t>& nack_sequence_numbers) { 929 const std::list<uint16_t>& nack_sequence_numbers) {
930 for (uint16_t nack_sequence_number : nack_sequence_numbers) {
931 send_loss_stats_.AddLostPacket(nack_sequence_number);
932 }
902 if (!rtp_sender_.StorePackets() || 933 if (!rtp_sender_.StorePackets() ||
903 nack_sequence_numbers.size() == 0) { 934 nack_sequence_numbers.size() == 0) {
904 return; 935 return;
905 } 936 }
906 // Use RTT from RtcpRttStats class if provided. 937 // Use RTT from RtcpRttStats class if provided.
907 int64_t rtt = rtt_ms(); 938 int64_t rtt = rtt_ms();
908 if (rtt == 0) { 939 if (rtt == 0) {
909 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL); 940 rtcp_receiver_.RTT(rtcp_receiver_.RemoteSSRC(), NULL, &rtt, NULL, NULL);
910 } 941 }
911 rtp_sender_.OnReceivedNACK(nack_sequence_numbers, rtt); 942 rtp_sender_.OnReceivedNACK(nack_sequence_numbers, rtt);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback( 1007 void ModuleRtpRtcpImpl::RegisterSendChannelRtpStatisticsCallback(
977 StreamDataCountersCallback* callback) { 1008 StreamDataCountersCallback* callback) {
978 rtp_sender_.RegisterRtpStatisticsCallback(callback); 1009 rtp_sender_.RegisterRtpStatisticsCallback(callback);
979 } 1010 }
980 1011
981 StreamDataCountersCallback* 1012 StreamDataCountersCallback*
982 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const { 1013 ModuleRtpRtcpImpl::GetSendChannelRtpStatisticsCallback() const {
983 return rtp_sender_.GetRtpStatisticsCallback(); 1014 return rtp_sender_.GetRtpStatisticsCallback();
984 } 1015 }
985 } // namespace webrtc 1016 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698