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/neteq_external_decoder_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) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 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 // Test to verify correct operation for externally created decoders. 11 // Test to verify correct operation for externally created decoders.
12 12
13 #include <memory>
14
13 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
14 #include "webrtc/base/scoped_ptr.h"
15 #include "webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h" 16 #include "webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h"
16 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" 17 #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
17 #include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h" 18 #include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
18 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h" 19 #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
19 #include "webrtc/test/testsupport/fileutils.h" 20 #include "webrtc/test/testsupport/fileutils.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 23
23 using ::testing::_; 24 using ::testing::_;
24 using ::testing::Return; 25 using ::testing::Return;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 } 139 }
139 140
140 MockExternalPcm16B* external_decoder() { return external_decoder_.get(); } 141 MockExternalPcm16B* external_decoder() { return external_decoder_.get(); }
141 142
142 void ResetRtpGenerator(test::RtpGenerator* rtp_generator) { 143 void ResetRtpGenerator(test::RtpGenerator* rtp_generator) {
143 rtp_generator_.reset(rtp_generator); 144 rtp_generator_.reset(rtp_generator);
144 } 145 }
145 146
146 int samples_per_ms() const { return samples_per_ms_; } 147 int samples_per_ms() const { return samples_per_ms_; }
147 private: 148 private:
148 rtc::scoped_ptr<MockExternalPcm16B> external_decoder_; 149 std::unique_ptr<MockExternalPcm16B> external_decoder_;
149 int samples_per_ms_; 150 int samples_per_ms_;
150 size_t frame_size_samples_; 151 size_t frame_size_samples_;
151 rtc::scoped_ptr<test::RtpGenerator> rtp_generator_; 152 std::unique_ptr<test::RtpGenerator> rtp_generator_;
152 int16_t* input_; 153 int16_t* input_;
153 uint8_t* encoded_; 154 uint8_t* encoded_;
154 size_t payload_size_bytes_; 155 size_t payload_size_bytes_;
155 uint32_t last_send_time_; 156 uint32_t last_send_time_;
156 uint32_t last_arrival_time_; 157 uint32_t last_arrival_time_;
157 rtc::scoped_ptr<test::InputAudioFile> input_file_; 158 std::unique_ptr<test::InputAudioFile> input_file_;
158 WebRtcRTPHeader rtp_header_; 159 WebRtcRTPHeader rtp_header_;
159 }; 160 };
160 161
161 // This test encodes a few packets of PCM16b 32 kHz data and inserts it into two 162 // This test encodes a few packets of PCM16b 32 kHz data and inserts it into two
162 // different NetEq instances. The first instance uses the internal version of 163 // different NetEq instances. The first instance uses the internal version of
163 // the decoder object, while the second one uses an externally created decoder 164 // the decoder object, while the second one uses an externally created decoder
164 // object (ExternalPcm16B wrapped in MockExternalPcm16B, both defined above). 165 // object (ExternalPcm16B wrapped in MockExternalPcm16B, both defined above).
165 // The test verifies that the output from both instances match. 166 // The test verifies that the output from both instances match.
166 class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest, 167 class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest,
167 public ::testing::Test { 168 public ::testing::Test {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 219
219 // Insert packet in external decoder instance. 220 // Insert packet in external decoder instance.
220 NetEqExternalDecoderUnitTest::InsertPacket(rtp_header, payload, 221 NetEqExternalDecoderUnitTest::InsertPacket(rtp_header, payload,
221 receive_timestamp); 222 receive_timestamp);
222 } 223 }
223 224
224 int NumExpectedDecodeCalls(int num_loops) override { return num_loops; } 225 int NumExpectedDecodeCalls(int num_loops) override { return num_loops; }
225 226
226 private: 227 private:
227 int sample_rate_hz_; 228 int sample_rate_hz_;
228 rtc::scoped_ptr<NetEq> neteq_internal_; 229 std::unique_ptr<NetEq> neteq_internal_;
229 int16_t output_internal_[kMaxBlockSize]; 230 int16_t output_internal_[kMaxBlockSize];
230 int16_t output_[kMaxBlockSize]; 231 int16_t output_[kMaxBlockSize];
231 }; 232 };
232 233
233 TEST_F(NetEqExternalVsInternalDecoderTest, RunTest) { 234 TEST_F(NetEqExternalVsInternalDecoderTest, RunTest) {
234 RunTest(100); // Run 100 laps @ 10 ms each in the test loop. 235 RunTest(100); // Run 100 laps @ 10 ms each in the test loop.
235 } 236 }
236 237
237 class LargeTimestampJumpTest : public NetEqExternalDecoderUnitTest, 238 class LargeTimestampJumpTest : public NetEqExternalDecoderUnitTest,
238 public ::testing::Test { 239 public ::testing::Test {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 kStartSeqeunceNumber, 451 kStartSeqeunceNumber,
451 kStartTimestamp, 452 kStartTimestamp,
452 kJumpFromTimestamp, 453 kJumpFromTimestamp,
453 kJumpToTimestamp)); 454 kJumpToTimestamp));
454 455
455 RunTest(130); // Run 130 laps @ 10 ms each in the test loop. 456 RunTest(130); // Run 130 laps @ 10 ms each in the test loop.
456 EXPECT_EQ(kRecovered, test_state_); 457 EXPECT_EQ(kRecovered, test_state_);
457 } 458 }
458 459
459 } // namespace webrtc 460 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/nack_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/neteq_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698