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

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

Issue 1174813003: Prepare to convert various types to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments + resync Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/modules/audio_coding/neteq/merge.cc ('k') | webrtc/modules/audio_coding/neteq/normal.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8cd9aebf6fa7e5e0660b39e54c7a6d03ad4fd595..2d4ff270e016f5302837d6fa56ec9a96495d3605 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -1520,10 +1520,10 @@ int NetEqImpl::DoPreemptiveExpand(int16_t* decoded_buffer,
borrowed_samples_per_channel = static_cast<int>(required_samples -
decoded_length_per_channel);
// Calculate how many of these were already played out.
- old_borrowed_samples_per_channel = static_cast<int>(
- borrowed_samples_per_channel - sync_buffer_->FutureLength());
- old_borrowed_samples_per_channel = std::max(
- 0, old_borrowed_samples_per_channel);
+ const int future_length = static_cast<int>(sync_buffer_->FutureLength());
+ old_borrowed_samples_per_channel =
+ (borrowed_samples_per_channel > future_length) ?
+ (borrowed_samples_per_channel - future_length) : 0;
memmove(&decoded_buffer[borrowed_samples_per_channel * num_channels],
decoded_buffer,
sizeof(int16_t) * decoded_length);
« no previous file with comments | « webrtc/modules/audio_coding/neteq/merge.cc ('k') | webrtc/modules/audio_coding/neteq/normal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698