| OLD | NEW |
| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 this, | 56 this, |
| 57 this, | 57 this, |
| 58 qm_callback_.get(), | 58 qm_callback_.get(), |
| 59 this), | 59 this), |
| 60 stats_proxy_(stats_proxy), | 60 stats_proxy_(stats_proxy), |
| 61 overuse_detector_(overuse_detector), | 61 overuse_detector_(overuse_detector), |
| 62 time_of_last_frame_activity_ms_(0), | 62 time_of_last_frame_activity_ms_(0), |
| 63 encoder_config_(), | 63 encoder_config_(), |
| 64 min_transmit_bitrate_bps_(0), | 64 min_transmit_bitrate_bps_(0), |
| 65 last_observed_bitrate_bps_(0), | 65 last_observed_bitrate_bps_(0), |
| 66 network_is_transmitting_(true), | |
| 67 encoder_paused_(true), | 66 encoder_paused_(true), |
| 68 encoder_paused_and_dropped_frame_(false), | 67 encoder_paused_and_dropped_frame_(false), |
| 69 module_process_thread_(module_process_thread), | 68 module_process_thread_(module_process_thread), |
| 70 has_received_sli_(false), | 69 has_received_sli_(false), |
| 71 picture_id_sli_(0), | 70 picture_id_sli_(0), |
| 72 has_received_rpsi_(false), | 71 has_received_rpsi_(false), |
| 73 picture_id_rpsi_(0), | 72 picture_id_rpsi_(0), |
| 74 video_suspended_(false) { | 73 video_suspended_(false) { |
| 75 module_process_thread_->RegisterModule(&video_sender_); | 74 module_process_thread_->RegisterModule(&video_sender_); |
| 76 vp_->EnableTemporalDecimation(true); | 75 vp_->EnableTemporalDecimation(true); |
| 77 | 76 |
| 78 // Enable/disable content analysis: off by default for now. | 77 // Enable/disable content analysis: off by default for now. |
| 79 vp_->EnableContentAnalysis(false); | 78 vp_->EnableContentAnalysis(false); |
| 80 } | 79 } |
| 81 | 80 |
| 82 vcm::VideoSender* ViEEncoder::video_sender() { | 81 vcm::VideoSender* ViEEncoder::video_sender() { |
| 83 return &video_sender_; | 82 return &video_sender_; |
| 84 } | 83 } |
| 85 | 84 |
| 86 ViEEncoder::~ViEEncoder() { | 85 ViEEncoder::~ViEEncoder() { |
| 87 module_process_thread_->DeRegisterModule(&video_sender_); | 86 module_process_thread_->DeRegisterModule(&video_sender_); |
| 88 } | 87 } |
| 89 | 88 |
| 90 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) { | |
| 91 { | |
| 92 rtc::CritScope lock(&data_cs_); | |
| 93 network_is_transmitting_ = is_transmitting; | |
| 94 } | |
| 95 } | |
| 96 | |
| 97 void ViEEncoder::Pause() { | 89 void ViEEncoder::Pause() { |
| 98 rtc::CritScope lock(&data_cs_); | 90 rtc::CritScope lock(&data_cs_); |
| 99 encoder_paused_ = true; | 91 encoder_paused_ = true; |
| 100 } | 92 } |
| 101 | 93 |
| 102 void ViEEncoder::Start() { | 94 void ViEEncoder::Start() { |
| 103 rtc::CritScope lock(&data_cs_); | 95 rtc::CritScope lock(&data_cs_); |
| 104 encoder_paused_ = false; | 96 encoder_paused_ = false; |
| 105 } | 97 } |
| 106 | 98 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // Padding may never exceed bitrate estimate. | 207 // Padding may never exceed bitrate estimate. |
| 216 if (pad_up_to_bitrate_bps > bitrate_bps) | 208 if (pad_up_to_bitrate_bps > bitrate_bps) |
| 217 pad_up_to_bitrate_bps = bitrate_bps; | 209 pad_up_to_bitrate_bps = bitrate_bps; |
| 218 | 210 |
| 219 return pad_up_to_bitrate_bps; | 211 return pad_up_to_bitrate_bps; |
| 220 } | 212 } |
| 221 | 213 |
| 222 bool ViEEncoder::EncoderPaused() const { | 214 bool ViEEncoder::EncoderPaused() const { |
| 223 // Pause video if paused by caller or as long as the network is down or the | 215 // Pause video if paused by caller or as long as the network is down or the |
| 224 // pacer queue has grown too large in buffered mode. | 216 // pacer queue has grown too large in buffered mode. |
| 225 if (encoder_paused_) { | 217 // If the pacer queue has grown to large or the network is down, |
| 226 return true; | 218 // last_observed_bitrate_bps_ will be 0. |
| 227 } | 219 return encoder_paused_ || video_suspended_ || last_observed_bitrate_bps_ == 0; |
| 228 if (video_suspended_ || last_observed_bitrate_bps_ == 0) { | |
| 229 return true; | |
| 230 } | |
| 231 return !network_is_transmitting_; | |
| 232 } | 220 } |
| 233 | 221 |
| 234 void ViEEncoder::TraceFrameDropStart() { | 222 void ViEEncoder::TraceFrameDropStart() { |
| 235 // Start trace event only on the first frame after encoder is paused. | 223 // Start trace event only on the first frame after encoder is paused. |
| 236 if (!encoder_paused_and_dropped_frame_) { | 224 if (!encoder_paused_and_dropped_frame_) { |
| 237 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this); | 225 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this); |
| 238 } | 226 } |
| 239 encoder_paused_and_dropped_frame_ = true; | 227 encoder_paused_and_dropped_frame_ = true; |
| 240 return; | 228 return; |
| 241 } | 229 } |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 } | 387 } |
| 400 | 388 |
| 401 int32_t QMVideoSettingsCallback::SetVideoQMSettings( | 389 int32_t QMVideoSettingsCallback::SetVideoQMSettings( |
| 402 const uint32_t frame_rate, | 390 const uint32_t frame_rate, |
| 403 const uint32_t width, | 391 const uint32_t width, |
| 404 const uint32_t height) { | 392 const uint32_t height) { |
| 405 return vp_->SetTargetResolution(width, height, frame_rate); | 393 return vp_->SetTargetResolution(width, height, frame_rate); |
| 406 } | 394 } |
| 407 | 395 |
| 408 } // namespace webrtc | 396 } // namespace webrtc |
| OLD | NEW |