AudioBuffer: Eliminate data_was_mixed_, and document what's left of data_
data_was_mixed_ was always false, so it can be removed. That makes the role of data_ simpler, but not so simple that it doesn't merit an explanation. BUG= R=aluebs@webrtc.org, andrew@webrtc.org Review URL: https://webrtc-codereview.appspot.com/17409004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6076 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
2219037e5e
commit
4cc763621e
@ -97,7 +97,6 @@ AudioBuffer::AudioBuffer(int input_samples_per_channel,
|
||||
samples_per_split_channel_(proc_samples_per_channel_),
|
||||
num_mixed_channels_(0),
|
||||
num_mixed_low_pass_channels_(0),
|
||||
data_was_mixed_(false),
|
||||
reference_copied_(false),
|
||||
activity_(AudioFrame::kVadUnknown),
|
||||
is_muted_(false),
|
||||
@ -220,7 +219,6 @@ void AudioBuffer::CopyTo(int samples_per_channel,
|
||||
void AudioBuffer::InitForNewData() {
|
||||
data_ = NULL;
|
||||
keyboard_data_ = NULL;
|
||||
data_was_mixed_ = false;
|
||||
num_mixed_channels_ = 0;
|
||||
num_mixed_low_pass_channels_ = 0;
|
||||
reference_copied_ = false;
|
||||
@ -231,6 +229,7 @@ void AudioBuffer::InitForNewData() {
|
||||
const int16_t* AudioBuffer::data(int channel) const {
|
||||
assert(channel >= 0 && channel < num_proc_channels_);
|
||||
if (data_ != NULL) {
|
||||
assert(channel == 0 && num_proc_channels_ == 1);
|
||||
return data_;
|
||||
}
|
||||
|
||||
@ -370,15 +369,7 @@ void AudioBuffer::InterleaveTo(AudioFrame* frame, bool data_changed) const {
|
||||
}
|
||||
|
||||
if (num_proc_channels_ == 1) {
|
||||
if (data_was_mixed_) {
|
||||
memcpy(frame->data_,
|
||||
channels_->channel(0),
|
||||
sizeof(int16_t) * proc_samples_per_channel_);
|
||||
} else {
|
||||
// These should point to the same buffer in this case.
|
||||
assert(data_ == frame->data_);
|
||||
}
|
||||
|
||||
assert(data_ == frame->data_);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -104,13 +104,15 @@ class AudioBuffer {
|
||||
int samples_per_split_channel_;
|
||||
int num_mixed_channels_;
|
||||
int num_mixed_low_pass_channels_;
|
||||
// Whether the original data was replaced with mixed data.
|
||||
bool data_was_mixed_;
|
||||
bool reference_copied_;
|
||||
AudioFrame::VADActivity activity_;
|
||||
bool is_muted_;
|
||||
|
||||
// If non-null, use this instead of channels_->channel(0). This is an
|
||||
// optimization for the case num_proc_channels_ == 1 that allows us to point
|
||||
// to the data instead of copying it.
|
||||
int16_t* data_;
|
||||
|
||||
const float* keyboard_data_;
|
||||
scoped_ptr<ChannelBuffer<int16_t> > channels_;
|
||||
scoped_ptr<SplitChannelBuffer> split_channels_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user