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/video/vie_channel.cc

Issue 1669623004: Use CallStats for RTT in Call, rather than VideoSendStream::GetRtt() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Cleanup Created 4 years, 10 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
« webrtc/video/vie_channel.h ('K') | « webrtc/video/vie_channel.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 14 matching lines...) Expand all
25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h" 25 #include "webrtc/modules/rtp_rtcp/include/rtp_receiver.h"
26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h" 26 #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp.h"
27 #include "webrtc/modules/utility/include/process_thread.h" 27 #include "webrtc/modules/utility/include/process_thread.h"
28 #include "webrtc/modules/video_coding/include/video_coding.h" 28 #include "webrtc/modules/video_coding/include/video_coding.h"
29 #include "webrtc/modules/video_processing/include/video_processing.h" 29 #include "webrtc/modules/video_processing/include/video_processing.h"
30 #include "webrtc/modules/video_render/video_render_defines.h" 30 #include "webrtc/modules/video_render/video_render_defines.h"
31 #include "webrtc/system_wrappers/include/metrics.h" 31 #include "webrtc/system_wrappers/include/metrics.h"
32 #include "webrtc/video/call_stats.h" 32 #include "webrtc/video/call_stats.h"
33 #include "webrtc/video/payload_router.h" 33 #include "webrtc/video/payload_router.h"
34 #include "webrtc/video/receive_statistics_proxy.h" 34 #include "webrtc/video/receive_statistics_proxy.h"
35 #include "webrtc/video/report_block_stats.h" 35 #include "webrtc/video/report_block_stats.h"
åsapersson 2016/02/05 13:50:12 remove
sprang 2016/02/05 14:10:22 Done.
36 36
37 namespace webrtc { 37 namespace webrtc {
38 38
39 const int kMaxDecodeWaitTimeMs = 50; 39 const int kMaxDecodeWaitTimeMs = 50;
40 static const int kMaxTargetDelayMs = 10000; 40 static const int kMaxTargetDelayMs = 10000;
41 const int kMinSendSidePacketHistorySize = 600; 41 const int kMinSendSidePacketHistorySize = 600;
42 const int kMaxPacketAgeToNack = 450; 42 const int kMaxPacketAgeToNack = 450;
43 const int kMaxNackListSize = 250; 43 const int kMaxNackListSize = 250;
44 44
45 // Helper class receiving statistics callbacks. 45 // Helper class receiving statistics callbacks.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 intra_frame_observer_(intra_frame_observer), 105 intra_frame_observer_(intra_frame_observer),
106 rtt_stats_(rtt_stats), 106 rtt_stats_(rtt_stats),
107 paced_sender_(paced_sender), 107 paced_sender_(paced_sender),
108 packet_router_(packet_router), 108 packet_router_(packet_router),
109 bandwidth_observer_(bandwidth_observer), 109 bandwidth_observer_(bandwidth_observer),
110 transport_feedback_observer_(transport_feedback_observer), 110 transport_feedback_observer_(transport_feedback_observer),
111 decode_thread_(ChannelDecodeThreadFunction, this, "DecodingThread"), 111 decode_thread_(ChannelDecodeThreadFunction, this, "DecodingThread"),
112 nack_history_size_sender_(kMinSendSidePacketHistorySize), 112 nack_history_size_sender_(kMinSendSidePacketHistorySize),
113 max_nack_reordering_threshold_(kMaxPacketAgeToNack), 113 max_nack_reordering_threshold_(kMaxPacketAgeToNack),
114 pre_render_callback_(NULL), 114 pre_render_callback_(NULL),
115 report_block_stats_sender_(new ReportBlockStats()),
116 time_of_first_rtt_ms_(-1), 115 time_of_first_rtt_ms_(-1),
117 rtt_sum_ms_(0), 116 rtt_sum_ms_(0),
118 last_rtt_ms_(0), 117 last_rtt_ms_(0),
119 num_rtts_(0), 118 num_rtts_(0),
120 rtp_rtcp_modules_( 119 rtp_rtcp_modules_(
121 CreateRtpRtcpModules(!sender, 120 CreateRtpRtcpModules(!sender,
122 vie_receiver_.GetReceiveStatistics(), 121 vie_receiver_.GetReceiveStatistics(),
123 transport, 122 transport,
124 intra_frame_observer_, 123 intra_frame_observer_,
125 bandwidth_observer_.get(), 124 bandwidth_observer_.get(),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 rtcp_counter.nack_packets * 60 / elapsed_sec); 212 rtcp_counter.nack_packets * 60 / elapsed_sec);
214 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute", 213 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute",
215 rtcp_counter.fir_packets * 60 / elapsed_sec); 214 rtcp_counter.fir_packets * 60 / elapsed_sec);
216 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute", 215 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute",
217 rtcp_counter.pli_packets * 60 / elapsed_sec); 216 rtcp_counter.pli_packets * 60 / elapsed_sec);
218 if (rtcp_counter.nack_requests > 0) { 217 if (rtcp_counter.nack_requests > 0) {
219 RTC_HISTOGRAM_PERCENTAGE( 218 RTC_HISTOGRAM_PERCENTAGE(
220 "WebRTC.Video.UniqueNackRequestsReceivedInPercent", 219 "WebRTC.Video.UniqueNackRequestsReceivedInPercent",
221 rtcp_counter.UniqueNackRequestsInPercent()); 220 rtcp_counter.UniqueNackRequestsInPercent());
222 } 221 }
223 int fraction_lost = report_block_stats_sender_->FractionLostInPercent();
224 if (fraction_lost != -1) {
225 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.SentPacketsLostInPercent",
226 fraction_lost);
227 }
228 } 222 }
229 223
230 StreamDataCounters rtp; 224 StreamDataCounters rtp;
231 StreamDataCounters rtx; 225 StreamDataCounters rtx;
232 GetSendStreamDataCounters(&rtp, &rtx); 226 GetSendStreamDataCounters(&rtp, &rtx);
233 StreamDataCounters rtp_rtx = rtp; 227 StreamDataCounters rtp_rtx = rtp;
234 rtp_rtx.Add(rtx); 228 rtp_rtx.Add(rtx);
235 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs( 229 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(
236 Clock::GetRealTimeClock()->TimeInMilliseconds()) / 230 Clock::GetRealTimeClock()->TimeInMilliseconds()) /
237 1000; 231 1000;
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 int32_t ViEChannel::SetRTCPCName(const char* rtcp_cname) { 719 int32_t ViEChannel::SetRTCPCName(const char* rtcp_cname) {
726 RTC_DCHECK(!rtp_rtcp_modules_[0]->Sending()); 720 RTC_DCHECK(!rtp_rtcp_modules_[0]->Sending());
727 return rtp_rtcp_modules_[0]->SetCNAME(rtcp_cname); 721 return rtp_rtcp_modules_[0]->SetCNAME(rtcp_cname);
728 } 722 }
729 723
730 int32_t ViEChannel::GetRemoteRTCPCName(char rtcp_cname[]) { 724 int32_t ViEChannel::GetRemoteRTCPCName(char rtcp_cname[]) {
731 uint32_t remoteSSRC = vie_receiver_.GetRemoteSsrc(); 725 uint32_t remoteSSRC = vie_receiver_.GetRemoteSsrc();
732 return rtp_rtcp_modules_[0]->RemoteCNAME(remoteSSRC, rtcp_cname); 726 return rtp_rtcp_modules_[0]->RemoteCNAME(remoteSSRC, rtcp_cname);
733 } 727 }
734 728
735 int32_t ViEChannel::GetSendRtcpStatistics(uint16_t* fraction_lost,
736 uint32_t* cumulative_lost,
737 uint32_t* extended_max,
738 uint32_t* jitter_samples,
739 int64_t* rtt_ms) {
740 // Aggregate the report blocks associated with streams sent on this channel.
741 std::vector<RTCPReportBlock> report_blocks;
742 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
743 rtp_rtcp->RemoteRTCPStat(&report_blocks);
744
745 if (report_blocks.empty())
746 return -1;
747
748 uint32_t remote_ssrc = vie_receiver_.GetRemoteSsrc();
749 std::vector<RTCPReportBlock>::const_iterator it = report_blocks.begin();
750 for (; it != report_blocks.end(); ++it) {
751 if (it->remoteSSRC == remote_ssrc)
752 break;
753 }
754 if (it == report_blocks.end()) {
755 // We have not received packets with an SSRC matching the report blocks. To
756 // have a chance of calculating an RTT we will try with the SSRC of the
757 // first report block received.
758 // This is very important for send-only channels where we don't know the
759 // SSRC of the other end.
760 remote_ssrc = report_blocks[0].remoteSSRC;
761 }
762
763 // TODO(asapersson): Change report_block_stats to not rely on
764 // GetSendRtcpStatistics to be called.
765 RTCPReportBlock report =
766 report_block_stats_sender_->AggregateAndStore(report_blocks);
767 *fraction_lost = report.fractionLost;
768 *cumulative_lost = report.cumulativeLost;
769 *extended_max = report.extendedHighSeqNum;
770 *jitter_samples = report.jitter;
771
772 int64_t dummy;
773 int64_t rtt = 0;
774 if (rtp_rtcp_modules_[0]->RTT(remote_ssrc, &rtt, &dummy, &dummy, &dummy) !=
775 0) {
776 return -1;
777 }
778 *rtt_ms = rtt;
779 return 0;
780 }
781
782 void ViEChannel::RegisterSendChannelRtcpStatisticsCallback( 729 void ViEChannel::RegisterSendChannelRtcpStatisticsCallback(
783 RtcpStatisticsCallback* callback) { 730 RtcpStatisticsCallback* callback) {
784 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) 731 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_)
785 rtp_rtcp->RegisterRtcpStatisticsCallback(callback); 732 rtp_rtcp->RegisterRtcpStatisticsCallback(callback);
786 } 733 }
787 734
788 void ViEChannel::RegisterReceiveChannelRtcpStatisticsCallback( 735 void ViEChannel::RegisterReceiveChannelRtcpStatisticsCallback(
789 RtcpStatisticsCallback* callback) { 736 RtcpStatisticsCallback* callback) {
790 vie_receiver_.GetReceiveStatistics()->RegisterRtcpStatisticsCallback( 737 vie_receiver_.GetReceiveStatistics()->RegisterRtcpStatisticsCallback(
791 callback); 738 callback);
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 rtc::CritScope lock(&crit_); 1144 rtc::CritScope lock(&crit_);
1198 receive_stats_callback_ = receive_statistics_proxy; 1145 receive_stats_callback_ = receive_statistics_proxy;
1199 } 1146 }
1200 1147
1201 void ViEChannel::SetIncomingVideoStream( 1148 void ViEChannel::SetIncomingVideoStream(
1202 IncomingVideoStream* incoming_video_stream) { 1149 IncomingVideoStream* incoming_video_stream) {
1203 rtc::CritScope lock(&crit_); 1150 rtc::CritScope lock(&crit_);
1204 incoming_video_stream_ = incoming_video_stream; 1151 incoming_video_stream_ = incoming_video_stream;
1205 } 1152 }
1206 } // namespace webrtc 1153 } // namespace webrtc
OLDNEW
« webrtc/video/vie_channel.h ('K') | « webrtc/video/vie_channel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698