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

Unified Diff: webrtc/modules/audio_device/include/audio_device_defines.h

Issue 1230503003: Update a ton of audio code to use size_t more correctly and in general reduce (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Resync Created 5 years, 4 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_device/include/audio_device_defines.h
diff --git a/webrtc/modules/audio_device/include/audio_device_defines.h b/webrtc/modules/audio_device/include/audio_device_defines.h
index 106edcb41d8ed1ca66d3a8d013dccddf18713803..32df9e975688f6d45c0a90d677f0eac73d21b005 100644
--- a/webrtc/modules/audio_device/include/audio_device_defines.h
+++ b/webrtc/modules/audio_device/include/audio_device_defines.h
@@ -11,6 +11,8 @@
#ifndef WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DEFINES_H
#define WEBRTC_AUDIO_DEVICE_AUDIO_DEVICE_DEFINES_H
+#include <stddef.h>
+
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -45,8 +47,8 @@ class AudioDeviceObserver {
class AudioTransport {
public:
virtual int32_t RecordedDataIsAvailable(const void* audioSamples,
- const uint32_t nSamples,
- const uint8_t nBytesPerSample,
+ const size_t nSamples,
+ const size_t nBytesPerSample,
const uint8_t nChannels,
const uint32_t samplesPerSec,
const uint32_t totalDelayMS,
@@ -55,12 +57,12 @@ class AudioTransport {
const bool keyPressed,
uint32_t& newMicLevel) = 0;
- virtual int32_t NeedMorePlayData(const uint32_t nSamples,
- const uint8_t nBytesPerSample,
+ virtual int32_t NeedMorePlayData(const size_t nSamples,
+ const size_t nBytesPerSample,
const uint8_t nChannels,
const uint32_t samplesPerSec,
void* audioSamples,
- uint32_t& nSamplesOut,
+ size_t& nSamplesOut,
int64_t* elapsed_time_ms,
int64_t* ntp_time_ms) = 0;
@@ -84,7 +86,7 @@ class AudioTransport {
const int16_t* audio_data,
int sample_rate,
int number_of_channels,
- int number_of_frames,
+ size_t number_of_frames,
int audio_delay_milliseconds,
int current_volume,
bool key_pressed,
@@ -102,7 +104,7 @@ class AudioTransport {
int bits_per_sample,
int sample_rate,
int number_of_channels,
- int number_of_frames) {}
+ size_t number_of_frames) {}
// Method to push the captured audio data to the specific VoE channel.
// The data will not undergo audio processing.
@@ -115,7 +117,7 @@ class AudioTransport {
int bits_per_sample,
int sample_rate,
int number_of_channels,
- int number_of_frames) {}
+ size_t number_of_frames) {}
// Method to pull mixed render audio data from all active VoE channels.
// The data will not be passed as reference for audio processing internally.
@@ -124,7 +126,7 @@ class AudioTransport {
virtual void PullRenderData(int bits_per_sample,
int sample_rate,
int number_of_channels,
- int number_of_frames,
+ size_t number_of_frames,
void* audio_data,
int64_t* elapsed_time_ms,
int64_t* ntp_time_ms) {}
@@ -151,18 +153,18 @@ class AudioParameters {
: sample_rate_(sample_rate),
channels_(channels),
frames_per_buffer_(frames_per_buffer),
- frames_per_10ms_buffer_(sample_rate / 100) {}
+ frames_per_10ms_buffer_(static_cast<size_t>(sample_rate / 100)) {}
void reset(int sample_rate, int channels, int frames_per_buffer) {
sample_rate_ = sample_rate;
channels_ = channels;
frames_per_buffer_ = frames_per_buffer;
- frames_per_10ms_buffer_ = (sample_rate / 100);
+ frames_per_10ms_buffer_ = static_cast<size_t>(sample_rate / 100);
}
int bits_per_sample() const { return kBitsPerSample; }
int sample_rate() const { return sample_rate_; }
int channels() const { return channels_; }
int frames_per_buffer() const { return frames_per_buffer_; }
- int frames_per_10ms_buffer() const { return frames_per_10ms_buffer_; }
+ size_t frames_per_10ms_buffer() const { return frames_per_10ms_buffer_; }
bool is_valid() const {
return ((sample_rate_ > 0) && (channels_ > 0) && (frames_per_buffer_ > 0));
}
@@ -170,7 +172,7 @@ class AudioParameters {
int GetBytesPerBuffer() const {
return frames_per_buffer_ * GetBytesPerFrame();
}
- int GetBytesPer10msBuffer() const {
+ size_t GetBytesPer10msBuffer() const {
return frames_per_10ms_buffer_ * GetBytesPerFrame();
}
float GetBufferSizeInMilliseconds() const {
@@ -183,7 +185,7 @@ class AudioParameters {
int sample_rate_;
int channels_;
int frames_per_buffer_;
- int frames_per_10ms_buffer_;
+ size_t frames_per_10ms_buffer_;
};
} // namespace webrtc
« no previous file with comments | « webrtc/modules/audio_device/dummy/file_audio_device.cc ('k') | webrtc/modules/audio_device/ios/audio_device_unittest_ios.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698