Replace rtc::Optional with absl::optional

This is a no-op change because rtc::Optional is an alias to absl::optional

This CL generated by running script from modules with parameters
'pacing video_coding congestion_controller remote_bitrate_estimator':

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: I8ea501d7f1ee36e8d8cd3ed37e6b763c7fe29118
Reviewed-on: https://webrtc-review.googlesource.com/83900
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23640}
This commit is contained in:
Danil Chapovalov 2018-06-18 10:48:16 +02:00 committed by Commit Bot
parent ae1888629a
commit 0040b66ad3
103 changed files with 271 additions and 268 deletions

View file

@ -31,12 +31,12 @@ rtc_source_set("bbr_controller") {
":loss_rate_filter", ":loss_rate_filter",
":rtt_stats", ":rtt_stats",
":windowed_filter", ":windowed_filter",
"../../../api:optional",
"../../../api/transport:network_control", "../../../api/transport:network_control",
"../../../rtc_base:checks", "../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
"../../../rtc_base/experiments:congestion_controller_experiment", "../../../rtc_base/experiments:congestion_controller_experiment",
"../../../rtc_base/system:fallthrough", "../../../rtc_base/system:fallthrough",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -48,13 +48,13 @@ rtc_source_set("bandwidth_sampler") {
] ]
deps = [ deps = [
":packet_number_indexed_queue", ":packet_number_indexed_queue",
"../../../api:optional",
"../../../api/units:data_rate", "../../../api/units:data_rate",
"../../../api/units:data_size", "../../../api/units:data_size",
"../../../api/units:time_delta", "../../../api/units:time_delta",
"../../../api/units:timestamp", "../../../api/units:timestamp",
"../../../rtc_base:checks", "../../../rtc_base:checks",
"../../../rtc_base:rtc_base_approved", "../../../rtc_base:rtc_base_approved",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -90,7 +90,7 @@ rtc_source_set("loss_rate_filter") {
"loss_rate_filter.h", "loss_rate_filter.h",
] ]
deps = [ deps = [
"../../../api:optional", "//third_party/abseil-cpp/absl/types:optional",
] ]
} }
rtc_source_set("rtt_stats") { rtc_source_set("rtt_stats") {

View file

@ -12,7 +12,7 @@
#ifndef MODULES_CONGESTION_CONTROLLER_BBR_BANDWIDTH_SAMPLER_H_ #ifndef MODULES_CONGESTION_CONTROLLER_BBR_BANDWIDTH_SAMPLER_H_
#define MODULES_CONGESTION_CONTROLLER_BBR_BANDWIDTH_SAMPLER_H_ #define MODULES_CONGESTION_CONTROLLER_BBR_BANDWIDTH_SAMPLER_H_
#include "api/optional.h" #include "absl/types/optional.h"
#include "api/units/data_rate.h" #include "api/units/data_rate.h"
#include "api/units/data_size.h" #include "api/units/data_size.h"
#include "api/units/time_delta.h" #include "api/units/time_delta.h"
@ -187,11 +187,11 @@ class BandwidthSampler {
// The value of |last_acked_packet_sent_time_| at the time the packet was // The value of |last_acked_packet_sent_time_| at the time the packet was
// sent. // sent.
rtc::Optional<Timestamp> last_acked_packet_sent_time; absl::optional<Timestamp> last_acked_packet_sent_time;
// The value of |last_acked_packet_ack_time_| at the time the packet was // The value of |last_acked_packet_ack_time_| at the time the packet was
// sent. // sent.
rtc::Optional<Timestamp> last_acked_packet_ack_time; absl::optional<Timestamp> last_acked_packet_ack_time;
// The value of |total_data_acked_| at the time the packet was // The value of |total_data_acked_| at the time the packet was
// sent. // sent.
@ -227,10 +227,10 @@ class BandwidthSampler {
// The time at which the last acknowledged packet was sent. Set to // The time at which the last acknowledged packet was sent. Set to
// Timestamp::Zero() if no valid timestamp is available. // Timestamp::Zero() if no valid timestamp is available.
rtc::Optional<Timestamp> last_acked_packet_sent_time_; absl::optional<Timestamp> last_acked_packet_sent_time_;
// The time at which the most recent packet was acknowledged. // The time at which the most recent packet was acknowledged.
rtc::Optional<Timestamp> last_acked_packet_ack_time_; absl::optional<Timestamp> last_acked_packet_ack_time_;
// The most recently sent packet. // The most recently sent packet.
int64_t last_sent_packet_; int64_t last_sent_packet_;

View file

@ -382,7 +382,7 @@ bool BbrNetworkController::IsProbingForMoreBandwidth() const {
NetworkControlUpdate BbrNetworkController::OnTransportPacketsFeedback( NetworkControlUpdate BbrNetworkController::OnTransportPacketsFeedback(
TransportPacketsFeedback msg) { TransportPacketsFeedback msg) {
Timestamp feedback_recv_time = msg.feedback_time; Timestamp feedback_recv_time = msg.feedback_time;
rtc::Optional<SentPacket> last_sent_packet = absl::optional<SentPacket> last_sent_packet =
msg.PacketsWithFeedback().back().sent_packet; msg.PacketsWithFeedback().back().sent_packet;
if (!last_sent_packet.has_value()) { if (!last_sent_packet.has_value()) {
RTC_LOG(LS_WARNING) << "Last ack packet not in history, no RTT update"; RTC_LOG(LS_WARNING) << "Last ack packet not in history, no RTT update";

View file

@ -26,7 +26,7 @@
#include "modules/congestion_controller/bbr/rtt_stats.h" #include "modules/congestion_controller/bbr/rtt_stats.h"
#include "modules/congestion_controller/bbr/windowed_filter.h" #include "modules/congestion_controller/bbr/windowed_filter.h"
#include "api/optional.h" #include "absl/types/optional.h"
#include "rtc_base/random.h" #include "rtc_base/random.h"
namespace webrtc { namespace webrtc {
@ -217,7 +217,7 @@ class BbrNetworkController : public NetworkControllerInterface {
webrtc::Random random_; webrtc::Random random_;
LossRateFilter loss_rate_; LossRateFilter loss_rate_;
rtc::Optional<TargetRateConstraints> constraints_; absl::optional<TargetRateConstraints> constraints_;
Mode mode_; Mode mode_;
@ -244,7 +244,7 @@ class BbrNetworkController : public NetworkControllerInterface {
MaxAckHeightFilter max_ack_height_; MaxAckHeightFilter max_ack_height_;
// The time this aggregation started and the number of bytes acked during it. // The time this aggregation started and the number of bytes acked during it.
rtc::Optional<Timestamp> aggregation_epoch_start_time_; absl::optional<Timestamp> aggregation_epoch_start_time_;
DataSize aggregation_epoch_bytes_; DataSize aggregation_epoch_bytes_;
// The number of bytes acknowledged since the last time bytes in flight // The number of bytes acknowledged since the last time bytes in flight
@ -308,7 +308,7 @@ class BbrNetworkController : public NetworkControllerInterface {
// Time at which PROBE_RTT has to be exited. Setting it to zero indicates // Time at which PROBE_RTT has to be exited. Setting it to zero indicates
// that the time is yet unknown as the number of packets in flight has not // that the time is yet unknown as the number of packets in flight has not
// reached the required value. // reached the required value.
rtc::Optional<Timestamp> exit_probe_rtt_at_; absl::optional<Timestamp> exit_probe_rtt_at_;
// Indicates whether a round-trip has passed since PROBE_RTT became active. // Indicates whether a round-trip has passed since PROBE_RTT became active.
bool probe_rtt_round_passed_; bool probe_rtt_round_passed_;
@ -321,7 +321,7 @@ class BbrNetworkController : public NetworkControllerInterface {
// Receiving acknowledgement of a packet after |end_recovery_at_| will cause // Receiving acknowledgement of a packet after |end_recovery_at_| will cause
// BBR to exit the recovery mode. A set value indicates at least one // BBR to exit the recovery mode. A set value indicates at least one
// loss has been detected, so it must not be reset. // loss has been detected, so it must not be reset.
rtc::Optional<int64_t> end_recovery_at_; absl::optional<int64_t> end_recovery_at_;
// A window used to limit the number of bytes in flight during loss recovery. // A window used to limit the number of bytes in flight during loss recovery.
DataSize recovery_window_; DataSize recovery_window_;

View file

@ -10,7 +10,7 @@
#ifndef MODULES_CONGESTION_CONTROLLER_BBR_LOSS_RATE_FILTER_H_ #ifndef MODULES_CONGESTION_CONTROLLER_BBR_LOSS_RATE_FILTER_H_
#define MODULES_CONGESTION_CONTROLLER_BBR_LOSS_RATE_FILTER_H_ #define MODULES_CONGESTION_CONTROLLER_BBR_LOSS_RATE_FILTER_H_
#include "api/optional.h" #include "absl/types/optional.h"
namespace webrtc { namespace webrtc {
namespace bbr { namespace bbr {

View file

@ -114,7 +114,7 @@ DelayBasedBwe::~DelayBasedBwe() {}
DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector( DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector(
const std::vector<PacketFeedback>& packet_feedback_vector, const std::vector<PacketFeedback>& packet_feedback_vector,
rtc::Optional<uint32_t> acked_bitrate_bps) { absl::optional<uint32_t> acked_bitrate_bps) {
RTC_DCHECK(std::is_sorted(packet_feedback_vector.begin(), RTC_DCHECK(std::is_sorted(packet_feedback_vector.begin(),
packet_feedback_vector.end(), packet_feedback_vector.end(),
PacketFeedbackComparator())); PacketFeedbackComparator()));
@ -222,12 +222,12 @@ void DelayBasedBwe::IncomingPacketFeedback(
} }
DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate( DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
bool recovered_from_overuse) { bool recovered_from_overuse) {
Result result; Result result;
int64_t now_ms = clock_->TimeInMilliseconds(); int64_t now_ms = clock_->TimeInMilliseconds();
rtc::Optional<int> probe_bitrate_bps = absl::optional<int> probe_bitrate_bps =
probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps(); probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps();
// Currently overusing the bandwidth. // Currently overusing the bandwidth.
if (delay_detector_->State() == BandwidthUsage::kBwOverusing) { if (delay_detector_->State() == BandwidthUsage::kBwOverusing) {
@ -280,7 +280,7 @@ DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
} }
bool DelayBasedBwe::UpdateEstimate(int64_t now_ms, bool DelayBasedBwe::UpdateEstimate(int64_t now_ms,
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
uint32_t* target_bitrate_bps) { uint32_t* target_bitrate_bps) {
// TODO(terelius): RateControlInput::noise_var is deprecated and will be // TODO(terelius): RateControlInput::noise_var is deprecated and will be
// removed. In the meantime, we set it to zero. // removed. In the meantime, we set it to zero.

View file

@ -47,7 +47,7 @@ class DelayBasedBwe {
Result IncomingPacketFeedbackVector( Result IncomingPacketFeedbackVector(
const std::vector<PacketFeedback>& packet_feedback_vector, const std::vector<PacketFeedback>& packet_feedback_vector,
rtc::Optional<uint32_t> acked_bitrate_bps); absl::optional<uint32_t> acked_bitrate_bps);
void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms); void OnRttUpdate(int64_t avg_rtt_ms, int64_t max_rtt_ms);
bool LatestEstimate(std::vector<uint32_t>* ssrcs, bool LatestEstimate(std::vector<uint32_t>* ssrcs,
uint32_t* bitrate_bps) const; uint32_t* bitrate_bps) const;
@ -58,12 +58,12 @@ class DelayBasedBwe {
private: private:
void IncomingPacketFeedback(const PacketFeedback& packet_feedback); void IncomingPacketFeedback(const PacketFeedback& packet_feedback);
Result OnLongFeedbackDelay(int64_t arrival_time_ms); Result OnLongFeedbackDelay(int64_t arrival_time_ms);
Result MaybeUpdateEstimate(rtc::Optional<uint32_t> acked_bitrate_bps, Result MaybeUpdateEstimate(absl::optional<uint32_t> acked_bitrate_bps,
bool request_probe); bool request_probe);
// Updates the current remote rate estimate and returns true if a valid // Updates the current remote rate estimate and returns true if a valid
// estimate exists. // estimate exists.
bool UpdateEstimate(int64_t now_ms, bool UpdateEstimate(int64_t now_ms,
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
uint32_t* target_bitrate_bps); uint32_t* target_bitrate_bps);
rtc::RaceChecker network_race_; rtc::RaceChecker network_race_;

View file

@ -29,7 +29,7 @@ constexpr float kTargetUtilizationFraction = 0.95f;
TEST_F(LegacyDelayBasedBweTest, NoCrashEmptyFeedback) { TEST_F(LegacyDelayBasedBweTest, NoCrashEmptyFeedback) {
std::vector<PacketFeedback> packet_feedback_vector; std::vector<PacketFeedback> packet_feedback_vector;
bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector, bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector,
rtc::nullopt); absl::nullopt);
} }
TEST_F(LegacyDelayBasedBweTest, NoCrashOnlyLostFeedback) { TEST_F(LegacyDelayBasedBweTest, NoCrashOnlyLostFeedback) {
@ -41,7 +41,7 @@ TEST_F(LegacyDelayBasedBweTest, NoCrashOnlyLostFeedback) {
PacketFeedback::kNoSendTime, PacketFeedback::kNoSendTime,
1, 1500, PacedPacketInfo())); 1, 1500, PacedPacketInfo()));
bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector, bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector,
rtc::nullopt); absl::nullopt);
} }
TEST_F(LegacyDelayBasedBweTest, ProbeDetection) { TEST_F(LegacyDelayBasedBweTest, ProbeDetection) {

View file

@ -43,7 +43,6 @@ rtc_static_library("goog_cc") {
"../..:module_api", "../..:module_api",
"../../..:webrtc_common", "../../..:webrtc_common",
"../../../:typedefs", "../../../:typedefs",
"../../../api:optional",
"../../../api/transport:network_control", "../../../api/transport:network_control",
"../../../logging:rtc_event_log_api", "../../../logging:rtc_event_log_api",
"../../../logging:rtc_event_pacing", "../../../logging:rtc_event_pacing",
@ -57,6 +56,7 @@ rtc_static_library("goog_cc") {
"../../pacing", "../../pacing",
"../../remote_bitrate_estimator", "../../remote_bitrate_estimator",
"../../rtp_rtcp:rtp_rtcp_format", "../../rtp_rtcp:rtp_rtcp_format",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -85,7 +85,6 @@ rtc_source_set("estimators") {
} }
deps = [ deps = [
"../../../api:optional",
"../../../logging:rtc_event_bwe", "../../../logging:rtc_event_bwe",
"../../../logging:rtc_event_log_api", "../../../logging:rtc_event_log_api",
"../../../rtc_base:checks", "../../../rtc_base:checks",
@ -96,6 +95,7 @@ rtc_source_set("estimators") {
"../../../system_wrappers:metrics_api", "../../../system_wrappers:metrics_api",
"../../remote_bitrate_estimator", "../../remote_bitrate_estimator",
"../../rtp_rtcp:rtp_rtcp_format", "../../rtp_rtcp:rtp_rtcp_format",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }

View file

@ -47,7 +47,7 @@ void AcknowledgedBitrateEstimator::IncomingPacketFeedbackVector(
} }
} }
rtc::Optional<uint32_t> AcknowledgedBitrateEstimator::bitrate_bps() const { absl::optional<uint32_t> AcknowledgedBitrateEstimator::bitrate_bps() const {
return bitrate_estimator_->bitrate_bps(); return bitrate_estimator_->bitrate_bps();
} }

View file

@ -14,7 +14,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "api/optional.h" #include "absl/types/optional.h"
#include "modules/congestion_controller/goog_cc/bitrate_estimator.h" #include "modules/congestion_controller/goog_cc/bitrate_estimator.h"
namespace webrtc { namespace webrtc {
@ -31,12 +31,12 @@ class AcknowledgedBitrateEstimator {
void IncomingPacketFeedbackVector( void IncomingPacketFeedbackVector(
const std::vector<PacketFeedback>& packet_feedback_vector); const std::vector<PacketFeedback>& packet_feedback_vector);
rtc::Optional<uint32_t> bitrate_bps() const; absl::optional<uint32_t> bitrate_bps() const;
void SetAlrEndedTimeMs(int64_t alr_ended_time_ms); void SetAlrEndedTimeMs(int64_t alr_ended_time_ms);
private: private:
void MaybeExpectFastRateChange(int64_t packet_arrival_time_ms); void MaybeExpectFastRateChange(int64_t packet_arrival_time_ms);
rtc::Optional<int64_t> alr_ended_time_ms_; absl::optional<int64_t> alr_ended_time_ms_;
std::unique_ptr<BitrateEstimator> bitrate_estimator_; std::unique_ptr<BitrateEstimator> bitrate_estimator_;
}; };

View file

@ -35,7 +35,7 @@ constexpr size_t kPayloadSize = 10;
class MockBitrateEstimator : public BitrateEstimator { class MockBitrateEstimator : public BitrateEstimator {
public: public:
MOCK_METHOD2(Update, void(int64_t now_ms, int bytes)); MOCK_METHOD2(Update, void(int64_t now_ms, int bytes));
MOCK_CONST_METHOD0(bitrate_bps, rtc::Optional<uint32_t>()); MOCK_CONST_METHOD0(bitrate_bps, absl::optional<uint32_t>());
MOCK_METHOD0(ExpectFastRateChange, void()); MOCK_METHOD0(ExpectFastRateChange, void());
}; };
@ -124,7 +124,7 @@ TEST(TestAcknowledgedBitrateEstimator, ExpectFastRateChangeWhenLeftAlr) {
TEST(TestAcknowledgedBitrateEstimator, ReturnBitrate) { TEST(TestAcknowledgedBitrateEstimator, ReturnBitrate) {
auto states = CreateTestStates(); auto states = CreateTestStates();
rtc::Optional<uint32_t> return_value(42); absl::optional<uint32_t> return_value(42);
EXPECT_CALL(*states.mock_bitrate_estimator, bitrate_bps()) EXPECT_CALL(*states.mock_bitrate_estimator, bitrate_bps())
.Times(1) .Times(1)
.WillOnce(Return(return_value)); .WillOnce(Return(return_value));

View file

@ -35,7 +35,7 @@ AlrDetector::AlrDetector(RtcEventLog* event_log)
alr_budget_(0, true), alr_budget_(0, true),
event_log_(event_log) { event_log_(event_log) {
RTC_CHECK(AlrExperimentSettings::MaxOneFieldTrialEnabled()); RTC_CHECK(AlrExperimentSettings::MaxOneFieldTrialEnabled());
rtc::Optional<AlrExperimentSettings> experiment_settings = absl::optional<AlrExperimentSettings> experiment_settings =
AlrExperimentSettings::CreateFromFieldTrial( AlrExperimentSettings::CreateFromFieldTrial(
AlrExperimentSettings::kScreenshareProbingBweExperimentName); AlrExperimentSettings::kScreenshareProbingBweExperimentName);
if (!experiment_settings) { if (!experiment_settings) {
@ -89,7 +89,7 @@ void AlrDetector::SetEstimatedBitrate(int bitrate_bps) {
alr_budget_.set_target_rate_kbps(rtc::dchecked_cast<int>(target_rate_kbps)); alr_budget_.set_target_rate_kbps(rtc::dchecked_cast<int>(target_rate_kbps));
} }
rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime() absl::optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
const { const {
return alr_started_time_ms_; return alr_started_time_ms_;
} }

View file

@ -11,7 +11,7 @@
#ifndef MODULES_CONGESTION_CONTROLLER_GOOG_CC_ALR_DETECTOR_H_ #ifndef MODULES_CONGESTION_CONTROLLER_GOOG_CC_ALR_DETECTOR_H_
#define MODULES_CONGESTION_CONTROLLER_GOOG_CC_ALR_DETECTOR_H_ #define MODULES_CONGESTION_CONTROLLER_GOOG_CC_ALR_DETECTOR_H_
#include "api/optional.h" #include "absl/types/optional.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/pacing/interval_budget.h" #include "modules/pacing/interval_budget.h"
#include "modules/pacing/paced_sender.h" #include "modules/pacing/paced_sender.h"
@ -44,7 +44,7 @@ class AlrDetector {
// Returns time in milliseconds when the current application-limited region // Returns time in milliseconds when the current application-limited region
// started or empty result if the sender is currently not application-limited. // started or empty result if the sender is currently not application-limited.
rtc::Optional<int64_t> GetApplicationLimitedRegionStartTime() const; absl::optional<int64_t> GetApplicationLimitedRegionStartTime() const;
// Sent traffic percentage as a function of network capacity used to determine // Sent traffic percentage as a function of network capacity used to determine
// application-limited region. ALR region start when bandwidth usage drops // application-limited region. ALR region start when bandwidth usage drops
@ -63,10 +63,10 @@ class AlrDetector {
int alr_start_budget_level_percent_; int alr_start_budget_level_percent_;
int alr_stop_budget_level_percent_; int alr_stop_budget_level_percent_;
rtc::Optional<int64_t> last_send_time_ms_; absl::optional<int64_t> last_send_time_ms_;
IntervalBudget alr_budget_; IntervalBudget alr_budget_;
rtc::Optional<int64_t> alr_started_time_ms_; absl::optional<int64_t> alr_started_time_ms_;
RtcEventLog* event_log_; RtcEventLog* event_log_;
}; };

View file

@ -65,8 +65,8 @@ class SimulateOutgoingTrafficIn {
} }
AlrDetector* const alr_detector_; AlrDetector* const alr_detector_;
int64_t* timestamp_ms_; int64_t* timestamp_ms_;
rtc::Optional<int> interval_ms_; absl::optional<int> interval_ms_;
rtc::Optional<int> usage_percentage_; absl::optional<int> usage_percentage_;
}; };
} // namespace } // namespace
@ -152,7 +152,7 @@ TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
TEST_F(AlrDetectorTest, ParseControlFieldTrial) { TEST_F(AlrDetectorTest, ParseControlFieldTrial) {
webrtc::test::ScopedFieldTrials field_trial( webrtc::test::ScopedFieldTrials field_trial(
"WebRTC-ProbingScreenshareBwe/Control/"); "WebRTC-ProbingScreenshareBwe/Control/");
rtc::Optional<AlrExperimentSettings> parsed_params = absl::optional<AlrExperimentSettings> parsed_params =
AlrExperimentSettings::CreateFromFieldTrial( AlrExperimentSettings::CreateFromFieldTrial(
"WebRTC-ProbingScreenshareBwe"); "WebRTC-ProbingScreenshareBwe");
EXPECT_FALSE(static_cast<bool>(parsed_params)); EXPECT_FALSE(static_cast<bool>(parsed_params));
@ -161,7 +161,7 @@ TEST_F(AlrDetectorTest, ParseControlFieldTrial) {
TEST_F(AlrDetectorTest, ParseActiveFieldTrial) { TEST_F(AlrDetectorTest, ParseActiveFieldTrial) {
webrtc::test::ScopedFieldTrials field_trial( webrtc::test::ScopedFieldTrials field_trial(
"WebRTC-ProbingScreenshareBwe/1.1,2875,85,20,-20,1/"); "WebRTC-ProbingScreenshareBwe/1.1,2875,85,20,-20,1/");
rtc::Optional<AlrExperimentSettings> parsed_params = absl::optional<AlrExperimentSettings> parsed_params =
AlrExperimentSettings::CreateFromFieldTrial( AlrExperimentSettings::CreateFromFieldTrial(
"WebRTC-ProbingScreenshareBwe"); "WebRTC-ProbingScreenshareBwe");
ASSERT_TRUE(static_cast<bool>(parsed_params)); ASSERT_TRUE(static_cast<bool>(parsed_params));

View file

@ -92,9 +92,9 @@ float BitrateEstimator::UpdateWindow(int64_t now_ms,
return bitrate_sample; return bitrate_sample;
} }
rtc::Optional<uint32_t> BitrateEstimator::bitrate_bps() const { absl::optional<uint32_t> BitrateEstimator::bitrate_bps() const {
if (bitrate_estimate_ < 0.f) if (bitrate_estimate_ < 0.f)
return rtc::nullopt; return absl::nullopt;
return bitrate_estimate_ * 1000; return bitrate_estimate_ * 1000;
} }

View file

@ -13,7 +13,7 @@
#include <vector> #include <vector>
#include "api/optional.h" #include "absl/types/optional.h"
namespace webrtc { namespace webrtc {
@ -28,7 +28,7 @@ class BitrateEstimator {
virtual ~BitrateEstimator(); virtual ~BitrateEstimator();
virtual void Update(int64_t now_ms, int bytes); virtual void Update(int64_t now_ms, int bytes);
virtual rtc::Optional<uint32_t> bitrate_bps() const; virtual absl::optional<uint32_t> bitrate_bps() const;
virtual void ExpectFastRateChange(); virtual void ExpectFastRateChange();

View file

@ -114,7 +114,7 @@ DelayBasedBwe::~DelayBasedBwe() {}
DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector( DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector(
const std::vector<PacketFeedback>& packet_feedback_vector, const std::vector<PacketFeedback>& packet_feedback_vector,
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
int64_t at_time_ms) { int64_t at_time_ms) {
RTC_DCHECK(std::is_sorted(packet_feedback_vector.begin(), RTC_DCHECK(std::is_sorted(packet_feedback_vector.begin(),
packet_feedback_vector.end(), packet_feedback_vector.end(),
@ -225,13 +225,13 @@ void DelayBasedBwe::IncomingPacketFeedback(
} }
DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate( DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
bool recovered_from_overuse, bool recovered_from_overuse,
int64_t at_time_ms) { int64_t at_time_ms) {
Result result; Result result;
int64_t now_ms = at_time_ms; int64_t now_ms = at_time_ms;
rtc::Optional<int> probe_bitrate_bps = absl::optional<int> probe_bitrate_bps =
probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps(); probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps();
// Currently overusing the bandwidth. // Currently overusing the bandwidth.
if (delay_detector_->State() == BandwidthUsage::kBwOverusing) { if (delay_detector_->State() == BandwidthUsage::kBwOverusing) {
@ -284,7 +284,7 @@ DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
} }
bool DelayBasedBwe::UpdateEstimate(int64_t now_ms, bool DelayBasedBwe::UpdateEstimate(int64_t now_ms,
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
uint32_t* target_bitrate_bps) { uint32_t* target_bitrate_bps) {
// TODO(terelius): RateControlInput::noise_var is deprecated and will be // TODO(terelius): RateControlInput::noise_var is deprecated and will be
// removed. In the meantime, we set it to zero. // removed. In the meantime, we set it to zero.

View file

@ -48,7 +48,7 @@ class DelayBasedBwe {
Result IncomingPacketFeedbackVector( Result IncomingPacketFeedbackVector(
const std::vector<PacketFeedback>& packet_feedback_vector, const std::vector<PacketFeedback>& packet_feedback_vector,
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
int64_t at_time_ms); int64_t at_time_ms);
void OnRttUpdate(int64_t avg_rtt_ms); void OnRttUpdate(int64_t avg_rtt_ms);
bool LatestEstimate(std::vector<uint32_t>* ssrcs, bool LatestEstimate(std::vector<uint32_t>* ssrcs,
@ -61,13 +61,13 @@ class DelayBasedBwe {
void IncomingPacketFeedback(const PacketFeedback& packet_feedback, void IncomingPacketFeedback(const PacketFeedback& packet_feedback,
int64_t at_time_ms); int64_t at_time_ms);
Result OnLongFeedbackDelay(int64_t arrival_time_ms); Result OnLongFeedbackDelay(int64_t arrival_time_ms);
Result MaybeUpdateEstimate(rtc::Optional<uint32_t> acked_bitrate_bps, Result MaybeUpdateEstimate(absl::optional<uint32_t> acked_bitrate_bps,
bool request_probe, bool request_probe,
int64_t at_time_ms); int64_t at_time_ms);
// Updates the current remote rate estimate and returns true if a valid // Updates the current remote rate estimate and returns true if a valid
// estimate exists. // estimate exists.
bool UpdateEstimate(int64_t now_ms, bool UpdateEstimate(int64_t now_ms,
rtc::Optional<uint32_t> acked_bitrate_bps, absl::optional<uint32_t> acked_bitrate_bps,
uint32_t* target_bitrate_bps); uint32_t* target_bitrate_bps);
rtc::RaceChecker network_race_; rtc::RaceChecker network_race_;

View file

@ -31,7 +31,7 @@ constexpr int64_t kDummyTimestamp = 1000;
TEST_F(DelayBasedBweTest, NoCrashEmptyFeedback) { TEST_F(DelayBasedBweTest, NoCrashEmptyFeedback) {
std::vector<PacketFeedback> packet_feedback_vector; std::vector<PacketFeedback> packet_feedback_vector;
bitrate_estimator_->IncomingPacketFeedbackVector( bitrate_estimator_->IncomingPacketFeedbackVector(
packet_feedback_vector, rtc::nullopt, kDummyTimestamp); packet_feedback_vector, absl::nullopt, kDummyTimestamp);
} }
TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) { TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) {
@ -43,7 +43,7 @@ TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) {
PacketFeedback::kNoSendTime, PacketFeedback::kNoSendTime,
1, 1500, PacedPacketInfo())); 1, 1500, PacedPacketInfo()));
bitrate_estimator_->IncomingPacketFeedbackVector( bitrate_estimator_->IncomingPacketFeedbackVector(
packet_feedback_vector, rtc::nullopt, kDummyTimestamp); packet_feedback_vector, absl::nullopt, kDummyTimestamp);
} }
TEST_F(DelayBasedBweTest, ProbeDetection) { TEST_F(DelayBasedBweTest, ProbeDetection) {

View file

@ -101,7 +101,7 @@ std::vector<PacketFeedback> ReceivedPacketsFeedbackAsRtp(
return packet_feedback_vector; return packet_feedback_vector;
} }
int64_t GetBpsOrDefault(const rtc::Optional<DataRate>& rate, int64_t GetBpsOrDefault(const absl::optional<DataRate>& rate,
int64_t fallback_bps) { int64_t fallback_bps) {
if (rate && rate->IsFinite()) { if (rate && rate->IsFinite()) {
return rate->bps(); return rate->bps();
@ -175,7 +175,7 @@ NetworkControlUpdate GoogCcNetworkController::OnNetworkRouteChange(
NetworkControlUpdate GoogCcNetworkController::OnProcessInterval( NetworkControlUpdate GoogCcNetworkController::OnProcessInterval(
ProcessInterval msg) { ProcessInterval msg) {
bandwidth_estimation_->UpdateEstimate(msg.at_time.ms()); bandwidth_estimation_->UpdateEstimate(msg.at_time.ms());
rtc::Optional<int64_t> start_time_ms = absl::optional<int64_t> start_time_ms =
alr_detector_->GetApplicationLimitedRegionStartTime(); alr_detector_->GetApplicationLimitedRegionStartTime();
probe_controller_->SetAlrStartTimeMs(start_time_ms); probe_controller_->SetAlrStartTimeMs(start_time_ms);
probe_controller_->Process(msg.at_time.ms()); probe_controller_->Process(msg.at_time.ms());
@ -244,13 +244,13 @@ NetworkControlUpdate GoogCcNetworkController::OnStreamsConfig(
NetworkControlUpdate GoogCcNetworkController::OnTargetRateConstraints( NetworkControlUpdate GoogCcNetworkController::OnTargetRateConstraints(
TargetRateConstraints constraints) { TargetRateConstraints constraints) {
UpdateBitrateConstraints(constraints, rtc::nullopt); UpdateBitrateConstraints(constraints, absl::nullopt);
return MaybeTriggerOnNetworkChanged(constraints.at_time); return MaybeTriggerOnNetworkChanged(constraints.at_time);
} }
void GoogCcNetworkController::UpdateBitrateConstraints( void GoogCcNetworkController::UpdateBitrateConstraints(
TargetRateConstraints constraints, TargetRateConstraints constraints,
rtc::Optional<DataRate> starting_rate) { absl::optional<DataRate> starting_rate) {
int64_t min_bitrate_bps = GetBpsOrDefault(constraints.min_data_rate, 0); int64_t min_bitrate_bps = GetBpsOrDefault(constraints.min_data_rate, 0);
int64_t max_bitrate_bps = GetBpsOrDefault(constraints.max_data_rate, -1); int64_t max_bitrate_bps = GetBpsOrDefault(constraints.max_data_rate, -1);
int64_t start_bitrate_bps = GetBpsOrDefault(starting_rate, -1); int64_t start_bitrate_bps = GetBpsOrDefault(starting_rate, -1);
@ -301,7 +301,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
std::vector<PacketFeedback> received_feedback_vector = std::vector<PacketFeedback> received_feedback_vector =
ReceivedPacketsFeedbackAsRtp(report); ReceivedPacketsFeedbackAsRtp(report);
rtc::Optional<int64_t> alr_start_time = absl::optional<int64_t> alr_start_time =
alr_detector_->GetApplicationLimitedRegionStartTime(); alr_detector_->GetApplicationLimitedRegionStartTime();
if (previously_in_alr && !alr_start_time.has_value()) { if (previously_in_alr && !alr_start_time.has_value()) {
@ -336,13 +336,14 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
return update; return update;
} }
rtc::Optional<DataSize> GoogCcNetworkController::MaybeUpdateCongestionWindow() { absl::optional<DataSize>
GoogCcNetworkController::MaybeUpdateCongestionWindow() {
if (!in_cwnd_experiment_) if (!in_cwnd_experiment_)
return rtc::nullopt; return absl::nullopt;
// No valid RTT. Could be because send-side BWE isn't used, in which case // No valid RTT. Could be because send-side BWE isn't used, in which case
// we don't try to limit the outstanding packets. // we don't try to limit the outstanding packets.
if (!min_feedback_rtt_ms_) if (!min_feedback_rtt_ms_)
return rtc::nullopt; return absl::nullopt;
const DataSize kMinCwnd = DataSize::bytes(2 * 1500); const DataSize kMinCwnd = DataSize::bytes(2 * 1500);
TimeDelta time_window = TimeDelta time_window =

View file

@ -16,7 +16,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "api/optional.h" #include "absl/types/optional.h"
#include "api/transport/network_control.h" #include "api/transport/network_control.h"
#include "logging/rtc_event_log/rtc_event_log.h" #include "logging/rtc_event_log/rtc_event_log.h"
#include "modules/bitrate_controller/send_side_bandwidth_estimation.h" #include "modules/bitrate_controller/send_side_bandwidth_estimation.h"
@ -51,8 +51,8 @@ class GoogCcNetworkController : public NetworkControllerInterface {
private: private:
void UpdateBitrateConstraints(TargetRateConstraints constraints, void UpdateBitrateConstraints(TargetRateConstraints constraints,
rtc::Optional<DataRate> starting_rate); absl::optional<DataRate> starting_rate);
rtc::Optional<DataSize> MaybeUpdateCongestionWindow(); absl::optional<DataSize> MaybeUpdateCongestionWindow();
NetworkControlUpdate MaybeTriggerOnNetworkChanged(Timestamp at_time); NetworkControlUpdate MaybeTriggerOnNetworkChanged(Timestamp at_time);
bool GetNetworkParameters(int32_t* estimated_bitrate_bps, bool GetNetworkParameters(int32_t* estimated_bitrate_bps,
uint8_t* fraction_loss, uint8_t* fraction_loss,
@ -71,10 +71,10 @@ class GoogCcNetworkController : public NetworkControllerInterface {
std::unique_ptr<AcknowledgedBitrateEstimator> acknowledged_bitrate_estimator_; std::unique_ptr<AcknowledgedBitrateEstimator> acknowledged_bitrate_estimator_;
std::deque<int64_t> feedback_rtts_; std::deque<int64_t> feedback_rtts_;
rtc::Optional<int64_t> min_feedback_rtt_ms_; absl::optional<int64_t> min_feedback_rtt_ms_;
DataRate last_bandwidth_; DataRate last_bandwidth_;
rtc::Optional<TargetTransferRate> last_target_rate_; absl::optional<TargetTransferRate> last_target_rate_;
int32_t last_estimated_bitrate_bps_ = 0; int32_t last_estimated_bitrate_bps_ = 0;
uint8_t last_estimated_fraction_loss_ = 0; uint8_t last_estimated_fraction_loss_ = 0;
@ -89,7 +89,7 @@ class GoogCcNetworkController : public NetworkControllerInterface {
int64_t accepted_queue_ms_; int64_t accepted_queue_ms_;
bool previously_in_alr = false; bool previously_in_alr = false;
rtc::Optional<DataSize> current_data_window_; absl::optional<DataSize> current_data_window_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GoogCcNetworkController); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GoogCcNetworkController);
}; };

View file

@ -170,9 +170,9 @@ int ProbeBitrateEstimator::HandleProbeAndEstimateBitrate(
return *estimated_bitrate_bps_; return *estimated_bitrate_bps_;
} }
rtc::Optional<int> absl::optional<int>
ProbeBitrateEstimator::FetchAndResetLastEstimatedBitrateBps() { ProbeBitrateEstimator::FetchAndResetLastEstimatedBitrateBps() {
rtc::Optional<int> estimated_bitrate_bps = estimated_bitrate_bps_; absl::optional<int> estimated_bitrate_bps = estimated_bitrate_bps_;
estimated_bitrate_bps_.reset(); estimated_bitrate_bps_.reset();
return estimated_bitrate_bps; return estimated_bitrate_bps;
} }

View file

@ -28,7 +28,7 @@ class ProbeBitrateEstimator {
// Returns the estimated bitrate if the probe completes a valid cluster. // Returns the estimated bitrate if the probe completes a valid cluster.
int HandleProbeAndEstimateBitrate(const PacketFeedback& packet_feedback); int HandleProbeAndEstimateBitrate(const PacketFeedback& packet_feedback);
rtc::Optional<int> FetchAndResetLastEstimatedBitrateBps(); absl::optional<int> FetchAndResetLastEstimatedBitrateBps();
private: private:
struct AggregatedCluster { struct AggregatedCluster {
@ -47,7 +47,7 @@ class ProbeBitrateEstimator {
std::map<int, AggregatedCluster> clusters_; std::map<int, AggregatedCluster> clusters_;
RtcEventLog* const event_log_; RtcEventLog* const event_log_;
rtc::Optional<int> estimated_bitrate_bps_; absl::optional<int> estimated_bitrate_bps_;
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -209,7 +209,7 @@ void ProbeController::EnablePeriodicAlrProbing(bool enable) {
} }
void ProbeController::SetAlrStartTimeMs( void ProbeController::SetAlrStartTimeMs(
rtc::Optional<int64_t> alr_start_time_ms) { absl::optional<int64_t> alr_start_time_ms) {
alr_start_time_ms_ = alr_start_time_ms; alr_start_time_ms_ = alr_start_time_ms;
} }
void ProbeController::SetAlrEndedTimeMs(int64_t alr_end_time_ms) { void ProbeController::SetAlrEndedTimeMs(int64_t alr_end_time_ms) {

View file

@ -16,7 +16,7 @@
#include <initializer_list> #include <initializer_list>
#include <vector> #include <vector>
#include "api/optional.h" #include "absl/types/optional.h"
#include "api/transport/network_control.h" #include "api/transport/network_control.h"
#include "rtc_base/constructormagic.h" #include "rtc_base/constructormagic.h"
@ -50,7 +50,7 @@ class ProbeController {
void EnablePeriodicAlrProbing(bool enable); void EnablePeriodicAlrProbing(bool enable);
void SetAlrStartTimeMs(rtc::Optional<int64_t> alr_start_time); void SetAlrStartTimeMs(absl::optional<int64_t> alr_start_time);
void SetAlrEndedTimeMs(int64_t alr_end_time); void SetAlrEndedTimeMs(int64_t alr_end_time);
void RequestProbe(int64_t at_time_ms); void RequestProbe(int64_t at_time_ms);
@ -86,8 +86,8 @@ class ProbeController {
int64_t start_bitrate_bps_; int64_t start_bitrate_bps_;
int64_t max_bitrate_bps_; int64_t max_bitrate_bps_;
int64_t last_bwe_drop_probing_time_ms_; int64_t last_bwe_drop_probing_time_ms_;
rtc::Optional<int64_t> alr_start_time_ms_; absl::optional<int64_t> alr_start_time_ms_;
rtc::Optional<int64_t> alr_end_time_ms_; absl::optional<int64_t> alr_end_time_ms_;
bool enable_periodic_alr_probing_; bool enable_periodic_alr_probing_;
int64_t time_of_last_large_drop_ms_; int64_t time_of_last_large_drop_ms_;
int64_t bitrate_before_last_large_drop_bps_; int64_t bitrate_before_last_large_drop_bps_;

View file

@ -161,7 +161,7 @@ TEST_F(ProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
probe_controller_->SetEstimatedBitrate(500, NowMs()); probe_controller_->SetEstimatedBitrate(500, NowMs());
EXPECT_EQ(probe_controller_->GetAndResetPendingProbes().size(), 2u); EXPECT_EQ(probe_controller_->GetAndResetPendingProbes().size(), 2u);
probe_controller_->SetAlrStartTimeMs(rtc::nullopt); probe_controller_->SetAlrStartTimeMs(absl::nullopt);
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1); clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
probe_controller_->Process(NowMs()); probe_controller_->Process(NowMs());
probe_controller_->SetEstimatedBitrate(250, NowMs()); probe_controller_->SetEstimatedBitrate(250, NowMs());
@ -181,7 +181,7 @@ TEST_F(ProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
probe_controller_->SetEstimatedBitrate(500, NowMs()); probe_controller_->SetEstimatedBitrate(500, NowMs());
EXPECT_EQ(probe_controller_->GetAndResetPendingProbes().size(), 2u); EXPECT_EQ(probe_controller_->GetAndResetPendingProbes().size(), 2u);
probe_controller_->SetAlrStartTimeMs(rtc::nullopt); probe_controller_->SetAlrStartTimeMs(absl::nullopt);
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1); clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
probe_controller_->Process(NowMs()); probe_controller_->Process(NowMs());
probe_controller_->SetEstimatedBitrate(250, NowMs()); probe_controller_->SetEstimatedBitrate(250, NowMs());

View file

@ -14,7 +14,7 @@
#include <algorithm> #include <algorithm>
#include "api/optional.h" #include "absl/types/optional.h"
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h" #include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
#include "rtc_base/checks.h" #include "rtc_base/checks.h"
#include "rtc_base/numerics/safe_minmax.h" #include "rtc_base/numerics/safe_minmax.h"
@ -22,7 +22,7 @@
namespace webrtc { namespace webrtc {
namespace { namespace {
rtc::Optional<double> LinearFitSlope( absl::optional<double> LinearFitSlope(
const std::deque<std::pair<double, double>>& points) { const std::deque<std::pair<double, double>>& points) {
RTC_DCHECK(points.size() >= 2); RTC_DCHECK(points.size() >= 2);
// Compute the "center of mass". // Compute the "center of mass".
@ -42,7 +42,7 @@ rtc::Optional<double> LinearFitSlope(
denominator += (point.first - x_avg) * (point.first - x_avg); denominator += (point.first - x_avg) * (point.first - x_avg);
} }
if (denominator == 0) if (denominator == 0)
return rtc::nullopt; return absl::nullopt;
return numerator / denominator; return numerator / denominator;
} }

View file

@ -285,7 +285,7 @@ void ProbeController::Process() {
return; return;
// Probe bandwidth periodically when in ALR state. // Probe bandwidth periodically when in ALR state.
rtc::Optional<int64_t> alr_start_time = absl::optional<int64_t> alr_start_time =
pacer_->GetApplicationLimitedRegionStartTime(); pacer_->GetApplicationLimitedRegionStartTime();
if (alr_start_time && estimated_bitrate_bps_ > 0) { if (alr_start_time && estimated_bitrate_bps_ > 0) {
int64_t next_probe_time_ms = int64_t next_probe_time_ms =

View file

@ -79,7 +79,7 @@ class ProbeController {
int64_t start_bitrate_bps_ RTC_GUARDED_BY(critsect_); int64_t start_bitrate_bps_ RTC_GUARDED_BY(critsect_);
int64_t max_bitrate_bps_ RTC_GUARDED_BY(critsect_); int64_t max_bitrate_bps_ RTC_GUARDED_BY(critsect_);
int64_t last_bwe_drop_probing_time_ms_ RTC_GUARDED_BY(critsect_); int64_t last_bwe_drop_probing_time_ms_ RTC_GUARDED_BY(critsect_);
rtc::Optional<int64_t> alr_end_time_ms_ RTC_GUARDED_BY(critsect_); absl::optional<int64_t> alr_end_time_ms_ RTC_GUARDED_BY(critsect_);
bool enable_periodic_alr_probing_ RTC_GUARDED_BY(critsect_); bool enable_periodic_alr_probing_ RTC_GUARDED_BY(critsect_);
int64_t time_of_last_large_drop_ms_ RTC_GUARDED_BY(critsect_); int64_t time_of_last_large_drop_ms_ RTC_GUARDED_BY(critsect_);
int64_t bitrate_before_last_large_drop_bps_ RTC_GUARDED_BY(critsect_); int64_t bitrate_before_last_large_drop_bps_ RTC_GUARDED_BY(critsect_);

View file

@ -147,7 +147,7 @@ TEST_F(LegacyProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
testing::Mock::VerifyAndClearExpectations(&pacer_); testing::Mock::VerifyAndClearExpectations(&pacer_);
EXPECT_CALL(pacer_, CreateProbeCluster(0.85 * 500)).Times(1); EXPECT_CALL(pacer_, CreateProbeCluster(0.85 * 500)).Times(1);
EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime()) EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime())
.WillRepeatedly(Return(rtc::nullopt)); .WillRepeatedly(Return(absl::nullopt));
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1); clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
probe_controller_->Process(); probe_controller_->Process();
probe_controller_->SetEstimatedBitrate(250); probe_controller_->SetEstimatedBitrate(250);
@ -164,7 +164,7 @@ TEST_F(LegacyProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
testing::Mock::VerifyAndClearExpectations(&pacer_); testing::Mock::VerifyAndClearExpectations(&pacer_);
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0); EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0);
EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime()) EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime())
.WillRepeatedly(Return(rtc::nullopt)); .WillRepeatedly(Return(absl::nullopt));
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1); clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
probe_controller_->Process(); probe_controller_->Process();
probe_controller_->SetEstimatedBitrate(250); probe_controller_->SetEstimatedBitrate(250);

View file

@ -41,7 +41,7 @@ class PacerController {
void SetPacerState(bool paused); void SetPacerState(bool paused);
PacedSender* const pacer_; PacedSender* const pacer_;
rtc::Optional<PacerConfig> current_pacer_config_; absl::optional<PacerConfig> current_pacer_config_;
bool pacer_paused_ = false; bool pacer_paused_ = false;
bool network_available_ = true; bool network_available_ = true;

View file

@ -185,7 +185,7 @@ class ControlHandler {
void OnOutstandingData(DataSize in_flight_data); void OnOutstandingData(DataSize in_flight_data);
void OnPacerQueueUpdate(TimeDelta expected_queue_time); void OnPacerQueueUpdate(TimeDelta expected_queue_time);
rtc::Optional<TargetTransferRate> last_transfer_rate(); absl::optional<TargetTransferRate> last_transfer_rate();
private: private:
void OnNetworkInvalidation(); void OnNetworkInvalidation();
@ -199,8 +199,8 @@ class ControlHandler {
NetworkChangedObserver* observer_ = nullptr; NetworkChangedObserver* observer_ = nullptr;
PacerController* pacer_controller_; PacerController* pacer_controller_;
rtc::Optional<TargetTransferRate> current_target_rate_msg_; absl::optional<TargetTransferRate> current_target_rate_msg_;
rtc::Optional<DataSize> congestion_window_; absl::optional<DataSize> congestion_window_;
DataSize outstanding_data_ = DataSize::Zero(); DataSize outstanding_data_ = DataSize::Zero();
bool network_available_ = true; bool network_available_ = true;
int64_t last_reported_target_bitrate_bps_ = 0; int64_t last_reported_target_bitrate_bps_ = 0;
@ -357,7 +357,7 @@ bool ControlHandler::IsSendQueueFull() const {
return pacer_expected_queue_ms_ > PacedSender::kMaxQueueLengthMs; return pacer_expected_queue_ms_ > PacedSender::kMaxQueueLengthMs;
} }
rtc::Optional<TargetTransferRate> ControlHandler::last_transfer_rate() { absl::optional<TargetTransferRate> ControlHandler::last_transfer_rate() {
RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_checker_); RTC_DCHECK_CALLED_SEQUENTIALLY(&sequenced_checker_);
return current_target_rate_msg_; return current_target_rate_msg_;
} }

View file

@ -167,7 +167,7 @@ class SendSideCongestionControllerTest : public ::testing::Test {
PacketRouter packet_router_; PacketRouter packet_router_;
std::unique_ptr<NiceMock<MockPacedSender>> pacer_; std::unique_ptr<NiceMock<MockPacedSender>> pacer_;
std::unique_ptr<SendSideCongestionControllerForTest> controller_; std::unique_ptr<SendSideCongestionControllerForTest> controller_;
rtc::Optional<uint32_t> target_bitrate_bps_; absl::optional<uint32_t> target_bitrate_bps_;
std::unique_ptr<rtc::TaskQueue> task_queue_; std::unique_ptr<rtc::TaskQueue> task_queue_;
}; };

View file

@ -58,11 +58,11 @@ bool SendTimeHistory::OnSentPacket(uint16_t sequence_number,
return true; return true;
} }
rtc::Optional<PacketFeedback> SendTimeHistory::GetPacket( absl::optional<PacketFeedback> SendTimeHistory::GetPacket(
uint16_t sequence_number) const { uint16_t sequence_number) const {
int64_t unwrapped_seq_num = int64_t unwrapped_seq_num =
seq_num_unwrapper_.UnwrapWithoutUpdate(sequence_number); seq_num_unwrapper_.UnwrapWithoutUpdate(sequence_number);
rtc::Optional<PacketFeedback> optional_feedback; absl::optional<PacketFeedback> optional_feedback;
auto it = history_.find(unwrapped_seq_num); auto it = history_.find(unwrapped_seq_num);
if (it != history_.end()) if (it != history_.end())
optional_feedback.emplace(it->second); optional_feedback.emplace(it->second);

View file

@ -34,7 +34,7 @@ class SendTimeHistory {
bool OnSentPacket(uint16_t sequence_number, int64_t send_time_ms); bool OnSentPacket(uint16_t sequence_number, int64_t send_time_ms);
// Retrieves packet info identified by |sequence_number|. // Retrieves packet info identified by |sequence_number|.
rtc::Optional<PacketFeedback> GetPacket(uint16_t sequence_number) const; absl::optional<PacketFeedback> GetPacket(uint16_t sequence_number) const;
// Look up PacketFeedback for a sent packet, based on the sequence number, and // Look up PacketFeedback for a sent packet, based on the sequence number, and
// populate all fields except for arrival_time. The packet parameter must // populate all fields except for arrival_time. The packet parameter must
@ -54,7 +54,7 @@ class SendTimeHistory {
const int64_t packet_age_limit_ms_; const int64_t packet_age_limit_ms_;
SequenceNumberUnwrapper seq_num_unwrapper_; SequenceNumberUnwrapper seq_num_unwrapper_;
std::map<int64_t, PacketFeedback> history_; std::map<int64_t, PacketFeedback> history_;
rtc::Optional<int64_t> last_ack_seq_num_; absl::optional<int64_t> last_ack_seq_num_;
std::map<RemoteAndLocalNetworkId, size_t> in_flight_bytes_; std::map<RemoteAndLocalNetworkId, size_t> in_flight_bytes_;
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendTimeHistory); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendTimeHistory);

View file

@ -83,7 +83,7 @@ void TransportFeedbackAdapter::OnSentPacket(uint16_t sequence_number,
send_time_history_.OnSentPacket(sequence_number, send_time_ms); send_time_history_.OnSentPacket(sequence_number, send_time_ms);
} }
rtc::Optional<PacketFeedback> TransportFeedbackAdapter::GetPacket( absl::optional<PacketFeedback> TransportFeedbackAdapter::GetPacket(
uint16_t sequence_number) const { uint16_t sequence_number) const {
rtc::CritScope cs(&lock_); rtc::CritScope cs(&lock_);
return send_time_history_.GetPacket(sequence_number); return send_time_history_.GetPacket(sequence_number);

View file

@ -48,7 +48,7 @@ class TransportFeedbackAdapter {
// to the CongestionController interface. // to the CongestionController interface.
void OnTransportFeedback(const rtcp::TransportFeedback& feedback); void OnTransportFeedback(const rtcp::TransportFeedback& feedback);
std::vector<PacketFeedback> GetTransportFeedbackVector() const; std::vector<PacketFeedback> GetTransportFeedbackVector() const;
rtc::Optional<PacketFeedback> GetPacket(uint16_t sequence_number) const; absl::optional<PacketFeedback> GetPacket(uint16_t sequence_number) const;
void SetTransportOverhead(int transport_overhead_bytes_per_packet); void SetTransportOverhead(int transport_overhead_bytes_per_packet);

View file

@ -385,7 +385,7 @@ void SendSideCongestionController::LimitOutstandingBytes(
size_t num_outstanding_bytes) { size_t num_outstanding_bytes) {
RTC_DCHECK(in_cwnd_experiment_); RTC_DCHECK(in_cwnd_experiment_);
rtc::CritScope lock(&network_state_lock_); rtc::CritScope lock(&network_state_lock_);
rtc::Optional<int64_t> min_rtt_ms = absl::optional<int64_t> min_rtt_ms =
transport_feedback_adapter_.GetMinFeedbackLoopRtt(); transport_feedback_adapter_.GetMinFeedbackLoopRtt();
// No valid RTT. Could be because send-side BWE isn't used, in which case // No valid RTT. Could be because send-side BWE isn't used, in which case
// we don't try to limit the outstanding packets. // we don't try to limit the outstanding packets.

View file

@ -142,7 +142,7 @@ class LegacySendSideCongestionControllerTest : public ::testing::Test {
std::unique_ptr<NiceMock<MockPacedSender>> pacer_; std::unique_ptr<NiceMock<MockPacedSender>> pacer_;
std::unique_ptr<SendSideCongestionController> controller_; std::unique_ptr<SendSideCongestionController> controller_;
rtc::Optional<uint32_t> target_bitrate_bps_; absl::optional<uint32_t> target_bitrate_bps_;
}; };
TEST_F(LegacySendSideCongestionControllerTest, OnNetworkChanged) { TEST_F(LegacySendSideCongestionControllerTest, OnNetworkChanged) {

View file

@ -193,7 +193,8 @@ TransportFeedbackAdapter::GetTransportFeedbackVector() const {
return last_packet_feedback_vector_; return last_packet_feedback_vector_;
} }
rtc::Optional<int64_t> TransportFeedbackAdapter::GetMinFeedbackLoopRtt() const { absl::optional<int64_t> TransportFeedbackAdapter::GetMinFeedbackLoopRtt()
const {
rtc::CritScope cs(&lock_); rtc::CritScope cs(&lock_);
return min_feedback_rtt_; return min_feedback_rtt_;
} }

View file

@ -47,7 +47,7 @@ class TransportFeedbackAdapter {
// to the CongestionController interface. // to the CongestionController interface.
void OnTransportFeedback(const rtcp::TransportFeedback& feedback); void OnTransportFeedback(const rtcp::TransportFeedback& feedback);
std::vector<PacketFeedback> GetTransportFeedbackVector() const; std::vector<PacketFeedback> GetTransportFeedbackVector() const;
rtc::Optional<int64_t> GetMinFeedbackLoopRtt() const; absl::optional<int64_t> GetMinFeedbackLoopRtt() const;
void SetTransportOverhead(size_t transport_overhead_bytes_per_packet); void SetTransportOverhead(size_t transport_overhead_bytes_per_packet);
@ -68,7 +68,7 @@ class TransportFeedbackAdapter {
uint16_t local_net_id_ RTC_GUARDED_BY(&lock_); uint16_t local_net_id_ RTC_GUARDED_BY(&lock_);
uint16_t remote_net_id_ RTC_GUARDED_BY(&lock_); uint16_t remote_net_id_ RTC_GUARDED_BY(&lock_);
std::deque<int64_t> feedback_rtts_ RTC_GUARDED_BY(&lock_); std::deque<int64_t> feedback_rtts_ RTC_GUARDED_BY(&lock_);
rtc::Optional<int64_t> min_feedback_rtt_ RTC_GUARDED_BY(&lock_); absl::optional<int64_t> min_feedback_rtt_ RTC_GUARDED_BY(&lock_);
rtc::CriticalSection observers_lock_; rtc::CriticalSection observers_lock_;
std::vector<PacketFeedbackObserver*> observers_ std::vector<PacketFeedbackObserver*> observers_

View file

@ -38,7 +38,6 @@ rtc_static_library("pacing") {
"..:module_api", "..:module_api",
"../../:typedefs", "../../:typedefs",
"../../:webrtc_common", "../../:webrtc_common",
"../../api:optional",
"../../logging:rtc_event_bwe", "../../logging:rtc_event_bwe",
"../../logging:rtc_event_log_api", "../../logging:rtc_event_log_api",
"../../logging:rtc_event_pacing", "../../logging:rtc_event_pacing",
@ -52,6 +51,7 @@ rtc_static_library("pacing") {
"../rtp_rtcp", "../rtp_rtcp",
"../rtp_rtcp:rtp_rtcp_format", "../rtp_rtcp:rtp_rtcp_format",
"../utility", "../utility",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }

View file

@ -34,7 +34,7 @@ AlrDetector::AlrDetector(RtcEventLog* event_log)
alr_budget_(0, true), alr_budget_(0, true),
event_log_(event_log) { event_log_(event_log) {
RTC_CHECK(AlrExperimentSettings::MaxOneFieldTrialEnabled()); RTC_CHECK(AlrExperimentSettings::MaxOneFieldTrialEnabled());
rtc::Optional<AlrExperimentSettings> experiment_settings = absl::optional<AlrExperimentSettings> experiment_settings =
AlrExperimentSettings::CreateFromFieldTrial( AlrExperimentSettings::CreateFromFieldTrial(
AlrExperimentSettings::kScreenshareProbingBweExperimentName); AlrExperimentSettings::kScreenshareProbingBweExperimentName);
if (!experiment_settings) { if (!experiment_settings) {
@ -79,7 +79,7 @@ void AlrDetector::SetEstimatedBitrate(int bitrate_bps) {
alr_budget_.set_target_rate_kbps(rtc::dchecked_cast<int>(target_rate_kbps)); alr_budget_.set_target_rate_kbps(rtc::dchecked_cast<int>(target_rate_kbps));
} }
rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime() absl::optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
const { const {
return alr_started_time_ms_; return alr_started_time_ms_;
} }

View file

@ -11,7 +11,7 @@
#ifndef MODULES_PACING_ALR_DETECTOR_H_ #ifndef MODULES_PACING_ALR_DETECTOR_H_
#define MODULES_PACING_ALR_DETECTOR_H_ #define MODULES_PACING_ALR_DETECTOR_H_
#include "api/optional.h" #include "absl/types/optional.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/pacing/interval_budget.h" #include "modules/pacing/interval_budget.h"
#include "modules/pacing/paced_sender.h" #include "modules/pacing/paced_sender.h"
@ -42,7 +42,7 @@ class AlrDetector {
// Returns time in milliseconds when the current application-limited region // Returns time in milliseconds when the current application-limited region
// started or empty result if the sender is currently not application-limited. // started or empty result if the sender is currently not application-limited.
rtc::Optional<int64_t> GetApplicationLimitedRegionStartTime() const; absl::optional<int64_t> GetApplicationLimitedRegionStartTime() const;
// Sent traffic percentage as a function of network capacity used to determine // Sent traffic percentage as a function of network capacity used to determine
// application-limited region. ALR region start when bandwidth usage drops // application-limited region. ALR region start when bandwidth usage drops
@ -62,7 +62,7 @@ class AlrDetector {
int alr_stop_budget_level_percent_; int alr_stop_budget_level_percent_;
IntervalBudget alr_budget_; IntervalBudget alr_budget_;
rtc::Optional<int64_t> alr_started_time_ms_; absl::optional<int64_t> alr_started_time_ms_;
RtcEventLog* event_log_; RtcEventLog* event_log_;
}; };

View file

@ -60,8 +60,8 @@ class SimulateOutgoingTrafficIn {
} }
} }
AlrDetector* const alr_detector_; AlrDetector* const alr_detector_;
rtc::Optional<int> interval_ms_; absl::optional<int> interval_ms_;
rtc::Optional<int> usage_percentage_; absl::optional<int> usage_percentage_;
}; };
} // namespace } // namespace
@ -146,7 +146,7 @@ TEST_F(LegacyAlrDetectorTest, BandwidthEstimateChanges) {
TEST_F(LegacyAlrDetectorTest, ParseControlFieldTrial) { TEST_F(LegacyAlrDetectorTest, ParseControlFieldTrial) {
webrtc::test::ScopedFieldTrials field_trial( webrtc::test::ScopedFieldTrials field_trial(
"WebRTC-ProbingScreenshareBwe/Control/"); "WebRTC-ProbingScreenshareBwe/Control/");
rtc::Optional<AlrExperimentSettings> parsed_params = absl::optional<AlrExperimentSettings> parsed_params =
AlrExperimentSettings::CreateFromFieldTrial( AlrExperimentSettings::CreateFromFieldTrial(
"WebRTC-ProbingScreenshareBwe"); "WebRTC-ProbingScreenshareBwe");
EXPECT_FALSE(static_cast<bool>(parsed_params)); EXPECT_FALSE(static_cast<bool>(parsed_params));
@ -155,7 +155,7 @@ TEST_F(LegacyAlrDetectorTest, ParseControlFieldTrial) {
TEST_F(LegacyAlrDetectorTest, ParseActiveFieldTrial) { TEST_F(LegacyAlrDetectorTest, ParseActiveFieldTrial) {
webrtc::test::ScopedFieldTrials field_trial( webrtc::test::ScopedFieldTrials field_trial(
"WebRTC-ProbingScreenshareBwe/1.1,2875,85,20,-20,1/"); "WebRTC-ProbingScreenshareBwe/1.1,2875,85,20,-20,1/");
rtc::Optional<AlrExperimentSettings> parsed_params = absl::optional<AlrExperimentSettings> parsed_params =
AlrExperimentSettings::CreateFromFieldTrial( AlrExperimentSettings::CreateFromFieldTrial(
"WebRTC-ProbingScreenshareBwe"); "WebRTC-ProbingScreenshareBwe");
ASSERT_TRUE(static_cast<bool>(parsed_params)); ASSERT_TRUE(static_cast<bool>(parsed_params));

View file

@ -36,7 +36,7 @@ class MockPacedSender : public PacedSender {
MOCK_CONST_METHOD0(QueueInPackets, int()); MOCK_CONST_METHOD0(QueueInPackets, int());
MOCK_CONST_METHOD0(ExpectedQueueTimeMs, int64_t()); MOCK_CONST_METHOD0(ExpectedQueueTimeMs, int64_t());
MOCK_CONST_METHOD0(GetApplicationLimitedRegionStartTime, MOCK_CONST_METHOD0(GetApplicationLimitedRegionStartTime,
rtc::Optional<int64_t>()); absl::optional<int64_t>());
MOCK_METHOD0(Process, void()); MOCK_METHOD0(Process, void());
}; };

View file

@ -211,7 +211,7 @@ int64_t PacedSender::ExpectedQueueTimeMs() const {
pacing_bitrate_kbps_); pacing_bitrate_kbps_);
} }
rtc::Optional<int64_t> PacedSender::GetApplicationLimitedRegionStartTime() absl::optional<int64_t> PacedSender::GetApplicationLimitedRegionStartTime()
const { const {
rtc::CritScope cs(&critsect_); rtc::CritScope cs(&critsect_);
return alr_detector_->GetApplicationLimitedRegionStartTime(); return alr_detector_->GetApplicationLimitedRegionStartTime();

View file

@ -13,7 +13,7 @@
#include <memory> #include <memory>
#include "api/optional.h" #include "absl/types/optional.h"
#include "modules/pacing/pacer.h" #include "modules/pacing/pacer.h"
#include "modules/pacing/packet_queue_interface.h" #include "modules/pacing/packet_queue_interface.h"
#include "rtc_base/criticalsection.h" #include "rtc_base/criticalsection.h"
@ -128,7 +128,7 @@ class PacedSender : public Pacer {
virtual int64_t ExpectedQueueTimeMs() const; virtual int64_t ExpectedQueueTimeMs() const;
// Deprecated, alr detection will be moved out of the pacer. // Deprecated, alr detection will be moved out of the pacer.
virtual rtc::Optional<int64_t> GetApplicationLimitedRegionStartTime() const; virtual absl::optional<int64_t> GetApplicationLimitedRegionStartTime() const;
// Returns the number of milliseconds until the module want a worker thread // Returns the number of milliseconds until the module want a worker thread
// to call Process. // to call Process.

View file

@ -83,8 +83,8 @@ class RoundRobinPacketQueue : public PacketQueueInterface {
const Clock* const clock_; const Clock* const clock_;
int64_t time_last_updated_; int64_t time_last_updated_;
rtc::Optional<Packet> pop_packet_; absl::optional<Packet> pop_packet_;
rtc::Optional<Stream*> pop_stream_; absl::optional<Stream*> pop_stream_;
bool paused_ = false; bool paused_ = false;
size_t size_packets_ = 0; size_t size_packets_ = 0;

View file

@ -46,7 +46,6 @@ rtc_static_library("remote_bitrate_estimator") {
deps = [ deps = [
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs", "../../:typedefs",
"../../api:optional",
"../../modules:module_api", "../../modules:module_api",
"../../modules/rtp_rtcp:rtp_rtcp_format", "../../modules/rtp_rtcp:rtp_rtcp_format",
"../../rtc_base:checks", "../../rtc_base:checks",
@ -55,6 +54,7 @@ rtc_static_library("remote_bitrate_estimator") {
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:field_trial_api", "../../system_wrappers:field_trial_api",
"../../system_wrappers:metrics_api", "../../system_wrappers:metrics_api",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -135,7 +135,6 @@ if (rtc_include_tests) {
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs", "../../:typedefs",
"../../api:optional",
"../../logging:mocks", "../../logging:mocks",
"../../rtc_base:checks", "../../rtc_base:checks",
"../../rtc_base:gtest_prod", "../../rtc_base:gtest_prod",
@ -161,6 +160,7 @@ if (rtc_include_tests) {
"../rtp_rtcp:rtp_rtcp_format", "../rtp_rtcp:rtp_rtcp_format",
"../video_coding:video_coding_utility", "../video_coding:video_coding_utility",
"//testing/gtest", "//testing/gtest",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }

View file

@ -256,7 +256,7 @@ uint32_t AimdRateControl::ChangeBitrate(uint32_t new_bitrate_bps,
// If bitrate decreases more than a normal back off after overuse, it // If bitrate decreases more than a normal back off after overuse, it
// indicates a real network degradation. We do not let such a decrease // indicates a real network degradation. We do not let such a decrease
// to determine the bandwidth estimation period. // to determine the bandwidth estimation period.
last_decrease_ = rtc::nullopt; last_decrease_ = absl::nullopt;
} else { } else {
last_decrease_ = current_bitrate_bps_ - new_bitrate_bps; last_decrease_ = current_bitrate_bps_ - new_bitrate_bps;
} }

View file

@ -87,7 +87,7 @@ class AimdRateControl {
int64_t rtt_; int64_t rtt_;
bool in_experiment_; bool in_experiment_;
bool smoothing_experiment_; bool smoothing_experiment_;
rtc::Optional<int> last_decrease_; absl::optional<int> last_decrease_;
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -43,7 +43,7 @@ AimdRateControlStates CreateAimdRateControlStates() {
void UpdateRateControl(const AimdRateControlStates& states, void UpdateRateControl(const AimdRateControlStates& states,
const BandwidthUsage& bandwidth_usage, const BandwidthUsage& bandwidth_usage,
rtc::Optional<uint32_t> bitrate, absl::optional<uint32_t> bitrate,
int64_t now_ms) { int64_t now_ms) {
RateControlInput input(bandwidth_usage, bitrate, now_ms); RateControlInput input(bandwidth_usage, bitrate, now_ms);
states.aimd_rate_control->Update(&input, now_ms); states.aimd_rate_control->Update(&input, now_ms);
@ -261,7 +261,7 @@ TEST(AimdRateControlTest, SendingRateBoundedWhenThroughputNotEstimated) {
UpdateRateControl(states, BandwidthUsage::kBwNormal, kInitialBitrateBps, UpdateRateControl(states, BandwidthUsage::kBwNormal, kInitialBitrateBps,
states.simulated_clock->TimeInMilliseconds()); states.simulated_clock->TimeInMilliseconds());
for (int i = 0; i < 100; ++i) { for (int i = 0; i < 100; ++i) {
UpdateRateControl(states, BandwidthUsage::kBwNormal, rtc::nullopt, UpdateRateControl(states, BandwidthUsage::kBwNormal, absl::nullopt,
states.simulated_clock->TimeInMilliseconds()); states.simulated_clock->TimeInMilliseconds());
states.simulated_clock->AdvanceTimeMilliseconds(100); states.simulated_clock->AdvanceTimeMilliseconds(100);
} }

View file

@ -30,7 +30,7 @@ int GetMinBitrateBps() {
RateControlInput::RateControlInput( RateControlInput::RateControlInput(
BandwidthUsage bw_state, BandwidthUsage bw_state,
const rtc::Optional<uint32_t>& incoming_bitrate, const absl::optional<uint32_t>& incoming_bitrate,
double noise_var) double noise_var)
: bw_state(bw_state), : bw_state(bw_state),
incoming_bitrate(incoming_bitrate), incoming_bitrate(incoming_bitrate),

View file

@ -11,7 +11,7 @@
#ifndef MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_ #ifndef MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
#define MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_ #define MODULES_REMOTE_BITRATE_ESTIMATOR_INCLUDE_BWE_DEFINES_H_
#include "api/optional.h" #include "absl/types/optional.h"
#include "typedefs.h" // NOLINT(build/include) #include "typedefs.h" // NOLINT(build/include)
#define BWE_MAX(a, b) ((a) > (b) ? (a) : (b)) #define BWE_MAX(a, b) ((a) > (b) ? (a) : (b))
@ -48,12 +48,12 @@ enum RateControlRegion { kRcNearMax, kRcAboveMax, kRcMaxUnknown };
struct RateControlInput { struct RateControlInput {
RateControlInput(BandwidthUsage bw_state, RateControlInput(BandwidthUsage bw_state,
const rtc::Optional<uint32_t>& incoming_bitrate, const absl::optional<uint32_t>& incoming_bitrate,
double noise_var); double noise_var);
~RateControlInput(); ~RateControlInput();
BandwidthUsage bw_state; BandwidthUsage bw_state;
rtc::Optional<uint32_t> incoming_bitrate; absl::optional<uint32_t> incoming_bitrate;
double noise_var; double noise_var;
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -248,7 +248,7 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo(
// here. // here.
// Check if incoming bitrate estimate is valid, and if it needs to be reset. // Check if incoming bitrate estimate is valid, and if it needs to be reset.
rtc::Optional<uint32_t> incoming_bitrate = absl::optional<uint32_t> incoming_bitrate =
incoming_bitrate_.Rate(arrival_time_ms); incoming_bitrate_.Rate(arrival_time_ms);
if (incoming_bitrate) { if (incoming_bitrate) {
incoming_bitrate_initialized_ = true; incoming_bitrate_initialized_ = true;
@ -322,7 +322,7 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo(
now_ms - last_update_ms_ > remote_rate_.GetFeedbackInterval()) { now_ms - last_update_ms_ > remote_rate_.GetFeedbackInterval()) {
update_estimate = true; update_estimate = true;
} else if (detector_.State() == BandwidthUsage::kBwOverusing) { } else if (detector_.State() == BandwidthUsage::kBwOverusing) {
rtc::Optional<uint32_t> incoming_rate = absl::optional<uint32_t> incoming_rate =
incoming_bitrate_.Rate(arrival_time_ms); incoming_bitrate_.Rate(arrival_time_ms);
if (incoming_rate && if (incoming_rate &&
remote_rate_.TimeToReduceFurther(now_ms, *incoming_rate)) { remote_rate_.TimeToReduceFurther(now_ms, *incoming_rate)) {

View file

@ -97,7 +97,7 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket(
estimator->last_packet_time_ms = now_ms; estimator->last_packet_time_ms = now_ms;
// Check if incoming bitrate estimate is valid, and if it needs to be reset. // Check if incoming bitrate estimate is valid, and if it needs to be reset.
rtc::Optional<uint32_t> incoming_bitrate = incoming_bitrate_.Rate(now_ms); absl::optional<uint32_t> incoming_bitrate = incoming_bitrate_.Rate(now_ms);
if (incoming_bitrate) { if (incoming_bitrate) {
last_valid_incoming_bitrate_ = *incoming_bitrate; last_valid_incoming_bitrate_ = *incoming_bitrate;
} else if (last_valid_incoming_bitrate_ > 0) { } else if (last_valid_incoming_bitrate_ > 0) {
@ -124,7 +124,7 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket(
estimator->estimator.num_of_deltas(), now_ms); estimator->estimator.num_of_deltas(), now_ms);
} }
if (estimator->detector.State() == BandwidthUsage::kBwOverusing) { if (estimator->detector.State() == BandwidthUsage::kBwOverusing) {
rtc::Optional<uint32_t> incoming_bitrate_bps = absl::optional<uint32_t> incoming_bitrate_bps =
incoming_bitrate_.Rate(now_ms); incoming_bitrate_.Rate(now_ms);
if (incoming_bitrate_bps && if (incoming_bitrate_bps &&
(prior_state != BandwidthUsage::kBwOverusing || (prior_state != BandwidthUsage::kBwOverusing ||

View file

@ -277,15 +277,15 @@ size_t BbrBweSender::TargetCongestionWindow(float gain) {
return target_congestion_window; return target_congestion_window;
} }
rtc::Optional<int64_t> BbrBweSender::CalculateBandwidthSample( absl::optional<int64_t> BbrBweSender::CalculateBandwidthSample(
size_t data_sent_bytes, size_t data_sent_bytes,
int64_t send_time_delta_ms, int64_t send_time_delta_ms,
size_t data_acked_bytes, size_t data_acked_bytes,
int64_t ack_time_delta_ms) { int64_t ack_time_delta_ms) {
rtc::Optional<int64_t> bandwidth_sample; absl::optional<int64_t> bandwidth_sample;
if (send_time_delta_ms > 0) if (send_time_delta_ms > 0)
bandwidth_sample.emplace(data_sent_bytes * 8000 / send_time_delta_ms); bandwidth_sample.emplace(data_sent_bytes * 8000 / send_time_delta_ms);
rtc::Optional<int64_t> ack_rate; absl::optional<int64_t> ack_rate;
if (ack_time_delta_ms > 0) if (ack_time_delta_ms > 0)
ack_rate.emplace(data_acked_bytes * 8000 / ack_time_delta_ms); ack_rate.emplace(data_acked_bytes * 8000 / ack_time_delta_ms);
// If send rate couldn't be calculated automaticaly set |bandwidth_sample| to // If send rate couldn't be calculated automaticaly set |bandwidth_sample| to
@ -311,7 +311,7 @@ void BbrBweSender::AddSampleForHighGain() {
data_acked_before_high_gain_started_bytes_; data_acked_before_high_gain_started_bytes_;
int64_t ack_time_delta_ms = last_packet_ack_time_during_high_gain_ms_ - int64_t ack_time_delta_ms = last_packet_ack_time_during_high_gain_ms_ -
first_packet_ack_time_during_high_gain_ms_; first_packet_ack_time_during_high_gain_ms_;
rtc::Optional<int64_t> bandwidth_sample = CalculateBandwidthSample( absl::optional<int64_t> bandwidth_sample = CalculateBandwidthSample(
data_sent_bytes, send_time_delta_ms, data_acked_bytes, ack_time_delta_ms); data_sent_bytes, send_time_delta_ms, data_acked_bytes, ack_time_delta_ms);
if (bandwidth_sample) if (bandwidth_sample)
max_bandwidth_filter_->AddBandwidthSample(*bandwidth_sample, round_count_); max_bandwidth_filter_->AddBandwidthSample(*bandwidth_sample, round_count_);
@ -322,7 +322,7 @@ void BbrBweSender::UpdateBandwidthAndMinRtt(
int64_t now_ms, int64_t now_ms,
const std::vector<uint16_t>& feedback_vector, const std::vector<uint16_t>& feedback_vector,
int64_t bytes_acked) { int64_t bytes_acked) {
rtc::Optional<int64_t> min_rtt_sample_ms; absl::optional<int64_t> min_rtt_sample_ms;
for (uint16_t f : feedback_vector) { for (uint16_t f : feedback_vector) {
PacketStats packet = packet_stats_[f]; PacketStats packet = packet_stats_[f];
size_t data_sent_bytes = size_t data_sent_bytes =
@ -333,7 +333,7 @@ void BbrBweSender::UpdateBandwidthAndMinRtt(
packet.data_acked_before_last_acked_packet_bytes; packet.data_acked_before_last_acked_packet_bytes;
int64_t ack_time_delta_ms = int64_t ack_time_delta_ms =
packet.ack_time_ms - packet.last_acked_packet_ack_time_ms; packet.ack_time_ms - packet.last_acked_packet_ack_time_ms;
rtc::Optional<int64_t> bandwidth_sample = absl::optional<int64_t> bandwidth_sample =
CalculateBandwidthSample(data_sent_bytes, send_time_delta_ms, CalculateBandwidthSample(data_sent_bytes, send_time_delta_ms,
data_acked_bytes, ack_time_delta_ms); data_acked_bytes, ack_time_delta_ms);
if (bandwidth_sample) if (bandwidth_sample)

View file

@ -17,7 +17,7 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "api/optional.h" #include "absl/types/optional.h"
#include "modules/remote_bitrate_estimator/test/bwe.h" #include "modules/remote_bitrate_estimator/test/bwe.h"
#include "rtc_base/numerics/sequence_number_util.h" #include "rtc_base/numerics/sequence_number_util.h"
#include "rtc_base/random.h" #include "rtc_base/random.h"
@ -129,10 +129,10 @@ class BbrBweSender : public BweSender {
// Calculates and returns bandwidth sample as minimum between send rate and // Calculates and returns bandwidth sample as minimum between send rate and
// ack rate, returns nothing if sample cannot be calculated. // ack rate, returns nothing if sample cannot be calculated.
rtc::Optional<int64_t> CalculateBandwidthSample(size_t data_sent, absl::optional<int64_t> CalculateBandwidthSample(size_t data_sent,
int64_t send_time_delta_ms, int64_t send_time_delta_ms,
size_t data_acked, size_t data_acked,
int64_t ack_time_delta_ms); int64_t ack_time_delta_ms);
// Calculate and add bandwidth sample only for packets' sent during high gain // Calculate and add bandwidth sample only for packets' sent during high gain
// phase. Motivation of having a seperate bucket for high gain phase is to // phase. Motivation of having a seperate bucket for high gain phase is to
@ -174,7 +174,7 @@ class BbrBweSender : public BweSender {
// First moment of time when data inflight decreased below // First moment of time when data inflight decreased below
// kMinimumCongestionWindow in PROBE_RTT mode. // kMinimumCongestionWindow in PROBE_RTT mode.
rtc::Optional<int64_t> minimum_congestion_window_start_time_ms_; absl::optional<int64_t> minimum_congestion_window_start_time_ms_;
// First round when data inflight decreased below kMinimumCongestionWindow in // First round when data inflight decreased below kMinimumCongestionWindow in
// PROBE_RTT mode. // PROBE_RTT mode.
@ -188,7 +188,7 @@ class BbrBweSender : public BweSender {
// Send time of a packet sent first during high gain phase. Also serves as a // Send time of a packet sent first during high gain phase. Also serves as a
// flag, holding value means that we are already in high gain. // flag, holding value means that we are already in high gain.
rtc::Optional<int64_t> first_packet_send_time_during_high_gain_ms_; absl::optional<int64_t> first_packet_send_time_during_high_gain_ms_;
// Send time of a packet sent last during high gain phase. // Send time of a packet sent last during high gain phase.
int64_t last_packet_send_time_during_high_gain_ms_; int64_t last_packet_send_time_during_high_gain_ms_;

View file

@ -33,7 +33,7 @@ CongestionWindow::~CongestionWindow() {}
int CongestionWindow::GetCongestionWindow(BbrBweSender::Mode mode, int CongestionWindow::GetCongestionWindow(BbrBweSender::Mode mode,
int64_t bandwidth_estimate_bps, int64_t bandwidth_estimate_bps,
rtc::Optional<int64_t> min_rtt_ms, absl::optional<int64_t> min_rtt_ms,
float gain) { float gain) {
return GetTargetCongestionWindow(bandwidth_estimate_bps, min_rtt_ms, gain); return GetTargetCongestionWindow(bandwidth_estimate_bps, min_rtt_ms, gain);
} }
@ -49,7 +49,7 @@ void CongestionWindow::AckReceived(size_t received_packet_size_bytes) {
int CongestionWindow::GetTargetCongestionWindow( int CongestionWindow::GetTargetCongestionWindow(
int64_t bandwidth_estimate_bps, int64_t bandwidth_estimate_bps,
rtc::Optional<int64_t> min_rtt_ms, absl::optional<int64_t> min_rtt_ms,
float gain) { float gain) {
// If we have no rtt sample yet, return the starting congestion window size. // If we have no rtt sample yet, return the starting congestion window size.
if (!min_rtt_ms) if (!min_rtt_ms)

View file

@ -14,7 +14,7 @@
#include "modules/remote_bitrate_estimator/test/estimators/bbr.h" #include "modules/remote_bitrate_estimator/test/estimators/bbr.h"
#include "api/optional.h" #include "absl/types/optional.h"
namespace webrtc { namespace webrtc {
namespace testing { namespace testing {
@ -25,10 +25,10 @@ class CongestionWindow {
~CongestionWindow(); ~CongestionWindow();
int GetCongestionWindow(BbrBweSender::Mode mode, int GetCongestionWindow(BbrBweSender::Mode mode,
int64_t bandwidth_estimate, int64_t bandwidth_estimate,
rtc::Optional<int64_t> min_rtt, absl::optional<int64_t> min_rtt,
float gain); float gain);
int GetTargetCongestionWindow(int64_t bandwidth_estimate, int GetTargetCongestionWindow(int64_t bandwidth_estimate,
rtc::Optional<int64_t> min_rtt, absl::optional<int64_t> min_rtt,
float gain); float gain);
// Packet sent from sender, meaning it is inflight until we receive it and we // Packet sent from sender, meaning it is inflight until we receive it and we
// should add packet's size to data_inflight. // should add packet's size to data_inflight.

View file

@ -16,7 +16,7 @@
#include <limits> #include <limits>
#include <list> #include <list>
#include "api/optional.h" #include "absl/types/optional.h"
namespace webrtc { namespace webrtc {
namespace testing { namespace testing {
@ -36,7 +36,7 @@ class MinRttFilter {
MinRttFilter() {} MinRttFilter() {}
~MinRttFilter() {} ~MinRttFilter() {}
rtc::Optional<int64_t> min_rtt_ms() { return min_rtt_ms_; } absl::optional<int64_t> min_rtt_ms() { return min_rtt_ms_; }
void AddRttSample(int64_t rtt_ms, int64_t now_ms) { void AddRttSample(int64_t rtt_ms, int64_t now_ms) {
if (!min_rtt_ms_ || rtt_ms <= *min_rtt_ms_ || MinRttExpired(now_ms)) { if (!min_rtt_ms_ || rtt_ms <= *min_rtt_ms_ || MinRttExpired(now_ms)) {
min_rtt_ms_.emplace(rtt_ms); min_rtt_ms_.emplace(rtt_ms);
@ -63,7 +63,7 @@ class MinRttFilter {
} }
private: private:
rtc::Optional<int64_t> min_rtt_ms_; absl::optional<int64_t> min_rtt_ms_;
std::list<int64_t> rtt_samples_; std::list<int64_t> rtt_samples_;
}; };
} // namespace bwe } // namespace bwe

View file

@ -17,7 +17,6 @@ rtc_static_library("encoded_frame") {
deps = [ deps = [
":video_codec_interface", ":video_codec_interface",
"../../:webrtc_common", "../../:webrtc_common",
"../../api:optional",
"../../api/video:video_frame_i420", "../../api/video:video_frame_i420",
"../../common_video:common_video", "../../common_video:common_video",
"../../modules:module_api", "../../modules:module_api",
@ -28,6 +27,7 @@ rtc_static_library("encoded_frame") {
"../../rtc_base/experiments:alr_experiment", "../../rtc_base/experiments:alr_experiment",
"../../system_wrappers:field_trial_api", "../../system_wrappers:field_trial_api",
"../../system_wrappers:system_wrappers", "../../system_wrappers:system_wrappers",
"//third_party/abseil-cpp/absl/types:optional",
] ]
if (!build_with_chromium && is_clang) { if (!build_with_chromium && is_clang) {
@ -165,7 +165,6 @@ rtc_static_library("video_coding") {
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs", "../../:typedefs",
"../../api:fec_controller_api", "../../api:fec_controller_api",
"../../api:optional",
"../../api/video:encoded_frame", "../../api/video:encoded_frame",
"../../api/video:video_frame", "../../api/video:video_frame",
"../../api/video:video_frame_i420", "../../api/video:video_frame_i420",
@ -185,6 +184,7 @@ rtc_static_library("video_coding") {
"../../system_wrappers:metrics_api", "../../system_wrappers:metrics_api",
"../rtp_rtcp:rtp_rtcp_format", "../rtp_rtcp:rtp_rtcp_format",
"../utility:utility", "../utility:utility",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -258,7 +258,6 @@ rtc_source_set("video_coding_utility") {
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs", "../../:typedefs",
"../../api:optional",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
"../../common_video", "../../common_video",
"../../modules/rtp_rtcp", "../../modules/rtp_rtcp",
@ -270,6 +269,7 @@ rtc_source_set("video_coding_utility") {
"../../rtc_base/experiments:quality_scaling_experiment", "../../rtc_base/experiments:quality_scaling_experiment",
"../../system_wrappers", "../../system_wrappers",
"../rtp_rtcp:rtp_rtcp_format", "../rtp_rtcp:rtp_rtcp_format",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -412,7 +412,6 @@ rtc_static_library("webrtc_vp8_helpers") {
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs", "../../:typedefs",
"../../api:optional",
"../../api/video:video_frame", "../../api/video:video_frame",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
"../../common_video", "../../common_video",
@ -422,6 +421,7 @@ rtc_static_library("webrtc_vp8_helpers") {
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:field_trial_api", "../../system_wrappers:field_trial_api",
"../../system_wrappers:metrics_api", "../../system_wrappers:metrics_api",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/libyuv", "//third_party/libyuv",
] ]
} }
@ -454,7 +454,6 @@ rtc_static_library("webrtc_vp8") {
"..:module_api", "..:module_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../:typedefs", "../../:typedefs",
"../../api:optional",
"../../api/video:video_frame", "../../api/video:video_frame",
"../../api/video_codecs:video_codecs_api", "../../api/video_codecs:video_codecs_api",
"../../common_video", "../../common_video",
@ -464,6 +463,7 @@ rtc_static_library("webrtc_vp8") {
"../../system_wrappers", "../../system_wrappers",
"../../system_wrappers:field_trial_api", "../../system_wrappers:field_trial_api",
"../../system_wrappers:metrics_api", "../../system_wrappers:metrics_api",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/libyuv", "//third_party/libyuv",
] ]
if (rtc_build_libvpx) { if (rtc_build_libvpx) {
@ -758,7 +758,6 @@ if (rtc_include_tests) {
"../..:webrtc_common", "../..:webrtc_common",
"../../api:create_videocodec_test_fixture_api", "../../api:create_videocodec_test_fixture_api",
"../../api:mock_video_codec_factory", "../../api:mock_video_codec_factory",
"../../api:optional",
"../../api:videocodec_test_fixture_api", "../../api:videocodec_test_fixture_api",
"../../api/video:video_frame_i420", "../../api/video:video_frame_i420",
"../../api/video_codecs:rtc_software_fallback_wrappers", "../../api/video_codecs:rtc_software_fallback_wrappers",
@ -773,6 +772,7 @@ if (rtc_include_tests) {
"../../test:test_support", "../../test:test_support",
"../../test:video_test_common", "../../test:video_test_common",
"../rtp_rtcp:rtp_rtcp_format", "../rtp_rtcp:rtp_rtcp_format",
"//third_party/abseil-cpp/absl/types:optional",
] ]
data = video_coding_modules_tests_resources data = video_coding_modules_tests_resources

View file

@ -43,7 +43,7 @@ bool IsH264CodecSupported() {
SdpVideoFormat CreateH264Format(H264::Profile profile, SdpVideoFormat CreateH264Format(H264::Profile profile,
H264::Level level, H264::Level level,
const std::string& packetization_mode) { const std::string& packetization_mode) {
const rtc::Optional<std::string> profile_string = const absl::optional<std::string> profile_string =
H264::ProfileLevelIdToString(H264::ProfileLevelId(profile, level)); H264::ProfileLevelIdToString(H264::ProfileLevelId(profile, level));
RTC_CHECK(profile_string); RTC_CHECK(profile_string);
return SdpVideoFormat( return SdpVideoFormat(

View file

@ -325,7 +325,7 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
RTC_CHECK_EQ(av_frame_->data[kVPlaneIndex], i420_buffer->DataV()); RTC_CHECK_EQ(av_frame_->data[kVPlaneIndex], i420_buffer->DataV());
video_frame->set_timestamp(input_image._timeStamp); video_frame->set_timestamp(input_image._timeStamp);
rtc::Optional<uint8_t> qp; absl::optional<uint8_t> qp;
// TODO(sakal): Maybe it is possible to get QP directly from FFmpeg. // TODO(sakal): Maybe it is possible to get QP directly from FFmpeg.
h264_bitstream_parser_.ParseBitstream(input_image._buffer, h264_bitstream_parser_.ParseBitstream(input_image._buffer,
input_image._length); input_image._length);
@ -351,10 +351,10 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
video_frame->rotation()); video_frame->rotation());
// TODO(nisse): Timestamp and rotation are all zero here. Change decoder // TODO(nisse): Timestamp and rotation are all zero here. Change decoder
// interface to pass a VideoFrameBuffer instead of a VideoFrame? // interface to pass a VideoFrameBuffer instead of a VideoFrame?
decoded_image_callback_->Decoded(cropped_frame, rtc::nullopt, qp); decoded_image_callback_->Decoded(cropped_frame, absl::nullopt, qp);
} else { } else {
// Return decoded frame. // Return decoded frame.
decoded_image_callback_->Decoded(*video_frame, rtc::nullopt, qp); decoded_image_callback_->Decoded(*video_frame, absl::nullopt, qp);
} }
// Stop referencing it, possibly freeing |video_frame|. // Stop referencing it, possibly freeing |video_frame|.
av_frame_unref(av_frame_.get()); av_frame_unref(av_frame_.get());

View file

@ -50,7 +50,7 @@ TEST_F(TestH264Impl, MAYBE_EncodeDecode) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, 0)); decoder_->Decode(encoded_frame, false, nullptr, 0));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36); EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
@ -67,7 +67,7 @@ TEST_F(TestH264Impl, MAYBE_DecodedQpEqualsEncodedQp) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, 0)); decoder_->Decode(encoded_frame, false, nullptr, 0));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
ASSERT_TRUE(decoded_qp); ASSERT_TRUE(decoded_qp);

View file

@ -42,8 +42,8 @@ class MultiplexDecoderAdapter : public VideoDecoder {
void Decoded(AlphaCodecStream stream_idx, void Decoded(AlphaCodecStream stream_idx,
VideoFrame* decoded_image, VideoFrame* decoded_image,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp); absl::optional<uint8_t> qp);
private: private:
// Wrapper class that redirects Decoded() calls. // Wrapper class that redirects Decoded() calls.
@ -53,11 +53,11 @@ class MultiplexDecoderAdapter : public VideoDecoder {
struct DecodedImageData; struct DecodedImageData;
void MergeAlphaImages(VideoFrame* decoded_image, void MergeAlphaImages(VideoFrame* decoded_image,
const rtc::Optional<int32_t>& decode_time_ms, const absl::optional<int32_t>& decode_time_ms,
const rtc::Optional<uint8_t>& qp, const absl::optional<uint8_t>& qp,
VideoFrame* multiplex_decoded_image, VideoFrame* multiplex_decoded_image,
const rtc::Optional<int32_t>& multiplex_decode_time_ms, const absl::optional<int32_t>& multiplex_decode_time_ms,
const rtc::Optional<uint8_t>& multiplex_qp); const absl::optional<uint8_t>& multiplex_qp);
VideoDecoderFactory* const factory_; VideoDecoderFactory* const factory_;
const SdpVideoFormat associated_format_; const SdpVideoFormat associated_format_;

View file

@ -33,8 +33,8 @@ class MultiplexDecoderAdapter::AdapterDecodedImageCallback
: adapter_(adapter), stream_idx_(stream_idx) {} : adapter_(adapter), stream_idx_(stream_idx) {}
void Decoded(VideoFrame& decoded_image, void Decoded(VideoFrame& decoded_image,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) override { absl::optional<uint8_t> qp) override {
if (!adapter_) if (!adapter_)
return; return;
adapter_->Decoded(stream_idx_, &decoded_image, decode_time_ms, qp); adapter_->Decoded(stream_idx_, &decoded_image, decode_time_ms, qp);
@ -64,16 +64,16 @@ struct MultiplexDecoderAdapter::DecodedImageData {
} }
DecodedImageData(AlphaCodecStream stream_idx, DecodedImageData(AlphaCodecStream stream_idx,
const VideoFrame& decoded_image, const VideoFrame& decoded_image,
const rtc::Optional<int32_t>& decode_time_ms, const absl::optional<int32_t>& decode_time_ms,
const rtc::Optional<uint8_t>& qp) const absl::optional<uint8_t>& qp)
: stream_idx_(stream_idx), : stream_idx_(stream_idx),
decoded_image_(decoded_image), decoded_image_(decoded_image),
decode_time_ms_(decode_time_ms), decode_time_ms_(decode_time_ms),
qp_(qp) {} qp_(qp) {}
const AlphaCodecStream stream_idx_; const AlphaCodecStream stream_idx_;
VideoFrame decoded_image_; VideoFrame decoded_image_;
const rtc::Optional<int32_t> decode_time_ms_; const absl::optional<int32_t> decode_time_ms_;
const rtc::Optional<uint8_t> qp_; const absl::optional<uint8_t> qp_;
private: private:
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DecodedImageData); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DecodedImageData);
@ -153,8 +153,8 @@ int32_t MultiplexDecoderAdapter::Release() {
void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx, void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
VideoFrame* decoded_image, VideoFrame* decoded_image,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) { absl::optional<uint8_t> qp) {
const auto& other_decoded_data_it = const auto& other_decoded_data_it =
decoded_data_.find(decoded_image->timestamp()); decoded_data_.find(decoded_image->timestamp());
if (other_decoded_data_it != decoded_data_.end()) { if (other_decoded_data_it != decoded_data_.end()) {
@ -184,11 +184,11 @@ void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
void MultiplexDecoderAdapter::MergeAlphaImages( void MultiplexDecoderAdapter::MergeAlphaImages(
VideoFrame* decoded_image, VideoFrame* decoded_image,
const rtc::Optional<int32_t>& decode_time_ms, const absl::optional<int32_t>& decode_time_ms,
const rtc::Optional<uint8_t>& qp, const absl::optional<uint8_t>& qp,
VideoFrame* alpha_decoded_image, VideoFrame* alpha_decoded_image,
const rtc::Optional<int32_t>& alpha_decode_time_ms, const absl::optional<int32_t>& alpha_decode_time_ms,
const rtc::Optional<uint8_t>& alpha_qp) { const absl::optional<uint8_t>& alpha_qp) {
if (!alpha_decoded_image->timestamp()) { if (!alpha_decoded_image->timestamp()) {
decoded_complete_callback_->Decoded(*decoded_image, decode_time_ms, qp); decoded_complete_callback_->Decoded(*decoded_image, decode_time_ms, qp);
return; return;

View file

@ -132,7 +132,7 @@ TEST_F(TestMultiplexAdapter, EncodeDecodeI420Frame) {
WEBRTC_VIDEO_CODEC_OK, WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, &codec_specific_info, -1)); decoder_->Decode(encoded_frame, false, &codec_specific_info, -1));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36); EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
@ -150,7 +150,7 @@ TEST_F(TestMultiplexAdapter, EncodeDecodeI420AFrame) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, 0)); decoder_->Decode(encoded_frame, false, nullptr, 0));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
EXPECT_GT(I420PSNR(yuva_frame.get(), decoded_frame.get()), 36); EXPECT_GT(I420PSNR(yuva_frame.get(), decoded_frame.get()), 36);

View file

@ -50,8 +50,8 @@ VideoCodecUnitTest::FakeEncodeCompleteCallback::OnEncodedImage(
void VideoCodecUnitTest::FakeDecodeCompleteCallback::Decoded( void VideoCodecUnitTest::FakeDecodeCompleteCallback::Decoded(
VideoFrame& frame, VideoFrame& frame,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) { absl::optional<uint8_t> qp) {
rtc::CritScope lock(&test_->decoded_frame_section_); rtc::CritScope lock(&test_->decoded_frame_section_);
test_->decoded_frame_.emplace(frame); test_->decoded_frame_.emplace(frame);
test_->decoded_qp_ = qp; test_->decoded_qp_ = qp;
@ -71,7 +71,8 @@ void VideoCodecUnitTest::SetUp() {
input_frame_generator_ = test::FrameGenerator::CreateSquareGenerator( input_frame_generator_ = test::FrameGenerator::CreateSquareGenerator(
codec_settings_.width, codec_settings_.height, codec_settings_.width, codec_settings_.height,
rtc::Optional<test::FrameGenerator::OutputType>(), rtc::Optional<int>()); absl::optional<test::FrameGenerator::OutputType>(),
absl::optional<int>());
encoder_ = CreateEncoder(); encoder_ = CreateEncoder();
decoder_ = CreateDecoder(); decoder_ = CreateDecoder();
@ -141,7 +142,7 @@ bool VideoCodecUnitTest::WaitForEncodedFrames(
} }
bool VideoCodecUnitTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame, bool VideoCodecUnitTest::WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
rtc::Optional<uint8_t>* qp) { absl::optional<uint8_t>* qp) {
bool ret = decoded_frame_event_.Wait(kDecodeTimeoutMs); bool ret = decoded_frame_event_.Wait(kDecodeTimeoutMs);
EXPECT_TRUE(ret) << "Timed out while waiting for a decoded frame."; EXPECT_TRUE(ret) << "Timed out while waiting for a decoded frame.";
// This becomes unsafe if there are multiple threads waiting for frames. // This becomes unsafe if there are multiple threads waiting for frames.

View file

@ -67,8 +67,8 @@ class VideoCodecUnitTest : public ::testing::Test {
return -1; return -1;
} }
void Decoded(VideoFrame& frame, void Decoded(VideoFrame& frame,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) override; absl::optional<uint8_t> qp) override;
private: private:
VideoCodecUnitTest* const test_; VideoCodecUnitTest* const test_;
@ -97,7 +97,7 @@ class VideoCodecUnitTest : public ::testing::Test {
// Helper method for waiting a single decoded frame. // Helper method for waiting a single decoded frame.
bool WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame, bool WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
rtc::Optional<uint8_t>* qp); absl::optional<uint8_t>* qp);
size_t GetNumEncodedFrames(); size_t GetNumEncodedFrames();
@ -120,9 +120,9 @@ class VideoCodecUnitTest : public ::testing::Test {
rtc::Event decoded_frame_event_; rtc::Event decoded_frame_event_;
rtc::CriticalSection decoded_frame_section_; rtc::CriticalSection decoded_frame_section_;
rtc::Optional<VideoFrame> decoded_frame_ absl::optional<VideoFrame> decoded_frame_
RTC_GUARDED_BY(decoded_frame_section_); RTC_GUARDED_BY(decoded_frame_section_);
rtc::Optional<uint8_t> decoded_qp_ RTC_GUARDED_BY(decoded_frame_section_); absl::optional<uint8_t> decoded_qp_ RTC_GUARDED_BY(decoded_frame_section_);
std::unique_ptr<test::FrameGenerator> input_frame_generator_; std::unique_ptr<test::FrameGenerator> input_frame_generator_;
uint32_t last_input_frame_timestamp_; uint32_t last_input_frame_timestamp_;

View file

@ -151,8 +151,8 @@ class VideoProcessor {
} }
void Decoded(webrtc::VideoFrame& image, void Decoded(webrtc::VideoFrame& image,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) override { absl::optional<uint8_t> qp) override {
Decoded(image); Decoded(image);
} }

View file

@ -17,7 +17,7 @@
#include "modules/video_coding/codecs/vp8/temporal_layers.h" #include "modules/video_coding/codecs/vp8/temporal_layers.h"
#include "api/optional.h" #include "absl/types/optional.h"
namespace webrtc { namespace webrtc {
@ -52,7 +52,7 @@ class DefaultTemporalLayers : public TemporalLayers {
uint8_t pattern_idx_; uint8_t pattern_idx_;
bool last_base_layer_sync_; bool last_base_layer_sync_;
// Updated cumulative bitrates, per temporal layer. // Updated cumulative bitrates, per temporal layer.
rtc::Optional<std::vector<uint32_t>> new_bitrates_bps_; absl::optional<std::vector<uint32_t>> new_bitrates_bps_;
}; };
class DefaultTemporalLayersChecker : public TemporalLayersChecker { class DefaultTemporalLayersChecker : public TemporalLayersChecker {

View file

@ -308,7 +308,7 @@ int LibvpxVp8Decoder::ReturnFrame(const vpx_image_t* img,
VideoFrame decoded_image(buffer, timestamp, 0, kVideoRotation_0); VideoFrame decoded_image(buffer, timestamp, 0, kVideoRotation_0);
decoded_image.set_ntp_time_ms(ntp_time_ms); decoded_image.set_ntp_time_ms(ntp_time_ms);
decode_complete_callback_->Decoded(decoded_image, rtc::nullopt, qp); decode_complete_callback_->Decoded(decoded_image, absl::nullopt, qp);
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }

View file

@ -72,9 +72,9 @@ class ScreenshareLayers : public TemporalLayers {
uint32_t max_debt_bytes_; uint32_t max_debt_bytes_;
// Configured max framerate. // Configured max framerate.
rtc::Optional<uint32_t> target_framerate_; absl::optional<uint32_t> target_framerate_;
// Incoming framerate from capturer. // Incoming framerate from capturer.
rtc::Optional<uint32_t> capture_framerate_; absl::optional<uint32_t> capture_framerate_;
// Tracks what framerate we actually encode, and drops frames on overshoot. // Tracks what framerate we actually encode, and drops frames on overshoot.
RateStatistics encode_framerate_; RateStatistics encode_framerate_;
bool bitrate_updated_; bool bitrate_updated_;

View file

@ -138,11 +138,11 @@ class ScreenshareLayerTest : public ::testing::Test {
// FrameEncoded() call will be omitted and needs to be done by the caller. // FrameEncoded() call will be omitted and needs to be done by the caller.
// Returns the flags for the last frame. // Returns the flags for the last frame.
int SkipUntilTl(int layer) { int SkipUntilTl(int layer) {
return SkipUntilTlAndSync(layer, rtc::nullopt); return SkipUntilTlAndSync(layer, absl::nullopt);
} }
// Same as SkipUntilTl, but also waits until the sync bit condition is met. // Same as SkipUntilTl, but also waits until the sync bit condition is met.
int SkipUntilTlAndSync(int layer, rtc::Optional<bool> sync) { int SkipUntilTlAndSync(int layer, absl::optional<bool> sync) {
int flags = 0; int flags = 0;
const int kMaxFramesToSkip = const int kMaxFramesToSkip =
1 + (sync.value_or(false) ? kMaxSyncPeriodSeconds : 1) * kFrameRate; 1 + (sync.value_or(false) ? kMaxSyncPeriodSeconds : 1) * kFrameRate;

View file

@ -150,8 +150,8 @@ class SimulcastTestFixtureImpl::Vp8TestDecodedImageCallback
return -1; return -1;
} }
void Decoded(VideoFrame& decoded_image, void Decoded(VideoFrame& decoded_image,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) override { absl::optional<uint8_t> qp) override {
Decoded(decoded_image); Decoded(decoded_image);
} }
int DecodedFrames() { return decoded_frames_; } int DecodedFrames() { return decoded_frames_; }

View file

@ -162,7 +162,7 @@ TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, -1)); decoder_->Decode(encoded_frame, false, nullptr, -1));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
ASSERT_TRUE(decoded_qp); ASSERT_TRUE(decoded_qp);
@ -249,7 +249,7 @@ TEST_F(TestVp8Impl, MAYBE_AlignedStrideEncodeDecode) {
decoder_->Decode(encoded_frame, false, nullptr, -1)); decoder_->Decode(encoded_frame, false, nullptr, -1));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
// Compute PSNR on all planes (faster than SSIM). // Compute PSNR on all planes (faster than SSIM).
@ -283,7 +283,7 @@ TEST_F(TestVp8Impl, MAYBE_DecodeWithACompleteKeyFrame) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, -1)); decoder_->Decode(encoded_frame, false, nullptr, -1));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36); EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);

View file

@ -80,7 +80,7 @@ TEST_F(TestVp9Impl, EncodeDecode) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, 0)); decoder_->Decode(encoded_frame, false, nullptr, 0));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36); EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
@ -118,7 +118,7 @@ TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) {
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK, EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, 0)); decoder_->Decode(encoded_frame, false, nullptr, 0));
std::unique_ptr<VideoFrame> decoded_frame; std::unique_ptr<VideoFrame> decoded_frame;
rtc::Optional<uint8_t> decoded_qp; absl::optional<uint8_t> decoded_qp;
ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp)); ASSERT_TRUE(WaitForDecodedFrame(&decoded_frame, &decoded_qp));
ASSERT_TRUE(decoded_frame); ASSERT_TRUE(decoded_frame);
ASSERT_TRUE(decoded_qp); ASSERT_TRUE(decoded_qp);

View file

@ -1101,7 +1101,7 @@ int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img,
0 /* render_time_ms */, webrtc::kVideoRotation_0); 0 /* render_time_ms */, webrtc::kVideoRotation_0);
decoded_image.set_ntp_time_ms(ntp_time_ms); decoded_image.set_ntp_time_ms(ntp_time_ms);
decode_complete_callback_->Decoded(decoded_image, rtc::nullopt, qp); decode_complete_callback_->Decoded(decoded_image, absl::nullopt, qp);
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }

View file

@ -113,7 +113,7 @@ class VP9EncoderImpl : public VP9Encoder {
InterLayerPredMode inter_layer_pred_; InterLayerPredMode inter_layer_pred_;
// Framerate controller. // Framerate controller.
rtc::Optional<float> target_framerate_fps_; absl::optional<float> target_framerate_fps_;
RateStatistics output_framerate_; RateStatistics output_framerate_;
uint32_t last_encoded_frame_rtp_timestamp_; uint32_t last_encoded_frame_rtp_timestamp_;

View file

@ -599,7 +599,7 @@ void FrameBuffer::UpdateJitterDelay() {
void FrameBuffer::UpdateTimingFrameInfo() { void FrameBuffer::UpdateTimingFrameInfo() {
TRACE_EVENT0("webrtc", "FrameBuffer::UpdateTimingFrameInfo"); TRACE_EVENT0("webrtc", "FrameBuffer::UpdateTimingFrameInfo");
rtc::Optional<TimingFrameInfo> info = timing_->GetTimingFrameInfo(); absl::optional<TimingFrameInfo> info = timing_->GetTimingFrameInfo();
if (info && stats_callback_) if (info && stats_callback_)
stats_callback_->OnTimingFrameInfoUpdated(*info); stats_callback_->OnTimingFrameInfoUpdated(*info);
} }

View file

@ -156,11 +156,11 @@ bool RtpFrameObject::delayed_by_retransmission() const {
return times_nacked() > 0; return times_nacked() > 0;
} }
rtc::Optional<RTPVideoTypeHeader> RtpFrameObject::GetCodecHeader() const { absl::optional<RTPVideoTypeHeader> RtpFrameObject::GetCodecHeader() const {
rtc::CritScope lock(&packet_buffer_->crit_); rtc::CritScope lock(&packet_buffer_->crit_);
VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_); VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_);
if (!packet) if (!packet)
return rtc::nullopt; return absl::nullopt;
return packet->video_header.codecHeader; return packet->video_header.codecHeader;
} }

View file

@ -11,7 +11,7 @@
#ifndef MODULES_VIDEO_CODING_FRAME_OBJECT_H_ #ifndef MODULES_VIDEO_CODING_FRAME_OBJECT_H_
#define MODULES_VIDEO_CODING_FRAME_OBJECT_H_ #define MODULES_VIDEO_CODING_FRAME_OBJECT_H_
#include "api/optional.h" #include "absl/types/optional.h"
#include "api/video/encoded_frame.h" #include "api/video/encoded_frame.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/include/module_common_types.h" #include "modules/include/module_common_types.h"
@ -41,7 +41,7 @@ class RtpFrameObject : public EncodedFrame {
int64_t ReceivedTime() const override; int64_t ReceivedTime() const override;
int64_t RenderTime() const override; int64_t RenderTime() const override;
bool delayed_by_retransmission() const override; bool delayed_by_retransmission() const override;
rtc::Optional<RTPVideoTypeHeader> GetCodecHeader() const; absl::optional<RTPVideoTypeHeader> GetCodecHeader() const;
private: private:
rtc::scoped_refptr<PacketBuffer> packet_buffer_; rtc::scoped_refptr<PacketBuffer> packet_buffer_;

View file

@ -57,15 +57,15 @@ int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) {
int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
int64_t decode_time_ms) { int64_t decode_time_ms) {
Decoded(decodedImage, Decoded(decodedImage,
decode_time_ms >= 0 ? rtc::Optional<int32_t>(decode_time_ms) decode_time_ms >= 0 ? absl::optional<int32_t>(decode_time_ms)
: rtc::nullopt, : absl::nullopt,
rtc::nullopt); absl::nullopt);
return WEBRTC_VIDEO_CODEC_OK; return WEBRTC_VIDEO_CODEC_OK;
} }
void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) { absl::optional<uint8_t> qp) {
RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point"; RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded", TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
"timestamp", decodedImage.timestamp()); "timestamp", decodedImage.timestamp());

View file

@ -46,8 +46,8 @@ class VCMDecodedFrameCallback : public DecodedImageCallback {
int32_t Decoded(VideoFrame& decodedImage) override; int32_t Decoded(VideoFrame& decodedImage) override;
int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) override; int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) override;
void Decoded(VideoFrame& decodedImage, void Decoded(VideoFrame& decodedImage,
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp) override; absl::optional<uint8_t> qp) override;
int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) override; int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) override;
int32_t ReceivedDecodedFrame(const uint64_t pictureId) override; int32_t ReceivedDecodedFrame(const uint64_t pictureId) override;

View file

@ -12,7 +12,7 @@
#include <vector> #include <vector>
#include "api/optional.h" #include "absl/types/optional.h"
#include "api/video/i420_buffer.h" #include "api/video/i420_buffer.h"
#include "modules/include/module_common_types_public.h" #include "modules/include/module_common_types_public.h"
#include "modules/video_coding/encoded_frame.h" #include "modules/video_coding/encoded_frame.h"
@ -178,7 +178,7 @@ VCMEncodedFrameCallback::VCMEncodedFrameCallback(
incorrect_capture_time_logged_messages_(0), incorrect_capture_time_logged_messages_(0),
reordered_frames_logged_messages_(0), reordered_frames_logged_messages_(0),
stalled_encoder_logged_messages_(0) { stalled_encoder_logged_messages_(0) {
rtc::Optional<AlrExperimentSettings> experiment_settings = absl::optional<AlrExperimentSettings> experiment_settings =
AlrExperimentSettings::CreateFromFieldTrial( AlrExperimentSettings::CreateFromFieldTrial(
AlrExperimentSettings::kStrictPacingAndProbingExperimentName); AlrExperimentSettings::kStrictPacingAndProbingExperimentName);
if (experiment_settings) { if (experiment_settings) {
@ -249,10 +249,10 @@ void VCMEncodedFrameCallback::OnEncodeStarted(uint32_t rtp_timestamp,
rtp_timestamp, capture_time_ms, rtc::TimeMillis()); rtp_timestamp, capture_time_ms, rtc::TimeMillis());
} }
rtc::Optional<int64_t> VCMEncodedFrameCallback::ExtractEncodeStartTime( absl::optional<int64_t> VCMEncodedFrameCallback::ExtractEncodeStartTime(
size_t simulcast_svc_idx, size_t simulcast_svc_idx,
EncodedImage* encoded_image) { EncodedImage* encoded_image) {
rtc::Optional<int64_t> result; absl::optional<int64_t> result;
size_t num_simulcast_svc_streams = timing_frames_info_.size(); size_t num_simulcast_svc_streams = timing_frames_info_.size();
if (simulcast_svc_idx < num_simulcast_svc_streams) { if (simulcast_svc_idx < num_simulcast_svc_streams) {
auto encode_start_list = auto encode_start_list =
@ -308,8 +308,8 @@ rtc::Optional<int64_t> VCMEncodedFrameCallback::ExtractEncodeStartTime(
void VCMEncodedFrameCallback::FillTimingInfo(size_t simulcast_svc_idx, void VCMEncodedFrameCallback::FillTimingInfo(size_t simulcast_svc_idx,
EncodedImage* encoded_image) { EncodedImage* encoded_image) {
rtc::Optional<size_t> outlier_frame_size; absl::optional<size_t> outlier_frame_size;
rtc::Optional<int64_t> encode_start_ms; absl::optional<int64_t> encode_start_ms;
uint8_t timing_flags = VideoSendTiming::kNotTriggered; uint8_t timing_flags = VideoSendTiming::kNotTriggered;
{ {
rtc::CritScope crit(&timing_params_lock_); rtc::CritScope crit(&timing_params_lock_);

View file

@ -79,8 +79,8 @@ class VCMEncodedFrameCallback : public EncodedImageCallback {
private: private:
// For non-internal-source encoders, returns encode started time and fixes // For non-internal-source encoders, returns encode started time and fixes
// capture timestamp for the frame, if corrupted by the encoder. // capture timestamp for the frame, if corrupted by the encoder.
rtc::Optional<int64_t> ExtractEncodeStartTime(size_t simulcast_svc_idx, absl::optional<int64_t> ExtractEncodeStartTime(size_t simulcast_svc_idx,
EncodedImage* encoded_image) EncodedImage* encoded_image)
RTC_EXCLUSIVE_LOCKS_REQUIRED(timing_params_lock_); RTC_EXCLUSIVE_LOCKS_REQUIRED(timing_params_lock_);
void FillTimingInfo(size_t simulcast_svc_idx, EncodedImage* encoded_image); void FillTimingInfo(size_t simulcast_svc_idx, EncodedImage* encoded_image);

View file

@ -219,9 +219,9 @@ void H264SpsPpsTracker::InsertSpsPpsNalus(const std::vector<uint8_t>& sps,
RTC_LOG(LS_WARNING) << "SPS Nalu header missing"; RTC_LOG(LS_WARNING) << "SPS Nalu header missing";
return; return;
} }
rtc::Optional<SpsParser::SpsState> parsed_sps = SpsParser::ParseSps( absl::optional<SpsParser::SpsState> parsed_sps = SpsParser::ParseSps(
sps.data() + kNaluHeaderOffset, sps.size() - kNaluHeaderOffset); sps.data() + kNaluHeaderOffset, sps.size() - kNaluHeaderOffset);
rtc::Optional<PpsParser::PpsState> parsed_pps = PpsParser::ParsePps( absl::optional<PpsParser::PpsState> parsed_pps = PpsParser::ParsePps(
pps.data() + kNaluHeaderOffset, pps.size() - kNaluHeaderOffset); pps.data() + kNaluHeaderOffset, pps.size() - kNaluHeaderOffset);
if (!parsed_sps) { if (!parsed_sps) {

View file

@ -34,7 +34,7 @@ class MockVCMReceiveCallback : public VCMReceiveCallback {
virtual ~MockVCMReceiveCallback() {} virtual ~MockVCMReceiveCallback() {}
MOCK_METHOD3(FrameToRender, MOCK_METHOD3(FrameToRender,
int32_t(VideoFrame&, rtc::Optional<uint8_t>, VideoContentType)); int32_t(VideoFrame&, absl::optional<uint8_t>, VideoContentType));
MOCK_METHOD1(ReceivedDecodedReferenceFrame, int32_t(const uint64_t)); MOCK_METHOD1(ReceivedDecodedReferenceFrame, int32_t(const uint64_t));
MOCK_METHOD1(OnIncomingPayloadType, void(int)); MOCK_METHOD1(OnIncomingPayloadType, void(int));
MOCK_METHOD1(OnDecoderImplementationName, void(const char*)); MOCK_METHOD1(OnDecoderImplementationName, void(const char*));

View file

@ -58,8 +58,8 @@ class MockDecodedImageCallback : public DecodedImageCallback {
int64_t decode_time_ms)); int64_t decode_time_ms));
MOCK_METHOD3(Decoded, MOCK_METHOD3(Decoded,
void(VideoFrame& decodedImage, // NOLINT void(VideoFrame& decodedImage, // NOLINT
rtc::Optional<int32_t> decode_time_ms, absl::optional<int32_t> decode_time_ms,
rtc::Optional<uint8_t> qp)); absl::optional<uint8_t> qp));
MOCK_METHOD1(ReceivedDecodedReferenceFrame, MOCK_METHOD1(ReceivedDecodedReferenceFrame,
int32_t(const uint64_t pictureId)); int32_t(const uint64_t pictureId));
MOCK_METHOD1(ReceivedDecodedFrame, int32_t(const uint64_t pictureId)); MOCK_METHOD1(ReceivedDecodedFrame, int32_t(const uint64_t pictureId));

View file

@ -70,7 +70,7 @@ struct VCMFrameCount {
class VCMReceiveCallback { class VCMReceiveCallback {
public: public:
virtual int32_t FrameToRender(VideoFrame& videoFrame, // NOLINT virtual int32_t FrameToRender(VideoFrame& videoFrame, // NOLINT
rtc::Optional<uint8_t> qp, absl::optional<uint8_t> qp,
VideoContentType content_type) = 0; VideoContentType content_type) = 0;
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId); virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId);

View file

@ -199,12 +199,12 @@ void PacketBuffer::PaddingReceived(uint16_t seq_num) {
received_frame_callback_->OnReceivedFrame(std::move(frame)); received_frame_callback_->OnReceivedFrame(std::move(frame));
} }
rtc::Optional<int64_t> PacketBuffer::LastReceivedPacketMs() const { absl::optional<int64_t> PacketBuffer::LastReceivedPacketMs() const {
rtc::CritScope lock(&crit_); rtc::CritScope lock(&crit_);
return last_received_packet_ms_; return last_received_packet_ms_;
} }
rtc::Optional<int64_t> PacketBuffer::LastReceivedKeyframePacketMs() const { absl::optional<int64_t> PacketBuffer::LastReceivedKeyframePacketMs() const {
rtc::CritScope lock(&crit_); rtc::CritScope lock(&crit_);
return last_received_keyframe_packet_ms_; return last_received_keyframe_packet_ms_;
} }

View file

@ -58,8 +58,8 @@ class PacketBuffer {
void PaddingReceived(uint16_t seq_num); void PaddingReceived(uint16_t seq_num);
// Timestamp (not RTP timestamp) of the last received packet/keyframe packet. // Timestamp (not RTP timestamp) of the last received packet/keyframe packet.
rtc::Optional<int64_t> LastReceivedPacketMs() const; absl::optional<int64_t> LastReceivedPacketMs() const;
rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const; absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
// Returns number of different frames seen in the packet buffer // Returns number of different frames seen in the packet buffer
int GetUniqueFramesSeen() const; int GetUniqueFramesSeen() const;
@ -159,13 +159,13 @@ class PacketBuffer {
OnReceivedFrameCallback* const received_frame_callback_; OnReceivedFrameCallback* const received_frame_callback_;
// Timestamp (not RTP timestamp) of the last received packet/keyframe packet. // Timestamp (not RTP timestamp) of the last received packet/keyframe packet.
rtc::Optional<int64_t> last_received_packet_ms_ RTC_GUARDED_BY(crit_); absl::optional<int64_t> last_received_packet_ms_ RTC_GUARDED_BY(crit_);
rtc::Optional<int64_t> last_received_keyframe_packet_ms_ absl::optional<int64_t> last_received_keyframe_packet_ms_
RTC_GUARDED_BY(crit_); RTC_GUARDED_BY(crit_);
int unique_frames_seen_ RTC_GUARDED_BY(crit_); int unique_frames_seen_ RTC_GUARDED_BY(crit_);
rtc::Optional<uint16_t> newest_inserted_seq_num_ RTC_GUARDED_BY(crit_); absl::optional<uint16_t> newest_inserted_seq_num_ RTC_GUARDED_BY(crit_);
std::set<uint16_t, DescendingSeqNumComp<uint16_t>> missing_packets_ std::set<uint16_t, DescendingSeqNumComp<uint16_t>> missing_packets_
RTC_GUARDED_BY(crit_); RTC_GUARDED_BY(crit_);

View file

@ -240,7 +240,7 @@ RtpFrameReferenceFinder::ManageFrameGeneric(RtpFrameObject* frame,
RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp8( RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp8(
RtpFrameObject* frame) { RtpFrameObject* frame) {
rtc::Optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader(); absl::optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader();
if (!rtp_codec_header) { if (!rtp_codec_header) {
RTC_LOG(LS_WARNING) RTC_LOG(LS_WARNING)
<< "Failed to get codec header from frame, dropping frame."; << "Failed to get codec header from frame, dropping frame.";
@ -393,7 +393,7 @@ void RtpFrameReferenceFinder::UpdateLayerInfoVp8(
RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp9( RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp9(
RtpFrameObject* frame) { RtpFrameObject* frame) {
rtc::Optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader(); absl::optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader();
if (!rtp_codec_header) { if (!rtp_codec_header) {
RTC_LOG(LS_WARNING) RTC_LOG(LS_WARNING)
<< "Failed to get codec header from frame, dropping frame."; << "Failed to get codec header from frame, dropping frame.";

View file

@ -239,7 +239,7 @@ void VCMTiming::SetTimingFrameInfo(const TimingFrameInfo& info) {
timing_frame_info_.emplace(info); timing_frame_info_.emplace(info);
} }
rtc::Optional<TimingFrameInfo> VCMTiming::GetTimingFrameInfo() { absl::optional<TimingFrameInfo> VCMTiming::GetTimingFrameInfo() {
rtc::CritScope cs(&crit_sect_); rtc::CritScope cs(&crit_sect_);
return timing_frame_info_; return timing_frame_info_;
} }

View file

@ -95,7 +95,7 @@ class VCMTiming {
int* render_delay_ms) const; int* render_delay_ms) const;
void SetTimingFrameInfo(const TimingFrameInfo& info); void SetTimingFrameInfo(const TimingFrameInfo& info);
rtc::Optional<TimingFrameInfo> GetTimingFrameInfo(); absl::optional<TimingFrameInfo> GetTimingFrameInfo();
enum { kDefaultRenderDelayMs = 10 }; enum { kDefaultRenderDelayMs = 10 };
enum { kDelayMaxChangeMsPerS = 100 }; enum { kDelayMaxChangeMsPerS = 100 };
@ -124,7 +124,7 @@ class VCMTiming {
int current_delay_ms_ RTC_GUARDED_BY(crit_sect_); int current_delay_ms_ RTC_GUARDED_BY(crit_sect_);
int last_decode_ms_ RTC_GUARDED_BY(crit_sect_); int last_decode_ms_ RTC_GUARDED_BY(crit_sect_);
uint32_t prev_frame_timestamp_ RTC_GUARDED_BY(crit_sect_); uint32_t prev_frame_timestamp_ RTC_GUARDED_BY(crit_sect_);
rtc::Optional<TimingFrameInfo> timing_frame_info_ RTC_GUARDED_BY(crit_sect_); absl::optional<TimingFrameInfo> timing_frame_info_ RTC_GUARDED_BY(crit_sect_);
size_t num_decoded_frames_ RTC_GUARDED_BY(crit_sect_); size_t num_decoded_frames_ RTC_GUARDED_BY(crit_sect_);
}; };
} // namespace webrtc } // namespace webrtc

View file

@ -23,13 +23,13 @@ void MovingAverage::AddSample(int sample) {
sum_history_[count_ % sum_history_.size()] = sum_; sum_history_[count_ % sum_history_.size()] = sum_;
} }
rtc::Optional<int> MovingAverage::GetAverage() const { absl::optional<int> MovingAverage::GetAverage() const {
return GetAverage(size()); return GetAverage(size());
} }
rtc::Optional<int> MovingAverage::GetAverage(size_t num_samples) const { absl::optional<int> MovingAverage::GetAverage(size_t num_samples) const {
if (num_samples > size() || num_samples == 0) if (num_samples > size() || num_samples == 0)
return rtc::nullopt; return absl::nullopt;
int sum = sum_ - sum_history_[(count_ - num_samples) % sum_history_.size()]; int sum = sum_ - sum_history_[(count_ - num_samples) % sum_history_.size()];
return sum / static_cast<int>(num_samples); return sum / static_cast<int>(num_samples);
} }

View file

@ -13,7 +13,7 @@
#include <vector> #include <vector>
#include "api/optional.h" #include "absl/types/optional.h"
namespace webrtc { namespace webrtc {
class MovingAverage { class MovingAverage {
@ -21,8 +21,8 @@ class MovingAverage {
explicit MovingAverage(size_t s); explicit MovingAverage(size_t s);
~MovingAverage(); ~MovingAverage();
void AddSample(int sample); void AddSample(int sample);
rtc::Optional<int> GetAverage() const; absl::optional<int> GetAverage() const;
rtc::Optional<int> GetAverage(size_t num_samples) const; absl::optional<int> GetAverage(size_t num_samples) const;
void Reset(); void Reset();
size_t size() const; size_t size() const;

Some files were not shown because too many files have changed in this diff Show more