OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 70 |
71 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; | 71 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; |
72 | 72 |
73 SendStatisticsProxy::SendStatisticsProxy( | 73 SendStatisticsProxy::SendStatisticsProxy( |
74 Clock* clock, | 74 Clock* clock, |
75 const VideoSendStream::Config& config, | 75 const VideoSendStream::Config& config, |
76 VideoEncoderConfig::ContentType content_type) | 76 VideoEncoderConfig::ContentType content_type) |
77 : clock_(clock), | 77 : clock_(clock), |
78 config_(config), | 78 config_(config), |
79 content_type_(content_type), | 79 content_type_(content_type), |
| 80 start_ms_(clock->TimeInMilliseconds()), |
80 last_sent_frame_timestamp_(0), | 81 last_sent_frame_timestamp_(0), |
81 encode_time_(kEncodeTimeWeigthFactor), | 82 encode_time_(kEncodeTimeWeigthFactor), |
82 uma_container_( | 83 uma_container_( |
83 new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) { | 84 new UmaSamplesContainer(GetUmaPrefix(content_type_), stats_, clock)) { |
84 UpdateCodecTypeHistogram(config_.encoder_settings.payload_name); | |
85 } | 85 } |
86 | 86 |
87 SendStatisticsProxy::~SendStatisticsProxy() { | 87 SendStatisticsProxy::~SendStatisticsProxy() { |
88 rtc::CritScope lock(&crit_); | 88 rtc::CritScope lock(&crit_); |
89 uma_container_->UpdateHistograms(config_, stats_); | 89 uma_container_->UpdateHistograms(config_, stats_); |
| 90 |
| 91 int64_t elapsed_sec = (clock_->TimeInMilliseconds() - start_ms_) / 1000; |
| 92 RTC_LOGGED_HISTOGRAM_COUNTS_100000("WebRTC.Video.SendStreamLifetimeInSeconds", |
| 93 elapsed_sec); |
| 94 |
| 95 if (elapsed_sec >= metrics::kMinRunTimeInSeconds) |
| 96 UpdateCodecTypeHistogram(config_.encoder_settings.payload_name); |
90 } | 97 } |
91 | 98 |
92 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( | 99 SendStatisticsProxy::UmaSamplesContainer::UmaSamplesContainer( |
93 const char* prefix, | 100 const char* prefix, |
94 const VideoSendStream::Stats& stats, | 101 const VideoSendStream::Stats& stats, |
95 Clock* const clock) | 102 Clock* const clock) |
96 : uma_prefix_(prefix), | 103 : uma_prefix_(prefix), |
97 clock_(clock), | 104 clock_(clock), |
98 max_sent_width_per_timestamp_(0), | 105 max_sent_width_per_timestamp_(0), |
99 max_sent_height_per_timestamp_(0), | 106 max_sent_height_per_timestamp_(0), |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 return Fraction(min_required_samples, 1000.0f); | 634 return Fraction(min_required_samples, 1000.0f); |
628 } | 635 } |
629 | 636 |
630 int SendStatisticsProxy::BoolSampleCounter::Fraction( | 637 int SendStatisticsProxy::BoolSampleCounter::Fraction( |
631 int min_required_samples, float multiplier) const { | 638 int min_required_samples, float multiplier) const { |
632 if (num_samples < min_required_samples || num_samples == 0) | 639 if (num_samples < min_required_samples || num_samples == 0) |
633 return -1; | 640 return -1; |
634 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); | 641 return static_cast<int>((sum * multiplier / num_samples) + 0.5f); |
635 } | 642 } |
636 } // namespace webrtc | 643 } // namespace webrtc |
OLD | NEW |