| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 29 matching lines...) Expand all Loading... |
| 278 congestion_controller_->GetRemoteBitrateEstimator(true)); | 280 congestion_controller_->GetRemoteBitrateEstimator(true)); |
| 279 module_process_thread_->DeRegisterModule(congestion_controller_.get()); | 281 module_process_thread_->DeRegisterModule(congestion_controller_.get()); |
| 280 module_process_thread_->DeRegisterModule(call_stats_.get()); | 282 module_process_thread_->DeRegisterModule(call_stats_.get()); |
| 281 module_process_thread_->Stop(); | 283 module_process_thread_->Stop(); |
| 282 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); | 284 call_stats_->DeregisterStatsObserver(congestion_controller_.get()); |
| 283 | 285 |
| 284 // Only update histograms after process threads have been shut down, so that | 286 // Only update histograms after process threads have been shut down, so that |
| 285 // they won't try to concurrently update stats. | 287 // they won't try to concurrently update stats. |
| 286 UpdateSendHistograms(); | 288 UpdateSendHistograms(); |
| 287 UpdateReceiveHistograms(); | 289 UpdateReceiveHistograms(); |
| 290 UpdateHistograms(); |
| 288 | 291 |
| 289 Trace::ReturnTrace(); | 292 Trace::ReturnTrace(); |
| 290 } | 293 } |
| 291 | 294 |
| 295 void Call::UpdateHistograms() { |
| 296 RTC_LOGGED_HISTOGRAM_COUNTS_100000( |
| 297 "WebRTC.Call.LifetimeInSeconds", |
| 298 (clock_->TimeInMilliseconds() - start_ms_) / 1000); |
| 299 } |
| 300 |
| 292 void Call::UpdateSendHistograms() { | 301 void Call::UpdateSendHistograms() { |
| 293 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1) | 302 if (num_bitrate_updates_ == 0 || first_packet_sent_ms_ == -1) |
| 294 return; | 303 return; |
| 295 int64_t elapsed_sec = | 304 int64_t elapsed_sec = |
| 296 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000; | 305 (clock_->TimeInMilliseconds() - first_packet_sent_ms_) / 1000; |
| 297 if (elapsed_sec < metrics::kMinRunTimeInSeconds) | 306 if (elapsed_sec < metrics::kMinRunTimeInSeconds) |
| 298 return; | 307 return; |
| 299 int send_bitrate_kbps = | 308 int send_bitrate_kbps = |
| 300 estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_; | 309 estimated_send_bitrate_sum_kbits_ / num_bitrate_updates_; |
| 301 int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_; | 310 int pacer_bitrate_kbps = pacer_bitrate_sum_kbits_ / num_bitrate_updates_; |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 // thread. Then this check can be enabled. | 886 // thread. Then this check can be enabled. |
| 878 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); | 887 // RTC_DCHECK(!configuration_thread_checker_.CalledOnValidThread()); |
| 879 if (RtpHeaderParser::IsRtcp(packet, length)) | 888 if (RtpHeaderParser::IsRtcp(packet, length)) |
| 880 return DeliverRtcp(media_type, packet, length); | 889 return DeliverRtcp(media_type, packet, length); |
| 881 | 890 |
| 882 return DeliverRtp(media_type, packet, length, packet_time); | 891 return DeliverRtp(media_type, packet, length, packet_time); |
| 883 } | 892 } |
| 884 | 893 |
| 885 } // namespace internal | 894 } // namespace internal |
| 886 } // namespace webrtc | 895 } // namespace webrtc |
| OLD | NEW |