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

Unified Diff: webrtc/common_audio/resampler/push_sinc_resampler.cc

Issue 1231713002: Update audio code to use size_t more correctly, webrtc/common_audio/resampler/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Review comments Created 5 years, 5 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/common_audio/resampler/push_sinc_resampler.cc
diff --git a/webrtc/common_audio/resampler/push_sinc_resampler.cc b/webrtc/common_audio/resampler/push_sinc_resampler.cc
index 7d372028b6cc5dc5fa231290ab31cfe5457161f9..72ed56b86a99648a1f8661eae5a5deb342e06951 100644
--- a/webrtc/common_audio/resampler/push_sinc_resampler.cc
+++ b/webrtc/common_audio/resampler/push_sinc_resampler.cc
@@ -17,7 +17,8 @@
namespace webrtc {
-PushSincResampler::PushSincResampler(int source_frames, int destination_frames)
+PushSincResampler::PushSincResampler(size_t source_frames,
+ size_t destination_frames)
: resampler_(new SincResampler(source_frames * 1.0 / destination_frames,
source_frames,
this)),
@@ -30,10 +31,10 @@ PushSincResampler::PushSincResampler(int source_frames, int destination_frames)
PushSincResampler::~PushSincResampler() {
}
-int PushSincResampler::Resample(const int16_t* source,
- int source_length,
- int16_t* destination,
- int destination_capacity) {
+size_t PushSincResampler::Resample(const int16_t* source,
+ size_t source_length,
+ int16_t* destination,
+ size_t destination_capacity) {
if (!float_buffer_.get())
float_buffer_.reset(new float[destination_frames_]);
@@ -45,10 +46,10 @@ int PushSincResampler::Resample(const int16_t* source,
return destination_frames_;
}
-int PushSincResampler::Resample(const float* source,
- int source_length,
- float* destination,
- int destination_capacity) {
+size_t PushSincResampler::Resample(const float* source,
+ size_t source_length,
+ float* destination,
+ size_t destination_capacity) {
CHECK_EQ(source_length, resampler_->request_frames());
CHECK_GE(destination_capacity, destination_frames_);
// Cache the source pointer. Calling Resample() will immediately trigger
@@ -77,7 +78,7 @@ int PushSincResampler::Resample(const float* source,
return destination_frames_;
}
-void PushSincResampler::Run(int frames, float* destination) {
+void PushSincResampler::Run(size_t frames, float* destination) {
// Ensure we are only asked for the available samples. This would fail if
// Run() was triggered more than once per Resample() call.
CHECK_EQ(source_available_, frames);
@@ -93,7 +94,7 @@ void PushSincResampler::Run(int frames, float* destination) {
if (source_ptr_) {
std::memcpy(destination, source_ptr_, frames * sizeof(*destination));
} else {
- for (int i = 0; i < frames; ++i)
+ for (size_t i = 0; i < frames; ++i)
destination[i] = static_cast<float>(source_ptr_int_[i]);
}
source_available_ -= frames;
« no previous file with comments | « webrtc/common_audio/resampler/push_sinc_resampler.h ('k') | webrtc/common_audio/resampler/push_sinc_resampler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698