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

Side by Side Diff: webrtc/call/call.cc

Issue 2136533002: Only update codec type histogram if lifetime is long enough (10 sec). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: updated test Created 4 years, 5 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) 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 internal::AudioState* audio_state = 129 internal::AudioState* audio_state =
130 static_cast<internal::AudioState*>(config_.audio_state.get()); 130 static_cast<internal::AudioState*>(config_.audio_state.get());
131 if (audio_state) 131 if (audio_state)
132 return audio_state->voice_engine(); 132 return audio_state->voice_engine();
133 else 133 else
134 return nullptr; 134 return nullptr;
135 } 135 }
136 136
137 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_); 137 void UpdateSendHistograms() EXCLUSIVE_LOCKS_REQUIRED(&bitrate_crit_);
138 void UpdateReceiveHistograms(); 138 void UpdateReceiveHistograms();
139 void UpdateHistograms();
139 void UpdateAggregateNetworkState(); 140 void UpdateAggregateNetworkState();
140 141
141 Clock* const clock_; 142 Clock* const clock_;
142 143
143 const int num_cpu_cores_; 144 const int num_cpu_cores_;
144 const std::unique_ptr<ProcessThread> module_process_thread_; 145 const std::unique_ptr<ProcessThread> module_process_thread_;
145 const std::unique_ptr<ProcessThread> pacer_thread_; 146 const std::unique_ptr<ProcessThread> pacer_thread_;
146 const std::unique_ptr<CallStats> call_stats_; 147 const std::unique_ptr<CallStats> call_stats_;
147 const std::unique_ptr<BitrateAllocator> bitrate_allocator_; 148 const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
148 Call::Config config_; 149 Call::Config config_;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_); 190 int64_t pacer_bitrate_sum_kbits_ GUARDED_BY(&bitrate_crit_);
190 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 191 uint32_t min_allocated_send_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
191 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_); 192 int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_);
192 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_); 193 uint32_t configured_max_padding_bitrate_bps_ GUARDED_BY(&bitrate_crit_);
193 194
194 std::map<std::string, rtc::NetworkRoute> network_routes_; 195 std::map<std::string, rtc::NetworkRoute> network_routes_;
195 196
196 VieRemb remb_; 197 VieRemb remb_;
197 const std::unique_ptr<CongestionController> congestion_controller_; 198 const std::unique_ptr<CongestionController> congestion_controller_;
198 const std::unique_ptr<SendDelayStats> video_send_delay_stats_; 199 const std::unique_ptr<SendDelayStats> video_send_delay_stats_;
200 const int64_t start_ms_;
199 201
200 RTC_DISALLOW_COPY_AND_ASSIGN(Call); 202 RTC_DISALLOW_COPY_AND_ASSIGN(Call);
201 }; 203 };
202 } // namespace internal 204 } // namespace internal
203 205
204 Call* Call::Create(const Call::Config& config) { 206 Call* Call::Create(const Call::Config& config) {
205 return new internal::Call(config); 207 return new internal::Call(config);
206 } 208 }
207 209
208 namespace internal { 210 namespace internal {
(...skipping 15 matching lines...) Expand all
224 received_audio_bytes_(0), 226 received_audio_bytes_(0),
225 received_rtcp_bytes_(0), 227 received_rtcp_bytes_(0),
226 first_rtp_packet_received_ms_(-1), 228 first_rtp_packet_received_ms_(-1),
227 last_rtp_packet_received_ms_(-1), 229 last_rtp_packet_received_ms_(-1),
228 first_packet_sent_ms_(-1), 230 first_packet_sent_ms_(-1),
229 estimated_send_bitrate_sum_kbits_(0), 231 estimated_send_bitrate_sum_kbits_(0),
230 pacer_bitrate_sum_kbits_(0), 232 pacer_bitrate_sum_kbits_(0),
231 min_allocated_send_bitrate_bps_(0), 233 min_allocated_send_bitrate_bps_(0),
232 num_bitrate_updates_(0), 234 num_bitrate_updates_(0),
233 configured_max_padding_bitrate_bps_(0), 235 configured_max_padding_bitrate_bps_(0),
234
235 remb_(clock_), 236 remb_(clock_),
236 congestion_controller_( 237 congestion_controller_(
237 new CongestionController(clock_, this, &remb_, event_log_.get())), 238 new CongestionController(clock_, this, &remb_, event_log_.get())),
238 video_send_delay_stats_(new SendDelayStats(clock_)) { 239 video_send_delay_stats_(new SendDelayStats(clock_)),
240 start_ms_(clock_->TimeInMilliseconds()) {
239 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 241 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
240 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0); 242 RTC_DCHECK_GE(config.bitrate_config.min_bitrate_bps, 0);
241 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps, 243 RTC_DCHECK_GE(config.bitrate_config.start_bitrate_bps,
242 config.bitrate_config.min_bitrate_bps); 244 config.bitrate_config.min_bitrate_bps);
243 if (config.bitrate_config.max_bitrate_bps != -1) { 245 if (config.bitrate_config.max_bitrate_bps != -1) {
244 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps, 246 RTC_DCHECK_GE(config.bitrate_config.max_bitrate_bps,
245 config.bitrate_config.start_bitrate_bps); 247 config.bitrate_config.start_bitrate_bps);
246 } 248 }
247 249
248 Trace::CreateTrace(); 250 Trace::CreateTrace();
(...skipping 11 matching lines...) Expand all
260 pacer_thread_->RegisterModule( 262 pacer_thread_->RegisterModule(
261 congestion_controller_->GetRemoteBitrateEstimator(true)); 263 congestion_controller_->GetRemoteBitrateEstimator(true));
262 pacer_thread_->Start(); 264 pacer_thread_->Start();
263 } 265 }
264 266
265 Call::~Call() { 267 Call::~Call() {
266 RTC_DCHECK(!remb_.InUse()); 268 RTC_DCHECK(!remb_.InUse());
267 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread()); 269 RTC_DCHECK(configuration_thread_checker_.CalledOnValidThread());
268 UpdateSendHistograms(); 270 UpdateSendHistograms();
269 UpdateReceiveHistograms(); 271 UpdateReceiveHistograms();
272 UpdateHistograms();
270 RTC_CHECK(audio_send_ssrcs_.empty()); 273 RTC_CHECK(audio_send_ssrcs_.empty());
271 RTC_CHECK(video_send_ssrcs_.empty()); 274 RTC_CHECK(video_send_ssrcs_.empty());
272 RTC_CHECK(video_send_streams_.empty()); 275 RTC_CHECK(video_send_streams_.empty());
273 RTC_CHECK(audio_receive_ssrcs_.empty()); 276 RTC_CHECK(audio_receive_ssrcs_.empty());
274 RTC_CHECK(video_receive_ssrcs_.empty()); 277 RTC_CHECK(video_receive_ssrcs_.empty());
275 RTC_CHECK(video_receive_streams_.empty()); 278 RTC_CHECK(video_receive_streams_.empty());
276 279
277 pacer_thread_->Stop(); 280 pacer_thread_->Stop();
278 pacer_thread_->DeRegisterModule(congestion_controller_->pacer()); 281 pacer_thread_->DeRegisterModule(congestion_controller_->pacer());
279 pacer_thread_->DeRegisterModule( 282 pacer_thread_->DeRegisterModule(
280 congestion_controller_->GetRemoteBitrateEstimator(true)); 283 congestion_controller_->GetRemoteBitrateEstimator(true));
281 module_process_thread_->DeRegisterModule(congestion_controller_.get()); 284 module_process_thread_->DeRegisterModule(congestion_controller_.get());
282 module_process_thread_->DeRegisterModule(call_stats_.get()); 285 module_process_thread_->DeRegisterModule(call_stats_.get());
283 module_process_thread_->Stop(); 286 module_process_thread_->Stop();
284 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); 287 call_stats_->DeregisterStatsObserver(congestion_controller_.get());
285 Trace::ReturnTrace(); 288 Trace::ReturnTrace();
286 } 289 }
287 290
291 void Call::UpdateHistograms() {
292 RTC_LOGGED_HISTOGRAM_COUNTS_100000(
293 "WebRTC.Call.LifetimeInSeconds",
294 (clock_->TimeInMilliseconds() - start_ms_) / 1000);
295 }
296
288 void Call::UpdateSendHistograms() { 297 void Call::UpdateSendHistograms() {
289 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1) 298 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1)
290 return; 299 return;
291 int64_t elapsed_sec = 300 int64_t elapsed_sec =
292 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000; 301 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000;
293 if (elapsed_sec < metrics::kMinRunTimeInSeconds) 302 if (elapsed_sec < metrics::kMinRunTimeInSeconds)
294 return; 303 return;
295 int send_bitrate_kbps = 304 int send_bitrate_kbps =
296 estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_; 305 estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_;
297 int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_; 306 int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_;
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 // thread. Then this check can be enabled. 877 // thread. Then this check can be enabled.
869 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); 878 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread());
870 if (RtpHeaderParser::IsRtcp(packet, length)) 879 if (RtpHeaderParser::IsRtcp(packet, length))
871 return DeliverRtcp(media_type, packet, length); 880 return DeliverRtcp(media_type, packet, length);
872 881
873 return DeliverRtp(media_type, packet, length, packet_time); 882 return DeliverRtp(media_type, packet, length, packet_time);
874 } 883 }
875 884
876 } // namespace internal 885 } // namespace internal
877 } // namespace webrtc 886 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698