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

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

Issue 1967473004: NetEq: Implement Expand::Muted (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 statistics_->LogDelayedPacketOutageEvent( 320 statistics_->LogDelayedPacketOutageEvent(
321 rtc::checked_cast<int>(expand_duration_samples_) / (fs_hz_ / 1000)); 321 rtc::checked_cast<int>(expand_duration_samples_) / (fs_hz_ / 1000));
322 } 322 }
323 323
324 void Expand::SetParametersForMergeAfterExpand() { 324 void Expand::SetParametersForMergeAfterExpand() {
325 current_lag_index_ = -1; /* out of the 3 possible ones */ 325 current_lag_index_ = -1; /* out of the 3 possible ones */
326 lag_index_direction_ = 1; /* make sure we get the "optimal" lag */ 326 lag_index_direction_ = 1; /* make sure we get the "optimal" lag */
327 stop_muting_ = true; 327 stop_muting_ = true;
328 } 328 }
329 329
330 bool Expand::Muted() const {
331 if (first_expand_ || stop_muting_)
332 return false;
333 RTC_DCHECK(channel_parameters_);
334 for (size_t ch = 0; ch < num_channels_; ++ch) {
335 if (channel_parameters_[ch].mute_factor != 0)
336 return false;
337 }
338 return true;
339 }
340
330 size_t Expand::overlap_length() const { 341 size_t Expand::overlap_length() const {
331 return overlap_length_; 342 return overlap_length_;
332 } 343 }
333 344
334 void Expand::InitializeForAnExpandPeriod() { 345 void Expand::InitializeForAnExpandPeriod() {
335 lag_index_direction_ = 1; 346 lag_index_direction_ = 1;
336 current_lag_index_ = -1; 347 current_lag_index_ = -1;
337 stop_muting_ = false; 348 stop_muting_ = false;
338 random_vector_->set_seed_increment(1); 349 random_vector_->set_seed_increment(1);
339 consecutive_expands_ = 0; 350 consecutive_expands_ = 0;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 const size_t kMaxRandSamples = RandomVector::kRandomTableSize; 949 const size_t kMaxRandSamples = RandomVector::kRandomTableSize;
939 while (samples_generated < length) { 950 while (samples_generated < length) {
940 size_t rand_length = std::min(length - samples_generated, kMaxRandSamples); 951 size_t rand_length = std::min(length - samples_generated, kMaxRandSamples);
941 random_vector_->IncreaseSeedIncrement(seed_increment); 952 random_vector_->IncreaseSeedIncrement(seed_increment);
942 random_vector_->Generate(rand_length, &random_vector[samples_generated]); 953 random_vector_->Generate(rand_length, &random_vector[samples_generated]);
943 samples_generated += rand_length; 954 samples_generated += rand_length;
944 } 955 }
945 } 956 }
946 957
947 } // namespace webrtc 958 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698