| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ssrcs_(ssrcs), | 62 ssrcs_(ssrcs), |
| 63 vp_(VideoProcessing::Create()), | 63 vp_(VideoProcessing::Create()), |
| 64 qm_callback_(new QMVideoSettingsCallback(vp_.get())), | 64 qm_callback_(new QMVideoSettingsCallback(vp_.get())), |
| 65 video_sender_(Clock::GetRealTimeClock(), this, this, qm_callback_.get()), | 65 video_sender_(Clock::GetRealTimeClock(), this, this, qm_callback_.get()), |
| 66 stats_proxy_(stats_proxy), | 66 stats_proxy_(stats_proxy), |
| 67 overuse_detector_(overuse_detector), | 67 overuse_detector_(overuse_detector), |
| 68 time_of_last_frame_activity_ms_(0), | 68 time_of_last_frame_activity_ms_(0), |
| 69 encoder_config_(), | 69 encoder_config_(), |
| 70 min_transmit_bitrate_bps_(0), | 70 min_transmit_bitrate_bps_(0), |
| 71 last_observed_bitrate_bps_(0), | 71 last_observed_bitrate_bps_(0), |
| 72 network_is_transmitting_(true), | |
| 73 encoder_paused_(true), | 72 encoder_paused_(true), |
| 74 encoder_paused_and_dropped_frame_(false), | 73 encoder_paused_and_dropped_frame_(false), |
| 75 time_last_intra_request_ms_(ssrcs.size(), -1), | 74 time_last_intra_request_ms_(ssrcs.size(), -1), |
| 76 module_process_thread_(module_process_thread), | 75 module_process_thread_(module_process_thread), |
| 77 has_received_sli_(false), | 76 has_received_sli_(false), |
| 78 picture_id_sli_(0), | 77 picture_id_sli_(0), |
| 79 has_received_rpsi_(false), | 78 has_received_rpsi_(false), |
| 80 picture_id_rpsi_(0), | 79 picture_id_rpsi_(0), |
| 81 video_suspended_(false) { | 80 video_suspended_(false) { |
| 82 module_process_thread_->RegisterModule(&video_sender_); | 81 module_process_thread_->RegisterModule(&video_sender_); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 100 } | 99 } |
| 101 | 100 |
| 102 vcm::VideoSender* ViEEncoder::video_sender() { | 101 vcm::VideoSender* ViEEncoder::video_sender() { |
| 103 return &video_sender_; | 102 return &video_sender_; |
| 104 } | 103 } |
| 105 | 104 |
| 106 ViEEncoder::~ViEEncoder() { | 105 ViEEncoder::~ViEEncoder() { |
| 107 module_process_thread_->DeRegisterModule(&video_sender_); | 106 module_process_thread_->DeRegisterModule(&video_sender_); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) { | |
| 111 { | |
| 112 rtc::CritScope lock(&data_cs_); | |
| 113 network_is_transmitting_ = is_transmitting; | |
| 114 } | |
| 115 } | |
| 116 | |
| 117 void ViEEncoder::Pause() { | 109 void ViEEncoder::Pause() { |
| 118 rtc::CritScope lock(&data_cs_); | 110 rtc::CritScope lock(&data_cs_); |
| 119 encoder_paused_ = true; | 111 encoder_paused_ = true; |
| 120 } | 112 } |
| 121 | 113 |
| 122 void ViEEncoder::Start() { | 114 void ViEEncoder::Start() { |
| 123 rtc::CritScope lock(&data_cs_); | 115 rtc::CritScope lock(&data_cs_); |
| 124 encoder_paused_ = false; | 116 encoder_paused_ = false; |
| 125 } | 117 } |
| 126 | 118 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 // Padding may never exceed bitrate estimate. | 232 // Padding may never exceed bitrate estimate. |
| 241 if (pad_up_to_bitrate_bps > bitrate_bps) | 233 if (pad_up_to_bitrate_bps > bitrate_bps) |
| 242 pad_up_to_bitrate_bps = bitrate_bps; | 234 pad_up_to_bitrate_bps = bitrate_bps; |
| 243 | 235 |
| 244 return pad_up_to_bitrate_bps; | 236 return pad_up_to_bitrate_bps; |
| 245 } | 237 } |
| 246 | 238 |
| 247 bool ViEEncoder::EncoderPaused() const { | 239 bool ViEEncoder::EncoderPaused() const { |
| 248 // Pause video if paused by caller or as long as the network is down or the | 240 // Pause video if paused by caller or as long as the network is down or the |
| 249 // pacer queue has grown too large in buffered mode. | 241 // pacer queue has grown too large in buffered mode. |
| 250 if (encoder_paused_) { | 242 // If the pacer queue has grown to large or the network is down, |
| 251 return true; | 243 // last_observed_bitrate_bps_ will be 0. |
| 252 } | 244 return encoder_paused_ || video_suspended_ || last_observed_bitrate_bps_ == 0; |
| 253 if (video_suspended_ || last_observed_bitrate_bps_ == 0) { | |
| 254 return true; | |
| 255 } | |
| 256 return !network_is_transmitting_; | |
| 257 } | 245 } |
| 258 | 246 |
| 259 void ViEEncoder::TraceFrameDropStart() { | 247 void ViEEncoder::TraceFrameDropStart() { |
| 260 // Start trace event only on the first frame after encoder is paused. | 248 // Start trace event only on the first frame after encoder is paused. |
| 261 if (!encoder_paused_and_dropped_frame_) { | 249 if (!encoder_paused_and_dropped_frame_) { |
| 262 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this); | 250 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this); |
| 263 } | 251 } |
| 264 encoder_paused_and_dropped_frame_ = true; | 252 encoder_paused_and_dropped_frame_ = true; |
| 265 return; | 253 return; |
| 266 } | 254 } |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 459 } |
| 472 | 460 |
| 473 int32_t QMVideoSettingsCallback::SetVideoQMSettings( | 461 int32_t QMVideoSettingsCallback::SetVideoQMSettings( |
| 474 const uint32_t frame_rate, | 462 const uint32_t frame_rate, |
| 475 const uint32_t width, | 463 const uint32_t width, |
| 476 const uint32_t height) { | 464 const uint32_t height) { |
| 477 return vp_->SetTargetResolution(width, height, frame_rate); | 465 return vp_->SetTargetResolution(width, height, frame_rate); |
| 478 } | 466 } |
| 479 | 467 |
| 480 } // namespace webrtc | 468 } // namespace webrtc |
| OLD | NEW |