Use std::make_unique instead of absl::make_unique.

WebRTC is now using C++14 so there is no need to use the Abseil version
of std::make_unique.

This CL has been created with the following steps:

git grep -l absl::make_unique | sort | uniq > /tmp/make_unique.txt
git grep -l absl::WrapUnique | sort | uniq > /tmp/wrap_unique.txt
git grep -l "#include <memory>" | sort | uniq > /tmp/memory.txt

diff --new-line-format="" --unchanged-line-format="" \
  /tmp/make_unique.txt /tmp/wrap_unique.txt | sort | \
  uniq > /tmp/only_make_unique.txt
diff --new-line-format="" --unchanged-line-format="" \
  /tmp/only_make_unique.txt /tmp/memory.txt | \
  xargs grep -l "absl/memory" > /tmp/add-memory.txt

git grep -l "\babsl::make_unique\b" | \
  xargs sed -i "s/\babsl::make_unique\b/std::make_unique/g"

git checkout PRESUBMIT.py abseil-in-webrtc.md

cat /tmp/add-memory.txt | \
  xargs sed -i \
  's/#include "absl\/memory\/memory.h"/#include <memory>/g'
git cl format
# Manual fix order of the new inserted #include <memory>

cat /tmp/only_make_unique | xargs grep -l "#include <memory>" | \
  xargs sed -i '/#include "absl\/memory\/memory.h"/d'

git ls-files | grep BUILD.gn | \
  xargs sed -i '/\/\/third_party\/abseil-cpp\/absl\/memory/d'

python tools_webrtc/gn_check_autofix.py \
  -m tryserver.webrtc -b linux_rel

# Repead the gn_check_autofix step for other platforms

git ls-files | grep BUILD.gn | \
  xargs sed -i 's/absl\/memory:memory/absl\/memory/g'
git cl format

Bug: webrtc:10945
Change-Id: I3fe28ea80f4dd3ba3cf28effd151d5e1f19aff89
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/153221
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29209}
This commit is contained in:
Mirko Bonadei
2019-09-17 17:06:18 +02:00
committed by Commit Bot
parent 809198edff
commit 317a1f09ed
477 changed files with 1796 additions and 2074 deletions

View File

