Replace rtc::Optional with absl::optional in test and rtc_tools
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script with parameters 'test rtc_tools'
find $@ -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+
find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"(../)*api:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;
git cl format
Bug: webrtc:9078
Change-Id: Ibb43c737f4c45fe300736382b0dd2d8ab32c6377
Reviewed-on: https://webrtc-review.googlesource.com/83944
Reviewed-by: Patrik Höglund <phoglund@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23642}
This commit is contained in:
committed by
Commit Bot
parent
9bf31584d1
commit
431abd989b
@ -63,7 +63,6 @@ rtc_source_set("video_test_common") {
|
||||
"..:webrtc_common",
|
||||
"../:typedefs",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_frame_i420",
|
||||
"../api/video_codecs:video_codecs_api",
|
||||
@ -75,6 +74,7 @@ rtc_source_set("video_test_common") {
|
||||
"../rtc_base:rtc_base",
|
||||
"../rtc_base:rtc_task_queue",
|
||||
"../system_wrappers",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -389,9 +389,9 @@ rtc_source_set("fileutils") {
|
||||
deps = [
|
||||
"..:webrtc_common",
|
||||
"../:typedefs",
|
||||
"../api:optional",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
if (is_ios) {
|
||||
deps += [ ":fileutils_objc" ]
|
||||
@ -453,10 +453,10 @@ rtc_source_set("fileutils_unittests") {
|
||||
deps = [
|
||||
":fileutils",
|
||||
":test_support",
|
||||
"../api:optional",
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//testing/gtest",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -323,7 +323,7 @@ void CallTest::CreateFrameGeneratorCapturerWithDrift(Clock* clock,
|
||||
int width,
|
||||
int height) {
|
||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
||||
width, height, rtc::nullopt, rtc::nullopt, framerate * speed, clock));
|
||||
width, height, absl::nullopt, absl::nullopt, framerate * speed, clock));
|
||||
video_send_stream_->SetSource(frame_generator_capturer_.get(),
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
}
|
||||
@ -332,7 +332,7 @@ void CallTest::CreateFrameGeneratorCapturer(int framerate,
|
||||
int width,
|
||||
int height) {
|
||||
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
|
||||
width, height, rtc::nullopt, rtc::nullopt, framerate, clock_));
|
||||
width, height, absl::nullopt, absl::nullopt, framerate, clock_));
|
||||
video_send_stream_->SetSource(frame_generator_capturer_.get(),
|
||||
DegradationPreference::MAINTAIN_FRAMERATE);
|
||||
}
|
||||
|
||||
@ -402,7 +402,7 @@ class ScrollingImageFrameGenerator : public FrameGenerator {
|
||||
|
||||
size_t current_frame_num_;
|
||||
VideoFrame* current_source_frame_;
|
||||
rtc::Optional<VideoFrame> current_frame_;
|
||||
absl::optional<VideoFrame> current_frame_;
|
||||
YuvFileGenerator file_generator_;
|
||||
};
|
||||
|
||||
@ -444,8 +444,8 @@ bool FrameForwarder::has_sinks() const {
|
||||
std::unique_ptr<FrameGenerator> FrameGenerator::CreateSquareGenerator(
|
||||
int width,
|
||||
int height,
|
||||
rtc::Optional<OutputType> type,
|
||||
rtc::Optional<int> num_squares) {
|
||||
absl::optional<OutputType> type,
|
||||
absl::optional<int> num_squares) {
|
||||
return std::unique_ptr<FrameGenerator>(
|
||||
new SquareGenerator(width, height, type.value_or(OutputType::I420),
|
||||
num_squares.value_or(10)));
|
||||
|
||||
@ -67,8 +67,8 @@ class FrameGenerator {
|
||||
static std::unique_ptr<FrameGenerator> CreateSquareGenerator(
|
||||
int width,
|
||||
int height,
|
||||
rtc::Optional<OutputType> type,
|
||||
rtc::Optional<int> num_squares);
|
||||
absl::optional<OutputType> type,
|
||||
absl::optional<int> num_squares);
|
||||
|
||||
// Creates a frame generator that repeatedly plays a set of yuv files.
|
||||
// The frame_repeat_count determines how many times each frame is shown,
|
||||
|
||||
@ -87,8 +87,8 @@ class FrameGeneratorCapturer::InsertFrameTask : public rtc::QueuedTask {
|
||||
FrameGeneratorCapturer* FrameGeneratorCapturer::Create(
|
||||
int width,
|
||||
int height,
|
||||
rtc::Optional<FrameGenerator::OutputType> type,
|
||||
rtc::Optional<int> num_squares,
|
||||
absl::optional<FrameGenerator::OutputType> type,
|
||||
absl::optional<int> num_squares,
|
||||
int target_fps,
|
||||
Clock* clock) {
|
||||
std::unique_ptr<FrameGeneratorCapturer> capturer(new FrameGeneratorCapturer(
|
||||
@ -187,7 +187,7 @@ void FrameGeneratorCapturer::InsertFrame() {
|
||||
}
|
||||
|
||||
if (sink_) {
|
||||
rtc::Optional<VideoFrame> out_frame = AdaptFrame(*frame);
|
||||
absl::optional<VideoFrame> out_frame = AdaptFrame(*frame);
|
||||
if (out_frame)
|
||||
sink_->OnFrame(*out_frame);
|
||||
}
|
||||
|
||||
@ -44,8 +44,8 @@ class FrameGeneratorCapturer : public VideoCapturer {
|
||||
static FrameGeneratorCapturer* Create(
|
||||
int width,
|
||||
int height,
|
||||
rtc::Optional<FrameGenerator::OutputType> type,
|
||||
rtc::Optional<int> num_squares,
|
||||
absl::optional<FrameGenerator::OutputType> type,
|
||||
absl::optional<int> num_squares,
|
||||
int target_fps,
|
||||
Clock* clock);
|
||||
|
||||
@ -98,7 +98,7 @@ class FrameGeneratorCapturer : public VideoCapturer {
|
||||
std::unique_ptr<FrameGenerator> frame_generator_;
|
||||
|
||||
int target_fps_ RTC_GUARDED_BY(&lock_);
|
||||
rtc::Optional<int> wanted_fps_ RTC_GUARDED_BY(&lock_);
|
||||
absl::optional<int> wanted_fps_ RTC_GUARDED_BY(&lock_);
|
||||
VideoRotation fake_rotation_ = kVideoRotation_0;
|
||||
|
||||
int64_t first_frame_capture_time_;
|
||||
|
||||
@ -260,11 +260,11 @@ rtc_static_library("audio_decoder_fuzzer") {
|
||||
deps = [
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:optional",
|
||||
"../../api/audio_codecs:audio_codecs_api",
|
||||
"../../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -454,11 +454,11 @@ rtc_static_library("audio_processing_fuzzer_helper") {
|
||||
]
|
||||
deps = [
|
||||
":fuzz_data_helper",
|
||||
"../../api:optional",
|
||||
"../../api/audio:audio_frame_api",
|
||||
"../../modules/audio_processing",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -12,8 +12,8 @@
|
||||
|
||||
#include <limits>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_decoder.h"
|
||||
#include "api/optional.h"
|
||||
#include "modules/rtp_rtcp/source/byte_io.h"
|
||||
#include "rtc_base/checks.h"
|
||||
|
||||
|
||||
@ -65,11 +65,11 @@ class FuzzRtpInput : public NetEqInput {
|
||||
FuzzHeader();
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> NextPacketTime() const override {
|
||||
absl::optional<int64_t> NextPacketTime() const override {
|
||||
return packet_->time_ms;
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> NextOutputEventTime() const override {
|
||||
absl::optional<int64_t> NextOutputEventTime() const override {
|
||||
return input_->NextOutputEventTime();
|
||||
}
|
||||
|
||||
@ -85,7 +85,7 @@ class FuzzRtpInput : public NetEqInput {
|
||||
|
||||
bool ended() const override { return ended_; }
|
||||
|
||||
rtc::Optional<RTPHeader> NextHeader() const override {
|
||||
absl::optional<RTPHeader> NextHeader() const override {
|
||||
RTC_DCHECK(packet_);
|
||||
return packet_->header;
|
||||
}
|
||||
|
||||
@ -88,11 +88,11 @@ class FuzzSignalInput : public NetEqInput {
|
||||
output_event_period_ms_ = fuzz_data_.SelectOneOf(output_event_periods);
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> NextPacketTime() const override {
|
||||
absl::optional<int64_t> NextPacketTime() const override {
|
||||
return packet_->time_ms;
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> NextOutputEventTime() const override {
|
||||
absl::optional<int64_t> NextOutputEventTime() const override {
|
||||
return next_output_event_ms_;
|
||||
}
|
||||
|
||||
@ -124,7 +124,7 @@ class FuzzSignalInput : public NetEqInput {
|
||||
|
||||
bool ended() const override { return ended_; }
|
||||
|
||||
rtc::Optional<RTPHeader> NextHeader() const override {
|
||||
absl::optional<RTPHeader> NextHeader() const override {
|
||||
RTC_DCHECK(packet_);
|
||||
return packet_->header;
|
||||
}
|
||||
|
||||
@ -28,14 +28,14 @@ class MockAudioDecoderFactory : public AudioDecoderFactory {
|
||||
MOCK_METHOD1(IsSupportedDecoder, bool(const SdpAudioFormat&));
|
||||
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||
const SdpAudioFormat& format,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||
std::unique_ptr<AudioDecoder> return_value;
|
||||
MakeAudioDecoderMock(format, codec_pair_id, &return_value);
|
||||
return return_value;
|
||||
}
|
||||
MOCK_METHOD3(MakeAudioDecoderMock,
|
||||
void(const SdpAudioFormat& format,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
std::unique_ptr<AudioDecoder>* return_value));
|
||||
|
||||
// Creates a MockAudioDecoderFactory with no formats and that may not be
|
||||
|
||||
@ -43,7 +43,7 @@ class MockAudioEncoder : public AudioEncoder {
|
||||
MOCK_METHOD1(SetMaxPayloadSize, void(int max_payload_size_bytes));
|
||||
MOCK_METHOD2(OnReceivedUplinkBandwidth,
|
||||
void(int target_audio_bitrate_bps,
|
||||
rtc::Optional<int64_t> probing_interval_ms));
|
||||
absl::optional<int64_t> probing_interval_ms));
|
||||
MOCK_METHOD1(OnReceivedUplinkPacketLossFraction,
|
||||
void(float uplink_packet_loss_fraction));
|
||||
|
||||
|
||||
@ -25,12 +25,12 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||
public:
|
||||
MOCK_METHOD0(GetSupportedEncoders, std::vector<AudioCodecSpec>());
|
||||
MOCK_METHOD1(QueryAudioEncoder,
|
||||
rtc::Optional<AudioCodecInfo>(const SdpAudioFormat& format));
|
||||
absl::optional<AudioCodecInfo>(const SdpAudioFormat& format));
|
||||
|
||||
std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||
int payload_type,
|
||||
const SdpAudioFormat& format,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
||||
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||
std::unique_ptr<AudioEncoder> return_value;
|
||||
MakeAudioEncoderMock(payload_type, format, codec_pair_id, &return_value);
|
||||
return return_value;
|
||||
@ -38,7 +38,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||
MOCK_METHOD4(MakeAudioEncoderMock,
|
||||
void(int payload_type,
|
||||
const SdpAudioFormat& format,
|
||||
rtc::Optional<AudioCodecPairId> codec_pair_id,
|
||||
absl::optional<AudioCodecPairId> codec_pair_id,
|
||||
std::unique_ptr<AudioEncoder>* return_value));
|
||||
|
||||
// Creates a MockAudioEncoderFactory with no formats and that may not be
|
||||
@ -55,7 +55,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||
ON_CALL(*factory.get(), GetSupportedEncoders())
|
||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
||||
.WillByDefault(Return(rtc::nullopt));
|
||||
.WillByDefault(Return(absl::nullopt));
|
||||
|
||||
EXPECT_CALL(*factory.get(), GetSupportedEncoders()).Times(AnyNumber());
|
||||
EXPECT_CALL(*factory.get(), QueryAudioEncoder(_)).Times(AnyNumber());
|
||||
@ -78,7 +78,7 @@ class MockAudioEncoderFactory : public testing::NiceMock<AudioEncoderFactory> {
|
||||
ON_CALL(*factory.get(), GetSupportedEncoders())
|
||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
||||
.WillByDefault(Return(rtc::nullopt));
|
||||
.WillByDefault(Return(absl::nullopt));
|
||||
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _, _))
|
||||
.WillByDefault(SetArgPointee<3>(nullptr));
|
||||
|
||||
|
||||
@ -223,9 +223,9 @@ std::string GenerateTempFilename(const std::string& dir,
|
||||
return filename;
|
||||
}
|
||||
|
||||
rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||
absl::optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||
if (path.length() == 0)
|
||||
return rtc::Optional<std::vector<std::string>>();
|
||||
return absl::optional<std::vector<std::string>>();
|
||||
|
||||
#if defined(WEBRTC_WIN)
|
||||
// Append separator character if needed.
|
||||
@ -236,7 +236,7 @@ rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||
WIN32_FIND_DATA data;
|
||||
HANDLE handle = ::FindFirstFile(rtc::ToUtf16(path + '*').c_str(), &data);
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
return rtc::Optional<std::vector<std::string>>();
|
||||
return absl::optional<std::vector<std::string>>();
|
||||
|
||||
// Populate output.
|
||||
std::vector<std::string> found_entries;
|
||||
@ -257,7 +257,7 @@ rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||
// Init.
|
||||
DIR* dir = ::opendir(path.c_str());
|
||||
if (dir == nullptr)
|
||||
return rtc::Optional<std::vector<std::string>>();
|
||||
return absl::optional<std::vector<std::string>>();
|
||||
|
||||
// Populate output.
|
||||
std::vector<std::string> found_entries;
|
||||
@ -271,7 +271,7 @@ rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path) {
|
||||
closedir(dir);
|
||||
#endif
|
||||
|
||||
return rtc::Optional<std::vector<std::string>>(std::move(found_entries));
|
||||
return absl::optional<std::vector<std::string>>(std::move(found_entries));
|
||||
}
|
||||
|
||||
bool CreateDir(const std::string& directory_name) {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace test {
|
||||
@ -81,7 +81,7 @@ std::string WorkingDir();
|
||||
// of strings with one element for each found file or directory. Each element is
|
||||
// a path created by prepending |dir| to the file/directory name. "." and ".."
|
||||
// are never added in the returned vector.
|
||||
rtc::Optional<std::vector<std::string>> ReadDirectory(std::string path);
|
||||
absl::optional<std::vector<std::string>> ReadDirectory(std::string path);
|
||||
|
||||
// Creates a directory if it not already exists.
|
||||
// Returns true if successful. Will print an error message to stderr and return
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -41,7 +41,7 @@ namespace {
|
||||
void CleanDir(const std::string& dir, size_t* num_deleted_entries) {
|
||||
RTC_DCHECK(num_deleted_entries);
|
||||
*num_deleted_entries = 0;
|
||||
rtc::Optional<std::vector<std::string>> dir_content = ReadDirectory(dir);
|
||||
absl::optional<std::vector<std::string>> dir_content = ReadDirectory(dir);
|
||||
EXPECT_TRUE(dir_content);
|
||||
for (const auto& entry : *dir_content) {
|
||||
if (DirExists(entry)) {
|
||||
@ -238,7 +238,7 @@ TEST_F(FileUtilsTest, WriteReadDeleteFilesAndDirs) {
|
||||
EXPECT_TRUE(DirExists(temp_subdir));
|
||||
|
||||
// Checks.
|
||||
rtc::Optional<std::vector<std::string>> dir_content =
|
||||
absl::optional<std::vector<std::string>> dir_content =
|
||||
ReadDirectory(temp_directory);
|
||||
EXPECT_TRUE(dir_content);
|
||||
EXPECT_EQ(2u, dir_content->size());
|
||||
|
||||
@ -108,7 +108,7 @@ VcmCapturer::~VcmCapturer() { Destroy(); }
|
||||
void VcmCapturer::OnFrame(const VideoFrame& frame) {
|
||||
rtc::CritScope lock(&crit_);
|
||||
if (started_ && sink_) {
|
||||
rtc::Optional<VideoFrame> out_frame = AdaptFrame(frame);
|
||||
absl::optional<VideoFrame> out_frame = AdaptFrame(frame);
|
||||
if (out_frame)
|
||||
sink_->OnFrame(*out_frame);
|
||||
}
|
||||
|
||||
@ -17,7 +17,7 @@ namespace test {
|
||||
VideoCapturer::VideoCapturer() : video_adapter_(new cricket::VideoAdapter()) {}
|
||||
VideoCapturer::~VideoCapturer() {}
|
||||
|
||||
rtc::Optional<VideoFrame> VideoCapturer::AdaptFrame(const VideoFrame& frame) {
|
||||
absl::optional<VideoFrame> VideoCapturer::AdaptFrame(const VideoFrame& frame) {
|
||||
int cropped_width = 0;
|
||||
int cropped_height = 0;
|
||||
int out_width = 0;
|
||||
@ -27,10 +27,10 @@ rtc::Optional<VideoFrame> VideoCapturer::AdaptFrame(const VideoFrame& frame) {
|
||||
frame.width(), frame.height(), frame.timestamp_us() * 1000,
|
||||
&cropped_width, &cropped_height, &out_width, &out_height)) {
|
||||
// Drop frame in order to respect frame rate constraint.
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
rtc::Optional<VideoFrame> out_frame;
|
||||
absl::optional<VideoFrame> out_frame;
|
||||
if (out_height != frame.height() || out_width != frame.width()) {
|
||||
// Video adapter has requested a down-scale. Allocate a new buffer and
|
||||
// return scaled version.
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "api/video/video_source_interface.h"
|
||||
@ -41,7 +41,7 @@ class VideoCapturer : public rtc::VideoSourceInterface<VideoFrame> {
|
||||
const rtc::VideoSinkWants& wants) override;
|
||||
|
||||
protected:
|
||||
rtc::Optional<VideoFrame> AdaptFrame(const VideoFrame& frame);
|
||||
absl::optional<VideoFrame> AdaptFrame(const VideoFrame& frame);
|
||||
rtc::VideoSinkWants GetSinkWants();
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user