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

Side by Side Diff: webrtc/video/send_statistics_proxy.cc

Issue 1169543005: Add sent framerates to histogram stats: (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
« no previous file with comments | « webrtc/video/send_statistics_proxy.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) 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
11 #include "webrtc/video/send_statistics_proxy.h" 11 #include "webrtc/video/send_statistics_proxy.h"
12 12
13 #include <map> 13 #include <map>
14 14
15 #include "webrtc/base/checks.h" 15 #include "webrtc/base/checks.h"
16 16
17 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 17 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
18 #include "webrtc/system_wrappers/interface/logging.h" 18 #include "webrtc/system_wrappers/interface/logging.h"
19 #include "webrtc/system_wrappers/interface/metrics.h"
19 20
20 namespace webrtc { 21 namespace webrtc {
21 22
22 const int SendStatisticsProxy::kStatsTimeoutMs = 5000; 23 const int SendStatisticsProxy::kStatsTimeoutMs = 5000;
23 24
24 SendStatisticsProxy::SendStatisticsProxy(Clock* clock, 25 SendStatisticsProxy::SendStatisticsProxy(Clock* clock,
25 const VideoSendStream::Config& config) 26 const VideoSendStream::Config& config)
26 : clock_(clock), 27 : clock_(clock),
27 config_(config) { 28 config_(config),
29 last_sent_frame_timestamp_(0) {
28 } 30 }
29 31
30 SendStatisticsProxy::~SendStatisticsProxy() {} 32 SendStatisticsProxy::~SendStatisticsProxy() {
33 UpdateHistograms();
34 }
35
36 void SendStatisticsProxy::UpdateHistograms() {
pbos-webrtc 2015/06/12 13:03:47 See if EXCLUSIVE_LOCKS_REQUIRED(crit_) means that
37 int input_fps;
38 int sent_fps;
39 {
40 rtc::CritScope lock(&crit_);
41 input_fps =
42 static_cast<int>(input_frame_rate_tracker_total_.units_second());
43 sent_fps = static_cast<int>(sent_frame_rate_tracker_total_.units_second());
44 }
45 if (input_fps > 0)
46 RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.InputFramesPerSecond", input_fps);
47 if (sent_fps > 0)
48 RTC_HISTOGRAM_COUNTS_100("WebRTC.Video.SentFramesPerSecond", sent_fps);
49 }
31 50
32 void SendStatisticsProxy::OutgoingRate(const int video_channel, 51 void SendStatisticsProxy::OutgoingRate(const int video_channel,
33 const unsigned int framerate, 52 const unsigned int framerate,
34 const unsigned int bitrate) { 53 const unsigned int bitrate) {
35 rtc::CritScope lock(&crit_); 54 rtc::CritScope lock(&crit_);
36 stats_.encode_frame_rate = framerate; 55 stats_.encode_frame_rate = framerate;
37 stats_.media_bitrate_bps = bitrate; 56 stats_.media_bitrate_bps = bitrate;
38 } 57 }
39 58
40 void SendStatisticsProxy::CpuOveruseMetricsUpdated( 59 void SendStatisticsProxy::CpuOveruseMetricsUpdated(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 uint32_t ssrc = config_.rtp.ssrcs[simulcast_idx]; 137 uint32_t ssrc = config_.rtp.ssrcs[simulcast_idx];
119 138
120 rtc::CritScope lock(&crit_); 139 rtc::CritScope lock(&crit_);
121 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 140 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
122 if (stats == nullptr) 141 if (stats == nullptr)
123 return; 142 return;
124 143
125 stats->width = encoded_image._encodedWidth; 144 stats->width = encoded_image._encodedWidth;
126 stats->height = encoded_image._encodedHeight; 145 stats->height = encoded_image._encodedHeight;
127 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds(); 146 update_times_[ssrc].resolution_update_ms = clock_->TimeInMilliseconds();
147 if (encoded_image._timeStamp != last_sent_frame_timestamp_) {
148 last_sent_frame_timestamp_ = encoded_image._timeStamp;
149 sent_frame_rate_tracker_total_.Update(1);
150 }
128 } 151 }
129 152
130 void SendStatisticsProxy::OnIncomingFrame() { 153 void SendStatisticsProxy::OnIncomingFrame() {
131 rtc::CritScope lock(&crit_); 154 rtc::CritScope lock(&crit_);
132 input_frame_rate_tracker_.Update(1); 155 input_frame_rate_tracker_.Update(1);
156 input_frame_rate_tracker_total_.Update(1);
133 } 157 }
134 158
135 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated( 159 void SendStatisticsProxy::RtcpPacketTypesCounterUpdated(
136 uint32_t ssrc, 160 uint32_t ssrc,
137 const RtcpPacketTypeCounter& packet_counter) { 161 const RtcpPacketTypeCounter& packet_counter) {
138 rtc::CritScope lock(&crit_); 162 rtc::CritScope lock(&crit_);
139 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 163 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
140 if (stats == nullptr) 164 if (stats == nullptr)
141 return; 165 return;
142 166
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 uint32_t ssrc) { 218 uint32_t ssrc) {
195 rtc::CritScope lock(&crit_); 219 rtc::CritScope lock(&crit_);
196 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc); 220 VideoSendStream::StreamStats* stats = GetStatsEntry(ssrc);
197 if (stats == nullptr) 221 if (stats == nullptr)
198 return; 222 return;
199 stats->avg_delay_ms = avg_delay_ms; 223 stats->avg_delay_ms = avg_delay_ms;
200 stats->max_delay_ms = max_delay_ms; 224 stats->max_delay_ms = max_delay_ms;
201 } 225 }
202 226
203 } // namespace webrtc 227 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/send_statistics_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698