Replace scoped_ptr with unique_ptr in webrtc/voice_engine/

Also introduce a pair of scoped_ptr <-> unique_ptr conversion
functions. By using them judiciously, we can keep these CL:s small and
avoid having to convert enormous amounts of code at once.

BUG=webrtc:5520

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

Cr-Commit-Position: refs/heads/master@{#11658}
This commit is contained in:
kwiberg 2016-02-17 10:04:18 -08:00 committed by Commit bot
parent dabf07f477
commit b7f89d6e66
28 changed files with 94 additions and 64 deletions

View File

@ -93,7 +93,8 @@ AudioReceiveStream::AudioReceiveStream(
RTC_DCHECK(rtp_header_parser_);
VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
channel_proxy_ =
rtc::UniqueToScoped(voe_impl->GetChannelProxy(config_.voe_channel_id));
channel_proxy_->SetLocalSSRC(config.rtp.local_ssrc);
for (const auto& extension : config.rtp.extensions) {
if (extension.name == RtpExtension::kAudioLevel) {
@ -230,7 +231,7 @@ webrtc::AudioReceiveStream::Stats AudioReceiveStream::GetStats() const {
void AudioReceiveStream::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
channel_proxy_->SetSink(std::move(sink));
channel_proxy_->SetSink(rtc::ScopedToUnique(std::move(sink)));
}
const webrtc::AudioReceiveStream::Config& AudioReceiveStream::config() const {

View File

@ -67,7 +67,8 @@ AudioSendStream::AudioSendStream(
RTC_DCHECK(congestion_controller);
VoiceEngineImpl* voe_impl = static_cast<VoiceEngineImpl*>(voice_engine());
channel_proxy_ = voe_impl->GetChannelProxy(config_.voe_channel_id);
channel_proxy_ =
rtc::UniqueToScoped(voe_impl->GetChannelProxy(config_.voe_channel_id));
channel_proxy_->RegisterSenderCongestionControlObjects(
congestion_controller->pacer(),
congestion_controller->GetTransportFeedbackObserver(),

View File

@ -88,6 +88,7 @@
#include <algorithm> // For std::swap().
#include <cstddef>
#include <memory>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/deprecation.h"
@ -605,6 +606,16 @@ void swap(rtc::scoped_ptr<T, D>& p1, rtc::scoped_ptr<T, D>& p2) {
p1.swap(p2);
}
// Convert between the most common kinds of scoped_ptr and unique_ptr.
template <typename T>
std::unique_ptr<T> ScopedToUnique(scoped_ptr<T> sp) {
return std::unique_ptr<T>(sp.release());
}
template <typename T>
scoped_ptr<T> UniqueToScoped(std::unique_ptr<T> up) {
return scoped_ptr<T>(up.release());
}
} // namespace rtc
template <class T, class D>

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
#define WEBRTC_AUDIO_MOCK_VOICE_ENGINE_H_
#include <memory>
#include "testing/gmock/include/gmock/gmock.h"
#include "webrtc/test/mock_voe_channel_proxy.h"
#include "webrtc/voice_engine/voice_engine_impl.h"
@ -43,8 +45,8 @@ class MockVoiceEngine : public VoiceEngineImpl {
MOCK_METHOD1(ChannelProxyFactory, voe::ChannelProxy*(int channel_id));
// VoiceEngineImpl
rtc::scoped_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id) override {
return rtc::scoped_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id));
std::unique_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id) override {
return std::unique_ptr<voe::ChannelProxy>(ChannelProxyFactory(channel_id));
}
// VoEAudioProcessing

View File

@ -1071,7 +1071,7 @@ int32_t Channel::UpdateLocalTimeStamp() {
return 0;
}
void Channel::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) {
void Channel::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
rtc::CritScope cs(&_callbackCritSect);
audio_sink_ = std::move(sink);
}
@ -3265,7 +3265,7 @@ int Channel::GetRtpRtcp(RtpRtcp** rtpRtcpModule,
// TODO(andrew): refactor Mix functions here and in transmit_mixer.cc to use
// a shared helper.
int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) {
rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[640]);
std::unique_ptr<int16_t[]> fileBuffer(new int16_t[640]);
size_t fileSamples(0);
{
@ -3313,7 +3313,7 @@ int32_t Channel::MixOrReplaceAudioWithFile(int mixingFrequency) {
int32_t Channel::MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency) {
assert(mixingFrequency <= 48000);
rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[960]);
std::unique_ptr<int16_t[]> fileBuffer(new int16_t[960]);
size_t fileSamples(0);
{

View File

@ -11,9 +11,10 @@
#ifndef WEBRTC_VOICE_ENGINE_CHANNEL_H_
#define WEBRTC_VOICE_ENGINE_CHANNEL_H_
#include <memory>
#include "webrtc/audio/audio_sink.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/resampler/include/push_resampler.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
@ -193,7 +194,7 @@ class Channel
rtc::CriticalSection* callbackCritSect);
int32_t UpdateLocalTimeStamp();
void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink);
void SetSink(std::unique_ptr<AudioSinkInterface> sink);
// API methods
@ -493,15 +494,15 @@ class Channel
RtcEventLog* const event_log_;
rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_;
rtc::scoped_ptr<ReceiveStatistics> rtp_receive_statistics_;
rtc::scoped_ptr<StatisticsProxy> statistics_proxy_;
rtc::scoped_ptr<RtpReceiver> rtp_receiver_;
std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry_;
std::unique_ptr<ReceiveStatistics> rtp_receive_statistics_;
std::unique_ptr<StatisticsProxy> statistics_proxy_;
std::unique_ptr<RtpReceiver> rtp_receiver_;
TelephoneEventHandler* telephone_event_handler_;
rtc::scoped_ptr<RtpRtcp> _rtpRtcpModule;
rtc::scoped_ptr<AudioCodingModule> audio_coding_;
rtc::scoped_ptr<AudioSinkInterface> audio_sink_;
std::unique_ptr<RtpRtcp> _rtpRtcpModule;
std::unique_ptr<AudioCodingModule> audio_coding_;
std::unique_ptr<AudioSinkInterface> audio_sink_;
AudioLevel _outputAudioLevel;
bool _externalTransport;
AudioFrame _audioFrame;
@ -535,7 +536,7 @@ class Channel
rtc::CriticalSection ts_stats_lock_;
rtc::scoped_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_;
std::unique_ptr<rtc::TimestampWrapAroundHandler> rtp_ts_wraparound_handler_;
// The rtp timestamp of the first played out audio frame.
int64_t capture_start_rtp_time_stamp_;
// The capture ntp time (in local timebase) of the first played out audio
@ -552,7 +553,7 @@ class Channel
rtc::CriticalSection* _callbackCritSectPtr; // owned by base
Transport* _transportPtr; // WebRtc socket or external transport
RMSLevel rms_level_;
rtc::scoped_ptr<AudioProcessing> rx_audioproc_; // far end AudioProcessing
std::unique_ptr<AudioProcessing> rx_audioproc_; // far end AudioProcessing
VoERxVadCallback* _rxVadObserverPtr;
int32_t _oldVadDecision;
int32_t _sendFrameType; // Send data is voice, 1-voice, 0-otherwise
@ -584,17 +585,17 @@ class Channel
bool _rxNsIsEnabled;
bool restored_packet_in_use_;
// RtcpBandwidthObserver
rtc::scoped_ptr<VoERtcpObserver> rtcp_observer_;
rtc::scoped_ptr<NetworkPredictor> network_predictor_;
std::unique_ptr<VoERtcpObserver> rtcp_observer_;
std::unique_ptr<NetworkPredictor> network_predictor_;
// An associated send channel.
rtc::CriticalSection assoc_send_channel_lock_;
ChannelOwner associate_send_channel_ GUARDED_BY(assoc_send_channel_lock_);
bool pacing_enabled_;
PacketRouter* packet_router_ = nullptr;
rtc::scoped_ptr<TransportFeedbackProxy> feedback_observer_proxy_;
rtc::scoped_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_;
rtc::scoped_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_;
std::unique_ptr<TransportFeedbackProxy> feedback_observer_proxy_;
std::unique_ptr<TransportSequenceNumberProxy> seq_num_allocator_proxy_;
std::unique_ptr<RtpPacketSenderProxy> rtp_packet_sender_proxy_;
};
} // namespace voe

View File

@ -49,7 +49,7 @@ ChannelManager::ChannelManager(uint32_t instance_id, const Config& config)
: instance_id_(instance_id),
last_channel_id_(-1),
config_(config),
event_log_(RtcEventLog::Create()) {}
event_log_(rtc::ScopedToUnique(RtcEventLog::Create())) {}
ChannelOwner ChannelManager::CreateChannel() {
return CreateChannelInternal(config_);

View File

@ -11,11 +11,11 @@
#ifndef WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H
#define WEBRTC_VOICE_ENGINE_CHANNEL_MANAGER_H
#include <memory>
#include <vector>
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/call/rtc_event_log.h"
#include "webrtc/system_wrappers/include/atomic32.h"
#include "webrtc/typedefs.h"
@ -62,7 +62,7 @@ class ChannelOwner {
// deleted when no references to them are held.
struct ChannelRef {
ChannelRef(Channel* channel);
const rtc::scoped_ptr<Channel> channel;
const std::unique_ptr<Channel> channel;
Atomic32 ref_count;
};
@ -127,7 +127,7 @@ class ChannelManager {
std::vector<ChannelOwner> channels_;
const Config& config_;
rtc::scoped_ptr<RtcEventLog> event_log_;
std::unique_ptr<RtcEventLog> event_log_;
RTC_DISALLOW_COPY_AND_ASSIGN(ChannelManager);
};

View File

@ -155,7 +155,7 @@ bool ChannelProxy::SendTelephoneEventOutband(uint8_t event,
channel()->SendTelephoneEventOutband(event, duration_ms, 10, false) == 0;
}
void ChannelProxy::SetSink(rtc::scoped_ptr<AudioSinkInterface> sink) {
void ChannelProxy::SetSink(std::unique_ptr<AudioSinkInterface> sink) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
channel()->SetSink(std::move(sink));
}

View File

@ -15,6 +15,7 @@
#include "webrtc/voice_engine/channel_manager.h"
#include "webrtc/voice_engine/include/voe_rtp_rtcp.h"
#include <memory>
#include <string>
#include <vector>
@ -69,7 +70,7 @@ class ChannelProxy {
virtual bool SetSendTelephoneEventPayloadType(int payload_type);
virtual bool SendTelephoneEventOutband(uint8_t event, uint32_t duration_ms);
virtual void SetSink(rtc::scoped_ptr<AudioSinkInterface> sink);
virtual void SetSink(std::unique_ptr<AudioSinkInterface> sink);
private:
Channel* channel() const;

View File

@ -11,6 +11,8 @@
#ifndef WEBRTC_VOICE_ENGINE_NETWORK_PREDICTOR_H_
#define WEBRTC_VOICE_ENGINE_NETWORK_PREDICTOR_H_
#include <memory>
#include "webrtc/base/exp_filter.h"
#include "webrtc/system_wrappers/include/clock.h"
@ -38,7 +40,7 @@ class NetworkPredictor {
int64_t last_loss_rate_update_time_ms_;
// An exponential filter is used to predict packet loss rate.
rtc::scoped_ptr<rtc::ExpFilter> loss_rate_filter_;
std::unique_ptr<rtc::ExpFilter> loss_rate_filter_;
};
} // namespace voe

View File

@ -10,6 +10,8 @@
#include <math.h>
#include <memory>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/voice_engine/network_predictor.h"
#include "webrtc/system_wrappers/include/clock.h"
@ -23,7 +25,7 @@ class TestNetworkPredictor : public ::testing::Test {
: clock_(0),
network_predictor_(new NetworkPredictor(&clock_)) {}
SimulatedClock clock_;
rtc::scoped_ptr<NetworkPredictor> network_predictor_;
std::unique_ptr<NetworkPredictor> network_predictor_;
};
TEST_F(TestNetworkPredictor, TestPacketLossRateFilter) {

View File

@ -27,7 +27,8 @@ SharedData::SharedData(const Config& config)
_channelManager(_gInstanceCounter, config),
_engineStatistics(_gInstanceCounter),
_audioDevicePtr(NULL),
_moduleProcessThreadPtr(ProcessThread::Create("VoiceProcessThread")) {
_moduleProcessThreadPtr(
rtc::ScopedToUnique(ProcessThread::Create("VoiceProcessThread"))) {
Trace::CreateTrace();
if (OutputMixer::Create(_outputMixerPtr, _gInstanceCounter) == 0)
{

View File

@ -11,8 +11,9 @@
#ifndef WEBRTC_VOICE_ENGINE_SHARED_DATA_H
#define WEBRTC_VOICE_ENGINE_SHARED_DATA_H
#include <memory>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_device/include/audio_device.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/utility/include/process_thread.h"
@ -69,8 +70,8 @@ protected:
AudioDeviceModule* _audioDevicePtr;
OutputMixer* _outputMixerPtr;
TransmitMixer* _transmitMixerPtr;
rtc::scoped_ptr<AudioProcessing> audioproc_;
rtc::scoped_ptr<ProcessThread> _moduleProcessThreadPtr;
std::unique_ptr<AudioProcessing> audioproc_;
std::unique_ptr<ProcessThread> _moduleProcessThreadPtr;
AudioDeviceModule::AudioLayer _audioDeviceLayer;

View File

@ -13,13 +13,13 @@
#include <deque>
#include <map>
#include <memory>
#include <utility>
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
@ -130,7 +130,7 @@ class ConferenceTransport: public webrtc::Transport {
rtc::CriticalSection pq_crit_;
rtc::CriticalSection stream_crit_;
const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_;
const std::unique_ptr<webrtc::EventWrapper> packet_event_;
rtc::PlatformThread thread_;
unsigned int rtt_ms_;
@ -156,7 +156,7 @@ class ConferenceTransport: public webrtc::Transport {
LoudestFilter loudest_filter_;
const rtc::scoped_ptr<webrtc::RtpHeaderParser> rtp_header_parser_;
const std::unique_ptr<webrtc::RtpHeaderParser> rtp_header_parser_;
};
} // namespace voetest

View File

@ -12,10 +12,10 @@
#define SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_
#include <deque>
#include <memory>
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
#include "webrtc/system_wrappers/include/atomic32.h"
@ -143,7 +143,7 @@ class LoopBackTransport : public webrtc::Transport {
}
rtc::CriticalSection crit_;
const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_;
const std::unique_ptr<webrtc::EventWrapper> packet_event_;
rtc::PlatformThread thread_;
std::deque<Packet> packet_queue_ GUARDED_BY(crit_);
const int channel_;
@ -163,7 +163,7 @@ class AfterInitializationFixture : public BeforeInitializationFixture {
virtual ~AfterInitializationFixture();
protected:
rtc::scoped_ptr<TestErrorObserver> error_observer_;
std::unique_ptr<TestErrorObserver> error_observer_;
};
#endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h"
#include "webrtc/system_wrappers/include/atomic32.h"
@ -83,7 +85,7 @@ class ExtensionVerifyTransport : public webrtc::Transport {
kPacketsExpected = 10,
kSleepIntervalMs = 10
};
rtc::scoped_ptr<webrtc::RtpHeaderParser> parser_;
std::unique_ptr<webrtc::RtpHeaderParser> parser_;
webrtc::Atomic32 received_packets_;
webrtc::Atomic32 bad_packets_;
int audio_level_id_;

View File

@ -8,6 +8,8 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "webrtc/base/criticalsection.h"
#include "webrtc/system_wrappers/include/atomic32.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
@ -35,7 +37,7 @@ class TestRtpObserver : public webrtc::VoERTPObserver {
public:
rtc::CriticalSection crit_;
unsigned int incoming_ssrc_;
rtc::scoped_ptr<voetest::EventWrapper> changed_ssrc_event_;
std::unique_ptr<voetest::EventWrapper> changed_ssrc_event_;
};
void TestRtpObserver::OnIncomingSSRCChanged(int channel,

View File

@ -17,7 +17,8 @@
#include <conio.h>
#endif
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/test/channel_transport/channel_transport.h"
#include "webrtc/voice_engine/test/auto_test/voe_test_defines.h"
@ -64,7 +65,7 @@ int VoECpuTest::DoTest() {
CHECK(base->Init());
channel = base->CreateChannel();
rtc::scoped_ptr<VoiceChannelTransport> voice_socket_transport(
std::unique_ptr<VoiceChannelTransport> voice_socket_transport(
new VoiceChannelTransport(voe_network, channel));
CHECK(voice_socket_transport->SetSendDestination("127.0.0.1", 5566));

View File

@ -10,7 +10,6 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/random.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/system_wrappers/include/sleep.h"
#include "webrtc/test/channel_transport/channel_transport.h"

View File

@ -24,7 +24,6 @@
#include "webrtc/voice_engine/test/auto_test/voe_stress_test.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/system_wrappers/include/sleep.h"
#include "webrtc/test/channel_transport/channel_transport.h"
#include "webrtc/voice_engine/test/auto_test/voe_standard_test.h"
@ -144,7 +143,7 @@ int VoEStressTest::StartStopTest() {
printf("Test will take approximately %d minutes. \n",
numberOfLoops * loopSleep / 1000 / 60 + 1);
rtc::scoped_ptr<VoiceChannelTransport> voice_channel_transport(
std::unique_ptr<VoiceChannelTransport> voice_channel_transport(
new VoiceChannelTransport(voe_network, 0));
for (i = 0; i < numberOfLoops; ++i) {

View File

@ -11,8 +11,9 @@
#ifndef WEBRTC_VOICE_ENGINE_VOE_STRESS_TEST_H
#define WEBRTC_VOICE_ENGINE_VOE_STRESS_TEST_H
#include <memory>
#include "webrtc/base/platform_thread.h"
#include "webrtc/base/scoped_ptr.h"
namespace voetest {
@ -37,8 +38,8 @@ class VoEStressTest {
VoETestManager& _mgr;
// TODO(pbos): Remove scoped_ptr and use PlatformThread directly.
rtc::scoped_ptr<rtc::PlatformThread> _ptrExtraApiThread;
// TODO(pbos): Remove unique_ptr and use PlatformThread directly.
std::unique_ptr<rtc::PlatformThread> _ptrExtraApiThread;
};
} // namespace voetest

View File

@ -15,12 +15,12 @@
#include <unistd.h>
#endif
#include <memory>
#include <vector>
#include "gflags/gflags.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/format_macros.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/call/rtc_event_log.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
@ -142,7 +142,7 @@ int main(int argc, char** argv) {
MyObserver my_observer;
rtc::scoped_ptr<test::TraceToStderr> trace_to_stderr;
std::unique_ptr<test::TraceToStderr> trace_to_stderr;
if (!FLAGS_use_log_file) {
trace_to_stderr.reset(new test::TraceToStderr);
} else {

View File

@ -10,6 +10,8 @@
#include "webrtc/voice_engine/transmit_mixer.h"
#include <memory>
#include "webrtc/base/format_macros.h"
#include "webrtc/base/logging.h"
#include "webrtc/modules/utility/include/audio_frame_operations.h"
@ -1180,7 +1182,7 @@ int32_t TransmitMixer::RecordAudioToFile(
int32_t TransmitMixer::MixOrReplaceAudioWithFile(
int mixingFrequency)
{
rtc::scoped_ptr<int16_t[]> fileBuffer(new int16_t[640]);
std::unique_ptr<int16_t[]> fileBuffer(new int16_t[640]);
size_t fileSamples(0);
{

View File

@ -12,7 +12,6 @@
#define WEBRTC_VOICE_ENGINE_TRANSMIT_MIXER_H
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/common_audio/resampler/include/push_resampler.h"
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_processing/typing_detection.h"

View File

@ -8,10 +8,11 @@
* be found in the AUTHORS file in the root of the source tree.
*/
#include <memory>
#include "webrtc/voice_engine/include/voe_codec.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webrtc/base/scoped_ptr.h"
#include "webrtc/modules/audio_device/include/fake_audio_device.h"
#include "webrtc/voice_engine/include/voe_base.h"
#include "webrtc/voice_engine/include/voe_hardware.h"
@ -93,7 +94,7 @@ class VoECodecTest : public ::testing::Test {
int channel_;
CodecInst primary_;
CodecInst valid_secondary_;
rtc::scoped_ptr<FakeAudioDeviceModule> adm_;
std::unique_ptr<FakeAudioDeviceModule> adm_;
// A codec which is not valid to be registered as secondary codec.
CodecInst invalid_secondary_;

View File

@ -62,12 +62,12 @@ int VoiceEngineImpl::Release() {
return new_ref;
}
rtc::scoped_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy(
std::unique_ptr<voe::ChannelProxy> VoiceEngineImpl::GetChannelProxy(
int channel_id) {
RTC_DCHECK(channel_id >= 0);
rtc::CritScope cs(crit_sec());
RTC_DCHECK(statistics().Initialized());
return rtc::scoped_ptr<voe::ChannelProxy>(
return std::unique_ptr<voe::ChannelProxy>(
new voe::ChannelProxy(channel_manager().GetChannel(channel_id)));
}

View File

@ -11,7 +11,8 @@
#ifndef WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
#define WEBRTC_VOICE_ENGINE_VOICE_ENGINE_IMPL_H
#include "webrtc/base/scoped_ptr.h"
#include <memory>
#include "webrtc/engine_configurations.h"
#include "webrtc/system_wrappers/include/atomic32.h"
#include "webrtc/voice_engine/voe_base_impl.h"
@ -134,14 +135,14 @@ class VoiceEngineImpl : public voe::SharedData, // Must be the first base class
// Backdoor to access a voe::Channel object without a channel ID. This is only
// to be used while refactoring the VoE API!
virtual rtc::scoped_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
virtual std::unique_ptr<voe::ChannelProxy> GetChannelProxy(int channel_id);
// This is *protected* so that FakeVoiceEngine can inherit from the class and
// manipulate the reference count. See: fake_voice_engine.h.
protected:
Atomic32 _ref_count;
private:
rtc::scoped_ptr<const Config> own_config_;
std::unique_ptr<const Config> own_config_;
};
} // namespace webrtc