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 1305983003: Convert some more things to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Support Android's C89 mode 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 32df9e975688f6d45c0a90d677f0eac73d21b005..a14c77e4c6074a0166e7873b34bcc923fa9274e7 100644
--- a/webrtc/modules/audio_device/include/audio_device_defines.h
+++ b/webrtc/modules/audio_device/include/audio_device_defines.h
@@ -143,33 +143,33 @@ class AudioTransport {
class AudioParameters {
public:
// This implementation does only support 16-bit PCM samples.
- enum { kBitsPerSample = 16 };
+ static const size_t kBitsPerSample = 16;
AudioParameters()
: sample_rate_(0),
channels_(0),
frames_per_buffer_(0),
frames_per_10ms_buffer_(0) {}
- AudioParameters(int sample_rate, int channels, int frames_per_buffer)
+ AudioParameters(int sample_rate, int channels, size_t frames_per_buffer)
: sample_rate_(sample_rate),
channels_(channels),
frames_per_buffer_(frames_per_buffer),
frames_per_10ms_buffer_(static_cast<size_t>(sample_rate / 100)) {}
- void reset(int sample_rate, int channels, int frames_per_buffer) {
+ void reset(int sample_rate, int channels, size_t frames_per_buffer) {
sample_rate_ = sample_rate;
channels_ = channels;
frames_per_buffer_ = frames_per_buffer;
frames_per_10ms_buffer_ = static_cast<size_t>(sample_rate / 100);
}
- int bits_per_sample() const { return kBitsPerSample; }
+ size_t 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_; }
+ size_t frames_per_buffer() const { return frames_per_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));
}
- int GetBytesPerFrame() const { return channels_ * kBitsPerSample / 8; }
- int GetBytesPerBuffer() const {
+ size_t GetBytesPerFrame() const { return channels_ * kBitsPerSample / 8; }
+ size_t GetBytesPerBuffer() const {
return frames_per_buffer_ * GetBytesPerFrame();
}
size_t GetBytesPer10msBuffer() const {
@@ -184,7 +184,7 @@ class AudioParameters {
private:
int sample_rate_;
int channels_;
- int frames_per_buffer_;
+ size_t frames_per_buffer_;
size_t frames_per_10ms_buffer_;
};
« no previous file with comments | « webrtc/modules/audio_device/android/opensles_player.cc ('k') | webrtc/modules/audio_device/ios/audio_device_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698