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

Side by Side Diff: webrtc/modules/video_coding/utility/frame_dropper.cc

Issue 1888453004: Remove VERBOSE logs from frame_dropper.cc. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | 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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 framesize_kbits / large_frame_accumulation_count_; 122 framesize_kbits / large_frame_accumulation_count_;
123 framesize_kbits = 0; 123 framesize_kbits = 0;
124 } else { 124 } else {
125 delta_frame_size_avg_kbits_.Apply(1, framesize_kbits); 125 delta_frame_size_avg_kbits_.Apply(1, framesize_kbits);
126 } 126 }
127 key_frame_ratio_.Apply(1.0, 0.0); 127 key_frame_ratio_.Apply(1.0, 0.0);
128 } 128 }
129 // Change the level of the accumulator (bucket) 129 // Change the level of the accumulator (bucket)
130 accumulator_ += framesize_kbits; 130 accumulator_ += framesize_kbits;
131 CapAccumulator(); 131 CapAccumulator();
132 LOG(LS_VERBOSE) << "FILL acc " << accumulator_ << " max " << accumulator_max_
133 << " count " << large_frame_accumulation_count_ << " chunk "
134 << large_frame_accumulation_chunk_size_ << " spread "
135 << large_frame_accumulation_spread_ << " delta avg "
136 << delta_frame_size_avg_kbits_.filtered() << " SIZE "
137 << framesize_kbits << "key frame ratio "
138 << key_frame_ratio_.filtered();
139 } 132 }
140 133
141 void FrameDropper::Leak(uint32_t input_framerate) { 134 void FrameDropper::Leak(uint32_t input_framerate) {
142 if (!enabled_) { 135 if (!enabled_) {
143 return; 136 return;
144 } 137 }
145 if (input_framerate < 1) { 138 if (input_framerate < 1) {
146 return; 139 return;
147 } 140 }
148 if (target_bitrate_ < 0.0f) { 141 if (target_bitrate_ < 0.0f) {
149 return; 142 return;
150 } 143 }
151 // Add lower bound for large frame accumulation spread. 144 // Add lower bound for large frame accumulation spread.
152 large_frame_accumulation_spread_ = std::max(0.5 * input_framerate, 5.0); 145 large_frame_accumulation_spread_ = std::max(0.5 * input_framerate, 5.0);
153 // Expected bits per frame based on current input frame rate. 146 // Expected bits per frame based on current input frame rate.
154 float expected_bits_per_frame = target_bitrate_ / input_framerate; 147 float expected_bits_per_frame = target_bitrate_ / input_framerate;
155 if (large_frame_accumulation_count_ > 0) { 148 if (large_frame_accumulation_count_ > 0) {
156 expected_bits_per_frame -= large_frame_accumulation_chunk_size_; 149 expected_bits_per_frame -= large_frame_accumulation_chunk_size_;
157 --large_frame_accumulation_count_; 150 --large_frame_accumulation_count_;
158 } 151 }
159 accumulator_ -= expected_bits_per_frame; 152 accumulator_ -= expected_bits_per_frame;
160 if (accumulator_ < 0.0f) { 153 if (accumulator_ < 0.0f) {
161 accumulator_ = 0.0f; 154 accumulator_ = 0.0f;
162 } 155 }
163 LOG(LS_VERBOSE) << "LEAK acc " << accumulator_ << " max " << accumulator_max_
164 << " count " << large_frame_accumulation_count_ << " spread "
165 << large_frame_accumulation_spread_ << " delta avg "
166 << delta_frame_size_avg_kbits_.filtered();
167 UpdateRatio(); 156 UpdateRatio();
168 } 157 }
169 158
170 void FrameDropper::UpdateRatio() { 159 void FrameDropper::UpdateRatio() {
171 if (accumulator_ > 1.3f * accumulator_max_) { 160 if (accumulator_ > 1.3f * accumulator_max_) {
172 // Too far above accumulator max, react faster 161 // Too far above accumulator max, react faster
173 drop_ratio_.UpdateBase(0.8f); 162 drop_ratio_.UpdateBase(0.8f);
174 } else { 163 } else {
175 // Go back to normal reaction 164 // Go back to normal reaction
176 drop_ratio_.UpdateBase(0.9f); 165 drop_ratio_.UpdateBase(0.9f);
(...skipping 17 matching lines...) Expand all
194 // dropRatio 183 // dropRatio
195 // to smooth out the drops over time. 184 // to smooth out the drops over time.
196 bool FrameDropper::DropFrame() { 185 bool FrameDropper::DropFrame() {
197 if (!enabled_) { 186 if (!enabled_) {
198 return false; 187 return false;
199 } 188 }
200 if (drop_next_) { 189 if (drop_next_) {
201 drop_next_ = false; 190 drop_next_ = false;
202 drop_count_ = 0; 191 drop_count_ = 0;
203 } 192 }
204 LOG(LS_VERBOSE) << " drop_ratio_ " << drop_ratio_.filtered()
205 << " drop_count_ " << drop_count_;
206 193
207 if (drop_ratio_.filtered() >= 0.5f) { // Drops per keep 194 if (drop_ratio_.filtered() >= 0.5f) { // Drops per keep
208 // limit is the number of frames we should drop between each kept frame 195 // limit is the number of frames we should drop between each kept frame
209 // to keep our drop ratio. limit is positive in this case. 196 // to keep our drop ratio. limit is positive in this case.
210 float denom = 1.0f - drop_ratio_.filtered(); 197 float denom = 1.0f - drop_ratio_.filtered();
211 if (denom < 1e-5) { 198 if (denom < 1e-5) {
212 denom = 1e-5f; 199 denom = 1e-5f;
213 } 200 }
214 int32_t limit = static_cast<int32_t>(1.0f / denom - 1.0f + 0.5f); 201 int32_t limit = static_cast<int32_t>(1.0f / denom - 1.0f + 0.5f);
215 // Put a bound on the max amount of dropped frames between each kept 202 // Put a bound on the max amount of dropped frames between each kept
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 // This is a temporary fix for screencasting where very large frames from 270 // This is a temporary fix for screencasting where very large frames from
284 // encoder will cause very slow response (too many frame drops). 271 // encoder will cause very slow response (too many frame drops).
285 // TODO(isheriff): Remove this now that large delta frames are also spread out ? 272 // TODO(isheriff): Remove this now that large delta frames are also spread out ?
286 void FrameDropper::CapAccumulator() { 273 void FrameDropper::CapAccumulator() {
287 float max_accumulator = target_bitrate_ * kAccumulatorCapBufferSizeSecs; 274 float max_accumulator = target_bitrate_ * kAccumulatorCapBufferSizeSecs;
288 if (accumulator_ > max_accumulator) { 275 if (accumulator_ > max_accumulator) {
289 accumulator_ = max_accumulator; 276 accumulator_ = max_accumulator;
290 } 277 }
291 } 278 }
292 } // namespace webrtc 279 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698