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

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_impl.cc

Issue 2859483005: NetEq: Fix a bug in expand_rate and speech_expand_rate calculation (Closed)
Patch Set: Changing to Minyue's suggestion Created 3 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/neteq_impl.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index e119d9439cfbb617f38dfe27c1a9773792f8664c..2d91b8c1c548204d8f78168cc5727feca6b23606 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -1600,16 +1600,18 @@ void NetEqImpl::DoMerge(int16_t* decoded_buffer, size_t decoded_length,
size_t new_length = merge_->Process(decoded_buffer, decoded_length,
mute_factor_array_.get(),
algorithm_buffer_.get());
- size_t expand_length_correction = new_length -
- decoded_length / algorithm_buffer_->Channels();
+ // Correction can be negative.
+ int expand_length_correction =
+ rtc::dchecked_cast<int>(new_length) -
+ rtc::dchecked_cast<int>(decoded_length / algorithm_buffer_->Channels());
// Update in-call and post-call statistics.
if (expand_->MuteFactor(0) == 0) {
// Expand generates only noise.
- stats_.ExpandedNoiseSamples(expand_length_correction);
+ stats_.ExpandedNoiseSamplesCorrection(expand_length_correction);
} else {
// Expansion generates more than only noise.
- stats_.ExpandedVoiceSamples(expand_length_correction);
+ stats_.ExpandedVoiceSamplesCorrection(expand_length_correction);
}
last_mode_ = kModeMerge;

Powered by Google App Engine
This is Rietveld 408576698