| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 return true; | 60 return true; |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace | 63 } // namespace |
| 64 | 64 |
| 65 void AecDumpBasedSimulator::PrepareProcessStreamCall( | 65 void AecDumpBasedSimulator::PrepareProcessStreamCall( |
| 66 const webrtc::audioproc::Stream& msg) { | 66 const webrtc::audioproc::Stream& msg, |
| 67 bool* set_stream_analog_level_called) { |
| 67 if (msg.has_input_data()) { | 68 if (msg.has_input_data()) { |
| 68 // Fixed interface processing. | 69 // Fixed interface processing. |
| 69 // Verify interface invariance. | 70 // Verify interface invariance. |
| 70 RTC_CHECK(interface_used_ == InterfaceType::kFixedInterface || | 71 RTC_CHECK(interface_used_ == InterfaceType::kFixedInterface || |
| 71 interface_used_ == InterfaceType::kNotSpecified); | 72 interface_used_ == InterfaceType::kNotSpecified); |
| 72 interface_used_ = InterfaceType::kFixedInterface; | 73 interface_used_ = InterfaceType::kFixedInterface; |
| 73 | 74 |
| 74 // Populate input buffer. | 75 // Populate input buffer. |
| 75 RTC_CHECK_EQ(sizeof(fwd_frame_.data_[0]) * fwd_frame_.samples_per_channel_ * | 76 RTC_CHECK_EQ(sizeof(fwd_frame_.data_[0]) * fwd_frame_.samples_per_channel_ * |
| 76 fwd_frame_.num_channels_, | 77 fwd_frame_.num_channels_, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 } | 121 } |
| 121 } else { | 122 } else { |
| 122 ap_->set_stream_key_pressed(*settings_.use_ts); | 123 ap_->set_stream_key_pressed(*settings_.use_ts); |
| 123 } | 124 } |
| 124 | 125 |
| 125 // TODO(peah): Add support for controlling the analog level via the | 126 // TODO(peah): Add support for controlling the analog level via the |
| 126 // command-line. | 127 // command-line. |
| 127 if (msg.has_level()) { | 128 if (msg.has_level()) { |
| 128 RTC_CHECK_EQ(AudioProcessing::kNoError, | 129 RTC_CHECK_EQ(AudioProcessing::kNoError, |
| 129 ap_->gain_control()->set_stream_analog_level(msg.level())); | 130 ap_->gain_control()->set_stream_analog_level(msg.level())); |
| 131 *set_stream_analog_level_called = true; |
| 132 } else { |
| 133 *set_stream_analog_level_called = false; |
| 130 } | 134 } |
| 131 } | 135 } |
| 132 | 136 |
| 133 void AecDumpBasedSimulator::VerifyProcessStreamBitExactness( | 137 void AecDumpBasedSimulator::VerifyProcessStreamBitExactness( |
| 134 const webrtc::audioproc::Stream& msg) { | 138 const webrtc::audioproc::Stream& msg) { |
| 135 if (bitexact_output_) { | 139 if (bitexact_output_) { |
| 136 if (interface_used_ == InterfaceType::kFixedInterface) { | 140 if (interface_used_ == InterfaceType::kFixedInterface) { |
| 137 bitexact_output_ = VerifyFixedBitExactness(msg, fwd_frame_); | 141 bitexact_output_ = VerifyFixedBitExactness(msg, fwd_frame_); |
| 138 } else { | 142 } else { |
| 139 bitexact_output_ = VerifyFloatBitExactness(msg, out_config_, *out_buf_); | 143 bitexact_output_ = VerifyFloatBitExactness(msg, out_config_, *out_buf_); |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 } | 504 } |
| 501 | 505 |
| 502 SetupBuffersConfigsOutputs( | 506 SetupBuffersConfigsOutputs( |
| 503 msg.sample_rate(), output_sample_rate, msg.reverse_sample_rate(), | 507 msg.sample_rate(), output_sample_rate, msg.reverse_sample_rate(), |
| 504 reverse_output_sample_rate, msg.num_input_channels(), num_output_channels, | 508 reverse_output_sample_rate, msg.num_input_channels(), num_output_channels, |
| 505 msg.num_reverse_channels(), num_reverse_output_channels); | 509 msg.num_reverse_channels(), num_reverse_output_channels); |
| 506 } | 510 } |
| 507 | 511 |
| 508 void AecDumpBasedSimulator::HandleMessage( | 512 void AecDumpBasedSimulator::HandleMessage( |
| 509 const webrtc::audioproc::Stream& msg) { | 513 const webrtc::audioproc::Stream& msg) { |
| 510 PrepareProcessStreamCall(msg); | 514 bool set_stream_analog_level_called = false; |
| 515 PrepareProcessStreamCall(msg, &set_stream_analog_level_called); |
| 511 ProcessStream(interface_used_ == InterfaceType::kFixedInterface); | 516 ProcessStream(interface_used_ == InterfaceType::kFixedInterface); |
| 517 if (set_stream_analog_level_called) { |
| 518 // Call stream analog level to ensure that any side-effects are triggered. |
| 519 (void)ap_->gain_control()->stream_analog_level(); |
| 520 } |
| 521 |
| 512 VerifyProcessStreamBitExactness(msg); | 522 VerifyProcessStreamBitExactness(msg); |
| 513 } | 523 } |
| 514 | 524 |
| 515 void AecDumpBasedSimulator::HandleMessage( | 525 void AecDumpBasedSimulator::HandleMessage( |
| 516 const webrtc::audioproc::ReverseStream& msg) { | 526 const webrtc::audioproc::ReverseStream& msg) { |
| 517 PrepareReverseProcessStreamCall(msg); | 527 PrepareReverseProcessStreamCall(msg); |
| 518 ProcessReverseStream(interface_used_ == InterfaceType::kFixedInterface); | 528 ProcessReverseStream(interface_used_ == InterfaceType::kFixedInterface); |
| 519 } | 529 } |
| 520 | 530 |
| 521 } // namespace test | 531 } // namespace test |
| 522 } // namespace webrtc | 532 } // namespace webrtc |
| OLD | NEW |