Convert channel counts to size_t.
IIRC, this was originally requested by ajm during review of the other size_t conversions I did over the past year, and I agreed it made sense, but wanted to do it separately since those changes were already gargantuan. BUG=chromium:81439 TEST=none R=henrik.lundin@webrtc.org, henrika@webrtc.org, kjellander@webrtc.org, minyue@webrtc.org, perkj@webrtc.org, solenberg@webrtc.org, stefan@webrtc.org, tina.legrand@webrtc.org Review URL: https://codereview.webrtc.org/1316523002 . Cr-Commit-Position: refs/heads/master@{#11229}
This commit is contained in:
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user