Chromium Code Reviews| 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) { | |
|
Andrew MacDonald
2015/09/26 02:36:20
Correct me if I'm wrong, but because the ref03.aec
minyue-webrtc
2015/09/26 16:26:44
ref03.aecdump doesn't contain Config message. But
Andrew MacDonald
2015/09/28 06:22:33
OK, thanks. Still not totally convinced this is a
minyue-webrtc
2015/09/29 04:51:49
True, it does not test all combination of configs,
| |
| 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); | |
|
Andrew MacDonald
2015/09/26 02:36:20
This API is deprecated. Don't add more calls to it
minyue-webrtc
2015/09/26 16:26:44
Ok, thanks for the info. But how should one set ns
Andrew MacDonald
2015/09/28 06:22:33
Through Create().
minyue-webrtc
2015/09/29 04:51:49
Yes I see, do you suggest recreate APM here?
Andrew MacDonald
2015/09/29 05:05:17
No, I suggest not testing this feature here, as in
minyue-webrtc
2015/09/29 21:05:05
Ok. I'd remove these changes.
I will try to add s
Andrew MacDonald
2015/09/29 23:38:49
Why in a separate CL? If you're going to add a uni
| |
| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1832 EXPECT_EQ(ref_size, out_size); | 1899 EXPECT_EQ(ref_size, out_size); |
| 1833 EXPECT_EQ(0, memcmp(ref_bytes.get(), out_bytes.get(), ref_size)); | 1900 EXPECT_EQ(0, memcmp(ref_bytes.get(), out_bytes.get(), ref_size)); |
| 1834 ref_size = ReadMessageBytesFromFile(ref_file, &ref_bytes); | 1901 ref_size = ReadMessageBytesFromFile(ref_file, &ref_bytes); |
| 1835 out_size = ReadMessageBytesFromFile(out_file, &out_bytes); | 1902 out_size = ReadMessageBytesFromFile(out_file, &out_bytes); |
| 1836 } | 1903 } |
| 1837 EXPECT_GT(bytes_read, 0u); | 1904 EXPECT_GT(bytes_read, 0u); |
| 1838 EXPECT_NE(0, feof(ref_file)); | 1905 EXPECT_NE(0, feof(ref_file)); |
| 1839 EXPECT_NE(0, feof(out_file)); | 1906 EXPECT_NE(0, feof(out_file)); |
| 1840 ASSERT_EQ(0, fclose(ref_file)); | 1907 ASSERT_EQ(0, fclose(ref_file)); |
| 1841 ASSERT_EQ(0, fclose(out_file)); | 1908 ASSERT_EQ(0, fclose(out_file)); |
| 1842 remove(ref_filename.c_str()); | 1909 // remove(ref_filename.c_str()); |
|
ivoc
2015/09/25 09:24:21
Why is this commented out? I think it's needed, is
minyue-webrtc
2015/09/25 09:49:09
sorry sorry, I needed they to help debugging.
| |
| 1843 remove(out_filename.c_str()); | 1910 // remove(out_filename.c_str()); |
| 1844 } | 1911 } |
| 1845 | 1912 |
| 1846 TEST_F(ApmTest, VerifyDebugDumpInt) { | 1913 TEST_F(ApmTest, VerifyDebugDumpInt) { |
| 1847 VerifyDebugDumpTest(kIntFormat); | 1914 VerifyDebugDumpTest(kIntFormat); |
| 1848 } | 1915 } |
| 1849 | 1916 |
| 1850 TEST_F(ApmTest, VerifyDebugDumpFloat) { | 1917 TEST_F(ApmTest, VerifyDebugDumpFloat) { |
| 1851 VerifyDebugDumpTest(kFloatFormat); | 1918 VerifyDebugDumpTest(kFloatFormat); |
| 1852 } | 1919 } |
| 1853 #endif | 1920 #endif |
| (...skipping 894 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 |