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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_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) 2011 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2011 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 /* 11 /*
12 * This file includes unit tests for NetEQ. 12 * This file includes unit tests for NetEQ.
13 */ 13 */
14 14
15 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" 15 #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
16 16
17 #include <math.h> 17 #include <math.h>
18 #include <stdlib.h> 18 #include <stdlib.h>
19 #include <string.h> // memset 19 #include <string.h> // memset
20 20
21 #include <algorithm> 21 #include <algorithm>
22 #include <memory>
22 #include <set> 23 #include <set>
23 #include <string> 24 #include <string>
24 #include <vector> 25 #include <vector>
25 26
26 #include "gflags/gflags.h" 27 #include "gflags/gflags.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
28 #include "webrtc/base/scoped_ptr.h"
29 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h" 29 #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
30 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" 30 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
31 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" 31 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
32 #include "webrtc/test/testsupport/fileutils.h" 32 #include "webrtc/test/testsupport/fileutils.h"
33 #include "webrtc/typedefs.h" 33 #include "webrtc/typedefs.h"
34 34
35 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT 35 #ifdef WEBRTC_NETEQ_UNITTEST_BITEXACT
36 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 36 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
37 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h" 37 #include "external/webrtc/webrtc/modules/audio_coding/neteq/neteq_unittest.pb.h"
38 #else 38 #else
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return; 95 return;
96 ASSERT_EQ(static_cast<size_t>(size), 96 ASSERT_EQ(static_cast<size_t>(size),
97 fwrite(message.data(), sizeof(char), size, file)); 97 fwrite(message.data(), sizeof(char), size, file));
98 } 98 }
99 99
100 void ReadMessage(FILE* file, std::string* message) { 100 void ReadMessage(FILE* file, std::string* message) {
101 int32_t size; 101 int32_t size;
102 ASSERT_EQ(1u, fread(&size, sizeof(size), 1, file)); 102 ASSERT_EQ(1u, fread(&size, sizeof(size), 1, file));
103 if (size <= 0) 103 if (size <= 0)
104 return; 104 return;
105 rtc::scoped_ptr<char[]> buffer(new char[size]); 105 std::unique_ptr<char[]> buffer(new char[size]);
106 ASSERT_EQ(static_cast<size_t>(size), 106 ASSERT_EQ(static_cast<size_t>(size),
107 fread(buffer.get(), sizeof(char), size, file)); 107 fread(buffer.get(), sizeof(char), size, file));
108 message->assign(buffer.get(), size); 108 message->assign(buffer.get(), size);
109 } 109 }
110 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT 110 #endif // WEBRTC_NETEQ_UNITTEST_BITEXACT
111 111
112 } // namespace 112 } // namespace
113 113
114 namespace webrtc { 114 namespace webrtc {
115 115
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 bool pull_audio_during_freeze, 313 bool pull_audio_during_freeze,
314 int delay_tolerance_ms, 314 int delay_tolerance_ms,
315 int max_time_to_speech_ms); 315 int max_time_to_speech_ms);
316 316
317 void DuplicateCng(); 317 void DuplicateCng();
318 318
319 uint32_t PlayoutTimestamp(); 319 uint32_t PlayoutTimestamp();
320 320
321 NetEq* neteq_; 321 NetEq* neteq_;
322 NetEq::Config config_; 322 NetEq::Config config_;
323 rtc::scoped_ptr<test::RtpFileSource> rtp_source_; 323 std::unique_ptr<test::RtpFileSource> rtp_source_;
324 rtc::scoped_ptr<test::Packet> packet_; 324 std::unique_ptr<test::Packet> packet_;
325 unsigned int sim_clock_; 325 unsigned int sim_clock_;
326 int16_t out_data_[kMaxBlockSize]; 326 int16_t out_data_[kMaxBlockSize];
327 int output_sample_rate_; 327 int output_sample_rate_;
328 int algorithmic_delay_ms_; 328 int algorithmic_delay_ms_;
329 }; 329 };
330 330
331 // Allocating the static const so that it can be passed by reference. 331 // Allocating the static const so that it can be passed by reference.
332 const int NetEqDecodingTest::kTimeStepMs; 332 const int NetEqDecodingTest::kTimeStepMs;
333 const size_t NetEqDecodingTest::kBlockSize8kHz; 333 const size_t NetEqDecodingTest::kBlockSize8kHz;
334 const size_t NetEqDecodingTest::kBlockSize16kHz; 334 const size_t NetEqDecodingTest::kBlockSize16kHz;
(...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1657 // Pull audio once. 1657 // Pull audio once.
1658 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len, 1658 ASSERT_EQ(0, neteq_->GetAudio(kMaxBlockSize, out_data_, &out_len,
1659 &num_channels, &type)); 1659 &num_channels, &type));
1660 ASSERT_EQ(kBlockSize16kHz, out_len); 1660 ASSERT_EQ(kBlockSize16kHz, out_len);
1661 } 1661 }
1662 // Verify speech output. 1662 // Verify speech output.
1663 EXPECT_EQ(kOutputNormal, type); 1663 EXPECT_EQ(kOutputNormal, type);
1664 } 1664 }
1665 1665
1666 } // namespace webrtc 1666 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq_stereo_unittest.cc ('k') | webrtc/modules/audio_coding/neteq/normal_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698