Chromium Code Reviews| Index: webrtc/modules/audio_processing/audio_processing_impl.cc |
| diff --git a/webrtc/modules/audio_processing/audio_processing_impl.cc b/webrtc/modules/audio_processing/audio_processing_impl.cc |
| index ff4128b6ed4485df0d5abef47a2ff006da53a6b5..d2a5ecbe3fe471c946eb1687863af57b4d7d296b 100644 |
| --- a/webrtc/modules/audio_processing/audio_processing_impl.cc |
| +++ b/webrtc/modules/audio_processing/audio_processing_impl.cc |
| @@ -239,6 +239,10 @@ AudioProcessingImpl::AudioProcessingImpl(const Config& config, |
| gain_control_for_new_agc_.reset(new GainControlForNewAgc(gain_control_)); |
| SetExtraOptions(config); |
| + |
| +#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
| + config_ = GetCurrentConfig(); |
| +#endif |
| } |
| AudioProcessingImpl::~AudioProcessingImpl() { |
| @@ -552,6 +556,16 @@ int AudioProcessingImpl::ProcessStream(const float* const* src, |
| #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
| if (debug_file_->Open()) { |
| + ApmConfig current_config = GetCurrentConfig(); |
| + if (current_config != config_) { |
|
minyue-webrtc
2015/09/24 17:26:23
I changed the way of detecting changes in the conf
|
| + config_ = current_config; |
| + RETURN_ON_ERR(WriteConfigMessage()); |
| + } |
| + } |
| +#endif |
| + |
| +#ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
| + if (debug_file_->Open()) { |
| event_msg_->set_type(audioproc::Event::STREAM); |
| audioproc::Stream* msg = event_msg_->mutable_stream(); |
| const size_t channel_size = |
| @@ -937,7 +951,12 @@ int AudioProcessingImpl::StartDebugRecording( |
| return kFileError; |
| } |
| - int err = WriteInitMessage(); |
| + int err = WriteConfigMessage(); |
| + if (err != kNoError) { |
| + return err; |
| + } |
| + |
| + err = WriteInitMessage(); |
| if (err != kNoError) { |
| return err; |
| } |
| @@ -966,7 +985,12 @@ int AudioProcessingImpl::StartDebugRecording(FILE* handle) { |
| return kFileError; |
| } |
| - int err = WriteInitMessage(); |
| + int err = WriteConfigMessage(); |
| + if (err != kNoError) { |
| + return err; |
| + } |
| + |
| + err = WriteInitMessage(); |
| if (err != kNoError) { |
| return err; |
| } |
| @@ -1246,6 +1270,79 @@ int AudioProcessingImpl::WriteInitMessage() { |
| return kNoError; |
| } |
| + |
| +AudioProcessingImpl::ApmConfig AudioProcessingImpl::GetCurrentConfig() const { |
| + ApmConfig config; |
| + // Acoustic echo canceler |
| + config.aec_enabled = echo_cancellation_->is_enabled(); |
| + config.aec_delay_agnostic = echo_cancellation_->is_delay_agnostic_enabled(); |
| + config.aec_drift_compensation = |
| + echo_cancellation_->is_drift_compensation_enabled(); |
| + config.aec_extended_filter = |
| + echo_cancellation_->is_extended_filter_enabled(); |
| + config.aec_suppression_level = echo_cancellation_->suppression_level(); |
| + |
| + // Mobile AEC |
| + config.aecm_enabled = echo_control_mobile_->is_enabled(); |
| + config.aecm_comfort_noise = |
| + echo_control_mobile_->is_comfort_noise_enabled(); |
| + config.aecm_routing_mode = echo_control_mobile_->routing_mode(); |
| + |
| + // Automatic gain controller |
| + config.agc_enabled = gain_control_->is_enabled(); |
| + config.agc_experiment = use_new_agc_; |
| + config.agc_mode = gain_control_->mode(); |
| + config.agc_limiter = gain_control_->is_limiter_enabled(); |
| + |
| + // High pass filter |
| + config.hpf_enabled = high_pass_filter_->is_enabled(); |
| + |
| + // Noise suppression |
| + config.ns_enabled = noise_suppression_->is_enabled(); |
| + config.ns_experiment = transient_suppressor_enabled_; |
| + config.ns_level = noise_suppression_->level(); |
| + |
| + return config; |
| +} |
| + |
| +int AudioProcessingImpl::WriteConfigMessage() { |
| + event_msg_->set_type(audioproc::Event::CONFIG); |
| + audioproc::Config* msg = event_msg_->mutable_config(); |
| + |
| + // Acoustic echo canceler |
| + msg->set_aec_enabled(config_.aec_enabled); |
| + msg->set_aec_delay_agnostic(config_.aec_delay_agnostic); |
| + |
| + msg->set_aec_drift_compensation(config_.aec_drift_compensation); |
| + msg->set_aec_extended_filter(config_.aec_extended_filter); |
| + msg->set_aec_suppression_level(config_.aec_suppression_level); |
| + |
| + // Mobile AEC |
| + msg->set_aecm_enabled(config_.aecm_enabled); |
| + msg->set_aecm_comfort_noise(config_.aecm_comfort_noise); |
| + msg->set_aecm_routing_mode(config_.aecm_routing_mode); |
| + |
| + // Automatic gain controller |
| + msg->set_agc_enabled(config_.agc_enabled); |
| + msg->set_agc_experiment(config_.agc_experiment); |
| + msg->set_agc_mode(config_.agc_mode); |
| + msg->set_agc_limiter(config_.agc_limiter); |
| + |
| + // High pass filter |
| + msg->set_hpf_enabled(config_.hpf_enabled); |
| + |
| + // Noise suppression |
| + msg->set_ns_enabled(config_.ns_enabled); |
| + msg->set_ns_experiment(config_.ns_experiment); |
| + msg->set_ns_level(config_.ns_level); |
| + |
| + int err = WriteMessageToDebugFile(); |
| + if (err != kNoError) { |
| + return err; |
| + } |
| + |
| + return kNoError; |
| +} |
| #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
| } // namespace webrtc |