| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 |
| 11 #include "webrtc/modules/audio_coding/neteq/audio_classifier.h" | 11 #include "webrtc/modules/audio_coding/neteq/audio_classifier.h" |
| 12 | 12 |
| 13 #include <math.h> | 13 #include <math.h> |
| 14 #include <stdio.h> | 14 #include <stdio.h> |
| 15 #include <stdlib.h> | 15 #include <stdlib.h> |
| 16 #include <string.h> | 16 #include <string.h> |
| 17 #include <string> | 17 #include <string> |
| 18 | 18 |
| 19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 20 #include "webrtc/test/testsupport/fileutils.h" | 20 #include "webrtc/test/testsupport/fileutils.h" |
| 21 #include "webrtc/test/testsupport/gtest_disable.h" | |
| 22 | 21 |
| 23 namespace webrtc { | 22 namespace webrtc { |
| 24 | 23 |
| 25 static const size_t kFrameSize = 960; | 24 static const size_t kFrameSize = 960; |
| 26 | 25 |
| 27 TEST(AudioClassifierTest, AllZeroInput) { | 26 TEST(AudioClassifierTest, AllZeroInput) { |
| 28 int16_t in_mono[kFrameSize] = {0}; | 27 int16_t in_mono[kFrameSize] = {0}; |
| 29 | 28 |
| 30 // Test all-zero vectors and let the classifier converge from its default | 29 // Test all-zero vectors and let the classifier converge from its default |
| 31 // to the expected value. | 30 // to the expected value. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 54 bool is_music = | 53 bool is_music = |
| 55 classifier.Analysis(in.get(), channels * kFrameSize, channels); | 54 classifier.Analysis(in.get(), channels * kFrameSize, channels); |
| 56 EXPECT_EQ(is_music, classifier.is_music()); | 55 EXPECT_EQ(is_music, classifier.is_music()); |
| 57 ASSERT_EQ(1u, fread(&is_music_ref, sizeof(is_music_ref), 1, data_file)); | 56 ASSERT_EQ(1u, fread(&is_music_ref, sizeof(is_music_ref), 1, data_file)); |
| 58 EXPECT_EQ(is_music_ref, is_music); | 57 EXPECT_EQ(is_music_ref, is_music); |
| 59 } | 58 } |
| 60 fclose(audio_file); | 59 fclose(audio_file); |
| 61 fclose(data_file); | 60 fclose(data_file); |
| 62 } | 61 } |
| 63 | 62 |
| 64 TEST(AudioClassifierTest, DISABLED_ON_IOS(DoAnalysisMono)) { | 63 TEST(AudioClassifierTest, DoAnalysisMono) { |
| 65 RunAnalysisTest(test::ResourcePath("short_mixed_mono_48", "pcm"), | 64 RunAnalysisTest(test::ResourcePath("short_mixed_mono_48", "pcm"), |
| 66 test::ResourcePath("short_mixed_mono_48", "dat"), | 65 test::ResourcePath("short_mixed_mono_48", "dat"), |
| 67 1); | 66 1); |
| 68 } | 67 } |
| 69 | 68 |
| 70 TEST(AudioClassifierTest, DISABLED_ON_IOS(DoAnalysisStereo)) { | 69 TEST(AudioClassifierTest, DoAnalysisStereo) { |
| 71 RunAnalysisTest(test::ResourcePath("short_mixed_stereo_48", "pcm"), | 70 RunAnalysisTest(test::ResourcePath("short_mixed_stereo_48", "pcm"), |
| 72 test::ResourcePath("short_mixed_stereo_48", "dat"), | 71 test::ResourcePath("short_mixed_stereo_48", "dat"), |
| 73 2); | 72 2); |
| 74 } | 73 } |
| 75 | 74 |
| 76 } // namespace webrtc | 75 } // namespace webrtc |
| OLD | NEW |