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

@ -17,7 +17,6 @@ extern "C" {
#include "opus_private.h" #include "opus_private.h"
} }
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -14,6 +14,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <memory>
#include <string> #include <string>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
@ -39,7 +40,7 @@ void RunAnalysisTest(const std::string& audio_filename,
const std::string& data_filename, const std::string& data_filename,
size_t channels) { size_t channels) {
AudioClassifier classifier; AudioClassifier classifier;
rtc::scoped_ptr<int16_t[]> in(new int16_t[channels * kFrameSize]); std::unique_ptr<int16_t[]> in(new int16_t[channels * kFrameSize]);
bool is_music_ref; bool is_music_ref;
FILE* audio_file = fopen(audio_filename.c_str(), "rb"); FILE* audio_file = fopen(audio_filename.c_str(), "rb");

View File

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

View File

@ -13,6 +13,7 @@
#include <assert.h> #include <assert.h>
#include <algorithm> #include <algorithm>
#include <memory>
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
@ -180,7 +181,7 @@ int16_t& AudioVector::operator[](size_t index) {
void AudioVector::Reserve(size_t n) { void AudioVector::Reserve(size_t n) {
if (capacity_ < n) { if (capacity_ < n) {
rtc::scoped_ptr<int16_t[]> temp_array(new int16_t[n]); std::unique_ptr<int16_t[]> temp_array(new int16_t[n]);
memcpy(temp_array.get(), array_.get(), Size() * sizeof(int16_t)); memcpy(temp_array.get(), array_.get(), Size() * sizeof(int16_t));
array_.swap(temp_array); array_.swap(temp_array);
capacity_ = n; capacity_ = n;

View File

@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_VECTOR_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_VECTOR_H_
#include <string.h> // Access to size_t. #include <string.h> // Access to size_t.
#include <memory>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {
@ -100,7 +100,7 @@ class AudioVector {
void Reserve(size_t n); void Reserve(size_t n);
rtc::scoped_ptr<int16_t[]> array_; std::unique_ptr<int16_t[]> array_;
size_t first_free_ix_; // The first index after the last sample in array_. size_t first_free_ix_; // The first index after the last sample in array_.
// Note that this index may point outside of array_. // Note that this index may point outside of array_.
size_t capacity_; // Allocated number of samples in the array. size_t capacity_; // Allocated number of samples in the array.

View File

@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_BACKGROUND_NOISE_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_BACKGROUND_NOISE_H_
#include <string.h> // size_t #include <string.h> // size_t
#include <memory>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
@ -126,7 +126,7 @@ class BackgroundNoise {
int32_t residual_energy); int32_t residual_energy);
size_t num_channels_; size_t num_channels_;
rtc::scoped_ptr<ChannelParameters[]> channel_parameters_; std::unique_ptr<ChannelParameters[]> channel_parameters_;
bool initialized_; bool initialized_;
NetEq::BackgroundNoiseMode mode_; NetEq::BackgroundNoiseMode mode_;

View File

@ -15,7 +15,6 @@
#include <string> #include <string>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h" // NULL #include "webrtc/common_types.h" // NULL
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
#include "webrtc/modules/audio_coding/neteq/packet.h" #include "webrtc/modules/audio_coding/neteq/packet.h"

View File

@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_EXPAND_H_
#include <assert.h> #include <assert.h>
#include <memory>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
@ -138,7 +138,7 @@ class Expand {
int current_lag_index_; int current_lag_index_;
bool stop_muting_; bool stop_muting_;
size_t expand_duration_samples_; size_t expand_duration_samples_;
rtc::scoped_ptr<ChannelParameters[]> channel_parameters_; std::unique_ptr<ChannelParameters[]> channel_parameters_;
RTC_DISALLOW_COPY_AND_ASSIGN(Expand); RTC_DISALLOW_COPY_AND_ASSIGN(Expand);
}; };

View File

@ -14,8 +14,8 @@
#include <string.h> // memmove, memcpy, memset, size_t #include <string.h> // memmove, memcpy, memset, size_t
#include <algorithm> // min, max #include <algorithm> // min, max
#include <memory>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
#include "webrtc/modules/audio_coding/neteq/dsp_helper.h" #include "webrtc/modules/audio_coding/neteq/dsp_helper.h"
@ -327,7 +327,7 @@ size_t Merge::CorrelateAndPeakSearch(int16_t expanded_max, int16_t input_max,
// Normalize correlation to 14 bits and copy to a 16-bit array. // Normalize correlation to 14 bits and copy to a 16-bit array.
const size_t pad_length = expand_->overlap_length() - 1; const size_t pad_length = expand_->overlap_length() - 1;
const size_t correlation_buffer_size = 2 * pad_length + kMaxCorrelationLength; const size_t correlation_buffer_size = 2 * pad_length + kMaxCorrelationLength;
rtc::scoped_ptr<int16_t[]> correlation16( std::unique_ptr<int16_t[]> correlation16(
new int16_t[correlation_buffer_size]); new int16_t[correlation_buffer_size]);
memset(correlation16.get(), 0, correlation_buffer_size * sizeof(int16_t)); memset(correlation16.get(), 0, correlation_buffer_size * sizeof(int16_t));
int16_t* correlation_ptr = &correlation16[pad_length]; int16_t* correlation_ptr = &correlation16[pad_length];

View File

@ -15,7 +15,6 @@
#include <map> #include <map>
#include "webrtc/base/gtest_prod_util.h" #include "webrtc/base/gtest_prod_util.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
// //

View File

@ -13,9 +13,9 @@
#include <stdint.h> #include <stdint.h>
#include <algorithm> #include <algorithm>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
@ -55,7 +55,7 @@ bool IsNackListCorrect(const std::vector<uint16_t>& nack_list,
} // namespace } // namespace
TEST(NackTest, EmptyListWhenNoPacketLoss) { TEST(NackTest, EmptyListWhenNoPacketLoss) {
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
int seq_num = 1; int seq_num = 1;
@ -73,7 +73,7 @@ TEST(NackTest, EmptyListWhenNoPacketLoss) {
} }
TEST(NackTest, NoNackIfReorderWithinNackThreshold) { TEST(NackTest, NoNackIfReorderWithinNackThreshold) {
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
int seq_num = 1; int seq_num = 1;
@ -102,7 +102,7 @@ TEST(NackTest, LatePacketsMovedToNackThenNackListDoesNotChange) {
sizeof(kSequenceNumberLostPackets[0]); sizeof(kSequenceNumberLostPackets[0]);
for (int k = 0; k < 2; k++) { // Two iteration with/without wrap around. for (int k = 0; k < 2; k++) { // Two iteration with/without wrap around.
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
uint16_t sequence_num_lost_packets[kNumAllLostPackets]; uint16_t sequence_num_lost_packets[kNumAllLostPackets];
@ -151,7 +151,7 @@ TEST(NackTest, ArrivedPacketsAreRemovedFromNackList) {
sizeof(kSequenceNumberLostPackets[0]); sizeof(kSequenceNumberLostPackets[0]);
for (int k = 0; k < 2; ++k) { // Two iteration with/without wrap around. for (int k = 0; k < 2; ++k) { // Two iteration with/without wrap around.
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
uint16_t sequence_num_lost_packets[kNumAllLostPackets]; uint16_t sequence_num_lost_packets[kNumAllLostPackets];
@ -213,7 +213,7 @@ TEST(NackTest, EstimateTimestampAndTimeToPlay) {
sizeof(kLostPackets) / sizeof(kLostPackets[0]); sizeof(kLostPackets) / sizeof(kLostPackets[0]);
for (int k = 0; k < 4; ++k) { for (int k = 0; k < 4; ++k) {
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
// Sequence number wrap around if |k| is 2 or 3; // Sequence number wrap around if |k| is 2 or 3;
@ -284,7 +284,7 @@ TEST(NackTest, EstimateTimestampAndTimeToPlay) {
TEST(NackTest, MissingPacketsPriorToLastDecodedRtpShouldNotBeInNackList) { TEST(NackTest, MissingPacketsPriorToLastDecodedRtpShouldNotBeInNackList) {
for (int m = 0; m < 2; ++m) { for (int m = 0; m < 2; ++m) {
uint16_t seq_num_offset = (m == 0) ? 0 : 65531; // Wrap around if |m| is 1. uint16_t seq_num_offset = (m == 0) ? 0 : 65531; // Wrap around if |m| is 1.
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
// Two consecutive packets to have a correct estimate of timestamp increase. // Two consecutive packets to have a correct estimate of timestamp increase.
@ -335,7 +335,7 @@ TEST(NackTest, MissingPacketsPriorToLastDecodedRtpShouldNotBeInNackList) {
} }
TEST(NackTest, Reset) { TEST(NackTest, Reset) {
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
// Two consecutive packets to have a correct estimate of timestamp increase. // Two consecutive packets to have a correct estimate of timestamp increase.
@ -362,7 +362,7 @@ TEST(NackTest, ListSizeAppliedFromBeginning) {
const size_t kNackListSize = 10; const size_t kNackListSize = 10;
for (int m = 0; m < 2; ++m) { for (int m = 0; m < 2; ++m) {
uint16_t seq_num_offset = (m == 0) ? 0 : 65525; // Wrap around if |m| is 1. uint16_t seq_num_offset = (m == 0) ? 0 : 65525; // Wrap around if |m| is 1.
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
nack->SetMaxNackListSize(kNackListSize); nack->SetMaxNackListSize(kNackListSize);
@ -386,7 +386,7 @@ TEST(NackTest, ChangeOfListSizeAppliedAndOldElementsRemoved) {
const size_t kNackListSize = 10; const size_t kNackListSize = 10;
for (int m = 0; m < 2; ++m) { for (int m = 0; m < 2; ++m) {
uint16_t seq_num_offset = (m == 0) ? 0 : 65525; // Wrap around if |m| is 1. uint16_t seq_num_offset = (m == 0) ? 0 : 65525; // Wrap around if |m| is 1.
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
uint16_t seq_num = seq_num_offset; uint16_t seq_num = seq_num_offset;
@ -396,7 +396,7 @@ TEST(NackTest, ChangeOfListSizeAppliedAndOldElementsRemoved) {
// Packet lost more than NACK-list size limit. // Packet lost more than NACK-list size limit.
uint16_t num_lost_packets = kNackThreshold + kNackListSize + 5; uint16_t num_lost_packets = kNackThreshold + kNackListSize + 5;
rtc::scoped_ptr<uint16_t[]> seq_num_lost(new uint16_t[num_lost_packets]); std::unique_ptr<uint16_t[]> seq_num_lost(new uint16_t[num_lost_packets]);
for (int n = 0; n < num_lost_packets; ++n) { for (int n = 0; n < num_lost_packets; ++n) {
seq_num_lost[n] = ++seq_num; seq_num_lost[n] = ++seq_num;
} }
@ -452,7 +452,7 @@ TEST(NackTest, ChangeOfListSizeAppliedAndOldElementsRemoved) {
TEST(NackTest, RoudTripTimeIsApplied) { TEST(NackTest, RoudTripTimeIsApplied) {
const int kNackListSize = 200; const int kNackListSize = 200;
rtc::scoped_ptr<Nack> nack(Nack::Create(kNackThreshold)); std::unique_ptr<Nack> nack(Nack::Create(kNackThreshold));
nack->UpdateSampleRate(kSampleRateHz); nack->UpdateSampleRate(kSampleRateHz);
nack->SetMaxNackListSize(kNackListSize); nack->SetMaxNackListSize(kNackListSize);

View File

@ -10,8 +10,9 @@
// Test to verify correct operation for externally created decoders. // Test to verify correct operation for externally created decoders.
#include <memory>
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h" #include "webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h" #include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
@ -145,16 +146,16 @@ class NetEqExternalDecoderUnitTest : public test::NetEqExternalDecoderTest {
int samples_per_ms() const { return samples_per_ms_; } int samples_per_ms() const { return samples_per_ms_; }
private: private:
rtc::scoped_ptr<MockExternalPcm16B> external_decoder_; std::unique_ptr<MockExternalPcm16B> external_decoder_;
int samples_per_ms_; int samples_per_ms_;
size_t frame_size_samples_; size_t frame_size_samples_;
rtc::scoped_ptr<test::RtpGenerator> rtp_generator_; std::unique_ptr<test::RtpGenerator> rtp_generator_;
int16_t* input_; int16_t* input_;
uint8_t* encoded_; uint8_t* encoded_;
size_t payload_size_bytes_; size_t payload_size_bytes_;
uint32_t last_send_time_; uint32_t last_send_time_;
uint32_t last_arrival_time_; uint32_t last_arrival_time_;
rtc::scoped_ptr<test::InputAudioFile> input_file_; std::unique_ptr<test::InputAudioFile> input_file_;
WebRtcRTPHeader rtp_header_; WebRtcRTPHeader rtp_header_;
}; };
@ -225,7 +226,7 @@ class NetEqExternalVsInternalDecoderTest : public NetEqExternalDecoderUnitTest,
private: private:
int sample_rate_hz_; int sample_rate_hz_;
rtc::scoped_ptr<NetEq> neteq_internal_; std::unique_ptr<NetEq> neteq_internal_;
int16_t output_internal_[kMaxBlockSize]; int16_t output_internal_[kMaxBlockSize];
int16_t output_[kMaxBlockSize]; int16_t output_[kMaxBlockSize];
}; };

View File

@ -11,11 +11,11 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_
#include <memory>
#include <string> #include <string>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h" #include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/thread_annotations.h" #include "webrtc/base/thread_annotations.h"
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
#include "webrtc/modules/audio_coding/neteq/defines.h" #include "webrtc/modules/audio_coding/neteq/defines.h"
@ -339,39 +339,39 @@ class NetEqImpl : public webrtc::NetEq {
virtual void CreateDecisionLogic() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_); virtual void CreateDecisionLogic() EXCLUSIVE_LOCKS_REQUIRED(crit_sect_);
rtc::CriticalSection crit_sect_; rtc::CriticalSection crit_sect_;
const rtc::scoped_ptr<BufferLevelFilter> buffer_level_filter_ const std::unique_ptr<BufferLevelFilter> buffer_level_filter_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<DecoderDatabase> decoder_database_ const std::unique_ptr<DecoderDatabase> decoder_database_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<DelayManager> delay_manager_ GUARDED_BY(crit_sect_); const std::unique_ptr<DelayManager> delay_manager_ GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<DelayPeakDetector> delay_peak_detector_ const std::unique_ptr<DelayPeakDetector> delay_peak_detector_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<DtmfBuffer> dtmf_buffer_ GUARDED_BY(crit_sect_); const std::unique_ptr<DtmfBuffer> dtmf_buffer_ GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<DtmfToneGenerator> dtmf_tone_generator_ const std::unique_ptr<DtmfToneGenerator> dtmf_tone_generator_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<PacketBuffer> packet_buffer_ GUARDED_BY(crit_sect_); const std::unique_ptr<PacketBuffer> packet_buffer_ GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<PayloadSplitter> payload_splitter_ const std::unique_ptr<PayloadSplitter> payload_splitter_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<TimestampScaler> timestamp_scaler_ const std::unique_ptr<TimestampScaler> timestamp_scaler_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<PostDecodeVad> vad_ GUARDED_BY(crit_sect_); const std::unique_ptr<PostDecodeVad> vad_ GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<ExpandFactory> expand_factory_ GUARDED_BY(crit_sect_); const std::unique_ptr<ExpandFactory> expand_factory_ GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<AccelerateFactory> accelerate_factory_ const std::unique_ptr<AccelerateFactory> accelerate_factory_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
const rtc::scoped_ptr<PreemptiveExpandFactory> preemptive_expand_factory_ const std::unique_ptr<PreemptiveExpandFactory> preemptive_expand_factory_
GUARDED_BY(crit_sect_); GUARDED_BY(crit_sect_);
rtc::scoped_ptr<BackgroundNoise> background_noise_ GUARDED_BY(crit_sect_); std::unique_ptr<BackgroundNoise> background_noise_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<DecisionLogic> decision_logic_ GUARDED_BY(crit_sect_); std::unique_ptr<DecisionLogic> decision_logic_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<AudioMultiVector> algorithm_buffer_ GUARDED_BY(crit_sect_); std::unique_ptr<AudioMultiVector> algorithm_buffer_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<SyncBuffer> sync_buffer_ GUARDED_BY(crit_sect_); std::unique_ptr<SyncBuffer> sync_buffer_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<Expand> expand_ GUARDED_BY(crit_sect_); std::unique_ptr<Expand> expand_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<Normal> normal_ GUARDED_BY(crit_sect_); std::unique_ptr<Normal> normal_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<Merge> merge_ GUARDED_BY(crit_sect_); std::unique_ptr<Merge> merge_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<Accelerate> accelerate_ GUARDED_BY(crit_sect_); std::unique_ptr<Accelerate> accelerate_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<PreemptiveExpand> preemptive_expand_ GUARDED_BY(crit_sect_); std::unique_ptr<PreemptiveExpand> preemptive_expand_ GUARDED_BY(crit_sect_);
RandomVector random_vector_ GUARDED_BY(crit_sect_); RandomVector random_vector_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<ComfortNoise> comfort_noise_ GUARDED_BY(crit_sect_); std::unique_ptr<ComfortNoise> comfort_noise_ GUARDED_BY(crit_sect_);
Rtcp rtcp_ GUARDED_BY(crit_sect_); Rtcp rtcp_ GUARDED_BY(crit_sect_);
StatisticsCalculator stats_ GUARDED_BY(crit_sect_); StatisticsCalculator stats_ GUARDED_BY(crit_sect_);
int fs_hz_ GUARDED_BY(crit_sect_); int fs_hz_ GUARDED_BY(crit_sect_);
@ -380,9 +380,9 @@ class NetEqImpl : public webrtc::NetEq {
size_t output_size_samples_ GUARDED_BY(crit_sect_); size_t output_size_samples_ GUARDED_BY(crit_sect_);
size_t decoder_frame_length_ GUARDED_BY(crit_sect_); size_t decoder_frame_length_ GUARDED_BY(crit_sect_);
Modes last_mode_ GUARDED_BY(crit_sect_); Modes last_mode_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<int16_t[]> mute_factor_array_ GUARDED_BY(crit_sect_); std::unique_ptr<int16_t[]> mute_factor_array_ GUARDED_BY(crit_sect_);
size_t decoded_buffer_length_ GUARDED_BY(crit_sect_); size_t decoded_buffer_length_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<int16_t[]> decoded_buffer_ GUARDED_BY(crit_sect_); std::unique_ptr<int16_t[]> decoded_buffer_ GUARDED_BY(crit_sect_);
uint32_t playout_timestamp_ GUARDED_BY(crit_sect_); uint32_t playout_timestamp_ GUARDED_BY(crit_sect_);
bool new_codec_ GUARDED_BY(crit_sect_); bool new_codec_ GUARDED_BY(crit_sect_);
uint32_t timestamp_ GUARDED_BY(crit_sect_); uint32_t timestamp_ GUARDED_BY(crit_sect_);
@ -396,7 +396,7 @@ class NetEqImpl : public webrtc::NetEq {
const BackgroundNoiseMode background_noise_mode_ GUARDED_BY(crit_sect_); const BackgroundNoiseMode background_noise_mode_ GUARDED_BY(crit_sect_);
NetEqPlayoutMode playout_mode_ GUARDED_BY(crit_sect_); NetEqPlayoutMode playout_mode_ GUARDED_BY(crit_sect_);
bool enable_fast_accelerate_ GUARDED_BY(crit_sect_); bool enable_fast_accelerate_ GUARDED_BY(crit_sect_);
rtc::scoped_ptr<Nack> nack_ GUARDED_BY(crit_sect_); std::unique_ptr<Nack> nack_ GUARDED_BY(crit_sect_);
bool nack_enabled_ GUARDED_BY(crit_sect_); bool nack_enabled_ GUARDED_BY(crit_sect_);
private: private:

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/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h" #include "webrtc/modules/audio_coding/neteq/tools/neteq_external_decoder_test.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h" #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
@ -263,7 +264,7 @@ struct NetEqNetworkStatsCheck {
MockAudioDecoder* external_decoder_; MockAudioDecoder* external_decoder_;
const int samples_per_ms_; const int samples_per_ms_;
const size_t frame_size_samples_; const size_t frame_size_samples_;
rtc::scoped_ptr<test::RtpGenerator> rtp_generator_; std::unique_ptr<test::RtpGenerator> rtp_generator_;
WebRtcRTPHeader rtp_header_; WebRtcRTPHeader rtp_header_;
uint32_t last_lost_time_; uint32_t last_lost_time_;
uint32_t packet_loss_interval_; uint32_t packet_loss_interval_;

View File

@ -11,11 +11,11 @@
// Test to verify correct stereo and multi-channel operation. // Test to verify correct stereo and multi-channel operation.
#include <algorithm> #include <algorithm>
#include <memory>
#include <string> #include <string>
#include <list> #include <list>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
@ -261,7 +261,7 @@ class NetEqStereoTest : public ::testing::TestWithParam<TestParameters> {
size_t multi_payload_size_bytes_; size_t multi_payload_size_bytes_;
int last_send_time_; int last_send_time_;
int last_arrival_time_; int last_arrival_time_;
rtc::scoped_ptr<test::InputAudioFile> input_file_; std::unique_ptr<test::InputAudioFile> input_file_;
}; };
class NetEqStereoTestNoJitter : public NetEqStereoTest { class NetEqStereoTestNoJitter : public NetEqStereoTest {

View File

@ -19,13 +19,13 @@
#include <string.h> // memset #include <string.h> // memset
#include <algorithm> #include <algorithm>
#include <memory>
#include <set> #include <set>
#include <string> #include <string>
#include <vector> #include <vector>
#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/modules/audio_coding/neteq/tools/audio_loop.h" #include "webrtc/modules/audio_coding/neteq/tools/audio_loop.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
@ -102,7 +102,7 @@ void ReadMessage(FILE* file, std::string* message) {
ASSERT_EQ(1u, fread(&size, sizeof(size), 1, file)); ASSERT_EQ(1u, fread(&size, sizeof(size), 1, file));
if (size <= 0) if (size <= 0)
return; return;
rtc::scoped_ptr<char[]> buffer(new char[size]); std::unique_ptr<char[]> buffer(new char[size]);
ASSERT_EQ(static_cast<size_t>(size), ASSERT_EQ(static_cast<size_t>(size),
fread(buffer.get(), sizeof(char), size, file)); fread(buffer.get(), sizeof(char), size, file));
message->assign(buffer.get(), size); message->assign(buffer.get(), size);
@ -320,8 +320,8 @@ class NetEqDecodingTest : public ::testing::Test {
NetEq* neteq_; NetEq* neteq_;
NetEq::Config config_; NetEq::Config config_;
rtc::scoped_ptr<test::RtpFileSource> rtp_source_; std::unique_ptr<test::RtpFileSource> rtp_source_;
rtc::scoped_ptr<test::Packet> packet_; std::unique_ptr<test::Packet> packet_;
unsigned int sim_clock_; unsigned int sim_clock_;
int16_t out_data_[kMaxBlockSize]; int16_t out_data_[kMaxBlockSize];
int output_sample_rate_; int output_sample_rate_;

View File

@ -12,10 +12,10 @@
#include "webrtc/modules/audio_coding/neteq/normal.h" #include "webrtc/modules/audio_coding/neteq/normal.h"
#include <memory>
#include <vector> #include <vector>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h" #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
#include "webrtc/modules/audio_coding/neteq/background_noise.h" #include "webrtc/modules/audio_coding/neteq/background_noise.h"
@ -57,7 +57,7 @@ TEST(Normal, AvoidDivideByZero) {
Normal normal(fs, &db, bgn, &expand); Normal normal(fs, &db, bgn, &expand);
int16_t input[1000] = {0}; int16_t input[1000] = {0};
rtc::scoped_ptr<int16_t[]> mute_factor_array(new int16_t[channels]); std::unique_ptr<int16_t[]> mute_factor_array(new int16_t[channels]);
for (size_t i = 0; i < channels; ++i) { for (size_t i = 0; i < channels; ++i) {
mute_factor_array[i] = 16384; mute_factor_array[i] = 16384;
} }
@ -103,7 +103,7 @@ TEST(Normal, InputLengthAndChannelsDoNotMatch) {
Normal normal(fs, &db, bgn, &expand); Normal normal(fs, &db, bgn, &expand);
int16_t input[1000] = {0}; int16_t input[1000] = {0};
rtc::scoped_ptr<int16_t[]> mute_factor_array(new int16_t[channels]); std::unique_ptr<int16_t[]> mute_factor_array(new int16_t[channels]);
for (size_t i = 0; i < channels; ++i) { for (size_t i = 0; i < channels; ++i) {
mute_factor_array[i] = 16384; mute_factor_array[i] = 16384;
} }

View File

@ -14,10 +14,10 @@
#include <assert.h> #include <assert.h>
#include <memory>
#include <utility> // pair #include <utility> // pair
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h" #include "webrtc/modules/audio_coding/neteq/mock/mock_decoder_database.h"
#include "webrtc/modules/audio_coding/neteq/packet.h" #include "webrtc/modules/audio_coding/neteq/packet.h"
@ -371,32 +371,32 @@ TEST(AudioPayloadSplitter, NonSplittable) {
// Tell the mock decoder database to return DecoderInfo structs with different // Tell the mock decoder database to return DecoderInfo structs with different
// codec types. // codec types.
// Use scoped pointers to avoid having to delete them later. // Use scoped pointers to avoid having to delete them later.
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info0( std::unique_ptr<DecoderDatabase::DecoderInfo> info0(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderISAC, 16000, NULL, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderISAC, 16000, NULL,
false)); false));
EXPECT_CALL(decoder_database, GetDecoderInfo(0)) EXPECT_CALL(decoder_database, GetDecoderInfo(0))
.WillRepeatedly(Return(info0.get())); .WillRepeatedly(Return(info0.get()));
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info1( std::unique_ptr<DecoderDatabase::DecoderInfo> info1(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderISACswb, 32000, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderISACswb, 32000,
NULL, false)); NULL, false));
EXPECT_CALL(decoder_database, GetDecoderInfo(1)) EXPECT_CALL(decoder_database, GetDecoderInfo(1))
.WillRepeatedly(Return(info1.get())); .WillRepeatedly(Return(info1.get()));
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info2( std::unique_ptr<DecoderDatabase::DecoderInfo> info2(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderRED, 8000, NULL, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderRED, 8000, NULL,
false)); false));
EXPECT_CALL(decoder_database, GetDecoderInfo(2)) EXPECT_CALL(decoder_database, GetDecoderInfo(2))
.WillRepeatedly(Return(info2.get())); .WillRepeatedly(Return(info2.get()));
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info3( std::unique_ptr<DecoderDatabase::DecoderInfo> info3(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderAVT, 8000, NULL, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderAVT, 8000, NULL,
false)); false));
EXPECT_CALL(decoder_database, GetDecoderInfo(3)) EXPECT_CALL(decoder_database, GetDecoderInfo(3))
.WillRepeatedly(Return(info3.get())); .WillRepeatedly(Return(info3.get()));
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info4( std::unique_ptr<DecoderDatabase::DecoderInfo> info4(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderCNGnb, 8000, NULL, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderCNGnb, 8000, NULL,
false)); false));
EXPECT_CALL(decoder_database, GetDecoderInfo(4)) EXPECT_CALL(decoder_database, GetDecoderInfo(4))
.WillRepeatedly(Return(info4.get())); .WillRepeatedly(Return(info4.get()));
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info5( std::unique_ptr<DecoderDatabase::DecoderInfo> info5(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderArbitrary, 8000, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderArbitrary, 8000,
NULL, false)); NULL, false));
EXPECT_CALL(decoder_database, GetDecoderInfo(5)) EXPECT_CALL(decoder_database, GetDecoderInfo(5))
@ -535,7 +535,7 @@ TEST_P(SplitBySamplesTest, PayloadSizes) {
// codec types. // codec types.
// Use scoped pointers to avoid having to delete them later. // Use scoped pointers to avoid having to delete them later.
// (Sample rate is set to 8000 Hz, but does not matter.) // (Sample rate is set to 8000 Hz, but does not matter.)
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info( std::unique_ptr<DecoderDatabase::DecoderInfo> info(
new DecoderDatabase::DecoderInfo(decoder_type_, 8000, NULL, false)); new DecoderDatabase::DecoderInfo(decoder_type_, 8000, NULL, false));
EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType)) EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType))
.WillRepeatedly(Return(info.get())); .WillRepeatedly(Return(info.get()));
@ -622,7 +622,7 @@ TEST_P(SplitIlbcTest, NumFrames) {
// Tell the mock decoder database to return DecoderInfo structs with different // Tell the mock decoder database to return DecoderInfo structs with different
// codec types. // codec types.
// Use scoped pointers to avoid having to delete them later. // Use scoped pointers to avoid having to delete them later.
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info( std::unique_ptr<DecoderDatabase::DecoderInfo> info(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderILBC, 8000, NULL, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderILBC, 8000, NULL,
false)); false));
EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType)) EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType))
@ -686,7 +686,7 @@ TEST(IlbcPayloadSplitter, TooLargePayload) {
packet_list.push_back(packet); packet_list.push_back(packet);
MockDecoderDatabase decoder_database; MockDecoderDatabase decoder_database;
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info( std::unique_ptr<DecoderDatabase::DecoderInfo> info(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderILBC, 8000, NULL, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderILBC, 8000, NULL,
false)); false));
EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType)) EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType))
@ -718,7 +718,7 @@ TEST(IlbcPayloadSplitter, UnevenPayload) {
packet_list.push_back(packet); packet_list.push_back(packet);
MockDecoderDatabase decoder_database; MockDecoderDatabase decoder_database;
rtc::scoped_ptr<DecoderDatabase::DecoderInfo> info( std::unique_ptr<DecoderDatabase::DecoderInfo> info(
new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderILBC, 8000, NULL, new DecoderDatabase::DecoderInfo(NetEqDecoder::kDecoderILBC, 8000, NULL,
false)); false));
EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType)) EXPECT_CALL(decoder_database, GetDecoderInfo(kPayloadType))

View File

@ -15,10 +15,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <string>
#include <iostream> #include <iostream>
#include <memory>
#include "webrtc/base/scoped_ptr.h" #include <string>
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
if (argc != 5) { if (argc != 5) {
@ -48,7 +47,7 @@ int main(int argc, char* argv[]) {
} }
const int data_size = channels * kFrameSizeSamples; const int data_size = channels * kFrameSizeSamples;
rtc::scoped_ptr<int16_t[]> in(new int16_t[data_size]); std::unique_ptr<int16_t[]> in(new int16_t[data_size]);
std::string input_filename = argv[3]; std::string input_filename = argv[3];
std::string output_filename = argv[4]; std::string output_filename = argv[4];

View File

@ -8,9 +8,10 @@
* 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 "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/safe_conversions.h" #include "webrtc/base/safe_conversions.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h" #include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h" #include "webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"
@ -76,7 +77,7 @@ class NetEqIlbcQualityTest : public NetEqQualityTest {
} }
private: private:
rtc::scoped_ptr<AudioEncoderIlbc> encoder_; std::unique_ptr<AudioEncoderIlbc> encoder_;
}; };
TEST_F(NetEqIlbcQualityTest, Test) { TEST_F(NetEqIlbcQualityTest, Test) {

View File

@ -8,9 +8,10 @@
* 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 "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/safe_conversions.h" #include "webrtc/base/safe_conversions.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h" #include "webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h"
#include "webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h" #include "webrtc/modules/audio_coding/neteq/tools/neteq_quality_test.h"
#include "webrtc/test/testsupport/fileutils.h" #include "webrtc/test/testsupport/fileutils.h"
@ -76,7 +77,7 @@ class NetEqPcmuQualityTest : public NetEqQualityTest {
} }
private: private:
rtc::scoped_ptr<AudioEncoderPcmU> encoder_; std::unique_ptr<AudioEncoderPcmU> encoder_;
}; };
TEST_F(NetEqPcmuQualityTest, Test) { TEST_F(NetEqPcmuQualityTest, Test) {

View File

@ -11,9 +11,9 @@
#include "webrtc/modules/audio_coding/neteq/time_stretch.h" #include "webrtc/modules/audio_coding/neteq/time_stretch.h"
#include <algorithm> // min, max #include <algorithm> // min, max
#include <memory>
#include "webrtc/base/safe_conversions.h" #include "webrtc/base/safe_conversions.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_coding/neteq/background_noise.h" #include "webrtc/modules/audio_coding/neteq/background_noise.h"
#include "webrtc/modules/audio_coding/neteq/dsp_helper.h" #include "webrtc/modules/audio_coding/neteq/dsp_helper.h"
@ -30,7 +30,7 @@ TimeStretch::ReturnCodes TimeStretch::Process(const int16_t* input,
static_cast<size_t>(fs_mult_ * 120); // Corresponds to 15 ms. static_cast<size_t>(fs_mult_ * 120); // Corresponds to 15 ms.
const int16_t* signal; const int16_t* signal;
rtc::scoped_ptr<int16_t[]> signal_array; std::unique_ptr<int16_t[]> signal_array;
size_t signal_len; size_t signal_len;
if (num_channels_ == 1) { if (num_channels_ == 1) {
signal = input; signal = input;

View File

@ -14,10 +14,10 @@
#include "webrtc/modules/audio_coding/neteq/preemptive_expand.h" #include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
#include <map> #include <map>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
#include "webrtc/modules/audio_coding/neteq/background_noise.h" #include "webrtc/modules/audio_coding/neteq/background_noise.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
@ -100,10 +100,10 @@ class TimeStretchTest : public ::testing::Test {
} }
} }
rtc::scoped_ptr<test::InputAudioFile> input_file_; std::unique_ptr<test::InputAudioFile> input_file_;
const int sample_rate_hz_; const int sample_rate_hz_;
const size_t block_size_; const size_t block_size_;
rtc::scoped_ptr<int16_t[]> audio_; std::unique_ptr<int16_t[]> audio_;
std::map<TimeStretch::ReturnCodes, int> return_stats_; std::map<TimeStretch::ReturnCodes, int> return_stats_;
BackgroundNoise background_noise_; BackgroundNoise background_noise_;
}; };

View File

@ -11,11 +11,11 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_AUDIO_LOOP_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_AUDIO_LOOP_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_AUDIO_LOOP_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_AUDIO_LOOP_H_
#include <memory>
#include <string> #include <string>
#include "webrtc/base/array_view.h" #include "webrtc/base/array_view.h"
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {
@ -49,7 +49,7 @@ class AudioLoop {
size_t next_index_; size_t next_index_;
size_t loop_length_samples_; size_t loop_length_samples_;
size_t block_length_samples_; size_t block_length_samples_;
rtc::scoped_ptr<int16_t[]> audio_array_; std::unique_ptr<int16_t[]> audio_array_;
RTC_DISALLOW_COPY_AND_ASSIGN(AudioLoop); RTC_DISALLOW_COPY_AND_ASSIGN(AudioLoop);
}; };

View File

@ -11,9 +11,9 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EXTERNAL_DECODER_TEST_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EXTERNAL_DECODER_TEST_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EXTERNAL_DECODER_TEST_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_EXTERNAL_DECODER_TEST_H_
#include <memory>
#include <string> #include <string>
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h" #include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
@ -55,7 +55,7 @@ class NetEqExternalDecoderTest {
AudioDecoder* decoder_; AudioDecoder* decoder_;
int sample_rate_hz_; int sample_rate_hz_;
size_t channels_; size_t channels_;
rtc::scoped_ptr<NetEq> neteq_; std::unique_ptr<NetEq> neteq_;
}; };
} // namespace test } // namespace test

View File

@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_QUALITY_TEST_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_NETEQ_QUALITY_TEST_H_
#include <fstream> #include <fstream>
#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/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/audio_coding/neteq/tools/audio_sink.h" #include "webrtc/modules/audio_coding/neteq/tools/audio_sink.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
@ -58,7 +58,7 @@ class GilbertElliotLoss : public LossModel {
// Prob. of losing current packet, when previous packet is not lost. // Prob. of losing current packet, when previous packet is not lost.
double prob_trans_01_; double prob_trans_01_;
bool lost_last_; bool lost_last_;
rtc::scoped_ptr<UniformLoss> uniform_loss_model_; std::unique_ptr<UniformLoss> uniform_loss_model_;
}; };
class NetEqQualityTest : public ::testing::Test { class NetEqQualityTest : public ::testing::Test {
@ -119,17 +119,17 @@ class NetEqQualityTest : public ::testing::Test {
size_t payload_size_bytes_; size_t payload_size_bytes_;
size_t max_payload_bytes_; size_t max_payload_bytes_;
rtc::scoped_ptr<InputAudioFile> in_file_; std::unique_ptr<InputAudioFile> in_file_;
rtc::scoped_ptr<AudioSink> output_; std::unique_ptr<AudioSink> output_;
std::ofstream log_file_; std::ofstream log_file_;
rtc::scoped_ptr<RtpGenerator> rtp_generator_; std::unique_ptr<RtpGenerator> rtp_generator_;
rtc::scoped_ptr<NetEq> neteq_; std::unique_ptr<NetEq> neteq_;
rtc::scoped_ptr<LossModel> loss_model_; std::unique_ptr<LossModel> loss_model_;
rtc::scoped_ptr<int16_t[]> in_data_; std::unique_ptr<int16_t[]> in_data_;
rtc::scoped_ptr<uint8_t[]> payload_; std::unique_ptr<uint8_t[]> payload_;
rtc::scoped_ptr<int16_t[]> out_data_; std::unique_ptr<int16_t[]> out_data_;
WebRtcRTPHeader rtp_header_; WebRtcRTPHeader rtp_header_;
size_t total_payload_size_bytes_; size_t total_payload_size_bytes_;

View File

@ -19,13 +19,13 @@
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
#include <memory>
#include <limits> #include <limits>
#include <string> #include <string>
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/safe_conversions.h" #include "webrtc/base/safe_conversions.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h" #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/input_audio_file.h"
@ -295,8 +295,8 @@ int CodecTimestampRate(uint8_t payload_type) {
} }
size_t ReplacePayload(webrtc::test::InputAudioFile* replacement_audio_file, size_t ReplacePayload(webrtc::test::InputAudioFile* replacement_audio_file,
rtc::scoped_ptr<int16_t[]>* replacement_audio, std::unique_ptr<int16_t[]>* replacement_audio,
rtc::scoped_ptr<uint8_t[]>* payload, std::unique_ptr<uint8_t[]>* payload,
size_t* payload_mem_size_bytes, size_t* payload_mem_size_bytes,
size_t* frame_size_samples, size_t* frame_size_samples,
WebRtcRTPHeader* rtp_header, WebRtcRTPHeader* rtp_header,
@ -411,7 +411,7 @@ int main(int argc, char* argv[]) {
printf("Input file: %s\n", argv[1]); printf("Input file: %s\n", argv[1]);
bool is_rtp_dump = false; bool is_rtp_dump = false;
rtc::scoped_ptr<webrtc::test::PacketSource> file_source; std::unique_ptr<webrtc::test::PacketSource> file_source;
webrtc::test::RtcEventLogSource* event_log_source = nullptr; webrtc::test::RtcEventLogSource* event_log_source = nullptr;
if (webrtc::test::RtpFileSource::ValidRtpDump(argv[1]) || if (webrtc::test::RtpFileSource::ValidRtpDump(argv[1]) ||
webrtc::test::RtpFileSource::ValidPcap(argv[1])) { webrtc::test::RtpFileSource::ValidPcap(argv[1])) {
@ -433,7 +433,7 @@ int main(int argc, char* argv[]) {
// Check if a replacement audio file was provided, and if so, open it. // Check if a replacement audio file was provided, and if so, open it.
bool replace_payload = false; bool replace_payload = false;
rtc::scoped_ptr<webrtc::test::InputAudioFile> replacement_audio_file; std::unique_ptr<webrtc::test::InputAudioFile> replacement_audio_file;
if (!FLAGS_replacement_audio_file.empty()) { if (!FLAGS_replacement_audio_file.empty()) {
replacement_audio_file.reset( replacement_audio_file.reset(
new webrtc::test::InputAudioFile(FLAGS_replacement_audio_file)); new webrtc::test::InputAudioFile(FLAGS_replacement_audio_file));
@ -441,7 +441,7 @@ int main(int argc, char* argv[]) {
} }
// Read first packet. // Read first packet.
rtc::scoped_ptr<webrtc::test::Packet> packet(file_source->NextPacket()); std::unique_ptr<webrtc::test::Packet> packet(file_source->NextPacket());
if (!packet) { if (!packet) {
printf( printf(
"Warning: input file is empty, or the filters did not match any " "Warning: input file is empty, or the filters did not match any "
@ -468,7 +468,7 @@ int main(int argc, char* argv[]) {
// for wav files.) // for wav files.)
// Check output file type. // Check output file type.
std::string output_file_name = argv[2]; std::string output_file_name = argv[2];
rtc::scoped_ptr<webrtc::test::AudioSink> output; std::unique_ptr<webrtc::test::AudioSink> output;
if (output_file_name.size() >= 4 && if (output_file_name.size() >= 4 &&
output_file_name.substr(output_file_name.size() - 4) == ".wav") { output_file_name.substr(output_file_name.size() - 4) == ".wav") {
// Open a wav file. // Open a wav file.
@ -495,11 +495,11 @@ int main(int argc, char* argv[]) {
// Set up variables for audio replacement if needed. // Set up variables for audio replacement if needed.
rtc::scoped_ptr<webrtc::test::Packet> next_packet; std::unique_ptr<webrtc::test::Packet> next_packet;
bool next_packet_available = false; bool next_packet_available = false;
size_t input_frame_size_timestamps = 0; size_t input_frame_size_timestamps = 0;
rtc::scoped_ptr<int16_t[]> replacement_audio; std::unique_ptr<int16_t[]> replacement_audio;
rtc::scoped_ptr<uint8_t[]> payload; std::unique_ptr<uint8_t[]> payload;
size_t payload_mem_size_bytes = 0; size_t payload_mem_size_bytes = 0;
if (replace_payload) { if (replace_payload) {
// Initially assume that the frame size is 30 ms at the initial sample rate. // Initially assume that the frame size is 30 ms at the initial sample rate.

View File

@ -12,6 +12,8 @@
#include <string.h> #include <string.h>
#include <memory>
#include "webrtc/modules/include/module_common_types.h" #include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
@ -55,7 +57,7 @@ Packet::Packet(uint8_t* packet_memory, size_t allocated_bytes, double time_ms)
virtual_packet_length_bytes_(allocated_bytes), virtual_packet_length_bytes_(allocated_bytes),
virtual_payload_length_bytes_(0), virtual_payload_length_bytes_(0),
time_ms_(time_ms) { time_ms_(time_ms) {
rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
valid_header_ = ParseHeader(*parser); valid_header_ = ParseHeader(*parser);
} }
@ -70,7 +72,7 @@ Packet::Packet(uint8_t* packet_memory,
virtual_packet_length_bytes_(virtual_packet_length_bytes), virtual_packet_length_bytes_(virtual_packet_length_bytes),
virtual_payload_length_bytes_(0), virtual_payload_length_bytes_(0),
time_ms_(time_ms) { time_ms_(time_ms) {
rtc::scoped_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create()); std::unique_ptr<RtpHeaderParser> parser(RtpHeaderParser::Create());
valid_header_ = ParseHeader(*parser); valid_header_ = ParseHeader(*parser);
} }

View File

@ -12,9 +12,9 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_PACKET_H_
#include <list> #include <list>
#include <memory>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
@ -103,7 +103,7 @@ class Packet {
void CopyToHeader(RTPHeader* destination) const; void CopyToHeader(RTPHeader* destination) const;
RTPHeader header_; RTPHeader header_;
rtc::scoped_ptr<uint8_t[]> payload_memory_; std::unique_ptr<uint8_t[]> payload_memory_;
const uint8_t* payload_; // First byte after header. const uint8_t* payload_; // First byte after header.
const size_t packet_length_bytes_; // Total length of packet. const size_t packet_length_bytes_; // Total length of packet.
size_t payload_length_bytes_; // Length of the payload, after RTP header. size_t payload_length_bytes_; // Length of the payload, after RTP header.

View File

@ -10,8 +10,9 @@
#include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h" #include "webrtc/modules/audio_coding/neteq/tools/resample_input_audio_file.h"
#include <memory>
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
namespace webrtc { namespace webrtc {
namespace test { namespace test {
@ -22,7 +23,7 @@ bool ResampleInputAudioFile::Read(size_t samples,
const size_t samples_to_read = samples * file_rate_hz_ / output_rate_hz; const size_t samples_to_read = samples * file_rate_hz_ / output_rate_hz;
RTC_CHECK_EQ(samples_to_read * output_rate_hz, samples * file_rate_hz_) RTC_CHECK_EQ(samples_to_read * output_rate_hz, samples * file_rate_hz_)
<< "Frame size and sample rates don't add up to an integer."; << "Frame size and sample rates don't add up to an integer.";
rtc::scoped_ptr<int16_t[]> temp_destination(new int16_t[samples_to_read]); std::unique_ptr<int16_t[]> temp_destination(new int16_t[samples_to_read]);
if (!InputAudioFile::Read(samples_to_read, temp_destination.get())) if (!InputAudioFile::Read(samples_to_read, temp_destination.get()))
return false; return false;
resampler_.ResetIfNeeded(file_rate_hz_, output_rate_hz, 1); resampler_.ResetIfNeeded(file_rate_hz_, output_rate_hz, 1);

View File

@ -11,10 +11,10 @@
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTC_EVENT_LOG_SOURCE_H_ #ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTC_EVENT_LOG_SOURCE_H_
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTC_EVENT_LOG_SOURCE_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTC_EVENT_LOG_SOURCE_H_
#include <memory>
#include <string> #include <string>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet_source.h" #include "webrtc/modules/audio_coding/neteq/tools/packet_source.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@ -58,8 +58,8 @@ class RtcEventLogSource : public PacketSource {
int rtp_packet_index_ = 0; int rtp_packet_index_ = 0;
int audio_output_index_ = 0; int audio_output_index_ = 0;
rtc::scoped_ptr<rtclog::EventStream> event_log_; std::unique_ptr<rtclog::EventStream> event_log_;
rtc::scoped_ptr<RtpHeaderParser> parser_; std::unique_ptr<RtpHeaderParser> parser_;
RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogSource); RTC_DISALLOW_COPY_AND_ASSIGN(RtcEventLogSource);
}; };

View File

@ -10,10 +10,11 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <memory>
#include <vector> #include <vector>
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet.h" #include "webrtc/modules/audio_coding/neteq/tools/packet.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h"
@ -63,7 +64,7 @@ int main(int argc, char* argv[]) {
} }
printf("Input file: %s\n", argv[1]); printf("Input file: %s\n", argv[1]);
rtc::scoped_ptr<webrtc::test::RtpFileSource> file_source( std::unique_ptr<webrtc::test::RtpFileSource> file_source(
webrtc::test::RtpFileSource::Create(argv[1])); webrtc::test::RtpFileSource::Create(argv[1]));
assert(file_source.get()); assert(file_source.get());
// Set RTP extension IDs. // Set RTP extension IDs.
@ -104,7 +105,7 @@ int main(int argc, char* argv[]) {
uint32_t max_abs_send_time = 0; uint32_t max_abs_send_time = 0;
int cycles = -1; int cycles = -1;
rtc::scoped_ptr<webrtc::test::Packet> packet; std::unique_ptr<webrtc::test::Packet> packet;
while (true) { while (true) {
packet.reset(file_source->NextPacket()); packet.reset(file_source->NextPacket());
if (!packet.get()) { if (!packet.get()) {

View File

@ -18,6 +18,8 @@
#include <netinet/in.h> #include <netinet/in.h>
#endif #endif
#include <memory>
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet.h" #include "webrtc/modules/audio_coding/neteq/tools/packet.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
@ -33,13 +35,13 @@ RtpFileSource* RtpFileSource::Create(const std::string& file_name) {
} }
bool RtpFileSource::ValidRtpDump(const std::string& file_name) { bool RtpFileSource::ValidRtpDump(const std::string& file_name) {
rtc::scoped_ptr<RtpFileReader> temp_file( std::unique_ptr<RtpFileReader> temp_file(
RtpFileReader::Create(RtpFileReader::kRtpDump, file_name)); RtpFileReader::Create(RtpFileReader::kRtpDump, file_name));
return !!temp_file; return !!temp_file;
} }
bool RtpFileSource::ValidPcap(const std::string& file_name) { bool RtpFileSource::ValidPcap(const std::string& file_name) {
rtc::scoped_ptr<RtpFileReader> temp_file( std::unique_ptr<RtpFileReader> temp_file(
RtpFileReader::Create(RtpFileReader::kPcap, file_name)); RtpFileReader::Create(RtpFileReader::kPcap, file_name));
return !!temp_file; return !!temp_file;
} }
@ -64,9 +66,9 @@ Packet* RtpFileSource::NextPacket() {
// Read the next one. // Read the next one.
continue; continue;
} }
rtc::scoped_ptr<uint8_t[]> packet_memory(new uint8_t[temp_packet.length]); std::unique_ptr<uint8_t[]> packet_memory(new uint8_t[temp_packet.length]);
memcpy(packet_memory.get(), temp_packet.data, temp_packet.length); memcpy(packet_memory.get(), temp_packet.data, temp_packet.length);
rtc::scoped_ptr<Packet> packet(new Packet( std::unique_ptr<Packet> packet(new Packet(
packet_memory.release(), temp_packet.length, packet_memory.release(), temp_packet.length,
temp_packet.original_length, temp_packet.time_ms, *parser_.get())); temp_packet.original_length, temp_packet.time_ms, *parser_.get()));
if (!packet->valid_header()) { if (!packet->valid_header()) {

View File

@ -12,10 +12,11 @@
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_FILE_SOURCE_H_ #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_TOOLS_RTP_FILE_SOURCE_H_
#include <stdio.h> #include <stdio.h>
#include <memory>
#include <string> #include <string>
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/neteq/tools/packet_source.h" #include "webrtc/modules/audio_coding/neteq/tools/packet_source.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "webrtc/modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@ -56,8 +57,8 @@ class RtpFileSource : public PacketSource {
bool OpenFile(const std::string& file_name); bool OpenFile(const std::string& file_name);
rtc::scoped_ptr<RtpFileReader> rtp_reader_; std::unique_ptr<RtpFileReader> rtp_reader_;
rtc::scoped_ptr<RtpHeaderParser> parser_; std::unique_ptr<RtpHeaderParser> parser_;
RTC_DISALLOW_COPY_AND_ASSIGN(RtpFileSource); RTC_DISALLOW_COPY_AND_ASSIGN(RtpFileSource);
}; };

View File

@ -10,12 +10,12 @@
#include <stdio.h> #include <stdio.h>
#include <memory>
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/test/rtp_file_reader.h" #include "webrtc/test/rtp_file_reader.h"
#include "webrtc/test/rtp_file_writer.h" #include "webrtc/test/rtp_file_writer.h"
using rtc::scoped_ptr;
using webrtc::test::RtpFileReader; using webrtc::test::RtpFileReader;
using webrtc::test::RtpFileWriter; using webrtc::test::RtpFileWriter;
@ -26,13 +26,13 @@ int main(int argc, char* argv[]) {
exit(1); exit(1);
} }
scoped_ptr<RtpFileWriter> output( std::unique_ptr<RtpFileWriter> output(
RtpFileWriter::Create(RtpFileWriter::kRtpDump, argv[argc - 1])); RtpFileWriter::Create(RtpFileWriter::kRtpDump, argv[argc - 1]));
RTC_CHECK(output.get() != NULL) << "Cannot open output file."; RTC_CHECK(output.get() != NULL) << "Cannot open output file.";
printf("Output RTP file: %s\n", argv[argc - 1]); printf("Output RTP file: %s\n", argv[argc - 1]);
for (int i = 1; i < argc - 1; i++) { for (int i = 1; i < argc - 1; i++) {
scoped_ptr<RtpFileReader> input( std::unique_ptr<RtpFileReader> input(
RtpFileReader::Create(RtpFileReader::kRtpDump, argv[i])); RtpFileReader::Create(RtpFileReader::kRtpDump, argv[i]));
RTC_CHECK(input.get() != NULL) << "Cannot open input file " << argv[i]; RTC_CHECK(input.get() != NULL) << "Cannot open input file " << argv[i];
printf("Input RTP file: %s\n", argv[i]); printf("Input RTP file: %s\n", argv[i]);