Replace rtc::Optional with absl::optional in audio, call and video
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script with parameters 'audio call video':
#!/bin/bash
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: I02c5db956846a88a268a300ba086703a02d62e36
Reviewed-on: https://webrtc-review.googlesource.com/83722
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23628}
diff --git a/video/BUILD.gn b/video/BUILD.gn
index f56a71d..df50d90 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -62,7 +62,6 @@
"../:typedefs",
"../api:fec_controller_api",
"../api:libjingle_peerconnection_api",
- "../api:optional",
"../api:transport_api",
"../api/video:video_frame",
"../api/video:video_frame_i420",
@@ -84,6 +83,7 @@
"../rtc_base/system:fallthrough",
"../system_wrappers:field_trial_api",
"../system_wrappers:metrics_api",
+ "//third_party/abseil-cpp/absl/types:optional",
# For RtxReceiveStream.
"../call:rtp_receiver",
@@ -121,7 +121,6 @@
]
deps = [
- "../api:optional",
"../api/video:encoded_frame",
"../api/video:video_frame",
"../api/video:video_stream_decoder",
@@ -130,6 +129,7 @@
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue_api",
"../system_wrappers:system_wrappers",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -364,7 +364,6 @@
deps = [
":video",
":video_mocks",
- "../api:optional",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../api/video_codecs:video_codecs_api",
@@ -417,6 +416,7 @@
"../test:test_support",
"../test:video_test_common",
"//testing/gtest",
+ "//third_party/abseil-cpp/absl/types:optional",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
diff --git a/video/end_to_end_tests/call_operation_tests.cc b/video/end_to_end_tests/call_operation_tests.cc
index ed06aa8..2c45665 100644
--- a/video/end_to_end_tests/call_operation_tests.cc
+++ b/video/end_to_end_tests/call_operation_tests.cc
@@ -134,7 +134,7 @@
// to check that the callbacks are done after processing video.
std::unique_ptr<test::FrameGenerator> frame_generator(
test::FrameGenerator::CreateSquareGenerator(
- kWidth, kHeight, rtc::nullopt, rtc::nullopt));
+ kWidth, kHeight, absl::nullopt, absl::nullopt));
video_send_stream_->SetSource(&frame_forwarder,
DegradationPreference::MAINTAIN_FRAMERATE);
@@ -190,7 +190,7 @@
Start();
frame_generator = test::FrameGenerator::CreateSquareGenerator(
- kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
+ kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
video_send_stream_->SetSource(&frame_forwarder,
DegradationPreference::MAINTAIN_FRAMERATE);
frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
@@ -268,7 +268,7 @@
Start();
frame_generator = test::FrameGenerator::CreateSquareGenerator(
- kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
+ kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
video_send_stream_->SetSource(&forwarder,
DegradationPreference::MAINTAIN_FRAMERATE);
forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
diff --git a/video/end_to_end_tests/histogram_tests.cc b/video/end_to_end_tests/histogram_tests.cc
index c3a86b4..04255a8 100644
--- a/video/end_to_end_tests/histogram_tests.cc
+++ b/video/end_to_end_tests/histogram_tests.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/metrics_default.h"
@@ -123,7 +123,7 @@
const bool use_fec_;
const bool screenshare_;
test::FunctionVideoEncoderFactory encoder_factory_;
- rtc::Optional<int64_t> start_runtime_ms_;
+ absl::optional<int64_t> start_runtime_ms_;
int num_frames_received_ RTC_GUARDED_BY(&crit_);
} test(use_rtx, use_fec, screenshare);
diff --git a/video/end_to_end_tests/multi_codec_receive_tests.cc b/video/end_to_end_tests/multi_codec_receive_tests.cc
index 5afb147..ffbf8fb 100644
--- a/video/end_to_end_tests/multi_codec_receive_tests.cc
+++ b/video/end_to_end_tests/multi_codec_receive_tests.cc
@@ -132,8 +132,8 @@
}
rtc::CriticalSection crit_;
- rtc::Optional<uint32_t> last_timestamp_;
- rtc::Optional<uint8_t> last_payload_type_;
+ absl::optional<uint32_t> last_timestamp_;
+ absl::optional<uint8_t> last_payload_type_;
int num_sent_frames_ RTC_GUARDED_BY(crit_) = 0;
int num_rendered_frames_ RTC_GUARDED_BY(crit_) = 0;
std::vector<uint32_t> sent_timestamps_ RTC_GUARDED_BY(crit_);
diff --git a/video/end_to_end_tests/multi_stream_tester.cc b/video/end_to_end_tests/multi_stream_tester.cc
index 4ed3af6..92fa938 100644
--- a/video/end_to_end_tests/multi_stream_tester.cc
+++ b/video/end_to_end_tests/multi_stream_tester.cc
@@ -99,7 +99,7 @@
receive_streams[i]->Start();
frame_generators[i] = test::FrameGeneratorCapturer::Create(
- width, height, rtc::nullopt, rtc::nullopt, 30,
+ width, height, absl::nullopt, absl::nullopt, 30,
Clock::GetRealTimeClock());
send_streams[i]->SetSource(frame_generators[i],
DegradationPreference::MAINTAIN_FRAMERATE);
diff --git a/video/end_to_end_tests/retransmission_tests.cc b/video/end_to_end_tests/retransmission_tests.cc
index 425c0c2..fc09141 100644
--- a/video/end_to_end_tests/retransmission_tests.cc
+++ b/video/end_to_end_tests/retransmission_tests.cc
@@ -190,7 +190,7 @@
uint32_t local_ssrc_;
uint32_t remote_ssrc_;
Transport* receive_transport_;
- rtc::Optional<uint16_t> sequence_number_to_retransmit_;
+ absl::optional<uint16_t> sequence_number_to_retransmit_;
} test;
RunBaseTest(&test);
diff --git a/video/end_to_end_tests/rtp_rtcp_tests.cc b/video/end_to_end_tests/rtp_rtcp_tests.cc
index 5317242..1c953ac 100644
--- a/video/end_to_end_tests/rtp_rtcp_tests.cc
+++ b/video/end_to_end_tests/rtp_rtcp_tests.cc
@@ -453,9 +453,9 @@
return SEND_PACKET;
}
- rtc::Optional<uint16_t> last_observed_sequence_number_
+ absl::optional<uint16_t> last_observed_sequence_number_
RTC_GUARDED_BY(crit_);
- rtc::Optional<uint32_t> last_observed_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<uint32_t> last_observed_timestamp_ RTC_GUARDED_BY(crit_);
size_t num_flexfec_packets_sent_ RTC_GUARDED_BY(crit_);
rtc::CriticalSection crit_;
} observer;
diff --git a/video/overuse_frame_detector.cc b/video/overuse_frame_detector.cc
index 4bccdf3..0c56be8 100644
--- a/video/overuse_frame_detector.cc
+++ b/video/overuse_frame_detector.cc
@@ -110,12 +110,12 @@
time_when_first_seen_us));
}
- rtc::Optional<int> FrameSent(
+ absl::optional<int> FrameSent(
uint32_t timestamp,
int64_t time_sent_in_us,
int64_t /* capture_time_us */,
- rtc::Optional<int> /* encode_duration_us */) override {
- rtc::Optional<int> encode_duration_us;
+ absl::optional<int> /* encode_duration_us */) override {
+ absl::optional<int> encode_duration_us;
// Delay before reporting actual encoding time, used to have the ability to
// detect total encoding time when encoding more than one layer. Encoding is
// here assumed to finish within a second (or that we get enough long-time
@@ -241,10 +241,11 @@
int64_t time_when_first_seen_us,
int64_t last_capture_time_us) override {}
- rtc::Optional<int> FrameSent(uint32_t timestamp,
- int64_t time_sent_in_us,
- int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) override {
+ absl::optional<int> FrameSent(
+ uint32_t timestamp,
+ int64_t time_sent_in_us,
+ int64_t capture_time_us,
+ absl::optional<int> encode_duration_us) override {
if (encode_duration_us) {
if (prev_time_us_ != -1) {
AddSample(1e-6 * (*encode_duration_us),
@@ -321,13 +322,13 @@
usage_->FrameCaptured(frame, time_when_first_seen_us, last_capture_time_us);
}
- rtc::Optional<int> FrameSent(
+ absl::optional<int> FrameSent(
// These two argument used by old estimator.
uint32_t timestamp,
int64_t time_sent_in_us,
// And these two by the new estimator.
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) override {
+ absl::optional<int> encode_duration_us) override {
return usage_->FrameSent(timestamp, time_sent_in_us, capture_time_us,
encode_duration_us);
}
@@ -362,7 +363,7 @@
}
}
- rtc::Optional<int> overried_usage_value;
+ absl::optional<int> overried_usage_value;
switch (state_) {
case State::kNormal:
break;
@@ -514,7 +515,7 @@
: check_overuse_task_(nullptr),
metrics_observer_(metrics_observer),
num_process_times_(0),
- // TODO(nisse): Use rtc::Optional
+ // TODO(nisse): Use absl::optional
last_capture_time_us_(-1),
num_pixels_(0),
max_framerate_(kDefaultFrameRate),
@@ -582,7 +583,7 @@
usage_->Reset();
last_capture_time_us_ = -1;
num_process_times_ = 0;
- metrics_ = rtc::nullopt;
+ metrics_ = absl::nullopt;
OnTargetFramerateUpdated(max_framerate_);
}
@@ -610,7 +611,7 @@
void OveruseFrameDetector::FrameSent(uint32_t timestamp,
int64_t time_sent_in_us,
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) {
+ absl::optional<int> encode_duration_us) {
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
encode_duration_us = usage_->FrameSent(timestamp, time_sent_in_us,
capture_time_us, encode_duration_us);
diff --git a/video/overuse_frame_detector.h b/video/overuse_frame_detector.h
index 3525a97..800e53f 100644
--- a/video/overuse_frame_detector.h
+++ b/video/overuse_frame_detector.h
@@ -14,7 +14,7 @@
#include <list>
#include <memory>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/video_coding/utility/quality_scaler.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/numerics/exp_filter.h"
@@ -90,7 +90,7 @@
void FrameSent(uint32_t timestamp,
int64_t time_sent_in_us,
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us);
+ absl::optional<int> encode_duration_us);
// Interface for cpu load estimation. Intended for internal use only.
class ProcessingUsage {
@@ -101,13 +101,13 @@
int64_t time_when_first_seen_us,
int64_t last_capture_time_us) = 0;
// Returns encode_time in us, if there's a new measurement.
- virtual rtc::Optional<int> FrameSent(
+ virtual absl::optional<int> FrameSent(
// These two argument used by old estimator.
uint32_t timestamp,
int64_t time_sent_in_us,
// And these two by the new estimator.
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) = 0;
+ absl::optional<int> encode_duration_us) = 0;
virtual int Value() = 0;
virtual ~ProcessingUsage() = default;
@@ -141,7 +141,7 @@
// Stats metrics.
CpuOveruseMetricsObserver* const metrics_observer_;
- rtc::Optional<CpuOveruseMetrics> metrics_ RTC_GUARDED_BY(task_checker_);
+ absl::optional<CpuOveruseMetrics> metrics_ RTC_GUARDED_BY(task_checker_);
int64_t num_process_times_ RTC_GUARDED_BY(task_checker_);
diff --git a/video/overuse_frame_detector_unittest.cc b/video/overuse_frame_detector_unittest.cc
index 487b36f..bce5642 100644
--- a/video/overuse_frame_detector_unittest.cc
+++ b/video/overuse_frame_detector_unittest.cc
@@ -127,7 +127,7 @@
clock_.AdvanceTimeMicros(delay_us);
overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(),
capture_time_us,
- rtc::Optional<int>(delay_us));
+ absl::optional<int>(delay_us));
overuse_detector_->CheckForOveruse(observer_);
// Avoid turning clock backwards.
diff --git a/video/quality_threshold.cc b/video/quality_threshold.cc
index fc8787a..2b29992 100644
--- a/video/quality_threshold.cc
+++ b/video/quality_threshold.cc
@@ -74,13 +74,13 @@
}
}
-rtc::Optional<bool> QualityThreshold::IsHigh() const {
+absl::optional<bool> QualityThreshold::IsHigh() const {
return is_high_;
}
-rtc::Optional<double> QualityThreshold::CalculateVariance() const {
+absl::optional<double> QualityThreshold::CalculateVariance() const {
if (until_full_ > 0) {
- return rtc::nullopt;
+ return absl::nullopt;
}
double variance = 0;
@@ -91,11 +91,11 @@
return variance / (max_measurements_ - 1);
}
-rtc::Optional<double> QualityThreshold::FractionHigh(
+absl::optional<double> QualityThreshold::FractionHigh(
int min_required_samples) const {
RTC_DCHECK_GT(min_required_samples, 0);
if (num_certain_states_ < min_required_samples)
- return rtc::nullopt;
+ return absl::nullopt;
return static_cast<double>(num_high_states_) / num_certain_states_;
}
diff --git a/video/quality_threshold.h b/video/quality_threshold.h
index 519e2c3..4fad555 100644
--- a/video/quality_threshold.h
+++ b/video/quality_threshold.h
@@ -13,7 +13,7 @@
#include <memory>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -27,9 +27,9 @@
int max_measurements);
void AddMeasurement(int measurement);
- rtc::Optional<bool> IsHigh() const;
- rtc::Optional<double> CalculateVariance() const;
- rtc::Optional<double> FractionHigh(int min_required_samples) const;
+ absl::optional<bool> IsHigh() const;
+ absl::optional<double> CalculateVariance() const;
+ absl::optional<double> FractionHigh(int min_required_samples) const;
private:
const std::unique_ptr<int[]> buffer_;
@@ -39,7 +39,7 @@
const int high_threshold_;
int until_full_;
int next_index_;
- rtc::Optional<bool> is_high_;
+ absl::optional<bool> is_high_;
int sum_;
int count_low_;
int count_high_;
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 0fe366a..53903cf 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -209,7 +209,7 @@
round(render_pixel_tracker_.ComputeTotalRate()));
}
- rtc::Optional<int> sync_offset_ms =
+ absl::optional<int> sync_offset_ms =
sync_offset_counter_.Avg(kMinRequiredSamples);
if (sync_offset_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.AVSyncOffsetInMs",
@@ -236,17 +236,17 @@
<< key_frames_permille << '\n';
}
- rtc::Optional<int> qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
+ absl::optional<int> qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
if (qp) {
RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", *qp);
log_stream << "WebRTC.Video.Decoded.Vp8.Qp " << *qp << '\n';
}
- rtc::Optional<int> decode_ms = decode_time_counter_.Avg(kMinRequiredSamples);
+ absl::optional<int> decode_ms = decode_time_counter_.Avg(kMinRequiredSamples);
if (decode_ms) {
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", *decode_ms);
log_stream << "WebRTC.Video.DecodeTimeInMs " << *decode_ms << '\n';
}
- rtc::Optional<int> jb_delay_ms =
+ absl::optional<int> jb_delay_ms =
jitter_buffer_delay_counter_.Avg(kMinRequiredSamples);
if (jb_delay_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
@@ -254,21 +254,21 @@
log_stream << "WebRTC.Video.JitterBufferDelayInMs " << *jb_delay_ms << '\n';
}
- rtc::Optional<int> target_delay_ms =
+ absl::optional<int> target_delay_ms =
target_delay_counter_.Avg(kMinRequiredSamples);
if (target_delay_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs",
*target_delay_ms);
log_stream << "WebRTC.Video.TargetDelayInMs " << *target_delay_ms << '\n';
}
- rtc::Optional<int> current_delay_ms =
+ absl::optional<int> current_delay_ms =
current_delay_counter_.Avg(kMinRequiredSamples);
if (current_delay_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs",
*current_delay_ms);
log_stream << "WebRTC.Video.CurrentDelayInMs " << *current_delay_ms << '\n';
}
- rtc::Optional<int> delay_ms = delay_counter_.Avg(kMinRequiredSamples);
+ absl::optional<int> delay_ms = delay_counter_.Avg(kMinRequiredSamples);
if (delay_ms)
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", *delay_ms);
@@ -314,7 +314,7 @@
RTC_DCHECK(videocontenttypehelpers::GetExperimentId(content_type) == 0 ||
videocontenttypehelpers::GetSimulcastId(content_type) == 0);
- rtc::Optional<int> e2e_delay_ms =
+ absl::optional<int> e2e_delay_ms =
stats.e2e_delay_counter.Avg(kMinRequiredSamples);
if (e2e_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -322,14 +322,14 @@
log_stream << uma_prefix << ".EndToEndDelayInMs" << uma_suffix << " "
<< *e2e_delay_ms << '\n';
}
- rtc::Optional<int> e2e_delay_max_ms = stats.e2e_delay_counter.Max();
+ absl::optional<int> e2e_delay_max_ms = stats.e2e_delay_counter.Max();
if (e2e_delay_max_ms && e2e_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_100000(
uma_prefix + ".EndToEndDelayMaxInMs" + uma_suffix, *e2e_delay_max_ms);
log_stream << uma_prefix << ".EndToEndDelayMaxInMs" << uma_suffix << " "
<< *e2e_delay_max_ms << '\n';
}
- rtc::Optional<int> interframe_delay_ms =
+ absl::optional<int> interframe_delay_ms =
stats.interframe_delay_counter.Avg(kMinRequiredSamples);
if (interframe_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -338,7 +338,7 @@
log_stream << uma_prefix << ".InterframeDelayInMs" << uma_suffix << " "
<< *interframe_delay_ms << '\n';
}
- rtc::Optional<int> interframe_delay_max_ms =
+ absl::optional<int> interframe_delay_max_ms =
stats.interframe_delay_counter.Max();
if (interframe_delay_max_ms && interframe_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -348,7 +348,7 @@
<< *interframe_delay_max_ms << '\n';
}
- rtc::Optional<uint32_t> interframe_delay_95p_ms =
+ absl::optional<uint32_t> interframe_delay_95p_ms =
stats.interframe_delay_percentiles.GetPercentile(0.95f);
if (interframe_delay_95p_ms && interframe_delay_ms != -1) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -358,7 +358,7 @@
<< uma_suffix << " " << *interframe_delay_95p_ms << '\n';
}
- rtc::Optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
+ absl::optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
if (width) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
uma_prefix + ".ReceivedWidthInPixels" + uma_suffix, *width);
@@ -366,7 +366,7 @@
<< *width << '\n';
}
- rtc::Optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
+ absl::optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
if (height) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
uma_prefix + ".ReceivedHeightInPixels" + uma_suffix, *height);
@@ -401,7 +401,7 @@
<< " " << key_frames_permille << '\n';
}
- rtc::Optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
+ absl::optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
if (qp) {
RTC_HISTOGRAM_COUNTS_SPARSE_200(
uma_prefix + ".Decoded.Vp8.Qp" + uma_suffix, *qp);
@@ -465,19 +465,19 @@
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.Any",
100 * num_bad_states_ / num_certain_states_);
}
- rtc::Optional<double> fps_fraction =
+ absl::optional<double> fps_fraction =
fps_threshold_.FractionHigh(kBadCallMinRequiredSamples);
if (fps_fraction) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.FrameRate",
static_cast<int>(100 * (1 - *fps_fraction)));
}
- rtc::Optional<double> variance_fraction =
+ absl::optional<double> variance_fraction =
variance_threshold_.FractionHigh(kBadCallMinRequiredSamples);
if (variance_fraction) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.FrameRateVariance",
static_cast<int>(100 * *variance_fraction));
}
- rtc::Optional<double> qp_fraction =
+ absl::optional<double> qp_fraction =
qp_threshold_.FractionHigh(kBadCallMinRequiredSamples);
if (qp_fraction) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.Qp",
@@ -496,7 +496,7 @@
double fps =
render_fps_tracker_.ComputeRateForInterval(now - last_sample_time_);
- rtc::Optional<int> qp = qp_sample_.Avg(1);
+ absl::optional<int> qp = qp_sample_.Avg(1);
bool prev_fps_bad = !fps_threshold_.IsHigh().value_or(true);
bool prev_qp_bad = qp_threshold_.IsHigh().value_or(false);
@@ -506,7 +506,7 @@
fps_threshold_.AddMeasurement(static_cast<int>(fps));
if (qp)
qp_threshold_.AddMeasurement(*qp);
- rtc::Optional<double> fps_variance_opt = fps_threshold_.CalculateVariance();
+ absl::optional<double> fps_variance_opt = fps_threshold_.CalculateVariance();
double fps_variance = fps_variance_opt.value_or(0);
if (fps_variance_opt) {
variance_threshold_.AddMeasurement(static_cast<int>(fps_variance));
@@ -699,7 +699,7 @@
total_byte_tracker_.AddSamples(total_bytes - last_total_bytes);
}
-void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp,
+void ReceiveStatisticsProxy::OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
VideoContentType content_type) {
@@ -734,7 +734,7 @@
} else if (stats_.qp_sum) {
RTC_LOG(LS_WARNING)
<< "QP sum was already set and no QP was given for a frame.";
- stats_.qp_sum = rtc::nullopt;
+ stats_.qp_sum = absl::nullopt;
}
last_content_type_ = content_type;
decode_fps_estimator_.Update(1, now);
diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h
index 1ec0039..2ccfc93 100644
--- a/video/receive_statistics_proxy.h
+++ b/video/receive_statistics_proxy.h
@@ -16,7 +16,7 @@
#include <string>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "call/video_receive_stream.h"
#include "common_types.h" // NOLINT(build/include)
#include "common_video/include/frame_callback.h"
@@ -52,7 +52,7 @@
VideoReceiveStream::Stats GetStats() const;
- void OnDecodedFrame(rtc::Optional<uint8_t> qp,
+ void OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
VideoContentType content_type);
@@ -183,15 +183,15 @@
mutable std::map<int64_t, size_t> frame_window_ RTC_GUARDED_BY(&crit_);
VideoContentType last_content_type_ RTC_GUARDED_BY(&crit_);
VideoCodecType last_codec_type_ RTC_GUARDED_BY(&crit_);
- rtc::Optional<int64_t> first_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
- rtc::Optional<int64_t> last_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
+ absl::optional<int64_t> first_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
+ absl::optional<int64_t> last_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
size_t num_delayed_frames_rendered_ RTC_GUARDED_BY(&crit_);
int64_t sum_missed_render_deadline_ms_ RTC_GUARDED_BY(&crit_);
// Mutable because calling Max() on MovingMaxCounter is not const. Yet it is
// called from const GetStats().
mutable rtc::MovingMaxCounter<TimingFrameInfo> timing_frame_info_counter_
RTC_GUARDED_BY(&crit_);
- rtc::Optional<int> num_unique_frames_ RTC_GUARDED_BY(crit_);
+ absl::optional<int> num_unique_frames_ RTC_GUARDED_BY(crit_);
rtc::ThreadChecker decode_thread_;
rtc::ThreadChecker network_thread_;
rtc::ThreadChecker main_thread_;
diff --git a/video/receive_statistics_proxy_unittest.cc b/video/receive_statistics_proxy_unittest.cc
index 149c809..c3b9ae7 100644
--- a/video/receive_statistics_proxy_unittest.cc
+++ b/video/receive_statistics_proxy_unittest.cc
@@ -82,7 +82,7 @@
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) {
EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded);
for (uint32_t i = 1; i <= 3; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded);
}
@@ -92,8 +92,8 @@
const int kFps = 20;
const int kRequiredSamples = metrics::kMinRunTimeInSeconds * kFps;
for (int i = 0; i < kRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
- VideoContentType::UNSPECIFIED);
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
+ kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps);
}
statistics_proxy_.reset();
@@ -105,8 +105,8 @@
const int kFps = 20;
const int kRequiredSamples = metrics::kMinRunTimeInSeconds * kFps;
for (int i = 0; i < kRequiredSamples - 1; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
- VideoContentType::UNSPECIFIED);
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
+ kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps);
}
statistics_proxy_.reset();
@@ -116,14 +116,14 @@
TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsReportedWithQpReset) {
const int kFps1 = 10;
for (int i = 0; i < metrics::kMinRunTimeInSeconds * kFps1; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
- VideoContentType::UNSPECIFIED);
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
+ kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps1);
}
// First QP value received, resets frames decoded.
const int kFps2 = 20;
for (int i = 0; i < metrics::kMinRunTimeInSeconds * kFps2; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(1u), kWidth,
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(1u), kWidth,
kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps2);
}
@@ -136,7 +136,7 @@
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithQpResetsFramesDecoded) {
EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded);
for (uint32_t i = 1; i <= 3; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded);
}
@@ -146,7 +146,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesQpSum) {
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
statistics_proxy_->OnDecodedFrame(3u, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
@@ -230,20 +230,20 @@
}
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) {
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
}
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) {
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
statistics_proxy_->OnDecodedFrame(3u, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
}
TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) {
@@ -387,7 +387,7 @@
const int64_t kLongEndToEndDelay = 100;
const uint32_t kExpectedRtpTimestamp = 2;
TimingFrameInfo info;
- rtc::Optional<TimingFrameInfo> result;
+ absl::optional<TimingFrameInfo> result;
info.rtp_timestamp = kExpectedRtpTimestamp - 1;
info.capture_time_ms = 0;
info.decode_finish_ms = kShortEndToEndDelay;
@@ -412,7 +412,7 @@
const uint32_t kExpectedRtpTimestamp = 2;
const int64_t kShortDelayMs = 1000;
const int64_t kLongDelayMs = 10000;
- rtc::Optional<TimingFrameInfo> result;
+ absl::optional<TimingFrameInfo> result;
info.rtp_timestamp = kExpectedRtpTimestamp;
info.capture_time_ms = 0;
info.decode_finish_ms = kShortEndToEndDelay;
@@ -741,7 +741,7 @@
// Since OnRenderedFrame is never called the fps in each sample will be 0,
// i.e. bad
frame.set_ntp_time_ms(fake_clock_.CurrentNtpInMilliseconds());
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
statistics_proxy_->OnRenderedFrame(frame);
fake_clock_.AdvanceTimeMilliseconds(1000 / kDefaultFps);
@@ -796,7 +796,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, ZeroDelayReportedIfFrameNotDelayed) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Frame not delayed, delayed frames to render: 0%.
@@ -814,7 +814,7 @@
TEST_F(ReceiveStatisticsProxyTest,
DelayedFrameHistogramsAreNotUpdatedIfMinRuntimeHasNotPassed) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Frame not delayed, delayed frames to render: 0%.
@@ -832,7 +832,7 @@
TEST_F(ReceiveStatisticsProxyTest,
DelayedFramesHistogramsAreNotUpdatedIfNoRenderedFrames) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Min run time has passed. No rendered frames.
@@ -844,7 +844,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, DelayReportedIfFrameIsDelayed) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Frame delayed 1 ms, delayed frames to render: 100%.
@@ -863,7 +863,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, AverageDelayOfDelayedFramesIsReported) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Two frames delayed (6 ms, 10 ms), delayed frames to render: 50%.
@@ -937,13 +937,13 @@
const VideoContentType content_type = GetParam();
const int kInterFrameDelayMs = 33;
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// One extra with double the interval.
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -972,18 +972,18 @@
const int kLastFivePercentsSamples = kMinRequiredSamples * 5 / 100;
for (int i = 0; i <= kMinRequiredSamples - kLastFivePercentsSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
// Last 5% of intervals are double in size.
for (int i = 0; i < kLastFivePercentsSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(2 * kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
// Final sample is outlier and 10 times as big.
fake_clock_.AdvanceTimeMilliseconds(10 * kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -1003,7 +1003,7 @@
const VideoContentType content_type = GetParam();
const int kInterFrameDelayMs = 33;
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1023,7 +1023,7 @@
const VideoContentType content_type = GetParam();
const int kInterFrameDelayMs = 33;
for (int i = 0; i <= kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1035,10 +1035,10 @@
// Insert two more frames. The interval during the pause should be disregarded
// in the stats.
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -1068,13 +1068,13 @@
const int kInterFrameDelayMs = 33;
const int kFreezeDelayMs = 200;
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// Add extra freeze.
fake_clock_.AdvanceTimeMilliseconds(kFreezeDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -1100,7 +1100,7 @@
const int kInterFrameDelayMs = 33;
const int kPauseDurationMs = 10000;
for (int i = 0; i <= kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1110,7 +1110,7 @@
// Second playback interval with triple the length.
for (int i = 0; i <= kMinRequiredSamples * 3; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1137,15 +1137,15 @@
const int kInterFrameDelayMs = 33;
const int kPauseDurationMs = 10000;
for (int i = 0; i <= kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
statistics_proxy_->OnStreamInactive();
fake_clock_.AdvanceTimeMilliseconds(kPauseDurationMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
- content_type);
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
+ content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1164,18 +1164,18 @@
const int kInterFrameDelayMs = 20;
// HD frames.
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// SD frames.
for (int i = 0; i < 2 * kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth / 2, kHeight / 2,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth / 2, kHeight / 2,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// Extra last frame.
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth / 2, kHeight / 2,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth / 2, kHeight / 2,
content_type);
statistics_proxy_.reset();
const int kExpectedTimeInHdPercents = 33;
@@ -1268,14 +1268,14 @@
videocontenttypehelpers::SetSimulcastId(&content_type, 1);
for (int i = 0; i <= kMinRequiredSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs1);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
videocontenttypehelpers::SetSimulcastId(&content_type, 2);
for (int i = 0; i <= kMinRequiredSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs2);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
statistics_proxy_.reset();
diff --git a/video/rtp_streams_synchronizer.cc b/video/rtp_streams_synchronizer.cc
index c330a44..cc7f893 100644
--- a/video/rtp_streams_synchronizer.cc
+++ b/video/rtp_streams_synchronizer.cc
@@ -76,13 +76,13 @@
}
RTC_DCHECK(sync_.get());
- rtc::Optional<Syncable::Info> audio_info = syncable_audio_->GetInfo();
+ absl::optional<Syncable::Info> audio_info = syncable_audio_->GetInfo();
if (!audio_info || !UpdateMeasurements(&audio_measurement_, *audio_info)) {
return;
}
int64_t last_video_receive_ms = video_measurement_.latest_receive_time_ms;
- rtc::Optional<Syncable::Info> video_info = syncable_video_->GetInfo();
+ absl::optional<Syncable::Info> video_info = syncable_video_->GetInfo();
if (!video_info || !UpdateMeasurements(&video_measurement_, *video_info)) {
return;
}
diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc
index 996154f..271c56f 100644
--- a/video/rtp_video_stream_receiver.cc
+++ b/video/rtp_video_stream_receiver.cc
@@ -354,11 +354,11 @@
nack_module_->UpdateRtt(max_rtt_ms);
}
-rtc::Optional<int64_t> RtpVideoStreamReceiver::LastReceivedPacketMs() const {
+absl::optional<int64_t> RtpVideoStreamReceiver::LastReceivedPacketMs() const {
return packet_buffer_->LastReceivedPacketMs();
}
-rtc::Optional<int64_t> RtpVideoStreamReceiver::LastReceivedKeyframePacketMs()
+absl::optional<int64_t> RtpVideoStreamReceiver::LastReceivedKeyframePacketMs()
const {
return packet_buffer_->LastReceivedKeyframePacketMs();
}
diff --git a/video/rtp_video_stream_receiver.h b/video/rtp_video_stream_receiver.h
index 4c8a4f2..75dcea5 100644
--- a/video/rtp_video_stream_receiver.h
+++ b/video/rtp_video_stream_receiver.h
@@ -129,8 +129,8 @@
// Called by VideoReceiveStream when stats are updated.
void UpdateRtt(int64_t max_rtt_ms);
- rtc::Optional<int64_t> LastReceivedPacketMs() const;
- rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const;
+ absl::optional<int64_t> LastReceivedPacketMs() const;
+ absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
// RtpDemuxer only forwards a given RTP packet to one sink. However, some
// sinks, such as FlexFEC, might wish to be informed of all of the packets
diff --git a/video/send_statistics_proxy.cc b/video/send_statistics_proxy.cc
index 6c86c63..85afbc9 100644
--- a/video/send_statistics_proxy.cc
+++ b/video/send_statistics_proxy.cc
@@ -85,36 +85,36 @@
codec_info->codecSpecific.VP8.temporalIdx == kNoTemporalIdx);
}
-rtc::Optional<int> GetFallbackMaxPixels(const std::string& group) {
+absl::optional<int> GetFallbackMaxPixels(const std::string& group) {
if (group.empty())
- return rtc::nullopt;
+ return absl::nullopt;
int min_pixels;
int max_pixels;
int min_bps;
if (sscanf(group.c_str(), "-%d,%d,%d", &min_pixels, &max_pixels, &min_bps) !=
3) {
- return rtc::Optional<int>();
+ return absl::optional<int>();
}
if (min_pixels <= 0 || max_pixels <= 0 || max_pixels < min_pixels)
- return rtc::Optional<int>();
+ return absl::optional<int>();
- return rtc::Optional<int>(max_pixels);
+ return absl::optional<int>(max_pixels);
}
-rtc::Optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled() {
+absl::optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled() {
std::string group =
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
return (group.find("Enabled") == 0) ? GetFallbackMaxPixels(group.substr(7))
- : rtc::Optional<int>();
+ : absl::optional<int>();
}
-rtc::Optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled() {
+absl::optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled() {
std::string group =
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
return (group.find("Disabled") == 0) ? GetFallbackMaxPixels(group.substr(8))
- : rtc::Optional<int>();
+ : absl::optional<int>();
}
} // namespace
diff --git a/video/send_statistics_proxy.h b/video/send_statistics_proxy.h
index bef3b28..7239e7f 100644
--- a/video/send_statistics_proxy.h
+++ b/video/send_statistics_proxy.h
@@ -162,7 +162,7 @@
bool is_active = false;
int on_off_events = 0;
int64_t elapsed_ms = 0;
- rtc::Optional<int64_t> last_update_ms;
+ absl::optional<int64_t> last_update_ms;
const int max_frame_diff_ms = 2000;
};
struct FallbackEncoderInfoDisabled {
@@ -235,8 +235,8 @@
Clock* const clock_;
const std::string payload_name_;
const VideoSendStream::Config::Rtp rtp_config_;
- const rtc::Optional<int> fallback_max_pixels_;
- const rtc::Optional<int> fallback_max_pixels_disabled_;
+ const absl::optional<int> fallback_max_pixels_;
+ const absl::optional<int> fallback_max_pixels_disabled_;
rtc::CriticalSection crit_;
VideoEncoderConfig::ContentType content_type_ RTC_GUARDED_BY(crit_);
const int64_t start_ms_;
@@ -248,7 +248,7 @@
rtc::RateTracker media_byte_rate_tracker_ RTC_GUARDED_BY(crit_);
rtc::RateTracker encoded_frame_rate_tracker_ RTC_GUARDED_BY(crit_);
- rtc::Optional<int64_t> last_outlier_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<int64_t> last_outlier_timestamp_ RTC_GUARDED_BY(crit_);
// Contains stats used for UMA histograms. These stats will be reset if
// content type changes between real-time video and screenshare, since these
diff --git a/video/send_statistics_proxy_unittest.cc b/video/send_statistics_proxy_unittest.cc
index d9e8343..5730317 100644
--- a/video/send_statistics_proxy_unittest.cc
+++ b/video/send_statistics_proxy_unittest.cc
@@ -331,7 +331,7 @@
TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesQpSum) {
EncodedImage encoded_image;
CodecSpecificInfo codec_info;
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
encoded_image.qp_ = 3;
statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
@@ -344,9 +344,9 @@
EncodedImage encoded_image;
CodecSpecificInfo codec_info;
encoded_image.qp_ = -1;
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
}
TEST_F(SendStatisticsProxyTest, GetCpuAdaptationStats) {
diff --git a/video/video_quality_observer.cc b/video/video_quality_observer.cc
index c6663fa..b35a8c8 100644
--- a/video/video_quality_observer.cc
+++ b/video/video_quality_observer.cc
@@ -109,7 +109,7 @@
RTC_LOG(LS_INFO) << log_stream.str();
}
-void VideoQualityObserver::OnDecodedFrame(rtc::Optional<uint8_t> qp,
+void VideoQualityObserver::OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
int64_t now_ms,
@@ -125,7 +125,7 @@
// Process inter-frame delay.
int64_t interframe_delay_ms = now_ms - last_frame_decoded_ms_;
interframe_delays_.Add(interframe_delay_ms);
- rtc::Optional<int> avg_interframe_delay =
+ absl::optional<int> avg_interframe_delay =
interframe_delays_.Avg(kMinFrameSamplesToDetectFreeze);
// Check if it was a freeze.
if (avg_interframe_delay &&
@@ -140,7 +140,7 @@
// Only count inter-frame delay as playback time if there
// was no freeze.
time_in_resolution_ms_[current_resolution_] += interframe_delay_ms;
- rtc::Optional<int> qp_blocky_threshold;
+ absl::optional<int> qp_blocky_threshold;
// TODO(ilnik): add other codec types when we have QP for them.
switch (codec) {
case kVideoCodecVP8:
@@ -150,7 +150,7 @@
qp_blocky_threshold = kBlockyQpThresholdVp9;
break;
default:
- qp_blocky_threshold = rtc::nullopt;
+ qp_blocky_threshold = absl::nullopt;
}
if (qp_blocky_threshold && qp.value_or(0) > *qp_blocky_threshold) {
time_in_blocky_video_ms_ += interframe_delay_ms;
diff --git a/video/video_quality_observer.h b/video/video_quality_observer.h
index cbeab43..8ba4af3 100644
--- a/video/video_quality_observer.h
+++ b/video/video_quality_observer.h
@@ -14,7 +14,7 @@
#include <stdint.h>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/video/video_content_type.h"
#include "common_types.h" // NOLINT(build/include)
#include "rtc_base/numerics/sample_counter.h"
@@ -30,7 +30,7 @@
explicit VideoQualityObserver(VideoContentType content_type);
~VideoQualityObserver();
- void OnDecodedFrame(rtc::Optional<uint8_t> qp,
+ void OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
int64_t now_ms,
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index f6c48c0..3a174c4 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -491,8 +491,8 @@
render_time_ms(render_time_ms),
encoded_frame_size(encoded_frame_size) {}
- rtc::Optional<VideoFrame> reference;
- rtc::Optional<VideoFrame> render;
+ absl::optional<VideoFrame> reference;
+ absl::optional<VideoFrame> render;
bool dropped;
int64_t input_time_ms;
int64_t send_time_ms;
@@ -1028,7 +1028,7 @@
};
// Rendered frame with worst PSNR is saved for further analysis.
- rtc::Optional<FrameWithPsnr> worst_frame_ RTC_GUARDED_BY(comparison_lock_);
+ absl::optional<FrameWithPsnr> worst_frame_ RTC_GUARDED_BY(comparison_lock_);
size_t last_fec_bytes_;
@@ -1052,13 +1052,13 @@
rtc::CriticalSection crit_;
std::deque<VideoFrame> frames_ RTC_GUARDED_BY(crit_);
- rtc::Optional<VideoFrame> last_rendered_frame_ RTC_GUARDED_BY(crit_);
+ absl::optional<VideoFrame> last_rendered_frame_ RTC_GUARDED_BY(crit_);
rtc::TimestampWrapAroundHandler wrap_handler_ RTC_GUARDED_BY(crit_);
std::map<int64_t, int64_t> send_times_ RTC_GUARDED_BY(crit_);
std::map<int64_t, int64_t> recv_times_ RTC_GUARDED_BY(crit_);
std::map<int64_t, size_t> encoded_frame_sizes_ RTC_GUARDED_BY(crit_);
- rtc::Optional<uint32_t> first_encoded_timestamp_ RTC_GUARDED_BY(crit_);
- rtc::Optional<uint32_t> first_sent_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<uint32_t> first_encoded_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<uint32_t> first_sent_timestamp_ RTC_GUARDED_BY(crit_);
const double avg_psnr_threshold_;
const double avg_ssim_threshold_;
bool is_quick_test_enabled_;
@@ -1751,7 +1751,7 @@
for (size_t i = 0; i < num_thumbnail_streams; ++i) {
thumbnail_capturers_.emplace_back(test::FrameGeneratorCapturer::Create(
static_cast<int>(thumbnail.width), static_cast<int>(thumbnail.height),
- rtc::nullopt, rtc::nullopt, thumbnail.max_framerate, clock_));
+ absl::nullopt, absl::nullopt, thumbnail.max_framerate, clock_));
RTC_DCHECK(thumbnail_capturers_.back());
}
}
@@ -1817,13 +1817,13 @@
if (params_.video[video_idx].clip_name == "Generator") {
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
static_cast<int>(params_.video[video_idx].width),
- static_cast<int>(params_.video[video_idx].height), rtc::nullopt,
- rtc::nullopt, params_.video[video_idx].fps, clock_));
+ static_cast<int>(params_.video[video_idx].height), absl::nullopt,
+ absl::nullopt, params_.video[video_idx].fps, clock_));
} else if (params_.video[video_idx].clip_name == "GeneratorI420A") {
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
static_cast<int>(params_.video[video_idx].width),
static_cast<int>(params_.video[video_idx].height),
- test::FrameGenerator::OutputType::I420A, rtc::nullopt,
+ test::FrameGenerator::OutputType::I420A, absl::nullopt,
params_.video[video_idx].fps, clock_));
} else if (params_.video[video_idx].clip_name.empty()) {
video_capturers_[video_idx].reset(test::VcmCapturer::Create(
@@ -1836,7 +1836,7 @@
test::FrameGeneratorCapturer::Create(
static_cast<int>(params_.video[video_idx].width),
static_cast<int>(params_.video[video_idx].height),
- rtc::nullopt, rtc::nullopt, params_.video[video_idx].fps,
+ absl::nullopt, absl::nullopt, params_.video[video_idx].fps,
clock_));
}
} else {
diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc
index 0e596be..f5c7e2a 100644
--- a/video/video_receive_stream.cc
+++ b/video/video_receive_stream.cc
@@ -16,13 +16,13 @@
#include <string>
#include <utility>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "call/rtp_stream_receiver_controller_interface.h"
#include "call/rtx_receive_stream.h"
#include "common_types.h" // NOLINT(build/include)
#include "common_video/h264/profile_level_id.h"
-#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "common_video/include/incoming_video_stream.h"
+#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "modules/rtp_rtcp/include/rtp_receiver.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
#include "modules/utility/include/process_thread.h"
@@ -375,7 +375,7 @@
return config_.rtp.remote_ssrc;
}
-rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
+absl::optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
RTC_DCHECK_CALLED_SEQUENTIALLY(&module_process_sequence_checker_);
Syncable::Info info;
@@ -384,7 +384,7 @@
if (!rtp_receiver->GetLatestTimestamps(
&info.latest_received_capture_timestamp,
&info.latest_receive_time_ms))
- return rtc::nullopt;
+ return absl::nullopt;
RtpRtcp* rtp_rtcp = rtp_video_stream_receiver_.rtp_rtcp();
RTC_DCHECK(rtp_rtcp);
@@ -393,7 +393,7 @@
nullptr,
nullptr,
&info.capture_time_source_clock) != 0) {
- return rtc::nullopt;
+ return absl::nullopt;
}
info.current_delay_ms = video_receiver_.Delay();
@@ -454,9 +454,9 @@
} else {
RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kTimeout);
int64_t now_ms = clock_->TimeInMilliseconds();
- rtc::Optional<int64_t> last_packet_ms =
+ absl::optional<int64_t> last_packet_ms =
rtp_video_stream_receiver_.LastReceivedPacketMs();
- rtc::Optional<int64_t> last_keyframe_packet_ms =
+ absl::optional<int64_t> last_keyframe_packet_ms =
rtp_video_stream_receiver_.LastReceivedKeyframePacketMs();
// To avoid spamming keyframe requests for a stream that is not active we
diff --git a/video/video_receive_stream.h b/video/video_receive_stream.h
index 2ca4026..5b12894 100644
--- a/video/video_receive_stream.h
+++ b/video/video_receive_stream.h
@@ -108,7 +108,7 @@
// Implements Syncable.
int id() const override;
- rtc::Optional<Syncable::Info> GetInfo() const override;
+ absl::optional<Syncable::Info> GetInfo() const override;
uint32_t GetPlayoutTimestamp() const override;
void SetMinimumPlayoutDelay(int delay_ms) override;
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index e3fd642..3eb2d76 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -179,7 +179,7 @@
return stats_proxy_.GetStats();
}
-rtc::Optional<float> VideoSendStream::GetPacingFactorOverride() const {
+absl::optional<float> VideoSendStream::GetPacingFactorOverride() const {
return send_stream_->configured_pacing_factor_;
}
diff --git a/video/video_send_stream.h b/video/video_send_stream.h
index bbf706a..a41add8 100644
--- a/video/video_send_stream.h
+++ b/video/video_send_stream.h
@@ -106,7 +106,7 @@
class ConstructionTask;
- rtc::Optional<float> GetPacingFactorOverride() const;
+ absl::optional<float> GetPacingFactorOverride() const;
rtc::ThreadChecker thread_checker_;
rtc::TaskQueue* const worker_queue_;
diff --git a/video/video_send_stream_impl.cc b/video/video_send_stream_impl.cc
index c8fae7f..d8798b7 100644
--- a/video/video_send_stream_impl.cc
+++ b/video/video_send_stream_impl.cc
@@ -151,25 +151,25 @@
const char kForcedFallbackFieldTrial[] =
"WebRTC-VP8-Forced-Fallback-Encoder-v2";
-rtc::Optional<int> GetFallbackMinBpsFromFieldTrial() {
+absl::optional<int> GetFallbackMinBpsFromFieldTrial() {
if (!webrtc::field_trial::IsEnabled(kForcedFallbackFieldTrial))
- return rtc::nullopt;
+ return absl::nullopt;
std::string group =
webrtc::field_trial::FindFullName(kForcedFallbackFieldTrial);
if (group.empty())
- return rtc::nullopt;
+ return absl::nullopt;
int min_pixels;
int max_pixels;
int min_bps;
if (sscanf(group.c_str(), "Enabled-%d,%d,%d", &min_pixels, &max_pixels,
&min_bps) != 3) {
- return rtc::nullopt;
+ return absl::nullopt;
}
if (min_bps <= 0)
- return rtc::nullopt;
+ return absl::nullopt;
return min_bps;
}
@@ -370,7 +370,7 @@
if (TransportSeqNumExtensionConfigured(*config_)) {
has_packet_feedback_ = true;
- rtc::Optional<AlrExperimentSettings> alr_settings;
+ absl::optional<AlrExperimentSettings> alr_settings;
if (content_type == VideoEncoderConfig::ContentType::kScreen) {
alr_settings = AlrExperimentSettings::CreateFromFieldTrial(
AlrExperimentSettings::kScreenshareProbingBweExperimentName);
diff --git a/video/video_send_stream_impl.h b/video/video_send_stream_impl.h
index 84fca8f..ab9f8d1 100644
--- a/video/video_send_stream_impl.h
+++ b/video/video_send_stream_impl.h
@@ -88,7 +88,7 @@
void SetTransportOverhead(size_t transport_overhead_per_packet);
- rtc::Optional<float> configured_pacing_factor_;
+ absl::optional<float> configured_pacing_factor_;
// From PacketFeedbackObserver.
void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override;
diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc
index dbcfa09..a11d05e 100644
--- a/video/video_send_stream_tests.cc
+++ b/video/video_send_stream_tests.cc
@@ -58,7 +58,7 @@
explicit VideoSendStreamPeer(webrtc::VideoSendStream* base_class_stream)
: internal_stream_(
static_cast<internal::VideoSendStream*>(base_class_stream)) {}
- rtc::Optional<float> GetPacingFactorOverride() const {
+ absl::optional<float> GetPacingFactorOverride() const {
return internal_stream_->GetPacingFactorOverride();
}
@@ -2065,7 +2065,7 @@
bool WaitBitrateChanged(bool non_zero) {
do {
- rtc::Optional<int> bitrate_kbps;
+ absl::optional<int> bitrate_kbps;
{
rtc::CritScope lock(&crit_);
bitrate_kbps = bitrate_kbps_;
@@ -2085,7 +2085,7 @@
rtc::CriticalSection crit_;
rtc::Event encoder_init_;
rtc::Event bitrate_changed_;
- rtc::Optional<int> bitrate_kbps_ RTC_GUARDED_BY(crit_);
+ absl::optional<int> bitrate_kbps_ RTC_GUARDED_BY(crit_);
};
// This test that if the encoder use an internal source, VideoEncoder::SetRates
@@ -3773,7 +3773,7 @@
class PacingFactorObserver : public test::SendTest {
public:
PacingFactorObserver(bool configure_send_side,
- rtc::Optional<float> expected_pacing_factor)
+ absl::optional<float> expected_pacing_factor)
: test::SendTest(VideoSendStreamTest::kDefaultTimeoutMs),
configure_send_side_(configure_send_side),
expected_pacing_factor_(expected_pacing_factor) {}
@@ -3824,7 +3824,7 @@
private:
const bool configure_send_side_;
- const rtc::Optional<float> expected_pacing_factor_;
+ const absl::optional<float> expected_pacing_factor_;
};
std::string GetAlrProbingExperimentString() {
@@ -3845,7 +3845,7 @@
TEST_F(VideoSendStreamTest, AlrNotConfiguredWhenSendSideOff) {
test::ScopedFieldTrials alr_experiment(GetAlrProbingExperimentString());
// Send-side bwe off, use configuration should not be overridden.
- PacingFactorObserver test_without_send_side(false, rtc::nullopt);
+ PacingFactorObserver test_without_send_side(false, absl::nullopt);
RunBaseTest(&test_without_send_side);
}
diff --git a/video/video_stream_decoder.cc b/video/video_stream_decoder.cc
index 5557c6c..86810dd 100644
--- a/video/video_stream_decoder.cc
+++ b/video/video_stream_decoder.cc
@@ -75,7 +75,7 @@
// thread may have held the lock when calling VideoDecoder::Decode, Reset, or
// Release. Acquiring the same lock in the path of decode callback can deadlock.
int32_t VideoStreamDecoder::FrameToRender(VideoFrame& video_frame,
- rtc::Optional<uint8_t> qp,
+ absl::optional<uint8_t> qp,
VideoContentType content_type) {
receive_stats_callback_->OnDecodedFrame(qp, video_frame.width(),
video_frame.height(), content_type);
diff --git a/video/video_stream_decoder.h b/video/video_stream_decoder.h
index c7d04b7..4bc7406 100644
--- a/video/video_stream_decoder.h
+++ b/video/video_stream_decoder.h
@@ -52,7 +52,7 @@
// Implements VCMReceiveCallback.
int32_t FrameToRender(VideoFrame& video_frame,
- rtc::Optional<uint8_t> qp,
+ absl::optional<uint8_t> qp,
VideoContentType content_type) override;
int32_t ReceivedDecodedReferenceFrame(const uint64_t picture_id) override;
void OnIncomingPayloadType(int payload_type) override;
diff --git a/video/video_stream_decoder_impl.cc b/video/video_stream_decoder_impl.cc
index 46b40a1..1bbf943 100644
--- a/video/video_stream_decoder_impl.cc
+++ b/video/video_stream_decoder_impl.cc
@@ -232,21 +232,21 @@
// VideoDecoder::DecodedImageCallback
int32_t VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image) {
- Decoded(decoded_image, rtc::nullopt, rtc::nullopt);
+ Decoded(decoded_image, absl::nullopt, absl::nullopt);
return WEBRTC_VIDEO_CODEC_OK;
}
// VideoDecoder::DecodedImageCallback
int32_t VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image,
int64_t decode_time_ms) {
- Decoded(decoded_image, decode_time_ms, rtc::nullopt);
+ Decoded(decoded_image, decode_time_ms, absl::nullopt);
return WEBRTC_VIDEO_CODEC_OK;
}
// VideoDecoder::DecodedImageCallback
void VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image,
- rtc::Optional<int32_t> decode_time_ms,
- rtc::Optional<uint8_t> qp) {
+ absl::optional<int32_t> decode_time_ms,
+ absl::optional<uint8_t> qp) {
int64_t decode_stop_time_ms = rtc::TimeMillis();
bookkeeping_queue_.PostTask([this, decode_stop_time_ms, decoded_image,
@@ -261,11 +261,11 @@
return;
}
- rtc::Optional<int> casted_qp;
+ absl::optional<int> casted_qp;
if (qp)
casted_qp.emplace(*qp);
- rtc::Optional<int> casted_decode_time_ms(decode_time_ms.value_or(
+ absl::optional<int> casted_decode_time_ms(decode_time_ms.value_or(
decode_stop_time_ms - frame_timestamps->decode_start_time_ms));
timing_.StopDecodeTimer(0, *casted_decode_time_ms, decode_stop_time_ms,
diff --git a/video/video_stream_decoder_impl.h b/video/video_stream_decoder_impl.h
index d4de7b6..cd1f953 100644
--- a/video/video_stream_decoder_impl.h
+++ b/video/video_stream_decoder_impl.h
@@ -15,7 +15,7 @@
#include <memory>
#include <utility>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/video/video_stream_decoder.h"
#include "modules/video_coding/frame_buffer2.h"
#include "modules/video_coding/jitter_estimator.h"
@@ -64,8 +64,8 @@
int32_t Decoded(VideoFrame& decodedImage) override;
int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) override;
void Decoded(VideoFrame& decodedImage,
- rtc::Optional<int32_t> decode_time_ms,
- rtc::Optional<uint8_t> qp) override;
+ absl::optional<int32_t> decode_time_ms,
+ absl::optional<uint8_t> qp) override;
VideoStreamDecoder::Callbacks* const callbacks_
RTC_PT_GUARDED_BY(bookkeeping_queue_);
@@ -83,7 +83,7 @@
VCMTiming timing_;
video_coding::FrameBuffer frame_buffer_;
video_coding::VideoLayerFrameId last_continuous_id_;
- rtc::Optional<int> current_payload_type_;
+ absl::optional<int> current_payload_type_;
std::unique_ptr<VideoDecoder> decoder_;
// Some decoders are pipelined so it is not sufficient to save frame info
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc
index 6d214ff..6aee776 100644
--- a/video/video_stream_encoder.cc
+++ b/video/video_stream_encoder.cc
@@ -183,7 +183,7 @@
RTC_LOG(LS_INFO) << "Scaling down resolution, max pixels: "
<< pixels_wanted;
sink_wants_.max_pixel_count = pixels_wanted;
- sink_wants_.target_pixel_count = rtc::nullopt;
+ sink_wants_.target_pixel_count = absl::nullopt;
source_->AddOrUpdateSink(video_stream_encoder_,
GetActiveSinkWantsInternal());
return true;
@@ -606,7 +606,7 @@
// Drop frames and scale down until desired quality is achieved.
// Use experimental thresholds if available.
- rtc::Optional<VideoEncoder::QpThresholds> experimental_thresholds;
+ absl::optional<VideoEncoder::QpThresholds> experimental_thresholds;
if (quality_scaling_experiment_enabled_) {
experimental_thresholds = QualityScalingExperiment::GetQpThresholds(
encoder_config_.codec_type);
@@ -880,7 +880,7 @@
int64_t capture_time_us =
encoded_image.capture_time_ms_ * rtc::kNumMicrosecsPerMillisec;
- rtc::Optional<int> encode_duration_us;
+ absl::optional<int> encode_duration_us;
if (encoded_image.timing_.flags != VideoSendTiming::kInvalid) {
encode_duration_us.emplace(
// TODO(nisse): Maybe use capture_time_ms_ rather than encode_start_ms_?
diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h
index 7a48a07..0ea6dec 100644
--- a/video/video_stream_encoder.h
+++ b/video/video_stream_encoder.h
@@ -230,7 +230,7 @@
// Set when configuration must create a new encoder object, e.g.,
// because of a codec change.
bool pending_encoder_creation_ RTC_GUARDED_BY(&encoder_queue_);
- rtc::Optional<VideoFrameInfo> last_frame_info_
+ absl::optional<VideoFrameInfo> last_frame_info_
RTC_GUARDED_BY(&encoder_queue_);
int crop_width_ RTC_GUARDED_BY(&encoder_queue_);
int crop_height_ RTC_GUARDED_BY(&encoder_queue_);
@@ -259,7 +259,7 @@
};
// Stores a snapshot of the last adaptation request triggered by an AdaptUp
// or AdaptDown signal.
- rtc::Optional<AdaptationRequest> last_adaptation_request_
+ absl::optional<AdaptationRequest> last_adaptation_request_
RTC_GUARDED_BY(&encoder_queue_);
rtc::RaceChecker incoming_frame_race_checker_
@@ -274,12 +274,12 @@
int64_t last_frame_log_ms_ RTC_GUARDED_BY(incoming_frame_race_checker_);
int captured_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
int dropped_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
- rtc::Optional<VideoFrame> pending_frame_ RTC_GUARDED_BY(&encoder_queue_);
+ absl::optional<VideoFrame> pending_frame_ RTC_GUARDED_BY(&encoder_queue_);
int64_t pending_frame_post_time_us_ RTC_GUARDED_BY(&encoder_queue_);
VideoBitrateAllocationObserver* bitrate_observer_
RTC_GUARDED_BY(&encoder_queue_);
- rtc::Optional<int64_t> last_parameters_update_ms_
+ absl::optional<int64_t> last_parameters_update_ms_
RTC_GUARDED_BY(&encoder_queue_);
// All public methods are proxied to |encoder_queue_|. It must must be
diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc
index e295393..d83322d 100644
--- a/video/video_stream_encoder_unittest.cc
+++ b/video/video_stream_encoder_unittest.cc
@@ -180,8 +180,8 @@
return last_wants_;
}
- rtc::Optional<int> last_sent_width() const { return last_width_; }
- rtc::Optional<int> last_sent_height() const { return last_height_; }
+ absl::optional<int> last_sent_width() const { return last_width_; }
+ absl::optional<int> last_sent_height() const { return last_height_; }
void IncomingCapturedFrame(const VideoFrame& video_frame) override {
int cropped_width = 0;
@@ -201,8 +201,8 @@
last_width_.emplace(adapted_frame.width());
last_height_.emplace(adapted_frame.height());
} else {
- last_width_ = rtc::nullopt;
- last_height_ = rtc::nullopt;
+ last_width_ = absl::nullopt;
+ last_height_ = absl::nullopt;
}
} else {
test::FrameForwarder::IncomingCapturedFrame(video_frame);
@@ -223,8 +223,8 @@
cricket::VideoAdapter adapter_;
bool adaptation_enabled_ RTC_GUARDED_BY(crit_);
rtc::VideoSinkWants last_wants_ RTC_GUARDED_BY(crit_);
- rtc::Optional<int> last_width_;
- rtc::Optional<int> last_height_;
+ absl::optional<int> last_width_;
+ absl::optional<int> last_height_;
};
class MockableSendStatisticsProxy : public SendStatisticsProxy {
@@ -253,7 +253,7 @@
private:
rtc::CriticalSection lock_;
- rtc::Optional<VideoSendStream::Stats> mock_stats_ RTC_GUARDED_BY(lock_);
+ absl::optional<VideoSendStream::Stats> mock_stats_ RTC_GUARDED_BY(lock_);
};
class MockBitrateObserver : public VideoBitrateAllocationObserver {