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

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

Issue 1932683002: 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
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 qm_callback_(new QMVideoSettingsCallback(vp_.get())), 88 qm_callback_(new QMVideoSettingsCallback(vp_.get())),
89 video_sender_(Clock::GetRealTimeClock(), this, this, qm_callback_.get()), 89 video_sender_(Clock::GetRealTimeClock(), this, this, qm_callback_.get()),
90 stats_proxy_(stats_proxy), 90 stats_proxy_(stats_proxy),
91 overuse_detector_(overuse_detector), 91 overuse_detector_(overuse_detector),
92 send_payload_router_(payload_router), 92 send_payload_router_(payload_router),
93 post_encode_callback_(post_encode_callback), 93 post_encode_callback_(post_encode_callback),
94 time_of_last_frame_activity_ms_(0), 94 time_of_last_frame_activity_ms_(0),
95 encoder_config_(), 95 encoder_config_(),
96 min_transmit_bitrate_bps_(0), 96 min_transmit_bitrate_bps_(0),
97 last_observed_bitrate_bps_(0), 97 last_observed_bitrate_bps_(0),
98 network_is_transmitting_(true),
99 encoder_paused_(false), 98 encoder_paused_(false),
100 encoder_paused_and_dropped_frame_(false), 99 encoder_paused_and_dropped_frame_(false),
101 time_last_intra_request_ms_(ssrcs.size(), -1), 100 time_last_intra_request_ms_(ssrcs.size(), -1),
102 module_process_thread_(module_process_thread), 101 module_process_thread_(module_process_thread),
103 has_received_sli_(false), 102 has_received_sli_(false),
104 picture_id_sli_(0), 103 picture_id_sli_(0),
105 has_received_rpsi_(false), 104 has_received_rpsi_(false),
106 picture_id_rpsi_(0), 105 picture_id_rpsi_(0),
107 video_suspended_(false) { 106 video_suspended_(false) {
108 module_process_thread_->RegisterModule(&video_sender_); 107 module_process_thread_->RegisterModule(&video_sender_);
(...skipping 17 matching lines...) Expand all
126 } 125 }
127 126
128 vcm::VideoSender* ViEEncoder::video_sender() { 127 vcm::VideoSender* ViEEncoder::video_sender() {
129 return &video_sender_; 128 return &video_sender_;
130 } 129 }
131 130
132 ViEEncoder::~ViEEncoder() { 131 ViEEncoder::~ViEEncoder() {
133 module_process_thread_->DeRegisterModule(&video_sender_); 132 module_process_thread_->DeRegisterModule(&video_sender_);
134 } 133 }
135 134
136 void ViEEncoder::SetNetworkTransmissionState(bool is_transmitting) {
137 {
138 rtc::CritScope lock(&data_cs_);
139 network_is_transmitting_ = is_transmitting;
140 }
141 }
142
143 void ViEEncoder::Pause() { 135 void ViEEncoder::Pause() {
144 rtc::CritScope lock(&data_cs_); 136 rtc::CritScope lock(&data_cs_);
145 encoder_paused_ = true; 137 encoder_paused_ = true;
146 } 138 }
147 139
148 void ViEEncoder::Restart() { 140 void ViEEncoder::Restart() {
149 rtc::CritScope lock(&data_cs_); 141 rtc::CritScope lock(&data_cs_);
150 encoder_paused_ = false; 142 encoder_paused_ = false;
151 } 143 }
152 144
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 // Padding may never exceed bitrate estimate. 260 // Padding may never exceed bitrate estimate.
269 if (pad_up_to_bitrate_bps > bitrate_bps) 261 if (pad_up_to_bitrate_bps > bitrate_bps)
270 pad_up_to_bitrate_bps = bitrate_bps; 262 pad_up_to_bitrate_bps = bitrate_bps;
271 263
272 return pad_up_to_bitrate_bps; 264 return pad_up_to_bitrate_bps;
273 } 265 }
274 266
275 bool ViEEncoder::EncoderPaused() const { 267 bool ViEEncoder::EncoderPaused() const {
276 // Pause video if paused by caller or as long as the network is down or the 268 // Pause video if paused by caller or as long as the network is down or the
277 // pacer queue has grown too large in buffered mode. 269 // pacer queue has grown too large in buffered mode.
278 if (encoder_paused_) { 270 // If the pacer queue has grown to large or the network is down,
279 return true; 271 // last_observed_bitrate_bps_ will be 0.
280 } 272 return encoder_paused_ || video_suspended_ || last_observed_bitrate_bps_ == 0;
281 if (video_suspended_ || last_observed_bitrate_bps_ == 0) {
282 // Too low bitrate to send data.
283 return true;
284 }
285 return !network_is_transmitting_;
286 } 273 }
287 274
288 void ViEEncoder::TraceFrameDropStart() { 275 void ViEEncoder::TraceFrameDropStart() {
289 // Start trace event only on the first frame after encoder is paused. 276 // Start trace event only on the first frame after encoder is paused.
290 if (!encoder_paused_and_dropped_frame_) { 277 if (!encoder_paused_and_dropped_frame_) {
291 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this); 278 TRACE_EVENT_ASYNC_BEGIN0("webrtc", "EncoderPaused", this);
292 } 279 }
293 encoder_paused_and_dropped_frame_ = true; 280 encoder_paused_and_dropped_frame_ = true;
294 return; 281 return;
295 } 282 }
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 } 458 }
472 video_sender_.IntraFrameRequest(static_cast<int>(i)); 459 video_sender_.IntraFrameRequest(static_cast<int>(i));
473 return; 460 return;
474 } 461 }
475 RTC_NOTREACHED() << "Should not receive keyframe requests on unknown SSRCs."; 462 RTC_NOTREACHED() << "Should not receive keyframe requests on unknown SSRCs.";
476 } 463 }
477 464
478 void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps, 465 void ViEEncoder::OnBitrateUpdated(uint32_t bitrate_bps,
479 uint8_t fraction_lost, 466 uint8_t fraction_lost,
480 int64_t round_trip_time_ms) { 467 int64_t round_trip_time_ms) {
481 LOG(LS_VERBOSE) << "OnBitrateUpdated, bitrate " << bitrate_bps 468 LOG(LS_INFO) << "OnBitrateUpdated, bitrate " << bitrate_bps << " packet loss "
482 << " packet loss " << static_cast<int>(fraction_lost) 469 << static_cast<int>(fraction_lost) << " rtt "
483 << " rtt " << round_trip_time_ms; 470 << round_trip_time_ms;
484 RTC_DCHECK(send_payload_router_); 471 RTC_DCHECK(send_payload_router_);
485 video_sender_.SetChannelParameters(bitrate_bps, fraction_lost, 472 video_sender_.SetChannelParameters(bitrate_bps, fraction_lost,
486 round_trip_time_ms); 473 round_trip_time_ms);
487 bool video_is_suspended = video_sender_.VideoSuspended(); 474 bool video_is_suspended = video_sender_.VideoSuspended();
488 bool video_suspension_changed; 475 bool video_suspension_changed;
489 VideoCodec send_codec; 476 VideoCodec send_codec;
490 { 477 {
491 rtc::CritScope lock(&data_cs_); 478 rtc::CritScope lock(&data_cs_);
492 last_observed_bitrate_bps_ = bitrate_bps; 479 last_observed_bitrate_bps_ = bitrate_bps;
493 video_suspension_changed = video_suspended_ != video_is_suspended; 480 video_suspension_changed = video_suspended_ != video_is_suspended;
(...skipping 24 matching lines...) Expand all
518 } 505 }
519 506
520 int32_t QMVideoSettingsCallback::SetVideoQMSettings( 507 int32_t QMVideoSettingsCallback::SetVideoQMSettings(
521 const uint32_t frame_rate, 508 const uint32_t frame_rate,
522 const uint32_t width, 509 const uint32_t width,
523 const uint32_t height) { 510 const uint32_t height) {
524 return vp_->SetTargetResolution(width, height, frame_rate); 511 return vp_->SetTargetResolution(width, height, frame_rate);
525 } 512 }
526 513
527 } // namespace webrtc 514 } // namespace webrtc
OLDNEW
« webrtc/video/video_send_stream.cc ('K') | « webrtc/video/vie_encoder.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698