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

BUG=webrtc:5520

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

Cr-Commit-Position: refs/heads/master@{#11616}
This commit is contained in:
kwiberg
2016-02-14 09:28:33 -08:00
committed by Commit bot
parent 04af839a88
commit 2d0c33277c
35 changed files with 158 additions and 149 deletions

View File

@ -13,11 +13,11 @@
#include <assert.h>
#include <stdlib.h>
#include <memory>
#include <string>
#include <vector>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/g711/audio_decoder_pcm.h"
#include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
#include "webrtc/modules/audio_coding/codecs/g722/audio_decoder_g722.h"
@ -146,7 +146,7 @@ class AudioDecoderTest : public ::testing::Test {
const size_t samples_per_10ms = audio_encoder_->SampleRateHz() / 100;
RTC_CHECK_EQ(samples_per_10ms * audio_encoder_->Num10MsFramesInNextPacket(),
input_len_samples);
rtc::scoped_ptr<int16_t[]> interleaved_input(
std::unique_ptr<int16_t[]> interleaved_input(
new int16_t[channels_ * samples_per_10ms]);
for (size_t i = 0; i < audio_encoder_->Num10MsFramesInNextPacket(); ++i) {
EXPECT_EQ(0u, encoded_info_.encoded_bytes);
@ -223,14 +223,14 @@ class AudioDecoderTest : public ::testing::Test {
// decode. Verifies that the decoded result is the same.
void ReInitTest() {
InitEncoder();
rtc::scoped_ptr<int16_t[]> input(new int16_t[frame_size_]);
std::unique_ptr<int16_t[]> input(new int16_t[frame_size_]);
ASSERT_TRUE(
input_audio_.Read(frame_size_, codec_input_rate_hz_, input.get()));
size_t enc_len = EncodeFrame(input.get(), frame_size_, encoded_);
size_t dec_len;
AudioDecoder::SpeechType speech_type1, speech_type2;
decoder_->Reset();
rtc::scoped_ptr<int16_t[]> output1(new int16_t[frame_size_ * channels_]);
std::unique_ptr<int16_t[]> output1(new int16_t[frame_size_ * channels_]);
dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
frame_size_ * channels_ * sizeof(int16_t),
output1.get(), &speech_type1);
@ -238,7 +238,7 @@ class AudioDecoderTest : public ::testing::Test {
EXPECT_EQ(frame_size_ * channels_, dec_len);
// Re-init decoder and decode again.
decoder_->Reset();
rtc::scoped_ptr<int16_t[]> output2(new int16_t[frame_size_ * channels_]);
std::unique_ptr<int16_t[]> output2(new int16_t[frame_size_ * channels_]);
dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
frame_size_ * channels_ * sizeof(int16_t),
output2.get(), &speech_type2);
@ -253,13 +253,13 @@ class AudioDecoderTest : public ::testing::Test {
// Call DecodePlc and verify that the correct number of samples is produced.
void DecodePlcTest() {
InitEncoder();
rtc::scoped_ptr<int16_t[]> input(new int16_t[frame_size_]);
std::unique_ptr<int16_t[]> input(new int16_t[frame_size_]);
ASSERT_TRUE(
input_audio_.Read(frame_size_, codec_input_rate_hz_, input.get()));
size_t enc_len = EncodeFrame(input.get(), frame_size_, encoded_);
AudioDecoder::SpeechType speech_type;
decoder_->Reset();
rtc::scoped_ptr<int16_t[]> output(new int16_t[frame_size_ * channels_]);
std::unique_ptr<int16_t[]> output(new int16_t[frame_size_ * channels_]);
size_t dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
frame_size_ * channels_ * sizeof(int16_t),
output.get(), &speech_type);
@ -281,7 +281,7 @@ class AudioDecoderTest : public ::testing::Test {
const int payload_type_;
AudioEncoder::EncodedInfo encoded_info_;
AudioDecoder* decoder_;
rtc::scoped_ptr<AudioEncoder> audio_encoder_;
std::unique_ptr<AudioEncoder> audio_encoder_;
};
class AudioDecoderPcmUTest : public AudioDecoderTest {
@ -345,13 +345,13 @@ class AudioDecoderIlbcTest : public AudioDecoderTest {
// not return any data. It simply resets a few states and returns 0.
void DecodePlcTest() {
InitEncoder();
rtc::scoped_ptr<int16_t[]> input(new int16_t[frame_size_]);
std::unique_ptr<int16_t[]> input(new int16_t[frame_size_]);
ASSERT_TRUE(
input_audio_.Read(frame_size_, codec_input_rate_hz_, input.get()));
size_t enc_len = EncodeFrame(input.get(), frame_size_, encoded_);
AudioDecoder::SpeechType speech_type;
decoder_->Reset();
rtc::scoped_ptr<int16_t[]> output(new int16_t[frame_size_ * channels_]);
std::unique_ptr<int16_t[]> output(new int16_t[frame_size_ * channels_]);
size_t dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
frame_size_ * channels_ * sizeof(int16_t),
output.get(), &speech_type);