| 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { | 176 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) { |
| 177 module_process_thread_->DeRegisterModule(rtp_rtcp); | 177 module_process_thread_->DeRegisterModule(rtp_rtcp); |
| 178 delete rtp_rtcp; | 178 delete rtp_rtcp; |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 void ViEChannel::UpdateHistograms() { | 182 void ViEChannel::UpdateHistograms() { |
| 183 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); | 183 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); |
| 184 | 184 |
| 185 if (sender_) { | 185 if (sender_) { |
| 186 RtcpPacketTypeCounter rtcp_counter; | |
| 187 GetSendRtcpPacketTypeCounter(&rtcp_counter); | |
| 188 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; | |
| 189 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | |
| 190 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsReceivedPerMinute", | |
| 191 rtcp_counter.nack_packets * 60 / elapsed_sec); | |
| 192 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsReceivedPerMinute", | |
| 193 rtcp_counter.fir_packets * 60 / elapsed_sec); | |
| 194 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsReceivedPerMinute", | |
| 195 rtcp_counter.pli_packets * 60 / elapsed_sec); | |
| 196 if (rtcp_counter.nack_requests > 0) { | |
| 197 RTC_HISTOGRAM_PERCENTAGE( | |
| 198 "WebRTC.Video.UniqueNackRequestsReceivedInPercent", | |
| 199 rtcp_counter.UniqueNackRequestsInPercent()); | |
| 200 } | |
| 201 } | |
| 202 | |
| 203 StreamDataCounters rtp; | 186 StreamDataCounters rtp; |
| 204 StreamDataCounters rtx; | 187 StreamDataCounters rtx; |
| 205 GetSendStreamDataCounters(&rtp, &rtx); | 188 GetSendStreamDataCounters(&rtp, &rtx); |
| 206 StreamDataCounters rtp_rtx = rtp; | 189 StreamDataCounters rtp_rtx = rtp; |
| 207 rtp_rtx.Add(rtx); | 190 rtp_rtx.Add(rtx); |
| 208 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs( | 191 int64_t elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs( |
| 209 Clock::GetRealTimeClock()->TimeInMilliseconds()) / | 192 Clock::GetRealTimeClock()->TimeInMilliseconds()) / |
| 210 1000; | 193 1000; |
| 211 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | 194 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { |
| 212 RTC_HISTOGRAM_COUNTS_100000( | 195 RTC_HISTOGRAM_COUNTS_100000( |
| 213 "WebRTC.Video.BitrateSentInKbps", | 196 "WebRTC.Video.BitrateSentInKbps", |
| 214 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 197 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
| 215 1000)); | 198 1000)); |
| 216 RTC_HISTOGRAM_COUNTS_10000( | 199 RTC_HISTOGRAM_COUNTS_10000( |
| 217 "WebRTC.Video.MediaBitrateSentInKbps", | 200 "WebRTC.Video.MediaBitrateSentInKbps", |
| 218 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); | 201 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 235 uint8_t pltype_fec; | 218 uint8_t pltype_fec; |
| 236 rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red, | 219 rtp_rtcp_modules_[0]->GenericFECStatus(&fec_enabled, &pltype_red, |
| 237 &pltype_fec); | 220 &pltype_fec); |
| 238 if (fec_enabled) { | 221 if (fec_enabled) { |
| 239 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps", | 222 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FecBitrateSentInKbps", |
| 240 static_cast<int>(rtp_rtx.fec.TotalBytes() * | 223 static_cast<int>(rtp_rtx.fec.TotalBytes() * |
| 241 8 / elapsed_sec / 1000)); | 224 8 / elapsed_sec / 1000)); |
| 242 } | 225 } |
| 243 } | 226 } |
| 244 } else if (vie_receiver_.GetRemoteSsrc() > 0) { | 227 } else if (vie_receiver_.GetRemoteSsrc() > 0) { |
| 245 // Get receive stats if we are receiving packets, i.e. there is a remote | |
| 246 // ssrc. | |
| 247 RtcpPacketTypeCounter rtcp_counter; | |
| 248 GetReceiveRtcpPacketTypeCounter(&rtcp_counter); | |
| 249 int64_t elapsed_sec = rtcp_counter.TimeSinceFirstPacketInMs(now) / 1000; | |
| 250 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | |
| 251 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.NackPacketsSentPerMinute", | |
| 252 rtcp_counter.nack_packets * 60 / elapsed_sec); | |
| 253 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.FirPacketsSentPerMinute", | |
| 254 rtcp_counter.fir_packets * 60 / elapsed_sec); | |
| 255 RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.PliPacketsSentPerMinute", | |
| 256 rtcp_counter.pli_packets * 60 / elapsed_sec); | |
| 257 if (rtcp_counter.nack_requests > 0) { | |
| 258 RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.UniqueNackRequestsSentInPercent", | |
| 259 rtcp_counter.UniqueNackRequestsInPercent()); | |
| 260 } | |
| 261 } | |
| 262 | |
| 263 StreamDataCounters rtp; | 228 StreamDataCounters rtp; |
| 264 StreamDataCounters rtx; | 229 StreamDataCounters rtx; |
| 265 GetReceiveStreamDataCounters(&rtp, &rtx); | 230 GetReceiveStreamDataCounters(&rtp, &rtx); |
| 266 StreamDataCounters rtp_rtx = rtp; | 231 StreamDataCounters rtp_rtx = rtp; |
| 267 rtp_rtx.Add(rtx); | 232 rtp_rtx.Add(rtx); |
| 268 elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000; | 233 int64_t elapsed_sec = rtp_rtx.TimeSinceFirstPacketInMs(now) / 1000; |
| 269 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { | 234 if (elapsed_sec > metrics::kMinRunTimeInSeconds) { |
| 270 RTC_HISTOGRAM_COUNTS_10000( | 235 RTC_HISTOGRAM_COUNTS_10000( |
| 271 "WebRTC.Video.BitrateReceivedInKbps", | 236 "WebRTC.Video.BitrateReceivedInKbps", |
| 272 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / | 237 static_cast<int>(rtp_rtx.transmitted.TotalBytes() * 8 / elapsed_sec / |
| 273 1000)); | 238 1000)); |
| 274 RTC_HISTOGRAM_COUNTS_10000( | 239 RTC_HISTOGRAM_COUNTS_10000( |
| 275 "WebRTC.Video.MediaBitrateReceivedInKbps", | 240 "WebRTC.Video.MediaBitrateReceivedInKbps", |
| 276 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); | 241 static_cast<int>(rtp.MediaPayloadBytes() * 8 / elapsed_sec / 1000)); |
| 277 RTC_HISTOGRAM_COUNTS_10000( | 242 RTC_HISTOGRAM_COUNTS_10000( |
| 278 "WebRTC.Video.PaddingBitrateReceivedInKbps", | 243 "WebRTC.Video.PaddingBitrateReceivedInKbps", |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 610 } |
| 646 } | 611 } |
| 647 } | 612 } |
| 648 | 613 |
| 649 void ViEChannel::RegisterSendChannelRtpStatisticsCallback( | 614 void ViEChannel::RegisterSendChannelRtpStatisticsCallback( |
| 650 StreamDataCountersCallback* callback) { | 615 StreamDataCountersCallback* callback) { |
| 651 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | 616 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) |
| 652 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(callback); | 617 rtp_rtcp->RegisterSendChannelRtpStatisticsCallback(callback); |
| 653 } | 618 } |
| 654 | 619 |
| 655 void ViEChannel::GetSendRtcpPacketTypeCounter( | |
| 656 RtcpPacketTypeCounter* packet_counter) const { | |
| 657 std::map<uint32_t, RtcpPacketTypeCounter> counter_map = | |
| 658 rtcp_packet_type_counter_observer_.GetPacketTypeCounterMap(); | |
| 659 | |
| 660 RtcpPacketTypeCounter counter; | |
| 661 for (RtpRtcp* rtp_rtcp : rtp_rtcp_modules_) | |
| 662 counter.Add(counter_map[rtp_rtcp->SSRC()]); | |
| 663 *packet_counter = counter; | |
| 664 } | |
| 665 | |
| 666 void ViEChannel::GetReceiveRtcpPacketTypeCounter( | |
| 667 RtcpPacketTypeCounter* packet_counter) const { | |
| 668 std::map<uint32_t, RtcpPacketTypeCounter> counter_map = | |
| 669 rtcp_packet_type_counter_observer_.GetPacketTypeCounterMap(); | |
| 670 | |
| 671 RtcpPacketTypeCounter counter; | |
| 672 counter.Add(counter_map[vie_receiver_.GetRemoteSsrc()]); | |
| 673 | |
| 674 *packet_counter = counter; | |
| 675 } | |
| 676 | |
| 677 void ViEChannel::RegisterSendSideDelayObserver( | 620 void ViEChannel::RegisterSendSideDelayObserver( |
| 678 SendSideDelayObserver* observer) { | 621 SendSideDelayObserver* observer) { |
| 679 send_side_delay_observer_.Set(observer); | 622 send_side_delay_observer_.Set(observer); |
| 680 } | 623 } |
| 681 | 624 |
| 682 void ViEChannel::RegisterSendBitrateObserver( | 625 void ViEChannel::RegisterSendBitrateObserver( |
| 683 BitrateStatisticsObserver* observer) { | 626 BitrateStatisticsObserver* observer) { |
| 684 send_bitrate_observer_.Set(observer); | 627 send_bitrate_observer_.Set(observer); |
| 685 } | 628 } |
| 686 | 629 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 rtc::CritScope lock(&crit_); | 881 rtc::CritScope lock(&crit_); |
| 939 receive_stats_callback_ = receive_statistics_proxy; | 882 receive_stats_callback_ = receive_statistics_proxy; |
| 940 } | 883 } |
| 941 | 884 |
| 942 void ViEChannel::SetIncomingVideoStream( | 885 void ViEChannel::SetIncomingVideoStream( |
| 943 IncomingVideoStream* incoming_video_stream) { | 886 IncomingVideoStream* incoming_video_stream) { |
| 944 rtc::CritScope lock(&crit_); | 887 rtc::CritScope lock(&crit_); |
| 945 incoming_video_stream_ = incoming_video_stream; | 888 incoming_video_stream_ = incoming_video_stream; |
| 946 } | 889 } |
| 947 } // namespace webrtc | 890 } // namespace webrtc |
| OLD | NEW |