WebRtc_Word32 => int32_t etc. in audio_coding/
BUG=314
Review URL: https://webrtc-codereview.appspot.com/1271006
git-svn-id: http://webrtc.googlecode.com/svn/trunk@3789 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/main/test/PCMFile.cc b/webrtc/modules/audio_coding/main/test/PCMFile.cc
index fbe73f5..0b61bbb 100644
--- a/webrtc/modules/audio_coding/main/test/PCMFile.cc
+++ b/webrtc/modules/audio_coding/main/test/PCMFile.cc
@@ -30,11 +30,11 @@
rewinded_(false),
read_stereo_(false),
save_stereo_(false) {
- timestamp_ = (((WebRtc_UWord32)rand() & 0x0000FFFF) << 16) |
- ((WebRtc_UWord32)rand() & 0x0000FFFF);
+ timestamp_ = (((uint32_t)rand() & 0x0000FFFF) << 16) |
+ ((uint32_t)rand() & 0x0000FFFF);
}
-PCMFile::PCMFile(WebRtc_UWord32 timestamp)
+PCMFile::PCMFile(uint32_t timestamp)
: pcm_file_(NULL),
samples_10ms_(160),
frequency_(16000),
@@ -46,13 +46,12 @@
timestamp_ = timestamp;
}
-WebRtc_Word16 PCMFile::ChooseFile(std::string* file_name,
- WebRtc_Word16 max_len) {
+int16_t PCMFile::ChooseFile(std::string* file_name, int16_t max_len) {
char tmp_name[MAX_FILE_NAME_LENGTH_BYTE];
EXPECT_TRUE(fgets(tmp_name, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
tmp_name[MAX_FILE_NAME_LENGTH_BYTE - 1] = '\0';
- WebRtc_Word16 n = 0;
+ int16_t n = 0;
// Removing leading spaces.
while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (tmp_name[n] != 0)
@@ -64,7 +63,7 @@
}
// Removing trailing spaces.
- n = (WebRtc_Word16)(strlen(tmp_name) - 1);
+ n = (int16_t)(strlen(tmp_name) - 1);
if (n >= 0) {
while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (n >= 0)) {
n--;
@@ -74,7 +73,7 @@
tmp_name[n + 1] = '\0';
}
- WebRtc_Word16 len = (WebRtc_Word16) strlen(tmp_name);
+ int16_t len = (int16_t) strlen(tmp_name);
if (len > max_len) {
return -1;
}
@@ -85,14 +84,14 @@
return 0;
}
-WebRtc_Word16 PCMFile::ChooseFile(std::string* file_name,
- WebRtc_Word16 max_len,
- WebRtc_UWord16* frequency_hz) {
+int16_t PCMFile::ChooseFile(std::string* file_name,
+ int16_t max_len,
+ uint16_t* frequency_hz) {
char tmp_name[MAX_FILE_NAME_LENGTH_BYTE];
EXPECT_TRUE(fgets(tmp_name, MAX_FILE_NAME_LENGTH_BYTE, stdin) != NULL);
tmp_name[MAX_FILE_NAME_LENGTH_BYTE - 1] = '\0';
- WebRtc_Word16 n = 0;
+ int16_t n = 0;
// Removing trailing spaces.
while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (tmp_name[n] != 0)
@@ -104,7 +103,7 @@
}
// Removing trailing spaces.
- n = (WebRtc_Word16)(strlen(tmp_name) - 1);
+ n = (int16_t)(strlen(tmp_name) - 1);
if (n >= 0) {
while ((isspace(tmp_name[n]) || iscntrl(tmp_name[n])) && (n >= 0)) {
n--;
@@ -114,7 +113,7 @@
tmp_name[n + 1] = '\0';
}
- WebRtc_Word16 len = (WebRtc_Word16) strlen(tmp_name);
+ int16_t len = (int16_t) strlen(tmp_name);
if (len > max_len) {
return -1;
}
@@ -125,42 +124,42 @@
printf("Enter the sampling frequency (in Hz) of the above file [%u]: ",
*frequency_hz);
EXPECT_TRUE(fgets(tmp_name, 10, stdin) != NULL);
- WebRtc_UWord16 tmp_frequency = (WebRtc_UWord16) atoi(tmp_name);
+ uint16_t tmp_frequency = (uint16_t) atoi(tmp_name);
if (tmp_frequency > 0) {
*frequency_hz = tmp_frequency;
}
return 0;
}
-void PCMFile::Open(const std::string& file_name, WebRtc_UWord16 frequency,
+void PCMFile::Open(const std::string& file_name, uint16_t frequency,
const char* mode, bool auto_rewind) {
if ((pcm_file_ = fopen(file_name.c_str(), mode)) == NULL) {
printf("Cannot open file %s.\n", file_name.c_str());
ADD_FAILURE() << "Unable to read file";
}
frequency_ = frequency;
- samples_10ms_ = (WebRtc_UWord16)(frequency_ / 100);
+ samples_10ms_ = (uint16_t)(frequency_ / 100);
auto_rewind_ = auto_rewind;
end_of_file_ = false;
rewinded_ = false;
}
-WebRtc_Word32 PCMFile::SamplingFrequency() const {
+int32_t PCMFile::SamplingFrequency() const {
return frequency_;
}
-WebRtc_UWord16 PCMFile::PayloadLength10Ms() const {
+uint16_t PCMFile::PayloadLength10Ms() const {
return samples_10ms_;
}
-WebRtc_Word32 PCMFile::Read10MsData(AudioFrame& audio_frame) {
- WebRtc_UWord16 channels = 1;
+int32_t PCMFile::Read10MsData(AudioFrame& audio_frame) {
+ uint16_t channels = 1;
if (read_stereo_) {
channels = 2;
}
- WebRtc_Word32 payload_size = (WebRtc_Word32) fread(audio_frame.data_,
- sizeof(WebRtc_UWord16),
+ int32_t payload_size = (int32_t) fread(audio_frame.data_,
+ sizeof(uint16_t),
samples_10ms_ * channels,
pcm_file_);
if (payload_size < samples_10ms_ * channels) {
@@ -185,20 +184,20 @@
void PCMFile::Write10MsData(AudioFrame& audio_frame) {
if (audio_frame.num_channels_ == 1) {
if (!save_stereo_) {
- if (fwrite(audio_frame.data_, sizeof(WebRtc_UWord16),
+ if (fwrite(audio_frame.data_, sizeof(uint16_t),
audio_frame.samples_per_channel_, pcm_file_) !=
static_cast<size_t>(audio_frame.samples_per_channel_)) {
return;
}
} else {
- WebRtc_Word16* stereo_audio =
- new WebRtc_Word16[2 * audio_frame.samples_per_channel_];
+ int16_t* stereo_audio =
+ new int16_t[2 * audio_frame.samples_per_channel_];
int k;
for (k = 0; k < audio_frame.samples_per_channel_; k++) {
stereo_audio[k << 1] = audio_frame.data_[k];
stereo_audio[(k << 1) + 1] = audio_frame.data_[k];
}
- if (fwrite(stereo_audio, sizeof(WebRtc_Word16),
+ if (fwrite(stereo_audio, sizeof(int16_t),
2 * audio_frame.samples_per_channel_, pcm_file_) !=
static_cast<size_t>(2 * audio_frame.samples_per_channel_)) {
return;
@@ -206,7 +205,7 @@
delete[] stereo_audio;
}
} else {
- if (fwrite(audio_frame.data_, sizeof(WebRtc_Word16),
+ if (fwrite(audio_frame.data_, sizeof(int16_t),
audio_frame.num_channels_ * audio_frame.samples_per_channel_,
pcm_file_) != static_cast<size_t>(
audio_frame.num_channels_ * audio_frame.samples_per_channel_)) {
@@ -215,9 +214,9 @@
}
}
-void PCMFile::Write10MsData(WebRtc_Word16* playout_buffer,
- WebRtc_UWord16 length_smpls) {
- if (fwrite(playout_buffer, sizeof(WebRtc_UWord16),
+void PCMFile::Write10MsData(int16_t* playout_buffer,
+ uint16_t length_smpls) {
+ if (fwrite(playout_buffer, sizeof(uint16_t),
length_smpls, pcm_file_) != length_smpls) {
return;
}