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

Side by Side Diff: webrtc/modules/video_coding/media_optimization.cc

Issue 2953053002: Reland of Periodically update codec bit/frame rate settings. (Closed)
Patch Set: Fix bug and add test Created 3 years, 6 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/media/engine/simulcast.cc ('k') | webrtc/modules/video_coding/video_sender.cc » ('j') | 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 video_target_bitrate_ = target_bitrate; 111 video_target_bitrate_ = target_bitrate;
112 112
113 // Cap target video bitrate to codec maximum. 113 // Cap target video bitrate to codec maximum.
114 if (max_bit_rate_ > 0 && video_target_bitrate_ > max_bit_rate_) { 114 if (max_bit_rate_ > 0 && video_target_bitrate_ > max_bit_rate_) {
115 video_target_bitrate_ = max_bit_rate_; 115 video_target_bitrate_ = max_bit_rate_;
116 } 116 }
117 117
118 // Update encoding rates following protection settings. 118 // Update encoding rates following protection settings.
119 float target_video_bitrate_kbps = 119 float target_video_bitrate_kbps =
120 static_cast<float>(video_target_bitrate_) / 1000.0f; 120 static_cast<float>(video_target_bitrate_) / 1000.0f;
121 frame_dropper_->SetRates(target_video_bitrate_kbps, incoming_frame_rate_); 121 float framerate = incoming_frame_rate_;
122 if (framerate == 0.0) {
123 // No framerate estimate available, use configured max framerate instead.
124 framerate = user_frame_rate_;
125 }
126
127 frame_dropper_->SetRates(target_video_bitrate_kbps, framerate);
122 128
123 return video_target_bitrate_; 129 return video_target_bitrate_;
124 } 130 }
125 131
126 uint32_t MediaOptimization::InputFrameRate() { 132 uint32_t MediaOptimization::InputFrameRate() {
127 rtc::CritScope lock(&crit_sect_); 133 rtc::CritScope lock(&crit_sect_);
128 return InputFrameRateInternal(); 134 return InputFrameRateInternal();
129 } 135 }
130 136
131 uint32_t MediaOptimization::InputFrameRateInternal() { 137 uint32_t MediaOptimization::InputFrameRateInternal() {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 const int64_t diff = 278 const int64_t diff =
273 incoming_frame_times_[0] - incoming_frame_times_[num - 1]; 279 incoming_frame_times_[0] - incoming_frame_times_[num - 1];
274 incoming_frame_rate_ = 0.0; // No frame rate estimate available. 280 incoming_frame_rate_ = 0.0; // No frame rate estimate available.
275 if (diff > 0) { 281 if (diff > 0) {
276 incoming_frame_rate_ = nr_of_frames * 1000.0f / static_cast<float>(diff); 282 incoming_frame_rate_ = nr_of_frames * 1000.0f / static_cast<float>(diff);
277 } 283 }
278 } 284 }
279 } 285 }
280 } // namespace media_optimization 286 } // namespace media_optimization
281 } // namespace webrtc 287 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/media/engine/simulcast.cc ('k') | webrtc/modules/video_coding/video_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698