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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 void LoudnessHistogramTest::TestClean() { | 44 void LoudnessHistogramTest::TestClean() { |
45 EXPECT_EQ(hist_->CurrentRms(), 7.59621091765857e-02); | 45 EXPECT_EQ(hist_->CurrentRms(), 7.59621091765857e-02); |
46 EXPECT_EQ(hist_->AudioContent(), 0); | 46 EXPECT_EQ(hist_->AudioContent(), 0); |
47 EXPECT_EQ(hist_->num_updates(), 0); | 47 EXPECT_EQ(hist_->num_updates(), 0); |
48 } | 48 } |
49 | 49 |
50 void LoudnessHistogramTest::RunTest(bool enable_circular_buff, | 50 void LoudnessHistogramTest::RunTest(bool enable_circular_buff, |
51 const char* filename) { | 51 const char* filename) { |
52 FILE* in_file = fopen(filename, "rb"); | 52 FILE* in_file = fopen(filename, "rb"); |
53 ASSERT_TRUE(in_file != NULL); | 53 ASSERT_TRUE(in_file != nullptr); |
54 if (enable_circular_buff) { | 54 if (enable_circular_buff) { |
55 int buffer_size; | 55 int buffer_size; |
56 EXPECT_EQ(fread(&buffer_size, sizeof(buffer_size), 1, in_file), 1u); | 56 EXPECT_EQ(fread(&buffer_size, sizeof(buffer_size), 1, in_file), 1u); |
57 hist_.reset(LoudnessHistogram::Create(buffer_size)); | 57 hist_.reset(LoudnessHistogram::Create(buffer_size)); |
58 } else { | 58 } else { |
59 hist_.reset(LoudnessHistogram::Create()); | 59 hist_.reset(LoudnessHistogram::Create()); |
60 } | 60 } |
61 TestClean(); | 61 TestClean(); |
62 | 62 |
63 InputOutput io; | 63 InputOutput io; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 .c_str()); | 97 .c_str()); |
98 } | 98 } |
99 | 99 |
100 TEST_F(LoudnessHistogramTest, InactiveCircularBuffer) { | 100 TEST_F(LoudnessHistogramTest, InactiveCircularBuffer) { |
101 RunTest(false, test::ResourcePath( | 101 RunTest(false, test::ResourcePath( |
102 "audio_processing/agc/agc_no_circular_buffer", "dat") | 102 "audio_processing/agc/agc_no_circular_buffer", "dat") |
103 .c_str()); | 103 .c_str()); |
104 } | 104 } |
105 | 105 |
106 } // namespace webrtc | 106 } // namespace webrtc |
OLD | NEW |