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

Unified Diff: webrtc/modules/include/module_common_types.h

Issue 1316523002: Convert channel counts to size_t. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Fix compile Created 4 years, 11 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/include/module_common_types.h
diff --git a/webrtc/modules/include/module_common_types.h b/webrtc/modules/include/module_common_types.h
index 3a63af014fd87d0b2062629d159414994cdd212a..89c5f1b49b19b56a7c841eea0c25ccba5faebbd7 100644
--- a/webrtc/modules/include/module_common_types.h
+++ b/webrtc/modules/include/module_common_types.h
@@ -28,7 +28,7 @@ struct RTPAudioHeader {
uint8_t numEnergy; // number of valid entries in arrOfEnergy
uint8_t arrOfEnergy[kRtpCsrcSize]; // one energy byte (0-9) per channel
bool isCNG; // is this CNG
- uint8_t channel; // number of channels 2 = stereo
+ size_t channel; // number of channels 2 = stereo
};
const int16_t kNoPictureId = -1;
@@ -508,7 +508,7 @@ class AudioFrame {
void UpdateFrame(int id, uint32_t timestamp, const int16_t* data,
size_t samples_per_channel, int sample_rate_hz,
SpeechType speech_type, VADActivity vad_activity,
- int num_channels = 1, uint32_t energy = -1);
+ size_t num_channels = 1, uint32_t energy = -1);
AudioFrame& Append(const AudioFrame& rhs);
@@ -532,7 +532,7 @@ class AudioFrame {
int16_t data_[kMaxDataSizeSamples];
size_t samples_per_channel_;
int sample_rate_hz_;
- int num_channels_;
+ size_t num_channels_;
SpeechType speech_type_;
VADActivity vad_activity_;
// Note that there is no guarantee that |energy_| is correct. Any user of this
@@ -574,7 +574,7 @@ inline void AudioFrame::UpdateFrame(int id,
int sample_rate_hz,
SpeechType speech_type,
VADActivity vad_activity,
- int num_channels,
+ size_t num_channels,
uint32_t energy) {
id_ = id;
timestamp_ = timestamp;
@@ -585,7 +585,6 @@ inline void AudioFrame::UpdateFrame(int id,
num_channels_ = num_channels;
energy_ = energy;
- assert(num_channels >= 0);
const size_t length = samples_per_channel * num_channels;
assert(length <= kMaxDataSizeSamples);
if (data != NULL) {
@@ -610,7 +609,6 @@ inline void AudioFrame::CopyFrom(const AudioFrame& src) {
energy_ = src.energy_;
interleaved_ = src.interleaved_;
- assert(num_channels_ >= 0);
const size_t length = samples_per_channel_ * num_channels_;
assert(length <= kMaxDataSizeSamples);
memcpy(data_, src.data_, sizeof(int16_t) * length);
« no previous file with comments | « webrtc/modules/audio_processing/vad/voice_activity_detector.cc ('k') | webrtc/modules/media_file/media_file_utility.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698