Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: webrtc/modules/audio_coding/neteq/normal_unittest.cc

Issue 1697823002: Replace scoped_ptr with unique_ptr in webrtc/modules/audio_coding/neteq/ (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@up-codecs
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
11 // Unit tests for Normal class. 11 // Unit tests for Normal class.
12 12
13 #include "webrtc/modules/audio_coding/neteq/normal.h" 13 #include "webrtc/modules/audio_coding/neteq/normal.h"
14 14
15 #include <memory>
15 #include <vector> 16 #include <vector>
16 17
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "webrtc/base/scoped_ptr.h"
19 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h" 19 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar y.h"
20 #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" 20 #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
21 #include "webrtc/modules/audio_coding/neteq/background_noise.h" 21 #include "webrtc/modules/audio_coding/neteq/background_noise.h"
22 #include "webrtc/modules/audio_coding/neteq/expand.h" 22 #include "webrtc/modules/audio_coding/neteq/expand.h"
23 #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h" 23 #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h"
24 #include "webrtc/modules/audio_coding/neteq/mock/mock_expand.h" 24 #include "webrtc/modules/audio_coding/neteq/mock/mock_expand.h"
25 #include "webrtc/modules/audio_coding/neteq/random_vector.h" 25 #include "webrtc/modules/audio_coding/neteq/random_vector.h"
26 #include "webrtc/modules/audio_coding/neteq/statistics_calculator.h" 26 #include "webrtc/modules/audio_coding/neteq/statistics_calculator.h"
27 #include "webrtc/modules/audio_coding/neteq/sync_buffer.h" 27 #include "webrtc/modules/audio_coding/neteq/sync_buffer.h"
28 28
(...skipping 21 matching lines...) Expand all
50 size_t channels = 1; 50 size_t channels = 1;
51 BackgroundNoise bgn(channels); 51 BackgroundNoise bgn(channels);
52 SyncBuffer sync_buffer(1, 1000); 52 SyncBuffer sync_buffer(1, 1000);
53 RandomVector random_vector; 53 RandomVector random_vector;
54 StatisticsCalculator statistics; 54 StatisticsCalculator statistics;
55 MockExpand expand(&bgn, &sync_buffer, &random_vector, &statistics, fs, 55 MockExpand expand(&bgn, &sync_buffer, &random_vector, &statistics, fs,
56 channels); 56 channels);
57 Normal normal(fs, &db, bgn, &expand); 57 Normal normal(fs, &db, bgn, &expand);
58 58
59 int16_t input[1000] = {0}; 59 int16_t input[1000] = {0};
60 rtc::scoped_ptr<int16_t[]> mute_factor_array(new int16_t[channels]); 60 std::unique_ptr<int16_t[]> mute_factor_array(new int16_t[channels]);
61 for (size_t i = 0; i < channels; ++i) { 61 for (size_t i = 0; i < channels; ++i) {
62 mute_factor_array[i] = 16384; 62 mute_factor_array[i] = 16384;
63 } 63 }
64 AudioMultiVector output(channels); 64 AudioMultiVector output(channels);
65 65
66 // Zero input length. 66 // Zero input length.
67 EXPECT_EQ( 67 EXPECT_EQ(
68 0, 68 0,
69 normal.Process(input, 0, kModeExpand, mute_factor_array.get(), &output)); 69 normal.Process(input, 0, kModeExpand, mute_factor_array.get(), &output));
70 EXPECT_EQ(0u, output.Size()); 70 EXPECT_EQ(0u, output.Size());
(...skipping 25 matching lines...) Expand all
96 size_t channels = 2; 96 size_t channels = 2;
97 BackgroundNoise bgn(channels); 97 BackgroundNoise bgn(channels);
98 SyncBuffer sync_buffer(channels, 1000); 98 SyncBuffer sync_buffer(channels, 1000);
99 RandomVector random_vector; 99 RandomVector random_vector;
100 StatisticsCalculator statistics; 100 StatisticsCalculator statistics;
101 MockExpand expand(&bgn, &sync_buffer, &random_vector, &statistics, fs, 101 MockExpand expand(&bgn, &sync_buffer, &random_vector, &statistics, fs,
102 channels); 102 channels);
103 Normal normal(fs, &db, bgn, &expand); 103 Normal normal(fs, &db, bgn, &expand);
104 104
105 int16_t input[1000] = {0}; 105 int16_t input[1000] = {0};
106 rtc::scoped_ptr<int16_t[]> mute_factor_array(new int16_t[channels]); 106 std::unique_ptr<int16_t[]> mute_factor_array(new int16_t[channels]);
107 for (size_t i = 0; i < channels; ++i) { 107 for (size_t i = 0; i < channels; ++i) {
108 mute_factor_array[i] = 16384; 108 mute_factor_array[i] = 16384;
109 } 109 }
110 AudioMultiVector output(channels); 110 AudioMultiVector output(channels);
111 111
112 // Let the number of samples be one sample less than 80 samples per channel. 112 // Let the number of samples be one sample less than 80 samples per channel.
113 size_t input_len = 80 * channels - 1; 113 size_t input_len = 80 * channels - 1;
114 EXPECT_EQ( 114 EXPECT_EQ(
115 0, 115 0,
116 normal.Process( 116 normal.Process(
117 input, input_len, kModeExpand, mute_factor_array.get(), &output)); 117 input, input_len, kModeExpand, mute_factor_array.get(), &output));
118 EXPECT_EQ(0u, output.Size()); 118 EXPECT_EQ(0u, output.Size());
119 119
120 EXPECT_CALL(db, Die()); // Called when |db| goes out of scope. 120 EXPECT_CALL(db, Die()); // Called when |db| goes out of scope.
121 EXPECT_CALL(expand, Die()); // Called when |expand| goes out of scope. 121 EXPECT_CALL(expand, Die()); // Called when |expand| goes out of scope.
122 } 122 }
123 123
124 // TODO(hlundin): Write more tests. 124 // TODO(hlundin): Write more tests.
125 125
126 } // namespace webrtc 126 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/payload_splitter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698