Replace scoped_ptr with unique_ptr in webrtc/modules/audio_coding/test/

BUG=webrtc:5520

Review URL: https://codereview.webrtc.org/1695763004

Cr-Commit-Position: refs/heads/master@{#11618}
This commit is contained in:
kwiberg
2016-02-14 20:40:57 -08:00
committed by Commit bot
parent 1d9ada795c
commit 3747838afb
16 changed files with 63 additions and 49 deletions

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_APITEST_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_APITEST_H_
#define WEBRTC_MODULES_AUDIO_CODING_TEST_APITEST_H_ #define WEBRTC_MODULES_AUDIO_CODING_TEST_APITEST_H_
#include "webrtc/base/scoped_ptr.h" #include <memory>
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
#include "webrtc/modules/audio_coding/test/Channel.h" #include "webrtc/modules/audio_coding/test/Channel.h"
@ -82,8 +83,8 @@ class APITest : public ACMTest {
bool APIRunB(); bool APIRunB();
//--- ACMs //--- ACMs
rtc::scoped_ptr<AudioCodingModule> _acmA; std::unique_ptr<AudioCodingModule> _acmA;
rtc::scoped_ptr<AudioCodingModule> _acmB; std::unique_ptr<AudioCodingModule> _acmB;
//--- Channels //--- Channels
Channel* _channel_A2B; Channel* _channel_A2B;

View File

@ -10,12 +10,12 @@
#include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h" #include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h"
#include <memory>
#include <sstream> #include <sstream>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h" #include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
@ -275,7 +275,7 @@ void EncodeDecodeTest::Perform() {
codePars[1] = 0; codePars[1] = 0;
codePars[2] = 0; codePars[2] = 0;
rtc::scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0)); std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0));
struct CodecInst sendCodecTmp; struct CodecInst sendCodecTmp;
numCodecs = acm->NumberOfCodecs(); numCodecs = acm->NumberOfCodecs();
@ -331,7 +331,7 @@ std::string EncodeDecodeTest::EncodeToFile(int fileType,
int codeId, int codeId,
int* codePars, int* codePars,
int testMode) { int testMode) {
rtc::scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1)); std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(1));
RTPFile rtpFile; RTPFile rtpFile;
std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(), std::string fileName = webrtc::test::TempFilename(webrtc::test::OutputPath(),
"encode_decode_rtp"); "encode_decode_rtp");

View File