@ -250,7 +250,6 @@ if (rtc_enable_protobuf) {
"../rtc_base:rtc_task_queue",
"../rtc_base:safe_minmax",
"../rtc_base/synchronization:sequence_checker",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -447,7 +447,7 @@ FixedLengthDeltaEncoder::FixedLengthDeltaEncoder(
: params_(params), base_(base), values_(values) {
RTC_DCHECK(!values_.empty());
writer_ =
absl::make_unique<BitWriter>(OutputLengthBytes(existent_values_count));
std::make_unique<BitWriter>(OutputLengthBytes(existent_values_count));
}
std::string FixedLengthDeltaEncoder::Encode() {
@ -723,7 +723,7 @@ std::unique_ptr<FixedLengthDeltaDecoder> FixedLengthDeltaDecoder::Create(
return nullptr;
}
auto reader = absl::make_unique<rtc::BitBuffer>(
auto reader = std::make_unique<rtc::BitBuffer>(
reinterpret_cast<const uint8_t*>(&input[0]), input.length());
// Encoding type

View File

@ -10,10 +10,10 @@
#include <deque>
#include <limits>
#include <memory>
#include <string>
#include <tuple>
#include "absl/memory/memory.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_legacy.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_new_format.h"
#include "logging/rtc_event_log/events/rtc_event_alr_state.h"
@ -55,9 +55,9 @@ class RtcEventLogEncoderTest
verifier_(new_encoding_ ? RtcEventLog::EncodingType::NewFormat
: RtcEventLog::EncodingType::Legacy) {
if (new_encoding_)
encoder_ = absl::make_unique<RtcEventLogEncoderNewFormat>();
encoder_ = std::make_unique<RtcEventLogEncoderNewFormat>();
else
encoder_ = absl::make_unique<RtcEventLogEncoderLegacy>();
encoder_ = std::make_unique<RtcEventLogEncoderLegacy>();
}
~RtcEventLogEncoderTest() override = default;
@ -244,11 +244,11 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationBitrate) {
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
if (i == 0 || !force_repeated_fields_) {
auto runtime_config = absl::make_unique<AudioEncoderRuntimeConfig>();
auto runtime_config = std::make_unique<AudioEncoderRuntimeConfig>();
const int bitrate_bps = rtc::checked_cast<int>(
prng_.Rand(0, std::numeric_limits<int32_t>::max()));
runtime_config->bitrate_bps = bitrate_bps;
events[i] = absl::make_unique<RtcEventAudioNetworkAdaptation>(
events[i] = std::make_unique<RtcEventAudioNetworkAdaptation>(
std::move(runtime_config));
} else {
events[i] = events[0]->Copy();
@ -262,10 +262,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationFrameLength) {
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
if (i == 0 || !force_repeated_fields_) {
auto runtime_config = absl::make_unique<AudioEncoderRuntimeConfig>();
auto runtime_config = std::make_unique<AudioEncoderRuntimeConfig>();
const int frame_length_ms = prng_.Rand(1, 1000);
runtime_config->frame_length_ms = frame_length_ms;
events[i] = absl::make_unique<RtcEventAudioNetworkAdaptation>(
events[i] = std::make_unique<RtcEventAudioNetworkAdaptation>(
std::move(runtime_config));
} else {
events[i] = events[0]->Copy();
@ -281,9 +281,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationPacketLoss) {
if (i == 0 || !force_repeated_fields_) {
// To simplify the test, we just check powers of two.
const float plr = std::pow(0.5f, prng_.Rand(1, 8));
auto runtime_config = absl::make_unique<AudioEncoderRuntimeConfig>();
auto runtime_config = std::make_unique<AudioEncoderRuntimeConfig>();
runtime_config->uplink_packet_loss_fraction = plr;
events[i] = absl::make_unique<RtcEventAudioNetworkAdaptation>(
events[i] = std::make_unique<RtcEventAudioNetworkAdaptation>(
std::move(runtime_config));
} else {
events[i] = events[0]->Copy();
@ -297,9 +297,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationFec) {
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
if (i == 0 || !force_repeated_fields_) {
auto runtime_config = absl::make_unique<AudioEncoderRuntimeConfig>();
auto runtime_config = std::make_unique<AudioEncoderRuntimeConfig>();
runtime_config->enable_fec = prng_.Rand<bool>();
events[i] = absl::make_unique<RtcEventAudioNetworkAdaptation>(
events[i] = std::make_unique<RtcEventAudioNetworkAdaptation>(
std::move(runtime_config));
} else {
events[i] = events[0]->Copy();
@ -313,9 +313,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationDtx) {
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
if (i == 0 || !force_repeated_fields_) {
auto runtime_config = absl::make_unique<AudioEncoderRuntimeConfig>();
auto runtime_config = std::make_unique<AudioEncoderRuntimeConfig>();
runtime_config->enable_dtx = prng_.Rand<bool>();
events[i] = absl::make_unique<RtcEventAudioNetworkAdaptation>(
events[i] = std::make_unique<RtcEventAudioNetworkAdaptation>(
std::move(runtime_config));
} else {
events[i] = events[0]->Copy();
@ -329,9 +329,9 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationChannels) {
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
if (i == 0 || !force_repeated_fields_) {
auto runtime_config = absl::make_unique<AudioEncoderRuntimeConfig>();
auto runtime_config = std::make_unique<AudioEncoderRuntimeConfig>();
runtime_config->num_channels = prng_.Rand(1, 2);
events[i] = absl::make_unique<RtcEventAudioNetworkAdaptation>(
events[i] = std::make_unique<RtcEventAudioNetworkAdaptation>(
std::move(runtime_config));
} else {
events[i] = events[0]->Copy();
@ -345,7 +345,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationAll) {
event_count_);
for (size_t i = 0; i < event_count_; ++i) {
if (i == 0 || !force_repeated_fields_) {
auto runtime_config = absl::make_unique<AudioEncoderRuntimeConfig>();
auto runtime_config = std::make_unique<AudioEncoderRuntimeConfig>();
runtime_config->bitrate_bps = rtc::checked_cast<int>(
prng_.Rand(0, std::numeric_limits<int32_t>::max()));
runtime_config->frame_length_ms = prng_.Rand(1, 1000);
@ -354,7 +354,7 @@ TEST_P(RtcEventLogEncoderTest, RtcEventAudioNetworkAdaptationAll) {
runtime_config->enable_fec = prng_.Rand<bool>();
runtime_config->enable_dtx = prng_.Rand<bool>();
runtime_config->num_channels = prng_.Rand(1, 2);
events[i] = absl::make_unique<RtcEventAudioNetworkAdaptation>(
events[i] = std::make_unique<RtcEventAudioNetworkAdaptation>(
std::move(runtime_config));
} else {
events[i] = events[0]->Copy();
@ -773,10 +773,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpReceiverReport) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -812,10 +812,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpSenderReport) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -851,10 +851,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpExtendedReports) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -890,10 +890,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpFir) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -928,10 +928,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpPli) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -966,10 +966,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpNack) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -1004,10 +1004,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpRemb) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -1043,10 +1043,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpTransportFeedback) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}
@ -1084,10 +1084,10 @@ TEST_P(RtcEventLogEncoderTest, RtcEventRtcpLossNotification) {
rtc::Buffer buffer = events[i].Build();
if (direction == kIncomingPacket) {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketIncoming>(buffer));
std::make_unique<RtcEventRtcpPacketIncoming>(buffer));
} else {
history_.push_back(
absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
std::make_unique<RtcEventRtcpPacketOutgoing>(buffer));
}
fake_clock.AdvanceTime(TimeDelta::ms(prng_.Rand(0, 1000)));
}

View File

@ -27,7 +27,7 @@ RtcEventAudioNetworkAdaptation::RtcEventAudioNetworkAdaptation(
RtcEventAudioNetworkAdaptation::RtcEventAudioNetworkAdaptation(
const RtcEventAudioNetworkAdaptation& other)
: RtcEvent(other.timestamp_us_),
config_(absl::make_unique<AudioEncoderRuntimeConfig>(*other.config_)) {}
config_(std::make_unique<AudioEncoderRuntimeConfig>(*other.config_)) {}
RtcEventAudioNetworkAdaptation::~RtcEventAudioNetworkAdaptation() = default;

View File

@ -27,7 +27,7 @@ RtcEventAudioReceiveStreamConfig::RtcEventAudioReceiveStreamConfig(
RtcEventAudioReceiveStreamConfig::RtcEventAudioReceiveStreamConfig(
const RtcEventAudioReceiveStreamConfig& other)
: RtcEvent(other.timestamp_us_),
config_(absl::make_unique<rtclog::StreamConfig>(*other.config_)) {}
config_(std::make_unique<rtclog::StreamConfig>(*other.config_)) {}
RtcEventAudioReceiveStreamConfig::~RtcEventAudioReceiveStreamConfig() = default;

View File

@ -27,7 +27,7 @@ RtcEventAudioSendStreamConfig::RtcEventAudioSendStreamConfig(
RtcEventAudioSendStreamConfig::RtcEventAudioSendStreamConfig(
const RtcEventAudioSendStreamConfig& other)
: RtcEvent(other.timestamp_us_),
config_(absl::make_unique<rtclog::StreamConfig>(*other.config_)) {}
config_(std::make_unique<rtclog::StreamConfig>(*other.config_)) {}
RtcEventAudioSendStreamConfig::~RtcEventAudioSendStreamConfig() = default;

View File

@ -26,7 +26,7 @@ RtcEventVideoReceiveStreamConfig::RtcEventVideoReceiveStreamConfig(
RtcEventVideoReceiveStreamConfig::RtcEventVideoReceiveStreamConfig(
const RtcEventVideoReceiveStreamConfig& other)
: RtcEvent(other.timestamp_us_),
config_(absl::make_unique<rtclog::StreamConfig>(*other.config_)) {}
config_(std::make_unique<rtclog::StreamConfig>(*other.config_)) {}
RtcEventVideoReceiveStreamConfig::~RtcEventVideoReceiveStreamConfig() = default;

View File

@ -23,7 +23,7 @@ RtcEventVideoSendStreamConfig::RtcEventVideoSendStreamConfig(
RtcEventVideoSendStreamConfig::RtcEventVideoSendStreamConfig(
const RtcEventVideoSendStreamConfig& other)
: RtcEvent(other.timestamp_us_),
config_(absl::make_unique<rtclog::StreamConfig>(*other.config_)) {}
config_(std::make_unique<rtclog::StreamConfig>(*other.config_)) {}
RtcEventVideoSendStreamConfig::~RtcEventVideoSendStreamConfig() = default;

View File

@ -10,7 +10,8 @@
#include "logging/rtc_event_log/ice_logger.h"
#include "absl/memory/memory.h"
#include <memory>
#include "api/rtc_event_log/rtc_event_log.h"
namespace webrtc {
@ -26,7 +27,7 @@ void IceEventLog::LogCandidatePairConfig(
return;
}
candidate_pair_desc_by_id_[candidate_pair_id] = candidate_pair_desc;
event_log_->Log(absl::make_unique<RtcEventIceCandidatePairConfig>(
event_log_->Log(std::make_unique<RtcEventIceCandidatePairConfig>(
type, candidate_pair_id, candidate_pair_desc));
}
@ -36,13 +37,13 @@ void IceEventLog::LogCandidatePairEvent(IceCandidatePairEventType type,
if (event_log_ == nullptr) {
return;
}
event_log_->Log(absl::make_unique<RtcEventIceCandidatePair>(
event_log_->Log(std::make_unique<RtcEventIceCandidatePair>(
type, candidate_pair_id, transaction_id));
}
void IceEventLog::DumpCandidatePairDescriptionToMemoryAsConfigEvents() const {
for (const auto& desc_id_pair : candidate_pair_desc_by_id_) {
event_log_->Log(absl::make_unique<RtcEventIceCandidatePairConfig>(
event_log_->Log(std::make_unique<RtcEventIceCandidatePairConfig>(
IceCandidatePairConfigType::kUpdated, desc_id_pair.first,
desc_id_pair.second));
}

View File

@ -12,10 +12,10 @@
#include <functional>
#include <limits>
#include <memory>
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "absl/types/optional.h"
#include "api/task_queue/queued_task.h"
#include "api/task_queue/task_queue_base.h"
@ -61,10 +61,10 @@ std::unique_ptr<RtcEventLogEncoder> CreateEncoder(
switch (type) {
case RtcEventLog::EncodingType::Legacy:
RTC_LOG(LS_INFO) << "Creating legacy encoder for RTC event log.";
return absl::make_unique<RtcEventLogEncoderLegacy>();
return std::make_unique<RtcEventLogEncoderLegacy>();
case RtcEventLog::EncodingType::NewFormat:
RTC_LOG(LS_INFO) << "Creating new format encoder for RTC event log.";
return absl::make_unique<RtcEventLogEncoderNewFormat>();
return std::make_unique<RtcEventLogEncoderNewFormat>();
default:
RTC_LOG(LS_ERROR) << "Unknown RtcEventLog encoder type (" << int(type)
<< ")";
@ -82,7 +82,7 @@ RtcEventLogImpl::RtcEventLogImpl(RtcEventLog::EncodingType encoding_type,
output_scheduled_(false),
logging_state_started_(false),
task_queue_(
absl::make_unique<rtc::TaskQueue>(task_queue_factory->CreateTaskQueue(
std::make_unique<rtc::TaskQueue>(task_queue_factory->CreateTaskQueue(
"rtc_event_log",
TaskQueueFactory::Priority::NORMAL))) {}
@ -128,9 +128,8 @@ bool RtcEventLogImpl::StartLogging(std::unique_ptr<RtcEventLogOutput> output,
RTC_DCHECK_RUN_ON(&logging_state_checker_);
logging_state_started_ = true;
task_queue_->PostTask(
absl::make_unique<ResourceOwningTask<RtcEventLogOutput>>(
std::move(output), start));
task_queue_->PostTask(std::make_unique<ResourceOwningTask<RtcEventLogOutput>>(
std::move(output), start));
return true;
}
@ -176,7 +175,7 @@ void RtcEventLogImpl::Log(std::unique_ptr<RtcEvent> event) {
ScheduleOutput();
};
task_queue_->PostTask(absl::make_unique<ResourceOwningTask<RtcEvent>>(
task_queue_->PostTask(std::make_unique<ResourceOwningTask<RtcEvent>>(
std::move(event), event_handler));
}

View File

@ -17,7 +17,6 @@
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "api/rtc_event_log/rtc_event_log.h"
#include "api/rtc_event_log/rtc_event_log_factory.h"
#include "api/rtc_event_log_output_file.h"
@ -331,7 +330,7 @@ void RtcEventLogSession::WriteLog(EventCounts count,
if (remaining_events == remaining_events_at_start) {
clock_.AdvanceTime(TimeDelta::ms(prng_.Rand(20)));
event_log->StartLogging(
absl::make_unique<RtcEventLogOutputFile>(temp_filename_, 10000000),
std::make_unique<RtcEventLogOutputFile>(temp_filename_, 10000000),
output_period_ms_);
start_time_us_ = rtc::TimeMicros();
utc_start_time_us_ = rtc::TimeUTCMicros();
@ -843,7 +842,7 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
const std::string temp_filename = test::OutputPath() + test_name;
std::unique_ptr<rtc::ScopedFakeClock> fake_clock =
absl::make_unique<rtc::ScopedFakeClock>();
std::make_unique<rtc::ScopedFakeClock>();
fake_clock->SetTime(Timestamp::seconds(kStartTimeSeconds));
auto task_queue_factory = CreateDefaultTaskQueueFactory();
@ -860,14 +859,14 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
// simplicity.
// We base the various values on the index. We use this for some basic
// consistency checks when we read back.
log_dumper->Log(absl::make_unique<RtcEventProbeResultSuccess>(
log_dumper->Log(std::make_unique<RtcEventProbeResultSuccess>(
i, kStartBitrate + i * 1000));
fake_clock->AdvanceTime(TimeDelta::ms(10));
}
int64_t start_time_us = rtc::TimeMicros();
int64_t utc_start_time_us = rtc::TimeUTCMicros();
log_dumper->StartLogging(
absl::make_unique<RtcEventLogOutputFile>(temp_filename, 10000000),
std::make_unique<RtcEventLogOutputFile>(temp_filename, 10000000),
RtcEventLog::kImmediateOutput);
fake_clock->AdvanceTime(TimeDelta::ms(10));
int64_t stop_time_us = rtc::TimeMicros();
@ -901,7 +900,7 @@ TEST_P(RtcEventLogCircularBufferTest, KeepsMostRecentEvents) {
// recreate the clock. However we must ensure that the old fake_clock is
// destroyed before the new one is created, so we have to reset() first.
fake_clock.reset();
fake_clock = absl::make_unique<rtc::ScopedFakeClock>();
fake_clock = std::make_unique<rtc::ScopedFakeClock>();
fake_clock->SetTime(Timestamp::us(first_timestamp_us));
for (size_t i = 1; i < probe_success_events.size(); i++) {
fake_clock->AdvanceTime(TimeDelta::ms(10));

View File

@ -21,7 +21,6 @@
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/rtp_headers.h"
@ -90,18 +89,18 @@ absl::optional<int> GetExtensionId(const std::vector<RtpExtension>& extensions,
} // namespace
std::unique_ptr<RtcEventAlrState> EventGenerator::NewAlrState() {
return absl::make_unique<RtcEventAlrState>(prng_.Rand<bool>());
return std::make_unique<RtcEventAlrState>(prng_.Rand<bool>());
}
std::unique_ptr<RtcEventAudioPlayout> EventGenerator::NewAudioPlayout(
uint32_t ssrc) {
return absl::make_unique<RtcEventAudioPlayout>(ssrc);
return std::make_unique<RtcEventAudioPlayout>(ssrc);
}
std::unique_ptr<RtcEventAudioNetworkAdaptation>
EventGenerator::NewAudioNetworkAdaptation() {
std::unique_ptr<AudioEncoderRuntimeConfig> config =
absl::make_unique<AudioEncoderRuntimeConfig>();
std::make_unique<AudioEncoderRuntimeConfig>();
config->bitrate_bps = prng_.Rand(0, 3000000);
config->enable_fec = prng_.Rand<bool>();
@ -110,7 +109,7 @@ EventGenerator::NewAudioNetworkAdaptation() {
config->num_channels = prng_.Rand(1, 2);
config->uplink_packet_loss_fraction = prng_.Rand<float>();
return absl::make_unique<RtcEventAudioNetworkAdaptation>(std::move(config));
return std::make_unique<RtcEventAudioNetworkAdaptation>(std::move(config));
}
std::unique_ptr<RtcEventBweUpdateDelayBased>
@ -119,7 +118,7 @@ EventGenerator::NewBweUpdateDelayBased() {
int32_t bitrate_bps = prng_.Rand(0, kMaxBweBps);
BandwidthUsage state = static_cast<BandwidthUsage>(
prng_.Rand(static_cast<uint32_t>(BandwidthUsage::kLast) - 1));
return absl::make_unique<RtcEventBweUpdateDelayBased>(bitrate_bps, state);
return std::make_unique<RtcEventBweUpdateDelayBased>(bitrate_bps, state);
}
std::unique_ptr<RtcEventBweUpdateLossBased>
@ -130,7 +129,7 @@ EventGenerator::NewBweUpdateLossBased() {
uint8_t fraction_lost = prng_.Rand<uint8_t>();
int32_t total_packets = prng_.Rand(1, kMaxPackets);
return absl::make_unique<RtcEventBweUpdateLossBased>(
return std::make_unique<RtcEventBweUpdateLossBased>(
bitrate_bps, fraction_lost, total_packets);
}
@ -139,13 +138,13 @@ EventGenerator::NewDtlsTransportState() {
DtlsTransportState state = static_cast<DtlsTransportState>(
prng_.Rand(static_cast<uint32_t>(DtlsTransportState::kNumValues) - 1));
return absl::make_unique<RtcEventDtlsTransportState>(state);
return std::make_unique<RtcEventDtlsTransportState>(state);
}
std::unique_ptr<RtcEventDtlsWritableState>
EventGenerator::NewDtlsWritableState() {
bool writable = prng_.Rand<bool>();
return absl::make_unique<RtcEventDtlsWritableState>(writable);
return std::make_unique<RtcEventDtlsWritableState>(writable);
}
std::unique_ptr<RtcEventProbeClusterCreated>
@ -157,8 +156,8 @@ EventGenerator::NewProbeClusterCreated() {
int min_probes = prng_.Rand(5, 50);
int min_bytes = prng_.Rand(500, 50000);
return absl::make_unique<RtcEventProbeClusterCreated>(id, bitrate_bps,
min_probes, min_bytes);
return std::make_unique<RtcEventProbeClusterCreated>(id, bitrate_bps,
min_probes, min_bytes);
}
std::unique_ptr<RtcEventProbeResultFailure>
@ -168,7 +167,7 @@ EventGenerator::NewProbeResultFailure() {
ProbeFailureReason reason = static_cast<ProbeFailureReason>(
prng_.Rand(static_cast<uint32_t>(ProbeFailureReason::kLast) - 1));
return absl::make_unique<RtcEventProbeResultFailure>(id, reason);
return std::make_unique<RtcEventProbeResultFailure>(id, reason);
}
std::unique_ptr<RtcEventProbeResultSuccess>
@ -178,7 +177,7 @@ EventGenerator::NewProbeResultSuccess() {
int id = prng_.Rand(1, kMaxNumProbes);
int bitrate_bps = prng_.Rand(0, kMaxBweBps);
return absl::make_unique<RtcEventProbeResultSuccess>(id, bitrate_bps);
return std::make_unique<RtcEventProbeResultSuccess>(id, bitrate_bps);
}
std::unique_ptr<RtcEventIceCandidatePairConfig>
@ -215,7 +214,7 @@ EventGenerator::NewIceCandidatePairConfig() {
static_cast<IceCandidatePairConfigType>(prng_.Rand(
static_cast<uint32_t>(IceCandidatePairConfigType::kNumValues) - 1));
uint32_t pair_id = prng_.Rand<uint32_t>();
return absl::make_unique<RtcEventIceCandidatePairConfig>(type, pair_id, desc);
return std::make_unique<RtcEventIceCandidatePairConfig>(type, pair_id, desc);
}
std::unique_ptr<RtcEventIceCandidatePair>
@ -226,8 +225,8 @@ EventGenerator::NewIceCandidatePair() {
uint32_t pair_id = prng_.Rand<uint32_t>();
uint32_t transaction_id = prng_.Rand<uint32_t>();
return absl::make_unique<RtcEventIceCandidatePair>(type, pair_id,
transaction_id);
return std::make_unique<RtcEventIceCandidatePair>(type, pair_id,
transaction_id);
}
rtcp::ReportBlock EventGenerator::NewReportBlock() {
@ -352,8 +351,8 @@ rtcp::LossNotification EventGenerator::NewLossNotification() {
}
std::unique_ptr<RtcEventRouteChange> EventGenerator::NewRouteChange() {
return absl::make_unique<RtcEventRouteChange>(prng_.Rand<bool>(),
prng_.Rand(0, 128));
return std::make_unique<RtcEventRouteChange>(prng_.Rand<bool>(),
prng_.Rand(0, 128));
}
std::unique_ptr<RtcEventRtcpPacketIncoming>
@ -375,47 +374,47 @@ EventGenerator::NewRtcpPacketIncoming() {
case SupportedRtcpTypes::kSenderReport: {
rtcp::SenderReport sender_report = NewSenderReport();
rtc::Buffer buffer = sender_report.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
case SupportedRtcpTypes::kReceiverReport: {
rtcp::ReceiverReport receiver_report = NewReceiverReport();
rtc::Buffer buffer = receiver_report.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
case SupportedRtcpTypes::kExtendedReports: {
rtcp::ExtendedReports extended_report = NewExtendedReports();
rtc::Buffer buffer = extended_report.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
case SupportedRtcpTypes::kFir: {
rtcp::Fir fir = NewFir();
rtc::Buffer buffer = fir.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
case SupportedRtcpTypes::kPli: {
rtcp::Pli pli = NewPli();
rtc::Buffer buffer = pli.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
case SupportedRtcpTypes::kNack: {
rtcp::Nack nack = NewNack();
rtc::Buffer buffer = nack.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
case SupportedRtcpTypes::kRemb: {
rtcp::Remb remb = NewRemb();
rtc::Buffer buffer = remb.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
case SupportedRtcpTypes::kTransportFeedback: {
rtcp::TransportFeedback transport_feedback = NewTransportFeedback();
rtc::Buffer buffer = transport_feedback.Build();
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
default:
RTC_NOTREACHED();
rtc::Buffer buffer;
return absl::make_unique<RtcEventRtcpPacketIncoming>(buffer);
return std::make_unique<RtcEventRtcpPacketIncoming>(buffer);
}
}
@ -438,59 +437,59 @@ EventGenerator::NewRtcpPacketOutgoing() {
case SupportedRtcpTypes::kSenderReport: {
rtcp::SenderReport sender_report = NewSenderReport();
rtc::Buffer buffer = sender_report.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
case SupportedRtcpTypes::kReceiverReport: {
rtcp::ReceiverReport receiver_report = NewReceiverReport();
rtc::Buffer buffer = receiver_report.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
case SupportedRtcpTypes::kExtendedReports: {
rtcp::ExtendedReports extended_report = NewExtendedReports();
rtc::Buffer buffer = extended_report.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
case SupportedRtcpTypes::kFir: {
rtcp::Fir fir = NewFir();
rtc::Buffer buffer = fir.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
case SupportedRtcpTypes::kPli: {
rtcp::Pli pli = NewPli();
rtc::Buffer buffer = pli.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
case SupportedRtcpTypes::kNack: {
rtcp::Nack nack = NewNack();
rtc::Buffer buffer = nack.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
case SupportedRtcpTypes::kRemb: {
rtcp::Remb remb = NewRemb();
rtc::Buffer buffer = remb.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
case SupportedRtcpTypes::kTransportFeedback: {
rtcp::TransportFeedback transport_feedback = NewTransportFeedback();
rtc::Buffer buffer = transport_feedback.Build();
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
default:
RTC_NOTREACHED();
rtc::Buffer buffer;
return absl::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
return std::make_unique<RtcEventRtcpPacketOutgoing>(buffer);
}
}
std::unique_ptr<RtcEventGenericPacketSent>
EventGenerator::NewGenericPacketSent() {
return absl::make_unique<RtcEventGenericPacketSent>(
return std::make_unique<RtcEventGenericPacketSent>(
sent_packet_number_++, prng_.Rand(40, 50), prng_.Rand(0, 150),
prng_.Rand(0, 1000));
}
std::unique_ptr<RtcEventGenericPacketReceived>
EventGenerator::NewGenericPacketReceived() {
return absl::make_unique<RtcEventGenericPacketReceived>(
return std::make_unique<RtcEventGenericPacketReceived>(
received_packet_number_++, prng_.Rand(40, 250));
}
std::unique_ptr<RtcEventGenericAckReceived>
@ -586,7 +585,7 @@ std::unique_ptr<RtcEventRtpPacketIncoming> EventGenerator::NewRtpPacketIncoming(
RandomizeRtpPacket(payload_size, padding_size, ssrc, extension_map,
&rtp_packet, all_configured_exts);
return absl::make_unique<RtcEventRtpPacketIncoming>(rtp_packet);
return std::make_unique<RtcEventRtpPacketIncoming>(rtp_packet);
}
std::unique_ptr<RtcEventRtpPacketOutgoing> EventGenerator::NewRtpPacketOutgoing(
@ -617,8 +616,8 @@ std::unique_ptr<RtcEventRtpPacketOutgoing> EventGenerator::NewRtpPacketOutgoing(
&rtp_packet, all_configured_exts);
int probe_cluster_id = prng_.Rand(0, 100000);
return absl::make_unique<RtcEventRtpPacketOutgoing>(rtp_packet,
probe_cluster_id);
return std::make_unique<RtcEventRtpPacketOutgoing>(rtp_packet,
probe_cluster_id);
}
RtpHeaderExtensionMap EventGenerator::NewRtpHeaderExtensionMap(
@ -652,7 +651,7 @@ std::unique_ptr<RtcEventAudioReceiveStreamConfig>
EventGenerator::NewAudioReceiveStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions) {
auto config = absl::make_unique<rtclog::StreamConfig>();
auto config = std::make_unique<rtclog::StreamConfig>();
// Add SSRCs for the stream.
config->remote_ssrc = ssrc;
config->local_ssrc = prng_.Rand<uint32_t>();
@ -664,14 +663,14 @@ EventGenerator::NewAudioReceiveStreamConfig(
}
}
return absl::make_unique<RtcEventAudioReceiveStreamConfig>(std::move(config));
return std::make_unique<RtcEventAudioReceiveStreamConfig>(std::move(config));
}
std::unique_ptr<RtcEventAudioSendStreamConfig>
EventGenerator::NewAudioSendStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions) {
auto config = absl::make_unique<rtclog::StreamConfig>();
auto config = std::make_unique<rtclog::StreamConfig>();
// Add SSRC to the stream.
config->local_ssrc = ssrc;
// Add header extensions.
@ -681,14 +680,14 @@ EventGenerator::NewAudioSendStreamConfig(
config->rtp_extensions.emplace_back(kExtensions[i].name, id);
}
}
return absl::make_unique<RtcEventAudioSendStreamConfig>(std::move(config));
return std::make_unique<RtcEventAudioSendStreamConfig>(std::move(config));
}
std::unique_ptr<RtcEventVideoReceiveStreamConfig>
EventGenerator::NewVideoReceiveStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions) {
auto config = absl::make_unique<rtclog::StreamConfig>();
auto config = std::make_unique<rtclog::StreamConfig>();
// Add SSRCs for the stream.
config->remote_ssrc = ssrc;
@ -707,14 +706,14 @@ EventGenerator::NewVideoReceiveStreamConfig(
config->rtp_extensions.emplace_back(kExtensions[i].name, id);
}
}
return absl::make_unique<RtcEventVideoReceiveStreamConfig>(std::move(config));
return std::make_unique<RtcEventVideoReceiveStreamConfig>(std::move(config));
}
std::unique_ptr<RtcEventVideoSendStreamConfig>
EventGenerator::NewVideoSendStreamConfig(
uint32_t ssrc,
const RtpHeaderExtensionMap& extensions) {
auto config = absl::make_unique<rtclog::StreamConfig>();
auto config = std::make_unique<rtclog::StreamConfig>();
config->codecs.emplace_back(prng_.Rand<bool>() ? "VP8" : "H264",
prng_.Rand(127), prng_.Rand(127));
@ -727,7 +726,7 @@ EventGenerator::NewVideoSendStreamConfig(
config->rtp_extensions.emplace_back(kExtensions[i].name, id);
}
}
return absl::make_unique<RtcEventVideoSendStreamConfig>(std::move(config));
return std::make_unique<RtcEventVideoSendStreamConfig>(std::move(config));
}
void EventVerifier::VerifyLoggedAlrStateEvent(

View File

@ -18,7 +18,6 @@
#include <utility>
#include <vector>
#include "absl/memory/memory.h"
#include "api/function_view.h"
#include "rtc_base/checks.h"
@ -109,7 +108,7 @@ class RtcEventProcessor {
if (iterable.begin() == iterable.end())
return;
event_lists_.push_back(
absl::make_unique<event_processor_impl::ProcessableEventList<
std::make_unique<event_processor_impl::ProcessableEventList<
typename Iterable::const_iterator, typename Iterable::value_type>>(
iterable.begin(), iterable.end(), handler,
insertion_order_index_++));