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 1715 matching lines...) Loading... |
1726 Init(msg.sample_rate(), | 1726 Init(msg.sample_rate(), |
1727 output_sample_rate, | 1727 output_sample_rate, |
1728 reverse_sample_rate, | 1728 reverse_sample_rate, |
1729 msg.num_input_channels(), | 1729 msg.num_input_channels(), |
1730 msg.num_output_channels(), | 1730 msg.num_output_channels(), |
1731 msg.num_reverse_channels(), | 1731 msg.num_reverse_channels(), |
1732 false); | 1732 false); |
1733 if (first_init) { | 1733 if (first_init) { |
1734 // StartDebugRecording() writes an additional init message. Don't start | 1734 // StartDebugRecording() writes an additional init message. Don't start |
1735 // recording until after the first init to avoid the extra message. | 1735 // recording until after the first init to avoid the extra message. |
1736 EXPECT_NOERR( | 1736 EXPECT_NOERR(apm_->StartDebugRecording(out_filename.c_str(), |
1737 apm_->StartDebugRecording(out_filename.c_str(), max_size_bytes)); | 1737 max_size_bytes, nullptr)); |
1738 first_init = false; | 1738 first_init = false; |
1739 } | 1739 } |
1740 | 1740 |
1741 } else if (event_msg.type() == audioproc::Event::REVERSE_STREAM) { | 1741 } else if (event_msg.type() == audioproc::Event::REVERSE_STREAM) { |
1742 const audioproc::ReverseStream msg = event_msg.reverse_stream(); | 1742 const audioproc::ReverseStream msg = event_msg.reverse_stream(); |
1743 | 1743 |
1744 if (msg.channel_size() > 0) { | 1744 if (msg.channel_size() > 0) { |
1745 ASSERT_EQ(revframe_->num_channels_, | 1745 ASSERT_EQ(revframe_->num_channels_, |
1746 static_cast<size_t>(msg.channel_size())); | 1746 static_cast<size_t>(msg.channel_size())); |
1747 for (int i = 0; i < msg.channel_size(); ++i) { | 1747 for (int i = 0; i < msg.channel_size(); ++i) { |
(...skipping 117 matching lines...) Loading... |
1865 | 1865 |
1866 TEST_F(ApmTest, VerifyDebugDumpFloat) { | 1866 TEST_F(ApmTest, VerifyDebugDumpFloat) { |
1867 VerifyDebugDumpTest(kFloatFormat); | 1867 VerifyDebugDumpTest(kFloatFormat); |
1868 } | 1868 } |
1869 #endif | 1869 #endif |
1870 | 1870 |
1871 // TODO(andrew): expand test to verify output. | 1871 // TODO(andrew): expand test to verify output. |
1872 TEST_F(ApmTest, DebugDump) { | 1872 TEST_F(ApmTest, DebugDump) { |
1873 const std::string filename = | 1873 const std::string filename = |
1874 test::TempFilename(test::OutputPath(), "debug_aec"); | 1874 test::TempFilename(test::OutputPath(), "debug_aec"); |
1875 EXPECT_EQ(apm_->kNullPointerError, | 1875 EXPECT_EQ( |
1876 apm_->StartDebugRecording(static_cast<const char*>(NULL), -1)); | 1876 apm_->kNullPointerError, |
| 1877 apm_->StartDebugRecording(static_cast<const char*>(NULL), -1, nullptr)); |
1877 | 1878 |
1878 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 1879 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
1879 // Stopping without having started should be OK. | 1880 // Stopping without having started should be OK. |
1880 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); | 1881 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); |
1881 | 1882 |
1882 EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(filename.c_str(), -1)); | 1883 EXPECT_EQ(apm_->kNoError, |
| 1884 apm_->StartDebugRecording(filename.c_str(), -1, nullptr)); |
1883 EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); | 1885 EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); |
1884 EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_)); | 1886 EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_)); |
1885 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); | 1887 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); |
1886 | 1888 |
1887 // Verify the file has been written. | 1889 // Verify the file has been written. |
1888 FILE* fid = fopen(filename.c_str(), "r"); | 1890 FILE* fid = fopen(filename.c_str(), "r"); |
1889 ASSERT_TRUE(fid != NULL); | 1891 ASSERT_TRUE(fid != NULL); |
1890 | 1892 |
1891 // Clean it up. | 1893 // Clean it up. |
1892 ASSERT_EQ(0, fclose(fid)); | 1894 ASSERT_EQ(0, fclose(fid)); |
1893 ASSERT_EQ(0, remove(filename.c_str())); | 1895 ASSERT_EQ(0, remove(filename.c_str())); |
1894 #else | 1896 #else |
1895 EXPECT_EQ(apm_->kUnsupportedFunctionError, | 1897 EXPECT_EQ(apm_->kUnsupportedFunctionError, |
1896 apm_->StartDebugRecording(filename.c_str(), -1)); | 1898 apm_->StartDebugRecording(filename.c_str(), -1)); |
1897 EXPECT_EQ(apm_->kUnsupportedFunctionError, apm_->StopDebugRecording()); | 1899 EXPECT_EQ(apm_->kUnsupportedFunctionError, apm_->StopDebugRecording()); |
1898 | 1900 |
1899 // Verify the file has NOT been written. | 1901 // Verify the file has NOT been written. |
1900 ASSERT_TRUE(fopen(filename.c_str(), "r") == NULL); | 1902 ASSERT_TRUE(fopen(filename.c_str(), "r") == NULL); |
1901 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1903 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
1902 } | 1904 } |
1903 | 1905 |
1904 // TODO(andrew): expand test to verify output. | 1906 // TODO(andrew): expand test to verify output. |
1905 TEST_F(ApmTest, DebugDumpFromFileHandle) { | 1907 TEST_F(ApmTest, DebugDumpFromFileHandle) { |
1906 FILE* fid = NULL; | 1908 FILE* fid = NULL; |
1907 EXPECT_EQ(apm_->kNullPointerError, apm_->StartDebugRecording(fid, -1)); | 1909 EXPECT_EQ(apm_->kNullPointerError, |
| 1910 apm_->StartDebugRecording(fid, -1, nullptr)); |
1908 const std::string filename = | 1911 const std::string filename = |
1909 test::TempFilename(test::OutputPath(), "debug_aec"); | 1912 test::TempFilename(test::OutputPath(), "debug_aec"); |
1910 fid = fopen(filename.c_str(), "w"); | 1913 fid = fopen(filename.c_str(), "w"); |
1911 ASSERT_TRUE(fid); | 1914 ASSERT_TRUE(fid); |
1912 | 1915 |
1913 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 1916 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
1914 // Stopping without having started should be OK. | 1917 // Stopping without having started should be OK. |
1915 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); | 1918 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); |
1916 | 1919 |
1917 EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(fid, -1)); | 1920 EXPECT_EQ(apm_->kNoError, apm_->StartDebugRecording(fid, -1, nullptr)); |
1918 EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_)); | 1921 EXPECT_EQ(apm_->kNoError, apm_->ProcessReverseStream(revframe_)); |
1919 EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); | 1922 EXPECT_EQ(apm_->kNoError, apm_->ProcessStream(frame_)); |
1920 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); | 1923 EXPECT_EQ(apm_->kNoError, apm_->StopDebugRecording()); |
1921 | 1924 |
1922 // Verify the file has been written. | 1925 // Verify the file has been written. |
1923 fid = fopen(filename.c_str(), "r"); | 1926 fid = fopen(filename.c_str(), "r"); |
1924 ASSERT_TRUE(fid != NULL); | 1927 ASSERT_TRUE(fid != NULL); |
1925 | 1928 |
1926 // Clean it up. | 1929 // Clean it up. |
1927 ASSERT_EQ(0, fclose(fid)); | 1930 ASSERT_EQ(0, fclose(fid)); |
(...skipping 949 matching lines...) Loading... |
2877 // TODO(peah): Remove the testing for | 2880 // TODO(peah): Remove the testing for |
2878 // apm->capture_nonlocked_.level_controller_enabled once the value in config_ | 2881 // apm->capture_nonlocked_.level_controller_enabled once the value in config_ |
2879 // is instead used to activate the level controller. | 2882 // is instead used to activate the level controller. |
2880 EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled); | 2883 EXPECT_FALSE(apm->capture_nonlocked_.level_controller_enabled); |
2881 EXPECT_NEAR(kTargetLcPeakLeveldBFS, | 2884 EXPECT_NEAR(kTargetLcPeakLeveldBFS, |
2882 apm->config_.level_controller.initial_peak_level_dbfs, | 2885 apm->config_.level_controller.initial_peak_level_dbfs, |
2883 std::numeric_limits<float>::epsilon()); | 2886 std::numeric_limits<float>::epsilon()); |
2884 } | 2887 } |
2885 | 2888 |
2886 } // namespace webrtc | 2889 } // namespace webrtc |
OLD | NEW |