Keep track of the user-facing number of channels in a ChannelBuffer
Before this change the ChannelBuffer had a fixed number of channels. This meant for example that when the Beamformer would reduce the number of channels to one, the merging filter bank was still merging all the channels, which was unnecessary since they were not processed and just discarded later. This change doesn't change the signal at all. It just reflects the number of channels in the ChannelBuffer, reducing the complexity. R=henrik.lundin@webrtc.org, peah@webrtc.org, tina.legrand@webrtc.org Review URL: https://codereview.webrtc.org/2053773002 . Cr-Commit-Position: refs/heads/master@{#13352}
This commit is contained in:
@ -184,6 +184,10 @@ void AudioBuffer::InitForNewData() {
|
||||
reference_copied_ = false;
|
||||
activity_ = AudioFrame::kVadUnknown;
|
||||
num_channels_ = num_proc_channels_;
|
||||
data_->set_num_channels(num_proc_channels_);
|
||||
if (split_data_.get()) {
|
||||
split_data_->set_num_channels(num_proc_channels_);
|
||||
}
|
||||
}
|
||||
|
||||
const int16_t* const* AudioBuffer::channels_const() const {
|
||||
@ -345,6 +349,10 @@ size_t AudioBuffer::num_channels() const {
|
||||
|
||||
void AudioBuffer::set_num_channels(size_t num_channels) {
|
||||
num_channels_ = num_channels;
|
||||
data_->set_num_channels(num_channels);
|
||||
if (split_data_.get()) {
|
||||
split_data_->set_num_channels(num_channels);
|
||||
}
|
||||
}
|
||||
|
||||
size_t AudioBuffer::num_frames() const {
|
||||
|
||||
Reference in New Issue
Block a user