Replace scoped_ptr with unique_ptr in webrtc/call/
BUG=webrtc:5520 Review URL: https://codereview.webrtc.org/1789903003 Cr-Commit-Position: refs/heads/master@{#11970}
This commit is contained in:
@ -11,12 +11,13 @@
|
||||
#ifndef WEBRTC_CALL_BITRATE_ALLOCATOR_H_
|
||||
#define WEBRTC_CALL_BITRATE_ALLOCATOR_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <utility>
|
||||
|
||||
#include "webrtc/base/criticalsection.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -41,7 +42,7 @@ class BitrateAllocatorTest : public ::testing::Test {
|
||||
}
|
||||
~BitrateAllocatorTest() {}
|
||||
|
||||
rtc::scoped_ptr<BitrateAllocator> allocator_;
|
||||
std::unique_ptr<BitrateAllocator> allocator_;
|
||||
};
|
||||
|
||||
TEST_F(BitrateAllocatorTest, UpdatingBitrateObserver) {
|
||||
@ -105,7 +106,7 @@ class BitrateAllocatorTestNoEnforceMin : public ::testing::Test {
|
||||
}
|
||||
~BitrateAllocatorTestNoEnforceMin() {}
|
||||
|
||||
rtc::scoped_ptr<BitrateAllocator> allocator_;
|
||||
std::unique_ptr<BitrateAllocator> allocator_;
|
||||
};
|
||||
|
||||
// The following three tests verify that the EnforceMinBitrate() method works
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
#include <functional>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -17,7 +18,6 @@
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/event.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
#include "webrtc/call.h"
|
||||
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
|
||||
@ -243,17 +243,17 @@ class BitrateEstimatorTest : public test::CallTest {
|
||||
VideoSendStream* send_stream_;
|
||||
AudioReceiveStream* audio_receive_stream_;
|
||||
VideoReceiveStream* video_receive_stream_;
|
||||
rtc::scoped_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
|
||||
std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_;
|
||||
test::FakeEncoder fake_encoder_;
|
||||
test::FakeDecoder fake_decoder_;
|
||||
};
|
||||
|
||||
testing::NiceMock<test::MockVoiceEngine> mock_voice_engine_;
|
||||
LogObserver receiver_log_;
|
||||
rtc::scoped_ptr<test::DirectTransport> send_transport_;
|
||||
rtc::scoped_ptr<test::DirectTransport> receive_transport_;
|
||||
rtc::scoped_ptr<Call> sender_call_;
|
||||
rtc::scoped_ptr<Call> receiver_call_;
|
||||
std::unique_ptr<test::DirectTransport> send_transport_;
|
||||
std::unique_ptr<test::DirectTransport> receive_transport_;
|
||||
std::unique_ptr<Call> sender_call_;
|
||||
std::unique_ptr<Call> receiver_call_;
|
||||
VideoReceiveStream::Config receive_config_;
|
||||
std::vector<Stream*> streams_;
|
||||
};
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/audio/audio_receive_stream.h"
|
||||
@ -19,7 +20,6 @@
|
||||
#include "webrtc/audio/scoped_voe_interface.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/logging.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
#include "webrtc/base/thread_checker.h"
|
||||
#include "webrtc/base/trace_event.h"
|
||||
@ -120,16 +120,16 @@ class Call : public webrtc::Call, public PacketReceiver,
|
||||
Clock* const clock_;
|
||||
|
||||
const int num_cpu_cores_;
|
||||
const rtc::scoped_ptr<ProcessThread> module_process_thread_;
|
||||
const rtc::scoped_ptr<ProcessThread> pacer_thread_;
|
||||
const rtc::scoped_ptr<CallStats> call_stats_;
|
||||
const rtc::scoped_ptr<BitrateAllocator> bitrate_allocator_;
|
||||
const std::unique_ptr<ProcessThread> module_process_thread_;
|
||||
const std::unique_ptr<ProcessThread> pacer_thread_;
|
||||
const std::unique_ptr<CallStats> call_stats_;
|
||||
const std::unique_ptr<BitrateAllocator> bitrate_allocator_;
|
||||
Call::Config config_;
|
||||
rtc::ThreadChecker configuration_thread_checker_;
|
||||
|
||||
bool network_enabled_;
|
||||
|
||||
rtc::scoped_ptr<RWLockWrapper> receive_crit_;
|
||||
std::unique_ptr<RWLockWrapper> receive_crit_;
|
||||
// Audio and Video receive streams are owned by the client that creates them.
|
||||
std::map<uint32_t, AudioReceiveStream*> audio_receive_ssrcs_
|
||||
GUARDED_BY(receive_crit_);
|
||||
@ -140,7 +140,7 @@ class Call : public webrtc::Call, public PacketReceiver,
|
||||
std::map<std::string, AudioReceiveStream*> sync_stream_mapping_
|
||||
GUARDED_BY(receive_crit_);
|
||||
|
||||
rtc::scoped_ptr<RWLockWrapper> send_crit_;
|
||||
std::unique_ptr<RWLockWrapper> send_crit_;
|
||||
// Audio and Video send streams are owned by the client that creates them.
|
||||
std::map<uint32_t, AudioSendStream*> audio_send_ssrcs_ GUARDED_BY(send_crit_);
|
||||
std::map<uint32_t, VideoSendStream*> video_send_ssrcs_ GUARDED_BY(send_crit_);
|
||||
@ -168,7 +168,7 @@ class Call : public webrtc::Call, public PacketReceiver,
|
||||
int64_t num_bitrate_updates_ GUARDED_BY(&bitrate_crit_);
|
||||
|
||||
VieRemb remb_;
|
||||
const rtc::scoped_ptr<CongestionController> congestion_controller_;
|
||||
const std::unique_ptr<CongestionController> congestion_controller_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(Call);
|
||||
};
|
||||
@ -183,8 +183,9 @@ namespace internal {
|
||||
Call::Call(const Call::Config& config)
|
||||
: clock_(Clock::GetRealTimeClock()),
|
||||
num_cpu_cores_(CpuInfo::DetectNumberOfCores()),
|
||||
module_process_thread_(ProcessThread::Create("ModuleProcessThread")),
|
||||
pacer_thread_(ProcessThread::Create("PacerThread")),
|
||||
module_process_thread_(
|
||||
rtc::ScopedToUnique(ProcessThread::Create("ModuleProcessThread"))),
|
||||
pacer_thread_(rtc::ScopedToUnique(ProcessThread::Create("PacerThread"))),
|
||||
call_stats_(new CallStats(clock_)),
|
||||
bitrate_allocator_(new BitrateAllocator()),
|
||||
config_(config),
|
||||
|
||||
@ -8,13 +8,13 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/thread_annotations.h"
|
||||
#include "webrtc/call.h"
|
||||
#include "webrtc/call/transport_adapter.h"
|
||||
@ -235,7 +235,7 @@ void CallPerfTest::TestAudioVideoSync(FecMode fec,
|
||||
private:
|
||||
int channel_;
|
||||
VoENetwork* voe_network_;
|
||||
rtc::scoped_ptr<RtpHeaderParser> parser_;
|
||||
std::unique_ptr<RtpHeaderParser> parser_;
|
||||
};
|
||||
|
||||
VoiceEngine* voice_engine = VoiceEngine::Create();
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
@ -31,7 +32,7 @@ struct CallHelper {
|
||||
|
||||
private:
|
||||
testing::NiceMock<webrtc::test::MockVoiceEngine> voice_engine_;
|
||||
rtc::scoped_ptr<webrtc::Call> call_;
|
||||
std::unique_ptr<webrtc::Call> call_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
||||
@ -8,6 +8,8 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
#include "webrtc/test/call_test.h"
|
||||
@ -29,7 +31,7 @@ class PacketInjectionTest : public test::CallTest {
|
||||
const uint8_t* packet,
|
||||
size_t length);
|
||||
|
||||
rtc::scoped_ptr<RtpHeaderParser> rtp_header_parser_;
|
||||
std::unique_ptr<RtpHeaderParser> rtp_header_parser_;
|
||||
};
|
||||
|
||||
void PacketInjectionTest::InjectIncorrectPacket(CodecType codec_type,
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "webrtc/base/event.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/call.h"
|
||||
#include "webrtc/test/call_test.h"
|
||||
|
||||
|
||||
@ -105,8 +105,8 @@ class RtcEventLogImpl final : public RtcEventLog {
|
||||
EXCLUSIVE_LOCKS_REQUIRED(crit_);
|
||||
|
||||
rtc::CriticalSection crit_;
|
||||
rtc::scoped_ptr<FileWrapper> file_ GUARDED_BY(crit_) =
|
||||
rtc::scoped_ptr<FileWrapper>(FileWrapper::Create());
|
||||
std::unique_ptr<FileWrapper> file_ GUARDED_BY(crit_) =
|
||||
std::unique_ptr<FileWrapper>(FileWrapper::Create());
|
||||
rtc::PlatformFile platform_file_ GUARDED_BY(crit_) =
|
||||
rtc::kInvalidPlatformFileValue;
|
||||
rtclog::EventStream stream_ GUARDED_BY(crit_);
|
||||
@ -501,7 +501,7 @@ bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
|
||||
rtclog::EventStream* result) {
|
||||
char tmp_buffer[1024];
|
||||
int bytes_read = 0;
|
||||
rtc::scoped_ptr<FileWrapper> dump_file(FileWrapper::Create());
|
||||
std::unique_ptr<FileWrapper> dump_file(FileWrapper::Create());
|
||||
if (dump_file->OpenFile(file_name.c_str(), true) != 0) {
|
||||
return false;
|
||||
}
|
||||
@ -516,8 +516,8 @@ bool RtcEventLog::ParseRtcEventLog(const std::string& file_name,
|
||||
#endif // ENABLE_RTC_EVENT_LOG
|
||||
|
||||
// RtcEventLog member functions.
|
||||
rtc::scoped_ptr<RtcEventLog> RtcEventLog::Create() {
|
||||
return rtc::scoped_ptr<RtcEventLog>(new RtcEventLogImpl());
|
||||
std::unique_ptr<RtcEventLog> RtcEventLog::Create() {
|
||||
return std::unique_ptr<RtcEventLog>(new RtcEventLogImpl());
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
@ -11,10 +11,10 @@
|
||||
#ifndef WEBRTC_CALL_RTC_EVENT_LOG_H_
|
||||
#define WEBRTC_CALL_RTC_EVENT_LOG_H_
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "webrtc/base/platform_file.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/video_receive_stream.h"
|
||||
#include "webrtc/video_send_stream.h"
|
||||
|
||||
@ -36,7 +36,7 @@ class RtcEventLog {
|
||||
public:
|
||||
virtual ~RtcEventLog() {}
|
||||
|
||||
static rtc::scoped_ptr<RtcEventLog> Create();
|
||||
static std::unique_ptr<RtcEventLog> Create();
|
||||
|
||||
// Sets the time that events are stored in the internal event buffer
|
||||
// before the user calls StartLogging. The default is 10 000 000 us = 10 s
|
||||
|
||||
@ -9,12 +9,12 @@
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "gflags/gflags.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/call/rtc_event_log.h"
|
||||
#include "webrtc/modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "webrtc/test/rtp_file_writer.h"
|
||||
@ -100,7 +100,7 @@ int main(int argc, char* argv[]) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
rtc::scoped_ptr<webrtc::test::RtpFileWriter> rtp_writer(
|
||||
std::unique_ptr<webrtc::test::RtpFileWriter> rtp_writer(
|
||||
webrtc::test::RtpFileWriter::Create(
|
||||
webrtc::test::RtpFileWriter::FileFormat::kRtpDump, output_file));
|
||||
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
|
||||
#ifdef ENABLE_RTC_EVENT_LOG
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
@ -18,7 +19,6 @@
|
||||
#include "webrtc/base/buffer.h"
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/random.h"
|
||||
#include "webrtc/base/scoped_ptr.h"
|
||||
#include "webrtc/base/thread.h"
|
||||
#include "webrtc/call.h"
|
||||
#include "webrtc/call/rtc_event_log.h"
|
||||
@ -473,7 +473,7 @@ void LogSessionAndReadBack(size_t rtp_count,
|
||||
// When log_dumper goes out of scope, it causes the log file to be flushed
|
||||
// to disk.
|
||||
{
|
||||
rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
|
||||
std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
|
||||
log_dumper->LogVideoReceiveStreamConfig(receiver_config);
|
||||
log_dumper->LogVideoSendStreamConfig(sender_config);
|
||||
size_t rtcp_index = 1;
|
||||
@ -639,7 +639,7 @@ void DropOldEvents(uint32_t extensions_bitvector,
|
||||
|
||||
// The log file will be flushed to disk when the log_dumper goes out of scope.
|
||||
{
|
||||
rtc::scoped_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
|
||||
std::unique_ptr<RtcEventLog> log_dumper(RtcEventLog::Create());
|
||||
// Reduce the time old events are stored to 50 ms.
|
||||
log_dumper->SetBufferDuration(50000);
|
||||
log_dumper->LogVideoReceiveStreamConfig(receiver_config);
|
||||
|
||||
@ -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_(rtc::ScopedToUnique(RtcEventLog::Create())) {}
|
||||
event_log_(RtcEventLog::Create()) {}
|
||||
|
||||
ChannelOwner ChannelManager::CreateChannel() {
|
||||
return CreateChannelInternal(config_);
|
||||
|
||||
Reference in New Issue
Block a user