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

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

Issue 1978783002: Revert of Remove ViEEncoder::SetNetworkStatus (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@move_pacer
Patch Set: Created 4 years, 7 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
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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),
66 encoder_paused_(true), 67 encoder_paused_(true),
67 encoder_paused_and_dropped_frame_(false), 68 encoder_paused_and_dropped_frame_(false),
68 module_process_thread_(module_process_thread), 69 module_process_thread_(module_process_thread),
69 has_received_sli_(false), 70 has_received_sli_(false),
70 picture_id_sli_(0), 71 picture_id_sli_(0),
71 has_received_rpsi_(false), 72 has_received_rpsi_(false),
72 picture_id_rpsi_(0), 73 picture_id_rpsi_(0),
73 video_suspended_(false) { 74 video_suspended_(false) {
74 module_process_thread_->RegisterModule(&video_sender_); 75 module_process_thread_->RegisterModule(&video_sender_);
75 vp_->EnableTemporalDecimation(true); 76 vp_->EnableTemporalDecimation(true);
76 77
77 // Enable/disable content analysis: off by default for now. 78 // Enable/disable content analysis: off by default for now.
78 vp_->EnableContentAnalysis(false); 79 vp_->EnableContentAnalysis(false);
79 } 80 }
80 81
81 vcm::VideoSender* ViEEncoder::video_sender() { 82 vcm::VideoSender* ViEEncoder::video_sender() {
82 return &video_sender_; 83 return &video_sender_;
83 } 84 }
84 85
85 ViEEncoder::~ViEEncoder() { 86 ViEEncoder::~ViEEncoder() {
86 module_process_thread_->DeRegisterModule(&video_sender_); 87 module_process_thread_->DeRegisterModule(&video_sender_);
87 } 88 }
88 89
90 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) {
91 {
92 rtc::CritScope lock(&data_cs_);
93 network_is_transmitting_ = is_transmitting;
94 }
95 }
96
89 void ViEEncoder::Pause() { 97 void ViEEncoder::Pause() {
90 rtc::CritScope lock(&data_cs_); 98 rtc::CritScope lock(&data_cs_);
91 encoder_paused_ = true; 99 encoder_paused_ = true;
92 } 100 }
93 101
94 void ViEEncoder::Start() { 102 void ViEEncoder::Start() {
95 rtc::CritScope lock(&data_cs_); 103 rtc::CritScope lock(&data_cs_);
96 encoder_paused_ = false; 104 encoder_paused_ = false;
97 } 105 }
98 106
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // Padding may never exceed bitrate estimate. 215 // Padding may never exceed bitrate estimate.
208 if (pad_up_to_bitrate_bps > bitrate_bps) 216 if (pad_up_to_bitrate_bps > bitrate_bps)
209 pad_up_to_bitrate_bps = bitrate_bps; 217 pad_up_to_bitrate_bps = bitrate_bps;
210 218
211 return pad_up_to_bitrate_bps; 219 return pad_up_to_bitrate_bps;
212 } 220 }
213 221
214 bool ViEEncoder::EncoderPaused() const { 222 bool ViEEncoder::EncoderPaused() const {
215 // Pause video if paused by caller or as long as the network is down or the 223 // Pause video if paused by caller or as long as the network is down or the
216 // pacer queue has grown too large in buffered mode. 224 // pacer queue has grown too large in buffered mode.
217 // If the pacer queue has grown to large or the network is down, 225 if (encoder_paused_) {
218 // last_observed_bitrate_bps_ will be 0. 226 return true;
219 return encoder_paused_ || video_suspended_ || last_observed_bitrate_bps_ == 0; 227 }
228 if (video_suspended_ || last_observed_bitrate_bps_ == 0) {
229 return true;
230 }
231 return !network_is_transmitting_;
220 } 232 }
221 233
222 void ViEEncoder::TraceFrameDropStart() { 234 void ViEEncoder::TraceFrameDropStart() {
223 // Start trace event only on the first frame after encoder is paused. 235 // Start trace event only on the first frame after encoder is paused.
224 if (!encoder_paused_and_dropped_frame_) { 236 if (!encoder_paused_and_dropped_frame_) {
225 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this); 237 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this);
226 } 238 }
227 encoder_paused_and_dropped_frame_ = true; 239 encoder_paused_and_dropped_frame_ = true;
228 return; 240 return;
229 } 241 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 399 }
388 400
389 int32_t QMVideoSettingsCallback::SetVideoQMSettings( 401 int32_t QMVideoSettingsCallback::SetVideoQMSettings(
390 const uint32_t frame_rate, 402 const uint32_t frame_rate,
391 const uint32_t width, 403 const uint32_t width,
392 const uint32_t height) { 404 const uint32_t height) {
393 return vp_->SetTargetResolution(width, height, frame_rate); 405 return vp_->SetTargetResolution(width, height, frame_rate);
394 } 406 }
395 407
396 } // namespace webrtc 408 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/vie_encoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698