OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 if (!settings_.use_ts) { | 152 if (!settings_.use_ts) { |
153 if (msg.has_keypress()) { | 153 if (msg.has_keypress()) { |
154 ap_->set_stream_key_pressed(msg.keypress()); | 154 ap_->set_stream_key_pressed(msg.keypress()); |
155 } | 155 } |
156 } else { | 156 } else { |
157 ap_->set_stream_key_pressed(*settings_.use_ts); | 157 ap_->set_stream_key_pressed(*settings_.use_ts); |
158 } | 158 } |
159 | 159 |
160 // TODO(peah): Add support for controlling the analog level via the | 160 // TODO(peah): Add support for controlling the analog level via the |
161 // command-line. | 161 // command-line. |
162 RTC_CHECK(msg.has_level()); // Level is always logged in AEC dumps. | 162 |
163 // When the analog gain is simulated, use the gain suggested by AGC instead of | 163 // Level is always logged in AEC dumps. |
164 // that stored in the AEC dump. | 164 RTC_CHECK(msg.has_level()); |
165 RTC_CHECK_EQ(AudioProcessing::kNoError, | 165 // When the analog gain is simulated, use the gain suggested by AGC |
166 ap_->gain_control()->set_stream_analog_level( | 166 // instead of that stored in the AEC dump. |
167 settings_.simulate_mic_gain ? | 167 RTC_CHECK_EQ( |
168 last_specified_microphone_level_ : msg.level())); | 168 AudioProcessing::kNoError, |
169 // TODO(aleloi): If settings_.simulate_mic_gain, set undo level to | 169 ap_->gain_control()->set_stream_analog_level( |
170 // |msg.level()| via FakeRecordingDevice::NotifyAudioDeviceLevel(). | 170 settings_.simulate_mic_gain ? fake_recording_device_->analog_level() |
| 171 : msg.level())); |
| 172 if (settings_.simulate_mic_gain) { |
| 173 fake_recording_device_->NotifyAudioDeviceLevel(msg.level()); |
| 174 } |
171 } | 175 } |
172 | 176 |
173 void AecDumpBasedSimulator::VerifyProcessStreamBitExactness( | 177 void AecDumpBasedSimulator::VerifyProcessStreamBitExactness( |
174 const webrtc::audioproc::Stream& msg) { | 178 const webrtc::audioproc::Stream& msg) { |
175 if (bitexact_output_) { | 179 if (bitexact_output_) { |
176 if (interface_used_ == InterfaceType::kFixedInterface) { | 180 if (interface_used_ == InterfaceType::kFixedInterface) { |
177 bitexact_output_ = VerifyFixedBitExactness(msg, fwd_frame_); | 181 bitexact_output_ = VerifyFixedBitExactness(msg, fwd_frame_); |
178 } else { | 182 } else { |
179 bitexact_output_ = VerifyFloatBitExactness(msg, out_config_, *out_buf_); | 183 bitexact_output_ = VerifyFloatBitExactness(msg, out_config_, *out_buf_); |
180 } | 184 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 SetupBuffersConfigsOutputs( | 564 SetupBuffersConfigsOutputs( |
561 msg.sample_rate(), output_sample_rate, msg.reverse_sample_rate(), | 565 msg.sample_rate(), output_sample_rate, msg.reverse_sample_rate(), |
562 reverse_output_sample_rate, msg.num_input_channels(), num_output_channels, | 566 reverse_output_sample_rate, msg.num_input_channels(), num_output_channels, |
563 msg.num_reverse_channels(), num_reverse_output_channels); | 567 msg.num_reverse_channels(), num_reverse_output_channels); |
564 } | 568 } |
565 | 569 |
566 void AecDumpBasedSimulator::HandleMessage( | 570 void AecDumpBasedSimulator::HandleMessage( |
567 const webrtc::audioproc::Stream& msg) { | 571 const webrtc::audioproc::Stream& msg) { |
568 PrepareProcessStreamCall(msg); | 572 PrepareProcessStreamCall(msg); |
569 ProcessStream(interface_used_ == InterfaceType::kFixedInterface); | 573 ProcessStream(interface_used_ == InterfaceType::kFixedInterface); |
| 574 |
| 575 // Call stream analog level even if !simulate_mic_gain to ensure |
| 576 // that any side-effects are triggered. |
| 577 const int level = ap_->gain_control()->stream_analog_level(); |
570 if (settings_.simulate_mic_gain) { | 578 if (settings_.simulate_mic_gain) { |
571 // Store analog level for the next analyzed frame. | 579 fake_recording_device_->set_analog_level(level); |
572 last_specified_microphone_level_ = | |
573 ap_->gain_control()->stream_analog_level(); | |
574 // TODO(aleloi): Set the returned value into a FakeRecordingDevice instance | |
575 // via FakeRecordingDevice::set_analog_level() instead of using | |
576 // last_specified_microphone_level_. | |
577 } else { | |
578 // Call stream analog level to ensure that any side-effects are triggered. | |
579 (void)ap_->gain_control()->stream_analog_level(); | |
580 } | 580 } |
581 VerifyProcessStreamBitExactness(msg); | 581 VerifyProcessStreamBitExactness(msg); |
582 } | 582 } |
583 | 583 |
584 void AecDumpBasedSimulator::HandleMessage( | 584 void AecDumpBasedSimulator::HandleMessage( |
585 const webrtc::audioproc::ReverseStream& msg) { | 585 const webrtc::audioproc::ReverseStream& msg) { |
586 PrepareReverseProcessStreamCall(msg); | 586 PrepareReverseProcessStreamCall(msg); |
587 ProcessReverseStream(interface_used_ == InterfaceType::kFixedInterface); | 587 ProcessReverseStream(interface_used_ == InterfaceType::kFixedInterface); |
588 } | 588 } |
589 | 589 |
590 } // namespace test | 590 } // namespace test |
591 } // namespace webrtc | 591 } // namespace webrtc |
OLD | NEW |