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

Side by Side Diff: webrtc/modules/audio_coding/neteq/decision_logic_normal.cc

Issue 2412883002: NetEq: Remove special case for Merge without Expand (Closed)
Patch Set: Created 4 years, 2 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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 } else { 200 } else {
201 // Too early to play this new packet; keep on playing comfort noise. 201 // Too early to play this new packet; keep on playing comfort noise.
202 if (prev_mode == kModeRfc3389Cng) { 202 if (prev_mode == kModeRfc3389Cng) {
203 return kRfc3389CngNoPacket; 203 return kRfc3389CngNoPacket;
204 } else { // prevPlayMode == kModeCodecInternalCng. 204 } else { // prevPlayMode == kModeCodecInternalCng.
205 return kCodecInternalCng; 205 return kCodecInternalCng;
206 } 206 }
207 } 207 }
208 } 208 }
209 // Do not merge unless we have done an expand before. 209 // Do not merge unless we have done an expand before.
210 // (Convert kAllowMergeWithoutExpand from ms to samples by multiplying with 210 if (prev_mode == kModeExpand) {
211 // fs_mult_ * 8 = fs / 1000.)
212 if (prev_mode == kModeExpand ||
213 (decoder_frame_length < output_size_samples_ &&
214 cur_size_samples >
215 static_cast<size_t>(kAllowMergeWithoutExpandMs * fs_mult_ * 8))) {
216 return kMerge; 211 return kMerge;
217 } else if (play_dtmf) { 212 } else if (play_dtmf) {
218 // Play DTMF instead of expand. 213 // Play DTMF instead of expand.
219 return kDtmf; 214 return kDtmf;
220 } else { 215 } else {
221 return kExpand; 216 return kExpand;
222 } 217 }
223 } 218 }
224 219
225 bool DecisionLogicNormal::UnderTargetLevel() const { 220 bool DecisionLogicNormal::UnderTargetLevel() const {
226 return buffer_level_filter_->filtered_current_level() <= 221 return buffer_level_filter_->filtered_current_level() <=
227 delay_manager_->TargetLevel(); 222 delay_manager_->TargetLevel();
228 } 223 }
229 224
230 bool DecisionLogicNormal::ReinitAfterExpands(uint32_t timestamp_leap) const { 225 bool DecisionLogicNormal::ReinitAfterExpands(uint32_t timestamp_leap) const {
231 return timestamp_leap >= 226 return timestamp_leap >=
232 static_cast<uint32_t>(output_size_samples_ * kReinitAfterExpands); 227 static_cast<uint32_t>(output_size_samples_ * kReinitAfterExpands);
233 } 228 }
234 229
235 bool DecisionLogicNormal::PacketTooEarly(uint32_t timestamp_leap) const { 230 bool DecisionLogicNormal::PacketTooEarly(uint32_t timestamp_leap) const {
236 return timestamp_leap > 231 return timestamp_leap >
237 static_cast<uint32_t>(output_size_samples_ * num_consecutive_expands_); 232 static_cast<uint32_t>(output_size_samples_ * num_consecutive_expands_);
238 } 233 }
239 234
240 bool DecisionLogicNormal::MaxWaitForPacket() const { 235 bool DecisionLogicNormal::MaxWaitForPacket() const {
241 return num_consecutive_expands_ >= kMaxWaitForPacket; 236 return num_consecutive_expands_ >= kMaxWaitForPacket;
242 } 237 }
243 238
244 } // namespace webrtc 239 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/decision_logic_normal.h ('k') | webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698