OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1737 msg.num_output_channels(), | 1737 msg.num_output_channels(), |
1738 msg.num_reverse_channels(), | 1738 msg.num_reverse_channels(), |
1739 false); | 1739 false); |
1740 if (first_init) { | 1740 if (first_init) { |
1741 // StartDebugRecording() writes an additional init message. Don't start | 1741 // StartDebugRecording() writes an additional init message. Don't start |
1742 // recording until after the first init to avoid the extra message. | 1742 // recording until after the first init to avoid the extra message. |
1743 EXPECT_NOERR(apm_->StartDebugRecording(out_filename.c_str())); | 1743 EXPECT_NOERR(apm_->StartDebugRecording(out_filename.c_str())); |
1744 first_init = false; | 1744 first_init = false; |
1745 } | 1745 } |
1746 | 1746 |
| 1747 } else if (event_msg.type() == audioproc::Event::CONFIG) { |
| 1748 const audioproc::Config msg = event_msg.config(); |
| 1749 Config config; |
| 1750 // AEC (5) |
| 1751 if (msg.has_aec_enabled()) { |
| 1752 apm_->echo_cancellation()->Enable(msg.aec_enabled()); |
| 1753 } |
| 1754 if (msg.has_aec_delay_agnostic()) { |
| 1755 config.Set<DelayAgnostic>(new DelayAgnostic(msg.aec_delay_agnostic())); |
| 1756 } |
| 1757 if (msg.has_aec_drift_compensation()) { |
| 1758 apm_->echo_cancellation()->enable_drift_compensation( |
| 1759 msg.aec_drift_compensation()); |
| 1760 } |
| 1761 if (msg.has_aec_extended_filter()) { |
| 1762 config.Set<ExtendedFilter>(new ExtendedFilter( |
| 1763 msg.aec_extended_filter())); |
| 1764 } |
| 1765 if (msg.has_aec_suppression_level()) { |
| 1766 apm_->echo_cancellation()->set_suppression_level( |
| 1767 static_cast<webrtc::EchoCancellation::SuppressionLevel>( |
| 1768 msg.aec_suppression_level())); |
| 1769 } |
| 1770 // AEC-M (3) |
| 1771 if (msg.has_aecm_enabled()) { |
| 1772 apm_->echo_control_mobile()->Enable(msg.aecm_enabled()); |
| 1773 } |
| 1774 if (msg.has_aecm_comfort_noise()) { |
| 1775 apm_->echo_control_mobile()->enable_comfort_noise( |
| 1776 msg.aecm_comfort_noise()); |
| 1777 } |
| 1778 if (msg.has_aecm_routing_mode()) { |
| 1779 apm_->echo_control_mobile()->set_routing_mode( |
| 1780 static_cast<webrtc::EchoControlMobile::RoutingMode>( |
| 1781 msg.aecm_routing_mode())); |
| 1782 } |
| 1783 // AGC (4) |
| 1784 if (msg.has_agc_enabled()) { |
| 1785 apm_->gain_control()->Enable(msg.agc_enabled()); |
| 1786 } |
| 1787 if (msg.has_agc_experiment()) { |
| 1788 // agc_experiment can only be set in the ctor of APM. So there should be |
| 1789 // nothing to do, unless the |apm_| is wrongly initialized. |
| 1790 } |
| 1791 if (msg.has_agc_mode()) { |
| 1792 apm_->gain_control()->set_mode( |
| 1793 static_cast<webrtc::GainControl::Mode>(msg.agc_mode())); |
| 1794 } |
| 1795 if (msg.has_agc_limiter()) { |
| 1796 apm_->gain_control()->enable_limiter(msg.agc_limiter()); |
| 1797 } |
| 1798 // HPF (1) |
| 1799 if (msg.has_hpf_enabled()) { |
| 1800 apm_->high_pass_filter()->Enable(msg.hpf_enabled()); |
| 1801 } |
| 1802 // NS (3) |
| 1803 if (msg.has_ns_enabled()) { |
| 1804 apm_->noise_suppression()->Enable(msg.ns_enabled()); |
| 1805 } |
| 1806 if (msg.has_ns_experiment()) { |
| 1807 config.Set<ExperimentalNs>(new ExperimentalNs(msg.ns_experiment())); |
| 1808 } |
| 1809 if (msg.has_ns_level()) { |
| 1810 apm_->noise_suppression()->set_level( |
| 1811 static_cast<webrtc::NoiseSuppression::Level>(msg.ns_level())); |
| 1812 } |
| 1813 apm_->SetExtraOptions(config); |
1747 } else if (event_msg.type() == audioproc::Event::REVERSE_STREAM) { | 1814 } else if (event_msg.type() == audioproc::Event::REVERSE_STREAM) { |
1748 const audioproc::ReverseStream msg = event_msg.reverse_stream(); | 1815 const audioproc::ReverseStream msg = event_msg.reverse_stream(); |
1749 | 1816 |
1750 if (msg.channel_size() > 0) { | 1817 if (msg.channel_size() > 0) { |
1751 ASSERT_EQ(revframe_->num_channels_, msg.channel_size()); | 1818 ASSERT_EQ(revframe_->num_channels_, msg.channel_size()); |
1752 for (int i = 0; i < msg.channel_size(); ++i) { | 1819 for (int i = 0; i < msg.channel_size(); ++i) { |
1753 memcpy(revfloat_cb_->channels()[i], | 1820 memcpy(revfloat_cb_->channels()[i], |
1754 msg.channel(i).data(), | 1821 msg.channel(i).data(), |
1755 msg.channel(i).size()); | 1822 msg.channel(i).size()); |
1756 } | 1823 } |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 std::tr1::make_tuple(16000, 16000, 32000, 16000, 40, 20), | 2815 std::tr1::make_tuple(16000, 16000, 32000, 16000, 40, 20), |
2749 std::tr1::make_tuple(16000, 16000, 16000, 16000, 0, 0))); | 2816 std::tr1::make_tuple(16000, 16000, 16000, 16000, 0, 0))); |
2750 #endif | 2817 #endif |
2751 | 2818 |
2752 // TODO(henrike): re-implement functionality lost when removing the old main | 2819 // TODO(henrike): re-implement functionality lost when removing the old main |
2753 // function. See | 2820 // function. See |
2754 // https://code.google.com/p/webrtc/issues/detail?id=1981 | 2821 // https://code.google.com/p/webrtc/issues/detail?id=1981 |
2755 | 2822 |
2756 } // namespace | 2823 } // namespace |
2757 } // namespace webrtc | 2824 } // namespace webrtc |
OLD | NEW |