@ -10,6 +10,8 @@
#include "webrtc/modules/audio_coding/test/PacketLossTest.h" #include "webrtc/modules/audio_coding/test/PacketLossTest.h"
#include <memory>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/common.h" #include "webrtc/common.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"
@ -126,7 +128,7 @@ void PacketLossTest::Perform() {
#ifndef WEBRTC_CODEC_OPUS #ifndef WEBRTC_CODEC_OPUS
return; return;
#else #else
rtc::scoped_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0)); std::unique_ptr<AudioCodingModule> acm(AudioCodingModule::Create(0));
int codec_id = acm->Codec("opus", 48000, channels_); int codec_id = acm->Codec("opus", 48000, channels_);

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_PACKETLOSSTEST_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_PACKETLOSSTEST_H_
#define WEBRTC_MODULES_AUDIO_CODING_TEST_PACKETLOSSTEST_H_ #define WEBRTC_MODULES_AUDIO_CODING_TEST_PACKETLOSSTEST_H_
#include <memory>
#include <string> #include <string>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h" #include "webrtc/modules/audio_coding/test/EncodeDecodeTest.h"
namespace webrtc { namespace webrtc {
@ -55,8 +55,8 @@ class PacketLossTest : public ACMTest {
int channels_; int channels_;
std::string in_file_name_; std::string in_file_name_;
int sample_rate_hz_; int sample_rate_hz_;
rtc::scoped_ptr<SenderWithFEC> sender_; std::unique_ptr<SenderWithFEC> sender_;
rtc::scoped_ptr<ReceiverWithPacketLoss> receiver_; std::unique_ptr<ReceiverWithPacketLoss> receiver_;
int expected_loss_rate_; int expected_loss_rate_;
int actual_loss_rate_; int actual_loss_rate_;
int burst_length_; int burst_length_;

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_SPATIALAUDIO_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_SPATIALAUDIO_H_
#define WEBRTC_MODULES_AUDIO_CODING_TEST_SPATIALAUDIO_H_ #define WEBRTC_MODULES_AUDIO_CODING_TEST_SPATIALAUDIO_H_
#include "webrtc/base/scoped_ptr.h" #include <memory>
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
#include "webrtc/modules/audio_coding/test/Channel.h" #include "webrtc/modules/audio_coding/test/Channel.h"
@ -33,9 +34,9 @@ class SpatialAudio : public ACMTest {
void EncodeDecode(double leftPanning, double rightPanning); void EncodeDecode(double leftPanning, double rightPanning);
void EncodeDecode(); void EncodeDecode();
rtc::scoped_ptr<AudioCodingModule> _acmLeft; std::unique_ptr<AudioCodingModule> _acmLeft;
rtc::scoped_ptr<AudioCodingModule> _acmRight; std::unique_ptr<AudioCodingModule> _acmRight;
rtc::scoped_ptr<AudioCodingModule> _acmReceiver; std::unique_ptr<AudioCodingModule> _acmReceiver;
Channel* _channel; Channel* _channel;
PCMFile _inFile; PCMFile _inFile;
PCMFile _outFile; PCMFile _outFile;

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TESTALLCODECS_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TESTALLCODECS_H_
#define WEBRTC_MODULES_AUDIO_CODING_TEST_TESTALLCODECS_H_ #define WEBRTC_MODULES_AUDIO_CODING_TEST_TESTALLCODECS_H_
#include "webrtc/base/scoped_ptr.h" #include <memory>
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
#include "webrtc/modules/audio_coding/test/Channel.h" #include "webrtc/modules/audio_coding/test/Channel.h"
#include "webrtc/modules/audio_coding/test/PCMFile.h" #include "webrtc/modules/audio_coding/test/PCMFile.h"
@ -69,8 +70,8 @@ class TestAllCodecs : public ACMTest {
void DisplaySendReceiveCodec(); void DisplaySendReceiveCodec();
int test_mode_; int test_mode_;
rtc::scoped_ptr<AudioCodingModule> acm_a_; std::unique_ptr<AudioCodingModule> acm_a_;
rtc::scoped_ptr<AudioCodingModule> acm_b_; std::unique_ptr<AudioCodingModule> acm_b_;
TestPack* channel_a_to_b_; TestPack* channel_a_to_b_;
PCMFile infile_a_; PCMFile infile_a_;
PCMFile outfile_b_; PCMFile outfile_b_;

View File

@ -11,8 +11,9 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TESTREDFEC_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TESTREDFEC_H_
#define WEBRTC_MODULES_AUDIO_CODING_TEST_TESTREDFEC_H_ #define WEBRTC_MODULES_AUDIO_CODING_TEST_TESTREDFEC_H_
#include <memory>
#include <string> #include <string>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
#include "webrtc/modules/audio_coding/test/Channel.h" #include "webrtc/modules/audio_coding/test/Channel.h"
#include "webrtc/modules/audio_coding/test/PCMFile.h" #include "webrtc/modules/audio_coding/test/PCMFile.h"
@ -36,8 +37,8 @@ class TestRedFec : public ACMTest {
void Run(); void Run();
void OpenOutFile(int16_t testNumber); void OpenOutFile(int16_t testNumber);
int32_t SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode); int32_t SetVAD(bool enableDTX, bool enableVAD, ACMVADMode vadMode);
rtc::scoped_ptr<AudioCodingModule> _acmA; std::unique_ptr<AudioCodingModule> _acmA;
rtc::scoped_ptr<AudioCodingModule> _acmB; std::unique_ptr<AudioCodingModule> _acmB;
Channel* _channelA2B; Channel* _channelA2B;

View File

@ -13,7 +13,8 @@
#include <math.h> #include <math.h>
#include "webrtc/base/scoped_ptr.h" #include <memory>
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
#include "webrtc/modules/audio_coding/test/Channel.h" #include "webrtc/modules/audio_coding/test/Channel.h"
#include "webrtc/modules/audio_coding/test/PCMFile.h" #include "webrtc/modules/audio_coding/test/PCMFile.h"
@ -82,8 +83,8 @@ class TestStereo : public ACMTest {
int test_mode_; int test_mode_;
rtc::scoped_ptr<AudioCodingModule> acm_a_; std::unique_ptr<AudioCodingModule> acm_a_;
rtc::scoped_ptr<AudioCodingModule> acm_b_; std::unique_ptr<AudioCodingModule> acm_b_;
TestPackStereo* channel_a2b_; TestPackStereo* channel_a2b_;

View File

@ -11,8 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TESTVADDTX_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TESTVADDTX_H_
#define WEBRTC_MODULES_AUDIO_CODING_TEST_TESTVADDTX_H_ #define WEBRTC_MODULES_AUDIO_CODING_TEST_TESTVADDTX_H_
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
@ -68,10 +68,10 @@ class TestVadDtx : public ACMTest {
void Run(std::string in_filename, int frequency, int channels, void Run(std::string in_filename, int frequency, int channels,
std::string out_filename, bool append, const int* expects); std::string out_filename, bool append, const int* expects);
rtc::scoped_ptr<AudioCodingModule> acm_send_; std::unique_ptr<AudioCodingModule> acm_send_;
rtc::scoped_ptr<AudioCodingModule> acm_receive_; std::unique_ptr<AudioCodingModule> acm_receive_;
rtc::scoped_ptr<Channel> channel_; std::unique_ptr<Channel> channel_;
rtc::scoped_ptr<ActivityMonitor> monitor_; std::unique_ptr<ActivityMonitor> monitor_;
}; };
// TestWebRtcVadDtx is to verify that the WebRTC VAD/DTX perform as they should. // TestWebRtcVadDtx is to verify that the WebRTC VAD/DTX perform as they should.

View File

@ -14,6 +14,8 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <memory>
#ifdef WIN32 #ifdef WIN32
#include <Windows.h> #include <Windows.h>
#endif #endif
@ -66,7 +68,7 @@ TwoWayCommunication::~TwoWayCommunication() {
void TwoWayCommunication::ChooseCodec(uint8_t* codecID_A, void TwoWayCommunication::ChooseCodec(uint8_t* codecID_A,
uint8_t* codecID_B) { uint8_t* codecID_B) {
rtc::scoped_ptr<AudioCodingModule> tmpACM(AudioCodingModule::Create(0)); std::unique_ptr<AudioCodingModule> tmpACM(AudioCodingModule::Create(0));
uint8_t noCodec = tmpACM->NumberOfCodecs(); uint8_t noCodec = tmpACM->NumberOfCodecs();
CodecInst codecInst; CodecInst codecInst;
printf("List of Supported Codecs\n"); printf("List of Supported Codecs\n");

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TWOWAYCOMMUNICATION_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_TEST_TWOWAYCOMMUNICATION_H_
#define WEBRTC_MODULES_AUDIO_CODING_TEST_TWOWAYCOMMUNICATION_H_ #define WEBRTC_MODULES_AUDIO_CODING_TEST_TWOWAYCOMMUNICATION_H_
#include "webrtc/base/scoped_ptr.h" #include <memory>
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
#include "webrtc/modules/audio_coding/test/Channel.h" #include "webrtc/modules/audio_coding/test/Channel.h"
@ -31,11 +32,11 @@ class TwoWayCommunication : public ACMTest {
void SetUp(); void SetUp();
void SetUpAutotest(); void SetUpAutotest();
rtc::scoped_ptr<AudioCodingModule> _acmA; std::unique_ptr<AudioCodingModule> _acmA;
rtc::scoped_ptr<AudioCodingModule> _acmB; std::unique_ptr<AudioCodingModule> _acmB;
rtc::scoped_ptr<AudioCodingModule> _acmRefA; std::unique_ptr<AudioCodingModule> _acmRefA;
rtc::scoped_ptr<AudioCodingModule> _acmRefB; std::unique_ptr<AudioCodingModule> _acmRefB;
Channel* _channel_A2B; Channel* _channel_A2B;
Channel* _channel_B2A; Channel* _channel_B2A;

View File

@ -12,10 +12,10 @@
#include <math.h> #include <math.h>
#include <iostream> #include <iostream>
#include <memory>
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common.h" #include "webrtc/common.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/engine_configurations.h" #include "webrtc/engine_configurations.h"
@ -223,8 +223,8 @@ class DelayTest {
out_file_b_.Close(); out_file_b_.Close();
} }
rtc::scoped_ptr<AudioCodingModule> acm_a_; std::unique_ptr<AudioCodingModule> acm_a_;
rtc::scoped_ptr<AudioCodingModule> acm_b_; std::unique_ptr<AudioCodingModule> acm_b_;
Channel* channel_a2b_; Channel* channel_a2b_;

View File

@ -13,7 +13,8 @@
#include <string.h> #include <string.h>
#include "webrtc/base/scoped_ptr.h" #include <memory>
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
@ -51,11 +52,11 @@ class ISACTest : public ACMTest {
void SwitchingSamplingRate(int testNr, int maxSampRateChange); void SwitchingSamplingRate(int testNr, int maxSampRateChange);
rtc::scoped_ptr<AudioCodingModule> _acmA; std::unique_ptr<AudioCodingModule> _acmA;
rtc::scoped_ptr<AudioCodingModule> _acmB; std::unique_ptr<AudioCodingModule> _acmB;
rtc::scoped_ptr<Channel> _channel_A2B; std::unique_ptr<Channel> _channel_A2B;
rtc::scoped_ptr<Channel> _channel_B2A; std::unique_ptr<Channel> _channel_B2A;
PCMFile _inFileA; PCMFile _inFileA;
PCMFile _inFileB; PCMFile _inFileB;

View File

@ -10,9 +10,10 @@
#include <stdio.h> #include <stdio.h>
#include <memory>
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/test/Channel.h" #include "webrtc/modules/audio_coding/test/Channel.h"
@ -241,8 +242,8 @@ class InsertPacketWithTiming {
SimulatedClock* sender_clock_; SimulatedClock* sender_clock_;
SimulatedClock* receiver_clock_; SimulatedClock* receiver_clock_;
rtc::scoped_ptr<AudioCodingModule> send_acm_; std::unique_ptr<AudioCodingModule> send_acm_;
rtc::scoped_ptr<AudioCodingModule> receive_acm_; std::unique_ptr<AudioCodingModule> receive_acm_;
Channel* channel_; Channel* channel_;
FILE* seq_num_fid_; // Input (text), one sequence number per line. FILE* seq_num_fid_; // Input (text), one sequence number per line.

View File

@ -13,7 +13,8 @@
#include <math.h> #include <math.h>
#include "webrtc/base/scoped_ptr.h" #include <memory>
#include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h" #include "webrtc/modules/audio_coding/codecs/opus/opus_interface.h"
#include "webrtc/modules/audio_coding/acm2/acm_resampler.h" #include "webrtc/modules/audio_coding/acm2/acm_resampler.h"
#include "webrtc/modules/audio_coding/test/ACMTest.h" #include "webrtc/modules/audio_coding/test/ACMTest.h"
@ -39,7 +40,7 @@ class OpusTest : public ACMTest {
void OpenOutFile(int test_number); void OpenOutFile(int test_number);
rtc::scoped_ptr<AudioCodingModule> acm_receiver_; std::unique_ptr<AudioCodingModule> acm_receiver_;
TestPackStereo* channel_a2b_; TestPackStereo* channel_a2b_;
PCMFile in_file_stereo_; PCMFile in_file_stereo_;
PCMFile in_file_mono_; PCMFile in_file_mono_;

View File

@ -8,8 +8,9 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include <memory>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
@ -193,7 +194,7 @@ class TargetDelayTest : public ::testing::Test {
return acm_->LeastRequiredDelayMs(); return acm_->LeastRequiredDelayMs();
} }
rtc::scoped_ptr<AudioCodingModule> acm_; std::unique_ptr<AudioCodingModule> acm_;
WebRtcRTPHeader rtp_info_; WebRtcRTPHeader rtp_info_;
uint8_t payload_[kPayloadLenBytes]; uint8_t payload_[kPayloadLenBytes];
}; };