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

Side by Side Diff: webrtc/video_engine/vie_encoder.cc

Issue 1374673003: Move sent key frame stats to send_statistics_proxy class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: address comments Created 5 years, 2 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
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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 network_is_transmitting_(true), 130 network_is_transmitting_(true),
131 encoder_paused_(false), 131 encoder_paused_(false),
132 encoder_paused_and_dropped_frame_(false), 132 encoder_paused_and_dropped_frame_(false),
133 fec_enabled_(false), 133 fec_enabled_(false),
134 nack_enabled_(false), 134 nack_enabled_(false),
135 module_process_thread_(module_process_thread), 135 module_process_thread_(module_process_thread),
136 has_received_sli_(false), 136 has_received_sli_(false),
137 picture_id_sli_(0), 137 picture_id_sli_(0),
138 has_received_rpsi_(false), 138 has_received_rpsi_(false),
139 picture_id_rpsi_(0), 139 picture_id_rpsi_(0),
140 video_suspended_(false), 140 video_suspended_(false) {
141 start_ms_(Clock::GetRealTimeClock()->TimeInMilliseconds()) {
142 bitrate_observer_.reset(new ViEBitrateObserver(this)); 141 bitrate_observer_.reset(new ViEBitrateObserver(this));
143 } 142 }
144 143
145 bool ViEEncoder::Init() { 144 bool ViEEncoder::Init() {
146 vpm_->EnableTemporalDecimation(true); 145 vpm_->EnableTemporalDecimation(true);
147 146
148 // Enable/disable content analysis: off by default for now. 147 // Enable/disable content analysis: off by default for now.
149 vpm_->EnableContentAnalysis(false); 148 vpm_->EnableContentAnalysis(false);
150 149
151 if (vcm_->RegisterTransportCallback(this) != 0) { 150 if (vcm_->RegisterTransportCallback(this) != 0) {
(...skipping 16 matching lines...) Expand all
168 } 167 }
169 168
170 void ViEEncoder::StopThreadsAndRemoveSharedMembers() { 169 void ViEEncoder::StopThreadsAndRemoveSharedMembers() {
171 if (bitrate_allocator_) 170 if (bitrate_allocator_)
172 bitrate_allocator_->RemoveBitrateObserver(bitrate_observer_.get()); 171 bitrate_allocator_->RemoveBitrateObserver(bitrate_observer_.get());
173 module_process_thread_->DeRegisterModule(vcm_.get()); 172 module_process_thread_->DeRegisterModule(vcm_.get());
174 module_process_thread_->DeRegisterModule(vpm_.get()); 173 module_process_thread_->DeRegisterModule(vpm_.get());
175 } 174 }
176 175
177 ViEEncoder::~ViEEncoder() { 176 ViEEncoder::~ViEEncoder() {
178 UpdateHistograms();
179 }
180
181 void ViEEncoder::UpdateHistograms() {
182 int64_t elapsed_sec =
183 (Clock::GetRealTimeClock()->TimeInMilliseconds() - start_ms_) / 1000;
184 if (elapsed_sec < metrics::kMinRunTimeInSeconds) {
185 return;
186 }
187 webrtc::VCMFrameCount frames;
188 if (vcm_->SentFrameCount(frames) != VCM_OK) {
pbos-webrtc 2015/09/28 13:50:12 Is this function used anywhere now or can we remov
åsapersson 2015/09/28 15:21:03 Done.
189 return;
190 }
191 uint32_t total_frames = frames.numKeyFrames + frames.numDeltaFrames;
192 if (total_frames > 0) {
193 RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.KeyFramesSentInPermille",
194 static_cast<int>(
195 (frames.numKeyFrames * 1000.0f / total_frames) + 0.5f));
196 }
197 } 177 }
198 178
199 int ViEEncoder::Owner() const { 179 int ViEEncoder::Owner() const {
200 return channel_id_; 180 return channel_id_;
201 } 181 }
202 182
203 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) { 183 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) {
204 { 184 {
205 CriticalSectionScoped cs(data_cs_.get()); 185 CriticalSectionScoped cs(data_cs_.get());
206 network_is_transmitting_ = is_transmitting; 186 network_is_transmitting_ = is_transmitting;
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 const uint32_t width, 734 const uint32_t width,
755 const uint32_t height) { 735 const uint32_t height) {
756 return vpm_->SetTargetResolution(width, height, frame_rate); 736 return vpm_->SetTargetResolution(width, height, frame_rate);
757 } 737 }
758 738
759 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) { 739 void QMVideoSettingsCallback::SetTargetFramerate(int frame_rate) {
760 vpm_->SetTargetFramerate(frame_rate); 740 vpm_->SetTargetFramerate(frame_rate);
761 } 741 }
762 742
763 } // namespace webrtc 743 } // namespace webrtc
OLDNEW
« webrtc/video/send_statistics_proxy.cc ('K') | « webrtc/video_engine/vie_encoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698