Change how background noise mode in NetEq is set
This change prepares for switching default background noise (bgn) mode from on to off. The actual switch will be done later. In this change, the bgn mode is included as a setting in NetEq's config struct. We're also removing the connection between playout modes and bgn modes in ACM. In practice this means that bgn mode will change from off to on for streaming mode, but since the playout modes are not used it does not matter. BUG=3519 R=tina.legrand@webrtc.org Review URL: https://webrtc-codereview.appspot.com/21749004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6843 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -49,7 +49,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
NetEqImpl::NetEqImpl(int fs,
|
||||
NetEqImpl::NetEqImpl(const NetEq::Config& config,
|
||||
BufferLevelFilter* buffer_level_filter,
|
||||
DecoderDatabase* decoder_database,
|
||||
DelayManager* delay_manager,
|
||||
@ -90,8 +90,10 @@ NetEqImpl::NetEqImpl(int fs,
|
||||
first_packet_(true),
|
||||
error_code_(0),
|
||||
decoder_error_code_(0),
|
||||
background_noise_mode_(config.background_noise_mode),
|
||||
decoded_packet_sequence_number_(-1),
|
||||
decoded_packet_timestamp_(0) {
|
||||
int fs = config.sample_rate_hz;
|
||||
if (fs != 8000 && fs != 16000 && fs != 32000 && fs != 48000) {
|
||||
LOG(LS_ERROR) << "Sample rate " << fs << " Hz not supported. " <<
|
||||
"Changing to 8000 Hz.";
|
||||
@ -384,18 +386,6 @@ int NetEqImpl::DecodedRtpInfo(int* sequence_number, uint32_t* timestamp) const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NetEqImpl::SetBackgroundNoiseMode(NetEqBackgroundNoiseMode mode) {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
assert(background_noise_.get());
|
||||
background_noise_->set_mode(mode);
|
||||
}
|
||||
|
||||
NetEqBackgroundNoiseMode NetEqImpl::BackgroundNoiseMode() const {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
assert(background_noise_.get());
|
||||
return background_noise_->mode();
|
||||
}
|
||||
|
||||
const SyncBuffer* NetEqImpl::sync_buffer_for_test() const {
|
||||
CriticalSectionScoped lock(crit_sect_.get());
|
||||
return sync_buffer_.get();
|
||||
@ -1873,14 +1863,9 @@ void NetEqImpl::SetSampleRateAndChannels(int fs_hz, size_t channels) {
|
||||
// Delete sync buffer and create a new one.
|
||||
sync_buffer_.reset(new SyncBuffer(channels, kSyncBufferSize * fs_mult_));
|
||||
|
||||
|
||||
// Delete BackgroundNoise object and create a new one, while preserving its
|
||||
// mode.
|
||||
NetEqBackgroundNoiseMode current_mode = kBgnOn;
|
||||
if (background_noise_.get())
|
||||
current_mode = background_noise_->mode();
|
||||
// Delete BackgroundNoise object and create a new one.
|
||||
background_noise_.reset(new BackgroundNoise(channels));
|
||||
background_noise_->set_mode(current_mode);
|
||||
background_noise_->set_mode(background_noise_mode_);
|
||||
|
||||
// Reset random vector.
|
||||
random_vector_.Reset();
|
||||
|
||||
Reference in New Issue
Block a user