mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-19 16:47:50 +01:00
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:
parent
ae1888629a
commit
0040b66ad3
103 changed files with 271 additions and 268 deletions
|
@ -31,12 +31,12 @@ rtc_source_set("bbr_controller") {
|
|||
":loss_rate_filter",
|
||||
":rtt_stats",
|
||||
":windowed_filter",
|
||||
"../../../api:optional",
|
||||
"../../../api/transport:network_control",
|
||||
"../../../rtc_base:checks",
|
||||
"../../../rtc_base:rtc_base_approved",
|
||||
"../../../rtc_base/experiments:congestion_controller_experiment",
|
||||
"../../../rtc_base/system:fallthrough",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -48,13 +48,13 @@ rtc_source_set("bandwidth_sampler") {
|
|||
]
|
||||
deps = [
|
||||
":packet_number_indexed_queue",
|
||||
"../../../api:optional",
|
||||
"../../../api/units:data_rate",
|
||||
"../../../api/units:data_size",
|
||||
"../../../api/units:time_delta",
|
||||
"../../../api/units:timestamp",
|
||||
"../../../rtc_base:checks",
|
||||
"../../../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",
|
||||
]
|
||||
deps = [
|
||||
"../../../api:optional",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
rtc_source_set("rtt_stats") {
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef 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_size.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
|
||||
// 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
|
||||
// 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
|
||||
// sent.
|
||||
|
@ -227,10 +227,10 @@ class BandwidthSampler {
|
|||
|
||||
// The time at which the last acknowledged packet was sent. Set to
|
||||
// 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.
|
||||
rtc::Optional<Timestamp> last_acked_packet_ack_time_;
|
||||
absl::optional<Timestamp> last_acked_packet_ack_time_;
|
||||
|
||||
// The most recently sent packet.
|
||||
int64_t last_sent_packet_;
|
||||
|
|
|
@ -382,7 +382,7 @@ bool BbrNetworkController::IsProbingForMoreBandwidth() const {
|
|||
NetworkControlUpdate BbrNetworkController::OnTransportPacketsFeedback(
|
||||
TransportPacketsFeedback msg) {
|
||||
Timestamp feedback_recv_time = msg.feedback_time;
|
||||
rtc::Optional<SentPacket> last_sent_packet =
|
||||
absl::optional<SentPacket> last_sent_packet =
|
||||
msg.PacketsWithFeedback().back().sent_packet;
|
||||
if (!last_sent_packet.has_value()) {
|
||||
RTC_LOG(LS_WARNING) << "Last ack packet not in history, no RTT update";
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "modules/congestion_controller/bbr/rtt_stats.h"
|
||||
#include "modules/congestion_controller/bbr/windowed_filter.h"
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "rtc_base/random.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -217,7 +217,7 @@ class BbrNetworkController : public NetworkControllerInterface {
|
|||
webrtc::Random random_;
|
||||
LossRateFilter loss_rate_;
|
||||
|
||||
rtc::Optional<TargetRateConstraints> constraints_;
|
||||
absl::optional<TargetRateConstraints> constraints_;
|
||||
|
||||
Mode mode_;
|
||||
|
||||
|
@ -244,7 +244,7 @@ class BbrNetworkController : public NetworkControllerInterface {
|
|||
MaxAckHeightFilter max_ack_height_;
|
||||
|
||||
// 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_;
|
||||
|
||||
// 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
|
||||
// that the time is yet unknown as the number of packets in flight has not
|
||||
// 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.
|
||||
bool probe_rtt_round_passed_;
|
||||
|
||||
|
@ -321,7 +321,7 @@ class BbrNetworkController : public NetworkControllerInterface {
|
|||
// Receiving acknowledgement of a packet after |end_recovery_at_| will cause
|
||||
// BBR to exit the recovery mode. A set value indicates at least one
|
||||
// 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.
|
||||
DataSize recovery_window_;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#ifndef 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 bbr {
|
||||
|
|
|
@ -114,7 +114,7 @@ DelayBasedBwe::~DelayBasedBwe() {}
|
|||
|
||||
DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector(
|
||||
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(),
|
||||
packet_feedback_vector.end(),
|
||||
PacketFeedbackComparator()));
|
||||
|
@ -222,12 +222,12 @@ void DelayBasedBwe::IncomingPacketFeedback(
|
|||
}
|
||||
|
||||
DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
|
||||
rtc::Optional<uint32_t> acked_bitrate_bps,
|
||||
absl::optional<uint32_t> acked_bitrate_bps,
|
||||
bool recovered_from_overuse) {
|
||||
Result result;
|
||||
int64_t now_ms = clock_->TimeInMilliseconds();
|
||||
|
||||
rtc::Optional<int> probe_bitrate_bps =
|
||||
absl::optional<int> probe_bitrate_bps =
|
||||
probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps();
|
||||
// Currently overusing the bandwidth.
|
||||
if (delay_detector_->State() == BandwidthUsage::kBwOverusing) {
|
||||
|
@ -280,7 +280,7 @@ DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
|
|||
}
|
||||
|
||||
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) {
|
||||
// TODO(terelius): RateControlInput::noise_var is deprecated and will be
|
||||
// removed. In the meantime, we set it to zero.
|
||||
|
|
|
@ -47,7 +47,7 @@ class DelayBasedBwe {
|
|||
|
||||
Result IncomingPacketFeedbackVector(
|
||||
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);
|
||||
bool LatestEstimate(std::vector<uint32_t>* ssrcs,
|
||||
uint32_t* bitrate_bps) const;
|
||||
|
@ -58,12 +58,12 @@ class DelayBasedBwe {
|
|||
private:
|
||||
void IncomingPacketFeedback(const PacketFeedback& packet_feedback);
|
||||
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);
|
||||
// Updates the current remote rate estimate and returns true if a valid
|
||||
// estimate exists.
|
||||
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);
|
||||
|
||||
rtc::RaceChecker network_race_;
|
||||
|
|
|
@ -29,7 +29,7 @@ constexpr float kTargetUtilizationFraction = 0.95f;
|
|||
TEST_F(LegacyDelayBasedBweTest, NoCrashEmptyFeedback) {
|
||||
std::vector<PacketFeedback> packet_feedback_vector;
|
||||
bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector,
|
||||
rtc::nullopt);
|
||||
absl::nullopt);
|
||||
}
|
||||
|
||||
TEST_F(LegacyDelayBasedBweTest, NoCrashOnlyLostFeedback) {
|
||||
|
@ -41,7 +41,7 @@ TEST_F(LegacyDelayBasedBweTest, NoCrashOnlyLostFeedback) {
|
|||
PacketFeedback::kNoSendTime,
|
||||
1, 1500, PacedPacketInfo()));
|
||||
bitrate_estimator_->IncomingPacketFeedbackVector(packet_feedback_vector,
|
||||
rtc::nullopt);
|
||||
absl::nullopt);
|
||||
}
|
||||
|
||||
TEST_F(LegacyDelayBasedBweTest, ProbeDetection) {
|
||||
|
|
|
@ -43,7 +43,6 @@ rtc_static_library("goog_cc") {
|
|||
"../..:module_api",
|
||||
"../../..:webrtc_common",
|
||||
"../../../:typedefs",
|
||||
"../../../api:optional",
|
||||
"../../../api/transport:network_control",
|
||||
"../../../logging:rtc_event_log_api",
|
||||
"../../../logging:rtc_event_pacing",
|
||||
|
@ -57,6 +56,7 @@ rtc_static_library("goog_cc") {
|
|||
"../../pacing",
|
||||
"../../remote_bitrate_estimator",
|
||||
"../../rtp_rtcp:rtp_rtcp_format",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,6 @@ rtc_source_set("estimators") {
|
|||
}
|
||||
|
||||
deps = [
|
||||
"../../../api:optional",
|
||||
"../../../logging:rtc_event_bwe",
|
||||
"../../../logging:rtc_event_log_api",
|
||||
"../../../rtc_base:checks",
|
||||
|
@ -96,6 +95,7 @@ rtc_source_set("estimators") {
|
|||
"../../../system_wrappers:metrics_api",
|
||||
"../../remote_bitrate_estimator",
|
||||
"../../rtp_rtcp:rtp_rtcp_format",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/congestion_controller/goog_cc/bitrate_estimator.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
@ -31,12 +31,12 @@ class AcknowledgedBitrateEstimator {
|
|||
|
||||
void IncomingPacketFeedbackVector(
|
||||
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);
|
||||
|
||||
private:
|
||||
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_;
|
||||
};
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ constexpr size_t kPayloadSize = 10;
|
|||
class MockBitrateEstimator : public BitrateEstimator {
|
||||
public:
|
||||
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());
|
||||
};
|
||||
|
||||
|
@ -124,7 +124,7 @@ TEST(TestAcknowledgedBitrateEstimator, ExpectFastRateChangeWhenLeftAlr) {
|
|||
|
||||
TEST(TestAcknowledgedBitrateEstimator, ReturnBitrate) {
|
||||
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())
|
||||
.Times(1)
|
||||
.WillOnce(Return(return_value));
|
||||
|
|
|
@ -35,7 +35,7 @@ AlrDetector::AlrDetector(RtcEventLog* event_log)
|
|||
alr_budget_(0, true),
|
||||
event_log_(event_log) {
|
||||
RTC_CHECK(AlrExperimentSettings::MaxOneFieldTrialEnabled());
|
||||
rtc::Optional<AlrExperimentSettings> experiment_settings =
|
||||
absl::optional<AlrExperimentSettings> experiment_settings =
|
||||
AlrExperimentSettings::CreateFromFieldTrial(
|
||||
AlrExperimentSettings::kScreenshareProbingBweExperimentName);
|
||||
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));
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
|
||||
absl::optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
|
||||
const {
|
||||
return alr_started_time_ms_;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef 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 "modules/pacing/interval_budget.h"
|
||||
#include "modules/pacing/paced_sender.h"
|
||||
|
@ -44,7 +44,7 @@ class AlrDetector {
|
|||
|
||||
// Returns time in milliseconds when the current application-limited region
|
||||
// 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
|
||||
// application-limited region. ALR region start when bandwidth usage drops
|
||||
|
@ -63,10 +63,10 @@ class AlrDetector {
|
|||
int alr_start_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_;
|
||||
rtc::Optional<int64_t> alr_started_time_ms_;
|
||||
absl::optional<int64_t> alr_started_time_ms_;
|
||||
|
||||
RtcEventLog* event_log_;
|
||||
};
|
||||
|
|
|
@ -65,8 +65,8 @@ class SimulateOutgoingTrafficIn {
|
|||
}
|
||||
AlrDetector* const alr_detector_;
|
||||
int64_t* timestamp_ms_;
|
||||
rtc::Optional<int> interval_ms_;
|
||||
rtc::Optional<int> usage_percentage_;
|
||||
absl::optional<int> interval_ms_;
|
||||
absl::optional<int> usage_percentage_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
@ -152,7 +152,7 @@ TEST_F(AlrDetectorTest, BandwidthEstimateChanges) {
|
|||
TEST_F(AlrDetectorTest, ParseControlFieldTrial) {
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-ProbingScreenshareBwe/Control/");
|
||||
rtc::Optional<AlrExperimentSettings> parsed_params =
|
||||
absl::optional<AlrExperimentSettings> parsed_params =
|
||||
AlrExperimentSettings::CreateFromFieldTrial(
|
||||
"WebRTC-ProbingScreenshareBwe");
|
||||
EXPECT_FALSE(static_cast<bool>(parsed_params));
|
||||
|
@ -161,7 +161,7 @@ TEST_F(AlrDetectorTest, ParseControlFieldTrial) {
|
|||
TEST_F(AlrDetectorTest, ParseActiveFieldTrial) {
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-ProbingScreenshareBwe/1.1,2875,85,20,-20,1/");
|
||||
rtc::Optional<AlrExperimentSettings> parsed_params =
|
||||
absl::optional<AlrExperimentSettings> parsed_params =
|
||||
AlrExperimentSettings::CreateFromFieldTrial(
|
||||
"WebRTC-ProbingScreenshareBwe");
|
||||
ASSERT_TRUE(static_cast<bool>(parsed_params));
|
||||
|
|
|
@ -92,9 +92,9 @@ float BitrateEstimator::UpdateWindow(int64_t now_ms,
|
|||
return bitrate_sample;
|
||||
}
|
||||
|
||||
rtc::Optional<uint32_t> BitrateEstimator::bitrate_bps() const {
|
||||
absl::optional<uint32_t> BitrateEstimator::bitrate_bps() const {
|
||||
if (bitrate_estimate_ < 0.f)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
return bitrate_estimate_ * 1000;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -28,7 +28,7 @@ class BitrateEstimator {
|
|||
virtual ~BitrateEstimator();
|
||||
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();
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ DelayBasedBwe::~DelayBasedBwe() {}
|
|||
|
||||
DelayBasedBwe::Result DelayBasedBwe::IncomingPacketFeedbackVector(
|
||||
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) {
|
||||
RTC_DCHECK(std::is_sorted(packet_feedback_vector.begin(),
|
||||
packet_feedback_vector.end(),
|
||||
|
@ -225,13 +225,13 @@ void DelayBasedBwe::IncomingPacketFeedback(
|
|||
}
|
||||
|
||||
DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
|
||||
rtc::Optional<uint32_t> acked_bitrate_bps,
|
||||
absl::optional<uint32_t> acked_bitrate_bps,
|
||||
bool recovered_from_overuse,
|
||||
int64_t at_time_ms) {
|
||||
Result result;
|
||||
int64_t now_ms = at_time_ms;
|
||||
|
||||
rtc::Optional<int> probe_bitrate_bps =
|
||||
absl::optional<int> probe_bitrate_bps =
|
||||
probe_bitrate_estimator_.FetchAndResetLastEstimatedBitrateBps();
|
||||
// Currently overusing the bandwidth.
|
||||
if (delay_detector_->State() == BandwidthUsage::kBwOverusing) {
|
||||
|
@ -284,7 +284,7 @@ DelayBasedBwe::Result DelayBasedBwe::MaybeUpdateEstimate(
|
|||
}
|
||||
|
||||
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) {
|
||||
// TODO(terelius): RateControlInput::noise_var is deprecated and will be
|
||||
// removed. In the meantime, we set it to zero.
|
||||
|
|
|
@ -48,7 +48,7 @@ class DelayBasedBwe {
|
|||
|
||||
Result IncomingPacketFeedbackVector(
|
||||
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);
|
||||
void OnRttUpdate(int64_t avg_rtt_ms);
|
||||
bool LatestEstimate(std::vector<uint32_t>* ssrcs,
|
||||
|
@ -61,13 +61,13 @@ class DelayBasedBwe {
|
|||
void IncomingPacketFeedback(const PacketFeedback& packet_feedback,
|
||||
int64_t at_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,
|
||||
int64_t at_time_ms);
|
||||
// Updates the current remote rate estimate and returns true if a valid
|
||||
// estimate exists.
|
||||
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);
|
||||
|
||||
rtc::RaceChecker network_race_;
|
||||
|
|
|
@ -31,7 +31,7 @@ constexpr int64_t kDummyTimestamp = 1000;
|
|||
TEST_F(DelayBasedBweTest, NoCrashEmptyFeedback) {
|
||||
std::vector<PacketFeedback> packet_feedback_vector;
|
||||
bitrate_estimator_->IncomingPacketFeedbackVector(
|
||||
packet_feedback_vector, rtc::nullopt, kDummyTimestamp);
|
||||
packet_feedback_vector, absl::nullopt, kDummyTimestamp);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) {
|
||||
|
@ -43,7 +43,7 @@ TEST_F(DelayBasedBweTest, NoCrashOnlyLostFeedback) {
|
|||
PacketFeedback::kNoSendTime,
|
||||
1, 1500, PacedPacketInfo()));
|
||||
bitrate_estimator_->IncomingPacketFeedbackVector(
|
||||
packet_feedback_vector, rtc::nullopt, kDummyTimestamp);
|
||||
packet_feedback_vector, absl::nullopt, kDummyTimestamp);
|
||||
}
|
||||
|
||||
TEST_F(DelayBasedBweTest, ProbeDetection) {
|
||||
|
|
|
@ -101,7 +101,7 @@ std::vector<PacketFeedback> ReceivedPacketsFeedbackAsRtp(
|
|||
return packet_feedback_vector;
|
||||
}
|
||||
|
||||
int64_t GetBpsOrDefault(const rtc::Optional<DataRate>& rate,
|
||||
int64_t GetBpsOrDefault(const absl::optional<DataRate>& rate,
|
||||
int64_t fallback_bps) {
|
||||
if (rate && rate->IsFinite()) {
|
||||
return rate->bps();
|
||||
|
@ -175,7 +175,7 @@ NetworkControlUpdate GoogCcNetworkController::OnNetworkRouteChange(
|
|||
NetworkControlUpdate GoogCcNetworkController::OnProcessInterval(
|
||||
ProcessInterval msg) {
|
||||
bandwidth_estimation_->UpdateEstimate(msg.at_time.ms());
|
||||
rtc::Optional<int64_t> start_time_ms =
|
||||
absl::optional<int64_t> start_time_ms =
|
||||
alr_detector_->GetApplicationLimitedRegionStartTime();
|
||||
probe_controller_->SetAlrStartTimeMs(start_time_ms);
|
||||
probe_controller_->Process(msg.at_time.ms());
|
||||
|
@ -244,13 +244,13 @@ NetworkControlUpdate GoogCcNetworkController::OnStreamsConfig(
|
|||
|
||||
NetworkControlUpdate GoogCcNetworkController::OnTargetRateConstraints(
|
||||
TargetRateConstraints constraints) {
|
||||
UpdateBitrateConstraints(constraints, rtc::nullopt);
|
||||
UpdateBitrateConstraints(constraints, absl::nullopt);
|
||||
return MaybeTriggerOnNetworkChanged(constraints.at_time);
|
||||
}
|
||||
|
||||
void GoogCcNetworkController::UpdateBitrateConstraints(
|
||||
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 max_bitrate_bps = GetBpsOrDefault(constraints.max_data_rate, -1);
|
||||
int64_t start_bitrate_bps = GetBpsOrDefault(starting_rate, -1);
|
||||
|
@ -301,7 +301,7 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
|
|||
std::vector<PacketFeedback> received_feedback_vector =
|
||||
ReceivedPacketsFeedbackAsRtp(report);
|
||||
|
||||
rtc::Optional<int64_t> alr_start_time =
|
||||
absl::optional<int64_t> alr_start_time =
|
||||
alr_detector_->GetApplicationLimitedRegionStartTime();
|
||||
|
||||
if (previously_in_alr && !alr_start_time.has_value()) {
|
||||
|
@ -336,13 +336,14 @@ NetworkControlUpdate GoogCcNetworkController::OnTransportPacketsFeedback(
|
|||
return update;
|
||||
}
|
||||
|
||||
rtc::Optional<DataSize> GoogCcNetworkController::MaybeUpdateCongestionWindow() {
|
||||
absl::optional<DataSize>
|
||||
GoogCcNetworkController::MaybeUpdateCongestionWindow() {
|
||||
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
|
||||
// we don't try to limit the outstanding packets.
|
||||
if (!min_feedback_rtt_ms_)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
const DataSize kMinCwnd = DataSize::bytes(2 * 1500);
|
||||
TimeDelta time_window =
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/transport/network_control.h"
|
||||
#include "logging/rtc_event_log/rtc_event_log.h"
|
||||
#include "modules/bitrate_controller/send_side_bandwidth_estimation.h"
|
||||
|
@ -51,8 +51,8 @@ class GoogCcNetworkController : public NetworkControllerInterface {
|
|||
|
||||
private:
|
||||
void UpdateBitrateConstraints(TargetRateConstraints constraints,
|
||||
rtc::Optional<DataRate> starting_rate);
|
||||
rtc::Optional<DataSize> MaybeUpdateCongestionWindow();
|
||||
absl::optional<DataRate> starting_rate);
|
||||
absl::optional<DataSize> MaybeUpdateCongestionWindow();
|
||||
NetworkControlUpdate MaybeTriggerOnNetworkChanged(Timestamp at_time);
|
||||
bool GetNetworkParameters(int32_t* estimated_bitrate_bps,
|
||||
uint8_t* fraction_loss,
|
||||
|
@ -71,10 +71,10 @@ class GoogCcNetworkController : public NetworkControllerInterface {
|
|||
std::unique_ptr<AcknowledgedBitrateEstimator> acknowledged_bitrate_estimator_;
|
||||
|
||||
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_;
|
||||
rtc::Optional<TargetTransferRate> last_target_rate_;
|
||||
absl::optional<TargetTransferRate> last_target_rate_;
|
||||
|
||||
int32_t last_estimated_bitrate_bps_ = 0;
|
||||
uint8_t last_estimated_fraction_loss_ = 0;
|
||||
|
@ -89,7 +89,7 @@ class GoogCcNetworkController : public NetworkControllerInterface {
|
|||
int64_t accepted_queue_ms_;
|
||||
bool previously_in_alr = false;
|
||||
|
||||
rtc::Optional<DataSize> current_data_window_;
|
||||
absl::optional<DataSize> current_data_window_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GoogCcNetworkController);
|
||||
};
|
||||
|
|
|
@ -170,9 +170,9 @@ int ProbeBitrateEstimator::HandleProbeAndEstimateBitrate(
|
|||
return *estimated_bitrate_bps_;
|
||||
}
|
||||
|
||||
rtc::Optional<int>
|
||||
absl::optional<int>
|
||||
ProbeBitrateEstimator::FetchAndResetLastEstimatedBitrateBps() {
|
||||
rtc::Optional<int> estimated_bitrate_bps = estimated_bitrate_bps_;
|
||||
absl::optional<int> estimated_bitrate_bps = estimated_bitrate_bps_;
|
||||
estimated_bitrate_bps_.reset();
|
||||
return estimated_bitrate_bps;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class ProbeBitrateEstimator {
|
|||
// Returns the estimated bitrate if the probe completes a valid cluster.
|
||||
int HandleProbeAndEstimateBitrate(const PacketFeedback& packet_feedback);
|
||||
|
||||
rtc::Optional<int> FetchAndResetLastEstimatedBitrateBps();
|
||||
absl::optional<int> FetchAndResetLastEstimatedBitrateBps();
|
||||
|
||||
private:
|
||||
struct AggregatedCluster {
|
||||
|
@ -47,7 +47,7 @@ class ProbeBitrateEstimator {
|
|||
|
||||
std::map<int, AggregatedCluster> clusters_;
|
||||
RtcEventLog* const event_log_;
|
||||
rtc::Optional<int> estimated_bitrate_bps_;
|
||||
absl::optional<int> estimated_bitrate_bps_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -209,7 +209,7 @@ void ProbeController::EnablePeriodicAlrProbing(bool enable) {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
void ProbeController::SetAlrEndedTimeMs(int64_t alr_end_time_ms) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <initializer_list>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/transport/network_control.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
|
||||
|
@ -50,7 +50,7 @@ class ProbeController {
|
|||
|
||||
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 RequestProbe(int64_t at_time_ms);
|
||||
|
@ -86,8 +86,8 @@ class ProbeController {
|
|||
int64_t start_bitrate_bps_;
|
||||
int64_t max_bitrate_bps_;
|
||||
int64_t last_bwe_drop_probing_time_ms_;
|
||||
rtc::Optional<int64_t> alr_start_time_ms_;
|
||||
rtc::Optional<int64_t> alr_end_time_ms_;
|
||||
absl::optional<int64_t> alr_start_time_ms_;
|
||||
absl::optional<int64_t> alr_end_time_ms_;
|
||||
bool enable_periodic_alr_probing_;
|
||||
int64_t time_of_last_large_drop_ms_;
|
||||
int64_t bitrate_before_last_large_drop_bps_;
|
||||
|
|
|
@ -161,7 +161,7 @@ TEST_F(ProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
|
|||
probe_controller_->SetEstimatedBitrate(500, NowMs());
|
||||
EXPECT_EQ(probe_controller_->GetAndResetPendingProbes().size(), 2u);
|
||||
|
||||
probe_controller_->SetAlrStartTimeMs(rtc::nullopt);
|
||||
probe_controller_->SetAlrStartTimeMs(absl::nullopt);
|
||||
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
|
||||
probe_controller_->Process(NowMs());
|
||||
probe_controller_->SetEstimatedBitrate(250, NowMs());
|
||||
|
@ -181,7 +181,7 @@ TEST_F(ProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
|
|||
probe_controller_->SetEstimatedBitrate(500, NowMs());
|
||||
EXPECT_EQ(probe_controller_->GetAndResetPendingProbes().size(), 2u);
|
||||
|
||||
probe_controller_->SetAlrStartTimeMs(rtc::nullopt);
|
||||
probe_controller_->SetAlrStartTimeMs(absl::nullopt);
|
||||
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
|
||||
probe_controller_->Process(NowMs());
|
||||
probe_controller_->SetEstimatedBitrate(250, NowMs());
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe_test_logging.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/numerics/safe_minmax.h"
|
||||
|
@ -22,7 +22,7 @@
|
|||
namespace webrtc {
|
||||
|
||||
namespace {
|
||||
rtc::Optional<double> LinearFitSlope(
|
||||
absl::optional<double> LinearFitSlope(
|
||||
const std::deque<std::pair<double, double>>& points) {
|
||||
RTC_DCHECK(points.size() >= 2);
|
||||
// Compute the "center of mass".
|
||||
|
@ -42,7 +42,7 @@ rtc::Optional<double> LinearFitSlope(
|
|||
denominator += (point.first - x_avg) * (point.first - x_avg);
|
||||
}
|
||||
if (denominator == 0)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
return numerator / denominator;
|
||||
}
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ void ProbeController::Process() {
|
|||
return;
|
||||
|
||||
// Probe bandwidth periodically when in ALR state.
|
||||
rtc::Optional<int64_t> alr_start_time =
|
||||
absl::optional<int64_t> alr_start_time =
|
||||
pacer_->GetApplicationLimitedRegionStartTime();
|
||||
if (alr_start_time && estimated_bitrate_bps_ > 0) {
|
||||
int64_t next_probe_time_ms =
|
||||
|
|
|
@ -79,7 +79,7 @@ class ProbeController {
|
|||
int64_t start_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_);
|
||||
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_);
|
||||
int64_t time_of_last_large_drop_ms_ RTC_GUARDED_BY(critsect_);
|
||||
int64_t bitrate_before_last_large_drop_bps_ RTC_GUARDED_BY(critsect_);
|
||||
|
|
|
@ -147,7 +147,7 @@ TEST_F(LegacyProbeControllerTest, RequestProbeWhenAlrEndedRecently) {
|
|||
testing::Mock::VerifyAndClearExpectations(&pacer_);
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(0.85 * 500)).Times(1);
|
||||
EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime())
|
||||
.WillRepeatedly(Return(rtc::nullopt));
|
||||
.WillRepeatedly(Return(absl::nullopt));
|
||||
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
|
||||
probe_controller_->Process();
|
||||
probe_controller_->SetEstimatedBitrate(250);
|
||||
|
@ -164,7 +164,7 @@ TEST_F(LegacyProbeControllerTest, RequestProbeWhenAlrNotEndedRecently) {
|
|||
testing::Mock::VerifyAndClearExpectations(&pacer_);
|
||||
EXPECT_CALL(pacer_, CreateProbeCluster(_)).Times(0);
|
||||
EXPECT_CALL(pacer_, GetApplicationLimitedRegionStartTime())
|
||||
.WillRepeatedly(Return(rtc::nullopt));
|
||||
.WillRepeatedly(Return(absl::nullopt));
|
||||
clock_.AdvanceTimeMilliseconds(kAlrProbeInterval + 1);
|
||||
probe_controller_->Process();
|
||||
probe_controller_->SetEstimatedBitrate(250);
|
||||
|
|
|
@ -41,7 +41,7 @@ class PacerController {
|
|||
void SetPacerState(bool paused);
|
||||
PacedSender* const pacer_;
|
||||
|
||||
rtc::Optional<PacerConfig> current_pacer_config_;
|
||||
absl::optional<PacerConfig> current_pacer_config_;
|
||||
bool pacer_paused_ = false;
|
||||
bool network_available_ = true;
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ class ControlHandler {
|
|||
void OnOutstandingData(DataSize in_flight_data);
|
||||
void OnPacerQueueUpdate(TimeDelta expected_queue_time);
|
||||
|
||||
rtc::Optional<TargetTransferRate> last_transfer_rate();
|
||||
absl::optional<TargetTransferRate> last_transfer_rate();
|
||||
|
||||
private:
|
||||
void OnNetworkInvalidation();
|
||||
|
@ -199,8 +199,8 @@ class ControlHandler {
|
|||
NetworkChangedObserver* observer_ = nullptr;
|
||||
PacerController* pacer_controller_;
|
||||
|
||||
rtc::Optional<TargetTransferRate> current_target_rate_msg_;
|
||||
rtc::Optional<DataSize> congestion_window_;
|
||||
absl::optional<TargetTransferRate> current_target_rate_msg_;
|
||||
absl::optional<DataSize> congestion_window_;
|
||||
DataSize outstanding_data_ = DataSize::Zero();
|
||||
bool network_available_ = true;
|
||||
int64_t last_reported_target_bitrate_bps_ = 0;
|
||||
|
@ -357,7 +357,7 @@ bool ControlHandler::IsSendQueueFull() const {
|
|||
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_);
|
||||
return current_target_rate_msg_;
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ class SendSideCongestionControllerTest : public ::testing::Test {
|
|||
PacketRouter packet_router_;
|
||||
std::unique_ptr<NiceMock<MockPacedSender>> pacer_;
|
||||
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_;
|
||||
};
|
||||
|
||||
|
|
|
@ -58,11 +58,11 @@ bool SendTimeHistory::OnSentPacket(uint16_t sequence_number,
|
|||
return true;
|
||||
}
|
||||
|
||||
rtc::Optional<PacketFeedback> SendTimeHistory::GetPacket(
|
||||
absl::optional<PacketFeedback> SendTimeHistory::GetPacket(
|
||||
uint16_t sequence_number) const {
|
||||
int64_t unwrapped_seq_num =
|
||||
seq_num_unwrapper_.UnwrapWithoutUpdate(sequence_number);
|
||||
rtc::Optional<PacketFeedback> optional_feedback;
|
||||
absl::optional<PacketFeedback> optional_feedback;
|
||||
auto it = history_.find(unwrapped_seq_num);
|
||||
if (it != history_.end())
|
||||
optional_feedback.emplace(it->second);
|
||||
|
|
|
@ -34,7 +34,7 @@ class SendTimeHistory {
|
|||
bool OnSentPacket(uint16_t sequence_number, int64_t send_time_ms);
|
||||
|
||||
// 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
|
||||
// populate all fields except for arrival_time. The packet parameter must
|
||||
|
@ -54,7 +54,7 @@ class SendTimeHistory {
|
|||
const int64_t packet_age_limit_ms_;
|
||||
SequenceNumberUnwrapper seq_num_unwrapper_;
|
||||
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_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(SendTimeHistory);
|
||||
|
|
|
@ -83,7 +83,7 @@ void TransportFeedbackAdapter::OnSentPacket(uint16_t sequence_number,
|
|||
send_time_history_.OnSentPacket(sequence_number, send_time_ms);
|
||||
}
|
||||
|
||||
rtc::Optional<PacketFeedback> TransportFeedbackAdapter::GetPacket(
|
||||
absl::optional<PacketFeedback> TransportFeedbackAdapter::GetPacket(
|
||||
uint16_t sequence_number) const {
|
||||
rtc::CritScope cs(&lock_);
|
||||
return send_time_history_.GetPacket(sequence_number);
|
||||
|
|
|
@ -48,7 +48,7 @@ class TransportFeedbackAdapter {
|
|||
// to the CongestionController interface.
|
||||
void OnTransportFeedback(const rtcp::TransportFeedback& feedback);
|
||||
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);
|
||||
|
||||
|
|
|
@ -385,7 +385,7 @@ void SendSideCongestionController::LimitOutstandingBytes(
|
|||
size_t num_outstanding_bytes) {
|
||||
RTC_DCHECK(in_cwnd_experiment_);
|
||||
rtc::CritScope lock(&network_state_lock_);
|
||||
rtc::Optional<int64_t> min_rtt_ms =
|
||||
absl::optional<int64_t> min_rtt_ms =
|
||||
transport_feedback_adapter_.GetMinFeedbackLoopRtt();
|
||||
// No valid RTT. Could be because send-side BWE isn't used, in which case
|
||||
// we don't try to limit the outstanding packets.
|
||||
|
|
|
@ -142,7 +142,7 @@ class LegacySendSideCongestionControllerTest : public ::testing::Test {
|
|||
std::unique_ptr<NiceMock<MockPacedSender>> pacer_;
|
||||
std::unique_ptr<SendSideCongestionController> controller_;
|
||||
|
||||
rtc::Optional<uint32_t> target_bitrate_bps_;
|
||||
absl::optional<uint32_t> target_bitrate_bps_;
|
||||
};
|
||||
|
||||
TEST_F(LegacySendSideCongestionControllerTest, OnNetworkChanged) {
|
||||
|
|
|
@ -193,7 +193,8 @@ TransportFeedbackAdapter::GetTransportFeedbackVector() const {
|
|||
return last_packet_feedback_vector_;
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> TransportFeedbackAdapter::GetMinFeedbackLoopRtt() const {
|
||||
absl::optional<int64_t> TransportFeedbackAdapter::GetMinFeedbackLoopRtt()
|
||||
const {
|
||||
rtc::CritScope cs(&lock_);
|
||||
return min_feedback_rtt_;
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class TransportFeedbackAdapter {
|
|||
// to the CongestionController interface.
|
||||
void OnTransportFeedback(const rtcp::TransportFeedback& feedback);
|
||||
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);
|
||||
|
||||
|
@ -68,7 +68,7 @@ class TransportFeedbackAdapter {
|
|||
uint16_t local_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_);
|
||||
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_;
|
||||
std::vector<PacketFeedbackObserver*> observers_
|
||||
|
|
|
@ -38,7 +38,6 @@ rtc_static_library("pacing") {
|
|||
"..:module_api",
|
||||
"../../:typedefs",
|
||||
"../../:webrtc_common",
|
||||
"../../api:optional",
|
||||
"../../logging:rtc_event_bwe",
|
||||
"../../logging:rtc_event_log_api",
|
||||
"../../logging:rtc_event_pacing",
|
||||
|
@ -52,6 +51,7 @@ rtc_static_library("pacing") {
|
|||
"../rtp_rtcp",
|
||||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
"../utility",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ AlrDetector::AlrDetector(RtcEventLog* event_log)
|
|||
alr_budget_(0, true),
|
||||
event_log_(event_log) {
|
||||
RTC_CHECK(AlrExperimentSettings::MaxOneFieldTrialEnabled());
|
||||
rtc::Optional<AlrExperimentSettings> experiment_settings =
|
||||
absl::optional<AlrExperimentSettings> experiment_settings =
|
||||
AlrExperimentSettings::CreateFromFieldTrial(
|
||||
AlrExperimentSettings::kScreenshareProbingBweExperimentName);
|
||||
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));
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
|
||||
absl::optional<int64_t> AlrDetector::GetApplicationLimitedRegionStartTime()
|
||||
const {
|
||||
return alr_started_time_ms_;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef 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 "modules/pacing/interval_budget.h"
|
||||
#include "modules/pacing/paced_sender.h"
|
||||
|
@ -42,7 +42,7 @@ class AlrDetector {
|
|||
|
||||
// Returns time in milliseconds when the current application-limited region
|
||||
// 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
|
||||
// application-limited region. ALR region start when bandwidth usage drops
|
||||
|
@ -62,7 +62,7 @@ class AlrDetector {
|
|||
int alr_stop_budget_level_percent_;
|
||||
|
||||
IntervalBudget alr_budget_;
|
||||
rtc::Optional<int64_t> alr_started_time_ms_;
|
||||
absl::optional<int64_t> alr_started_time_ms_;
|
||||
|
||||
RtcEventLog* event_log_;
|
||||
};
|
||||
|
|
|
@ -60,8 +60,8 @@ class SimulateOutgoingTrafficIn {
|
|||
}
|
||||
}
|
||||
AlrDetector* const alr_detector_;
|
||||
rtc::Optional<int> interval_ms_;
|
||||
rtc::Optional<int> usage_percentage_;
|
||||
absl::optional<int> interval_ms_;
|
||||
absl::optional<int> usage_percentage_;
|
||||
};
|
||||
} // namespace
|
||||
|
||||
|
@ -146,7 +146,7 @@ TEST_F(LegacyAlrDetectorTest, BandwidthEstimateChanges) {
|
|||
TEST_F(LegacyAlrDetectorTest, ParseControlFieldTrial) {
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-ProbingScreenshareBwe/Control/");
|
||||
rtc::Optional<AlrExperimentSettings> parsed_params =
|
||||
absl::optional<AlrExperimentSettings> parsed_params =
|
||||
AlrExperimentSettings::CreateFromFieldTrial(
|
||||
"WebRTC-ProbingScreenshareBwe");
|
||||
EXPECT_FALSE(static_cast<bool>(parsed_params));
|
||||
|
@ -155,7 +155,7 @@ TEST_F(LegacyAlrDetectorTest, ParseControlFieldTrial) {
|
|||
TEST_F(LegacyAlrDetectorTest, ParseActiveFieldTrial) {
|
||||
webrtc::test::ScopedFieldTrials field_trial(
|
||||
"WebRTC-ProbingScreenshareBwe/1.1,2875,85,20,-20,1/");
|
||||
rtc::Optional<AlrExperimentSettings> parsed_params =
|
||||
absl::optional<AlrExperimentSettings> parsed_params =
|
||||
AlrExperimentSettings::CreateFromFieldTrial(
|
||||
"WebRTC-ProbingScreenshareBwe");
|
||||
ASSERT_TRUE(static_cast<bool>(parsed_params));
|
||||
|
|
|
@ -36,7 +36,7 @@ class MockPacedSender : public PacedSender {
|
|||
MOCK_CONST_METHOD0(QueueInPackets, int());
|
||||
MOCK_CONST_METHOD0(ExpectedQueueTimeMs, int64_t());
|
||||
MOCK_CONST_METHOD0(GetApplicationLimitedRegionStartTime,
|
||||
rtc::Optional<int64_t>());
|
||||
absl::optional<int64_t>());
|
||||
MOCK_METHOD0(Process, void());
|
||||
};
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ int64_t PacedSender::ExpectedQueueTimeMs() const {
|
|||
pacing_bitrate_kbps_);
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> PacedSender::GetApplicationLimitedRegionStartTime()
|
||||
absl::optional<int64_t> PacedSender::GetApplicationLimitedRegionStartTime()
|
||||
const {
|
||||
rtc::CritScope cs(&critsect_);
|
||||
return alr_detector_->GetApplicationLimitedRegionStartTime();
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/pacing/pacer.h"
|
||||
#include "modules/pacing/packet_queue_interface.h"
|
||||
#include "rtc_base/criticalsection.h"
|
||||
|
@ -128,7 +128,7 @@ class PacedSender : public Pacer {
|
|||
virtual int64_t ExpectedQueueTimeMs() const;
|
||||
|
||||
// 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
|
||||
// to call Process.
|
||||
|
|
|
@ -83,8 +83,8 @@ class RoundRobinPacketQueue : public PacketQueueInterface {
|
|||
|
||||
const Clock* const clock_;
|
||||
int64_t time_last_updated_;
|
||||
rtc::Optional<Packet> pop_packet_;
|
||||
rtc::Optional<Stream*> pop_stream_;
|
||||
absl::optional<Packet> pop_packet_;
|
||||
absl::optional<Stream*> pop_stream_;
|
||||
|
||||
bool paused_ = false;
|
||||
size_t size_packets_ = 0;
|
||||
|
|
|
@ -46,7 +46,6 @@ rtc_static_library("remote_bitrate_estimator") {
|
|||
deps = [
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:optional",
|
||||
"../../modules:module_api",
|
||||
"../../modules/rtp_rtcp:rtp_rtcp_format",
|
||||
"../../rtc_base:checks",
|
||||
|
@ -55,6 +54,7 @@ rtc_static_library("remote_bitrate_estimator") {
|
|||
"../../system_wrappers",
|
||||
"../../system_wrappers:field_trial_api",
|
||||
"../../system_wrappers:metrics_api",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,6 @@ if (rtc_include_tests) {
|
|||
"..:module_api",
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:optional",
|
||||
"../../logging:mocks",
|
||||
"../../rtc_base:checks",
|
||||
"../../rtc_base:gtest_prod",
|
||||
|
@ -161,6 +160,7 @@ if (rtc_include_tests) {
|
|||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
"../video_coding:video_coding_utility",
|
||||
"//testing/gtest",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
// indicates a real network degradation. We do not let such a decrease
|
||||
// to determine the bandwidth estimation period.
|
||||
last_decrease_ = rtc::nullopt;
|
||||
last_decrease_ = absl::nullopt;
|
||||
} else {
|
||||
last_decrease_ = current_bitrate_bps_ - new_bitrate_bps;
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ class AimdRateControl {
|
|||
int64_t rtt_;
|
||||
bool in_experiment_;
|
||||
bool smoothing_experiment_;
|
||||
rtc::Optional<int> last_decrease_;
|
||||
absl::optional<int> last_decrease_;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ AimdRateControlStates CreateAimdRateControlStates() {
|
|||
|
||||
void UpdateRateControl(const AimdRateControlStates& states,
|
||||
const BandwidthUsage& bandwidth_usage,
|
||||
rtc::Optional<uint32_t> bitrate,
|
||||
absl::optional<uint32_t> bitrate,
|
||||
int64_t now_ms) {
|
||||
RateControlInput input(bandwidth_usage, bitrate, now_ms);
|
||||
states.aimd_rate_control->Update(&input, now_ms);
|
||||
|
@ -261,7 +261,7 @@ TEST(AimdRateControlTest, SendingRateBoundedWhenThroughputNotEstimated) {
|
|||
UpdateRateControl(states, BandwidthUsage::kBwNormal, kInitialBitrateBps,
|
||||
states.simulated_clock->TimeInMilliseconds());
|
||||
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->AdvanceTimeMilliseconds(100);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ int GetMinBitrateBps() {
|
|||
|
||||
RateControlInput::RateControlInput(
|
||||
BandwidthUsage bw_state,
|
||||
const rtc::Optional<uint32_t>& incoming_bitrate,
|
||||
const absl::optional<uint32_t>& incoming_bitrate,
|
||||
double noise_var)
|
||||
: bw_state(bw_state),
|
||||
incoming_bitrate(incoming_bitrate),
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef 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)
|
||||
|
||||
#define BWE_MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
|
@ -48,12 +48,12 @@ enum RateControlRegion { kRcNearMax, kRcAboveMax, kRcMaxUnknown };
|
|||
|
||||
struct RateControlInput {
|
||||
RateControlInput(BandwidthUsage bw_state,
|
||||
const rtc::Optional<uint32_t>& incoming_bitrate,
|
||||
const absl::optional<uint32_t>& incoming_bitrate,
|
||||
double noise_var);
|
||||
~RateControlInput();
|
||||
|
||||
BandwidthUsage bw_state;
|
||||
rtc::Optional<uint32_t> incoming_bitrate;
|
||||
absl::optional<uint32_t> incoming_bitrate;
|
||||
double noise_var;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -248,7 +248,7 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo(
|
|||
// here.
|
||||
|
||||
// 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);
|
||||
if (incoming_bitrate) {
|
||||
incoming_bitrate_initialized_ = true;
|
||||
|
@ -322,7 +322,7 @@ void RemoteBitrateEstimatorAbsSendTime::IncomingPacketInfo(
|
|||
now_ms - last_update_ms_ > remote_rate_.GetFeedbackInterval()) {
|
||||
update_estimate = true;
|
||||
} else if (detector_.State() == BandwidthUsage::kBwOverusing) {
|
||||
rtc::Optional<uint32_t> incoming_rate =
|
||||
absl::optional<uint32_t> incoming_rate =
|
||||
incoming_bitrate_.Rate(arrival_time_ms);
|
||||
if (incoming_rate &&
|
||||
remote_rate_.TimeToReduceFurther(now_ms, *incoming_rate)) {
|
||||
|
|
|
@ -97,7 +97,7 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket(
|
|||
estimator->last_packet_time_ms = now_ms;
|
||||
|
||||
// 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) {
|
||||
last_valid_incoming_bitrate_ = *incoming_bitrate;
|
||||
} else if (last_valid_incoming_bitrate_ > 0) {
|
||||
|
@ -124,7 +124,7 @@ void RemoteBitrateEstimatorSingleStream::IncomingPacket(
|
|||
estimator->estimator.num_of_deltas(), now_ms);
|
||||
}
|
||||
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);
|
||||
if (incoming_bitrate_bps &&
|
||||
(prior_state != BandwidthUsage::kBwOverusing ||
|
||||
|
|
|
@ -277,15 +277,15 @@ size_t BbrBweSender::TargetCongestionWindow(float gain) {
|
|||
return target_congestion_window;
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> BbrBweSender::CalculateBandwidthSample(
|
||||
absl::optional<int64_t> BbrBweSender::CalculateBandwidthSample(
|
||||
size_t data_sent_bytes,
|
||||
int64_t send_time_delta_ms,
|
||||
size_t data_acked_bytes,
|
||||
int64_t ack_time_delta_ms) {
|
||||
rtc::Optional<int64_t> bandwidth_sample;
|
||||
absl::optional<int64_t> bandwidth_sample;
|
||||
if (send_time_delta_ms > 0)
|
||||
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)
|
||||
ack_rate.emplace(data_acked_bytes * 8000 / ack_time_delta_ms);
|
||||
// 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_;
|
||||
int64_t ack_time_delta_ms = last_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);
|
||||
if (bandwidth_sample)
|
||||
max_bandwidth_filter_->AddBandwidthSample(*bandwidth_sample, round_count_);
|
||||
|
@ -322,7 +322,7 @@ void BbrBweSender::UpdateBandwidthAndMinRtt(
|
|||
int64_t now_ms,
|
||||
const std::vector<uint16_t>& feedback_vector,
|
||||
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) {
|
||||
PacketStats packet = packet_stats_[f];
|
||||
size_t data_sent_bytes =
|
||||
|
@ -333,7 +333,7 @@ void BbrBweSender::UpdateBandwidthAndMinRtt(
|
|||
packet.data_acked_before_last_acked_packet_bytes;
|
||||
int64_t ack_time_delta_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,
|
||||
data_acked_bytes, ack_time_delta_ms);
|
||||
if (bandwidth_sample)
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "modules/remote_bitrate_estimator/test/bwe.h"
|
||||
#include "rtc_base/numerics/sequence_number_util.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
|
||||
// ack rate, returns nothing if sample cannot be calculated.
|
||||
rtc::Optional<int64_t> CalculateBandwidthSample(size_t data_sent,
|
||||
int64_t send_time_delta_ms,
|
||||
size_t data_acked,
|
||||
int64_t ack_time_delta_ms);
|
||||
absl::optional<int64_t> CalculateBandwidthSample(size_t data_sent,
|
||||
int64_t send_time_delta_ms,
|
||||
size_t data_acked,
|
||||
int64_t ack_time_delta_ms);
|
||||
|
||||
// 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
|
||||
|
@ -174,7 +174,7 @@ class BbrBweSender : public BweSender {
|
|||
|
||||
// First moment of time when data inflight decreased below
|
||||
// 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
|
||||
// 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
|
||||
// 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.
|
||||
int64_t last_packet_send_time_during_high_gain_ms_;
|
||||
|
|
|
@ -33,7 +33,7 @@ CongestionWindow::~CongestionWindow() {}
|
|||
|
||||
int CongestionWindow::GetCongestionWindow(BbrBweSender::Mode mode,
|
||||
int64_t bandwidth_estimate_bps,
|
||||
rtc::Optional<int64_t> min_rtt_ms,
|
||||
absl::optional<int64_t> min_rtt_ms,
|
||||
float 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(
|
||||
int64_t bandwidth_estimate_bps,
|
||||
rtc::Optional<int64_t> min_rtt_ms,
|
||||
absl::optional<int64_t> min_rtt_ms,
|
||||
float gain) {
|
||||
// If we have no rtt sample yet, return the starting congestion window size.
|
||||
if (!min_rtt_ms)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "modules/remote_bitrate_estimator/test/estimators/bbr.h"
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace testing {
|
||||
|
@ -25,10 +25,10 @@ class CongestionWindow {
|
|||
~CongestionWindow();
|
||||
int GetCongestionWindow(BbrBweSender::Mode mode,
|
||||
int64_t bandwidth_estimate,
|
||||
rtc::Optional<int64_t> min_rtt,
|
||||
absl::optional<int64_t> min_rtt,
|
||||
float gain);
|
||||
int GetTargetCongestionWindow(int64_t bandwidth_estimate,
|
||||
rtc::Optional<int64_t> min_rtt,
|
||||
absl::optional<int64_t> min_rtt,
|
||||
float gain);
|
||||
// Packet sent from sender, meaning it is inflight until we receive it and we
|
||||
// should add packet's size to data_inflight.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <limits>
|
||||
#include <list>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
namespace testing {
|
||||
|
@ -36,7 +36,7 @@ class 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) {
|
||||
if (!min_rtt_ms_ || rtt_ms <= *min_rtt_ms_ || MinRttExpired(now_ms)) {
|
||||
min_rtt_ms_.emplace(rtt_ms);
|
||||
|
@ -63,7 +63,7 @@ class MinRttFilter {
|
|||
}
|
||||
|
||||
private:
|
||||
rtc::Optional<int64_t> min_rtt_ms_;
|
||||
absl::optional<int64_t> min_rtt_ms_;
|
||||
std::list<int64_t> rtt_samples_;
|
||||
};
|
||||
} // namespace bwe
|
||||
|
|
|
@ -17,7 +17,6 @@ rtc_static_library("encoded_frame") {
|
|||
deps = [
|
||||
":video_codec_interface",
|
||||
"../../:webrtc_common",
|
||||
"../../api:optional",
|
||||
"../../api/video:video_frame_i420",
|
||||
"../../common_video:common_video",
|
||||
"../../modules:module_api",
|
||||
|
@ -28,6 +27,7 @@ rtc_static_library("encoded_frame") {
|
|||
"../../rtc_base/experiments:alr_experiment",
|
||||
"../../system_wrappers:field_trial_api",
|
||||
"../../system_wrappers:system_wrappers",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
if (!build_with_chromium && is_clang) {
|
||||
|
@ -165,7 +165,6 @@ rtc_static_library("video_coding") {
|
|||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:fec_controller_api",
|
||||
"../../api:optional",
|
||||
"../../api/video:encoded_frame",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video:video_frame_i420",
|
||||
|
@ -185,6 +184,7 @@ rtc_static_library("video_coding") {
|
|||
"../../system_wrappers:metrics_api",
|
||||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
"../utility:utility",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -258,7 +258,6 @@ rtc_source_set("video_coding_utility") {
|
|||
"..:module_api",
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:optional",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
"../../modules/rtp_rtcp",
|
||||
|
@ -270,6 +269,7 @@ rtc_source_set("video_coding_utility") {
|
|||
"../../rtc_base/experiments:quality_scaling_experiment",
|
||||
"../../system_wrappers",
|
||||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,6 @@ rtc_static_library("webrtc_vp8_helpers") {
|
|||
"..:module_api",
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:optional",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
|
@ -422,6 +421,7 @@ rtc_static_library("webrtc_vp8_helpers") {
|
|||
"../../system_wrappers",
|
||||
"../../system_wrappers:field_trial_api",
|
||||
"../../system_wrappers:metrics_api",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
"//third_party/libyuv",
|
||||
]
|
||||
}
|
||||
|
@ -454,7 +454,6 @@ rtc_static_library("webrtc_vp8") {
|
|||
"..:module_api",
|
||||
"../..:webrtc_common",
|
||||
"../../:typedefs",
|
||||
"../../api:optional",
|
||||
"../../api/video:video_frame",
|
||||
"../../api/video_codecs:video_codecs_api",
|
||||
"../../common_video",
|
||||
|
@ -464,6 +463,7 @@ rtc_static_library("webrtc_vp8") {
|
|||
"../../system_wrappers",
|
||||
"../../system_wrappers:field_trial_api",
|
||||
"../../system_wrappers:metrics_api",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
"//third_party/libyuv",
|
||||
]
|
||||
if (rtc_build_libvpx) {
|
||||
|
@ -758,7 +758,6 @@ if (rtc_include_tests) {
|
|||
"../..:webrtc_common",
|
||||
"../../api:create_videocodec_test_fixture_api",
|
||||
"../../api:mock_video_codec_factory",
|
||||
"../../api:optional",
|
||||
"../../api:videocodec_test_fixture_api",
|
||||
"../../api/video:video_frame_i420",
|
||||
"../../api/video_codecs:rtc_software_fallback_wrappers",
|
||||
|
@ -773,6 +772,7 @@ if (rtc_include_tests) {
|
|||
"../../test:test_support",
|
||||
"../../test:video_test_common",
|
||||
"../rtp_rtcp:rtp_rtcp_format",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
data = video_coding_modules_tests_resources
|
||||
|
|
|
@ -43,7 +43,7 @@ bool IsH264CodecSupported() {
|
|||
SdpVideoFormat CreateH264Format(H264::Profile profile,
|
||||
H264::Level level,
|
||||
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));
|
||||
RTC_CHECK(profile_string);
|
||||
return SdpVideoFormat(
|
||||
|
|
|
@ -325,7 +325,7 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
|
|||
RTC_CHECK_EQ(av_frame_->data[kVPlaneIndex], i420_buffer->DataV());
|
||||
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.
|
||||
h264_bitstream_parser_.ParseBitstream(input_image._buffer,
|
||||
input_image._length);
|
||||
|
@ -351,10 +351,10 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
|
|||
video_frame->rotation());
|
||||
// TODO(nisse): Timestamp and rotation are all zero here. Change decoder
|
||||
// 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 {
|
||||
// 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|.
|
||||
av_frame_unref(av_frame_.get());
|
||||
|
|
|
@ -50,7 +50,7 @@ TEST_F(TestH264Impl, MAYBE_EncodeDecode) {
|
|||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, 0));
|
||||
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(decoded_frame);
|
||||
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
|
||||
|
@ -67,7 +67,7 @@ TEST_F(TestH264Impl, MAYBE_DecodedQpEqualsEncodedQp) {
|
|||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, 0));
|
||||
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(decoded_frame);
|
||||
ASSERT_TRUE(decoded_qp);
|
||||
|
|
|
@ -42,8 +42,8 @@ class MultiplexDecoderAdapter : public VideoDecoder {
|
|||
|
||||
void Decoded(AlphaCodecStream stream_idx,
|
||||
VideoFrame* decoded_image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp);
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp);
|
||||
|
||||
private:
|
||||
// Wrapper class that redirects Decoded() calls.
|
||||
|
@ -53,11 +53,11 @@ class MultiplexDecoderAdapter : public VideoDecoder {
|
|||
struct DecodedImageData;
|
||||
|
||||
void MergeAlphaImages(VideoFrame* decoded_image,
|
||||
const rtc::Optional<int32_t>& decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& qp,
|
||||
const absl::optional<int32_t>& decode_time_ms,
|
||||
const absl::optional<uint8_t>& qp,
|
||||
VideoFrame* multiplex_decoded_image,
|
||||
const rtc::Optional<int32_t>& multiplex_decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& multiplex_qp);
|
||||
const absl::optional<int32_t>& multiplex_decode_time_ms,
|
||||
const absl::optional<uint8_t>& multiplex_qp);
|
||||
|
||||
VideoDecoderFactory* const factory_;
|
||||
const SdpVideoFormat associated_format_;
|
||||
|
|
|
@ -33,8 +33,8 @@ class MultiplexDecoderAdapter::AdapterDecodedImageCallback
|
|||
: adapter_(adapter), stream_idx_(stream_idx) {}
|
||||
|
||||
void Decoded(VideoFrame& decoded_image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) override {
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) override {
|
||||
if (!adapter_)
|
||||
return;
|
||||
adapter_->Decoded(stream_idx_, &decoded_image, decode_time_ms, qp);
|
||||
|
@ -64,16 +64,16 @@ struct MultiplexDecoderAdapter::DecodedImageData {
|
|||
}
|
||||
DecodedImageData(AlphaCodecStream stream_idx,
|
||||
const VideoFrame& decoded_image,
|
||||
const rtc::Optional<int32_t>& decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& qp)
|
||||
const absl::optional<int32_t>& decode_time_ms,
|
||||
const absl::optional<uint8_t>& qp)
|
||||
: stream_idx_(stream_idx),
|
||||
decoded_image_(decoded_image),
|
||||
decode_time_ms_(decode_time_ms),
|
||||
qp_(qp) {}
|
||||
const AlphaCodecStream stream_idx_;
|
||||
VideoFrame decoded_image_;
|
||||
const rtc::Optional<int32_t> decode_time_ms_;
|
||||
const rtc::Optional<uint8_t> qp_;
|
||||
const absl::optional<int32_t> decode_time_ms_;
|
||||
const absl::optional<uint8_t> qp_;
|
||||
|
||||
private:
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DecodedImageData);
|
||||
|
@ -153,8 +153,8 @@ int32_t MultiplexDecoderAdapter::Release() {
|
|||
|
||||
void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
||||
VideoFrame* decoded_image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) {
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) {
|
||||
const auto& other_decoded_data_it =
|
||||
decoded_data_.find(decoded_image->timestamp());
|
||||
if (other_decoded_data_it != decoded_data_.end()) {
|
||||
|
@ -184,11 +184,11 @@ void MultiplexDecoderAdapter::Decoded(AlphaCodecStream stream_idx,
|
|||
|
||||
void MultiplexDecoderAdapter::MergeAlphaImages(
|
||||
VideoFrame* decoded_image,
|
||||
const rtc::Optional<int32_t>& decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& qp,
|
||||
const absl::optional<int32_t>& decode_time_ms,
|
||||
const absl::optional<uint8_t>& qp,
|
||||
VideoFrame* alpha_decoded_image,
|
||||
const rtc::Optional<int32_t>& alpha_decode_time_ms,
|
||||
const rtc::Optional<uint8_t>& alpha_qp) {
|
||||
const absl::optional<int32_t>& alpha_decode_time_ms,
|
||||
const absl::optional<uint8_t>& alpha_qp) {
|
||||
if (!alpha_decoded_image->timestamp()) {
|
||||
decoded_complete_callback_->Decoded(*decoded_image, decode_time_ms, qp);
|
||||
return;
|
||||
|
|
|
@ -132,7 +132,7 @@ TEST_F(TestMultiplexAdapter, EncodeDecodeI420Frame) {
|
|||
WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, &codec_specific_info, -1));
|
||||
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(decoded_frame);
|
||||
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
|
||||
|
@ -150,7 +150,7 @@ TEST_F(TestMultiplexAdapter, EncodeDecodeI420AFrame) {
|
|||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, 0));
|
||||
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(decoded_frame);
|
||||
EXPECT_GT(I420PSNR(yuva_frame.get(), decoded_frame.get()), 36);
|
||||
|
|
|
@ -50,8 +50,8 @@ VideoCodecUnitTest::FakeEncodeCompleteCallback::OnEncodedImage(
|
|||
|
||||
void VideoCodecUnitTest::FakeDecodeCompleteCallback::Decoded(
|
||||
VideoFrame& frame,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) {
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) {
|
||||
rtc::CritScope lock(&test_->decoded_frame_section_);
|
||||
test_->decoded_frame_.emplace(frame);
|
||||
test_->decoded_qp_ = qp;
|
||||
|
@ -71,7 +71,8 @@ void VideoCodecUnitTest::SetUp() {
|
|||
|
||||
input_frame_generator_ = test::FrameGenerator::CreateSquareGenerator(
|
||||
codec_settings_.width, codec_settings_.height,
|
||||
rtc::Optional<test::FrameGenerator::OutputType>(), rtc::Optional<int>());
|
||||
absl::optional<test::FrameGenerator::OutputType>(),
|
||||
absl::optional<int>());
|
||||
|
||||
encoder_ = CreateEncoder();
|
||||
decoder_ = CreateDecoder();
|
||||
|
@ -141,7 +142,7 @@ bool VideoCodecUnitTest::WaitForEncodedFrames(
|
|||
}
|
||||
|
||||
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);
|
||||
EXPECT_TRUE(ret) << "Timed out while waiting for a decoded frame.";
|
||||
// This becomes unsafe if there are multiple threads waiting for frames.
|
||||
|
|
|
@ -67,8 +67,8 @@ class VideoCodecUnitTest : public ::testing::Test {
|
|||
return -1;
|
||||
}
|
||||
void Decoded(VideoFrame& frame,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) override;
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) override;
|
||||
|
||||
private:
|
||||
VideoCodecUnitTest* const test_;
|
||||
|
@ -97,7 +97,7 @@ class VideoCodecUnitTest : public ::testing::Test {
|
|||
|
||||
// Helper method for waiting a single decoded frame.
|
||||
bool WaitForDecodedFrame(std::unique_ptr<VideoFrame>* frame,
|
||||
rtc::Optional<uint8_t>* qp);
|
||||
absl::optional<uint8_t>* qp);
|
||||
|
||||
size_t GetNumEncodedFrames();
|
||||
|
||||
|
@ -120,9 +120,9 @@ class VideoCodecUnitTest : public ::testing::Test {
|
|||
|
||||
rtc::Event decoded_frame_event_;
|
||||
rtc::CriticalSection decoded_frame_section_;
|
||||
rtc::Optional<VideoFrame> decoded_frame_
|
||||
absl::optional<VideoFrame> decoded_frame_
|
||||
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_;
|
||||
uint32_t last_input_frame_timestamp_;
|
||||
|
|
|
@ -151,8 +151,8 @@ class VideoProcessor {
|
|||
}
|
||||
|
||||
void Decoded(webrtc::VideoFrame& image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) override {
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) override {
|
||||
Decoded(image);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "modules/video_coding/codecs/vp8/temporal_layers.h"
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
|
@ -52,7 +52,7 @@ class DefaultTemporalLayers : public TemporalLayers {
|
|||
uint8_t pattern_idx_;
|
||||
bool last_base_layer_sync_;
|
||||
// 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 {
|
||||
|
|
|
@ -308,7 +308,7 @@ int LibvpxVp8Decoder::ReturnFrame(const vpx_image_t* img,
|
|||
|
||||
VideoFrame decoded_image(buffer, timestamp, 0, kVideoRotation_0);
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -72,9 +72,9 @@ class ScreenshareLayers : public TemporalLayers {
|
|||
uint32_t max_debt_bytes_;
|
||||
|
||||
// Configured max framerate.
|
||||
rtc::Optional<uint32_t> target_framerate_;
|
||||
absl::optional<uint32_t> target_framerate_;
|
||||
// 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.
|
||||
RateStatistics encode_framerate_;
|
||||
bool bitrate_updated_;
|
||||
|
|
|
@ -138,11 +138,11 @@ class ScreenshareLayerTest : public ::testing::Test {
|
|||
// FrameEncoded() call will be omitted and needs to be done by the caller.
|
||||
// Returns the flags for the last frame.
|
||||
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.
|
||||
int SkipUntilTlAndSync(int layer, rtc::Optional<bool> sync) {
|
||||
int SkipUntilTlAndSync(int layer, absl::optional<bool> sync) {
|
||||
int flags = 0;
|
||||
const int kMaxFramesToSkip =
|
||||
1 + (sync.value_or(false) ? kMaxSyncPeriodSeconds : 1) * kFrameRate;
|
||||
|
|
|
@ -150,8 +150,8 @@ class SimulcastTestFixtureImpl::Vp8TestDecodedImageCallback
|
|||
return -1;
|
||||
}
|
||||
void Decoded(VideoFrame& decoded_image,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) override {
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) override {
|
||||
Decoded(decoded_image);
|
||||
}
|
||||
int DecodedFrames() { return decoded_frames_; }
|
||||
|
|
|
@ -162,7 +162,7 @@ TEST_F(TestVp8Impl, DecodedQpEqualsEncodedQp) {
|
|||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
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(decoded_frame);
|
||||
ASSERT_TRUE(decoded_qp);
|
||||
|
@ -249,7 +249,7 @@ TEST_F(TestVp8Impl, MAYBE_AlignedStrideEncodeDecode) {
|
|||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
|
||||
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(decoded_frame);
|
||||
// Compute PSNR on all planes (faster than SSIM).
|
||||
|
@ -283,7 +283,7 @@ TEST_F(TestVp8Impl, MAYBE_DecodeWithACompleteKeyFrame) {
|
|||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, -1));
|
||||
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(decoded_frame);
|
||||
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
|
||||
|
|
|
@ -80,7 +80,7 @@ TEST_F(TestVp9Impl, EncodeDecode) {
|
|||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, 0));
|
||||
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(decoded_frame);
|
||||
EXPECT_GT(I420PSNR(input_frame, decoded_frame.get()), 36);
|
||||
|
@ -118,7 +118,7 @@ TEST_F(TestVp9Impl, DecodedQpEqualsEncodedQp) {
|
|||
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
|
||||
decoder_->Decode(encoded_frame, false, nullptr, 0));
|
||||
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(decoded_frame);
|
||||
ASSERT_TRUE(decoded_qp);
|
||||
|
|
|
@ -1101,7 +1101,7 @@ int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img,
|
|||
0 /* render_time_ms */, webrtc::kVideoRotation_0);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ class VP9EncoderImpl : public VP9Encoder {
|
|||
InterLayerPredMode inter_layer_pred_;
|
||||
|
||||
// Framerate controller.
|
||||
rtc::Optional<float> target_framerate_fps_;
|
||||
absl::optional<float> target_framerate_fps_;
|
||||
RateStatistics output_framerate_;
|
||||
uint32_t last_encoded_frame_rtp_timestamp_;
|
||||
|
||||
|
|
|
@ -599,7 +599,7 @@ void FrameBuffer::UpdateJitterDelay() {
|
|||
|
||||
void FrameBuffer::UpdateTimingFrameInfo() {
|
||||
TRACE_EVENT0("webrtc", "FrameBuffer::UpdateTimingFrameInfo");
|
||||
rtc::Optional<TimingFrameInfo> info = timing_->GetTimingFrameInfo();
|
||||
absl::optional<TimingFrameInfo> info = timing_->GetTimingFrameInfo();
|
||||
if (info && stats_callback_)
|
||||
stats_callback_->OnTimingFrameInfoUpdated(*info);
|
||||
}
|
||||
|
|
|
@ -156,11 +156,11 @@ bool RtpFrameObject::delayed_by_retransmission() const {
|
|||
return times_nacked() > 0;
|
||||
}
|
||||
|
||||
rtc::Optional<RTPVideoTypeHeader> RtpFrameObject::GetCodecHeader() const {
|
||||
absl::optional<RTPVideoTypeHeader> RtpFrameObject::GetCodecHeader() const {
|
||||
rtc::CritScope lock(&packet_buffer_->crit_);
|
||||
VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_);
|
||||
if (!packet)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
return packet->video_header.codecHeader;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#ifndef 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 "common_types.h" // NOLINT(build/include)
|
||||
#include "modules/include/module_common_types.h"
|
||||
|
@ -41,7 +41,7 @@ class RtpFrameObject : public EncodedFrame {
|
|||
int64_t ReceivedTime() const override;
|
||||
int64_t RenderTime() const override;
|
||||
bool delayed_by_retransmission() const override;
|
||||
rtc::Optional<RTPVideoTypeHeader> GetCodecHeader() const;
|
||||
absl::optional<RTPVideoTypeHeader> GetCodecHeader() const;
|
||||
|
||||
private:
|
||||
rtc::scoped_refptr<PacketBuffer> packet_buffer_;
|
||||
|
|
|
@ -57,15 +57,15 @@ int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage) {
|
|||
int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
int64_t decode_time_ms) {
|
||||
Decoded(decodedImage,
|
||||
decode_time_ms >= 0 ? rtc::Optional<int32_t>(decode_time_ms)
|
||||
: rtc::nullopt,
|
||||
rtc::nullopt);
|
||||
decode_time_ms >= 0 ? absl::optional<int32_t>(decode_time_ms)
|
||||
: absl::nullopt,
|
||||
absl::nullopt);
|
||||
return WEBRTC_VIDEO_CODEC_OK;
|
||||
}
|
||||
|
||||
void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) {
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) {
|
||||
RTC_DCHECK(_receiveCallback) << "Callback must not be null at this point";
|
||||
TRACE_EVENT_INSTANT1("webrtc", "VCMDecodedFrameCallback::Decoded",
|
||||
"timestamp", decodedImage.timestamp());
|
||||
|
|
|
@ -46,8 +46,8 @@ class VCMDecodedFrameCallback : public DecodedImageCallback {
|
|||
int32_t Decoded(VideoFrame& decodedImage) override;
|
||||
int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) override;
|
||||
void Decoded(VideoFrame& decodedImage,
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp) override;
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp) override;
|
||||
int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId) override;
|
||||
int32_t ReceivedDecodedFrame(const uint64_t pictureId) override;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/video/i420_buffer.h"
|
||||
#include "modules/include/module_common_types_public.h"
|
||||
#include "modules/video_coding/encoded_frame.h"
|
||||
|
@ -178,7 +178,7 @@ VCMEncodedFrameCallback::VCMEncodedFrameCallback(
|
|||
incorrect_capture_time_logged_messages_(0),
|
||||
reordered_frames_logged_messages_(0),
|
||||
stalled_encoder_logged_messages_(0) {
|
||||
rtc::Optional<AlrExperimentSettings> experiment_settings =
|
||||
absl::optional<AlrExperimentSettings> experiment_settings =
|
||||
AlrExperimentSettings::CreateFromFieldTrial(
|
||||
AlrExperimentSettings::kStrictPacingAndProbingExperimentName);
|
||||
if (experiment_settings) {
|
||||
|
@ -249,10 +249,10 @@ void VCMEncodedFrameCallback::OnEncodeStarted(uint32_t rtp_timestamp,
|
|||
rtp_timestamp, capture_time_ms, rtc::TimeMillis());
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> VCMEncodedFrameCallback::ExtractEncodeStartTime(
|
||||
absl::optional<int64_t> VCMEncodedFrameCallback::ExtractEncodeStartTime(
|
||||
size_t simulcast_svc_idx,
|
||||
EncodedImage* encoded_image) {
|
||||
rtc::Optional<int64_t> result;
|
||||
absl::optional<int64_t> result;
|
||||
size_t num_simulcast_svc_streams = timing_frames_info_.size();
|
||||
if (simulcast_svc_idx < num_simulcast_svc_streams) {
|
||||
auto encode_start_list =
|
||||
|
@ -308,8 +308,8 @@ rtc::Optional<int64_t> VCMEncodedFrameCallback::ExtractEncodeStartTime(
|
|||
|
||||
void VCMEncodedFrameCallback::FillTimingInfo(size_t simulcast_svc_idx,
|
||||
EncodedImage* encoded_image) {
|
||||
rtc::Optional<size_t> outlier_frame_size;
|
||||
rtc::Optional<int64_t> encode_start_ms;
|
||||
absl::optional<size_t> outlier_frame_size;
|
||||
absl::optional<int64_t> encode_start_ms;
|
||||
uint8_t timing_flags = VideoSendTiming::kNotTriggered;
|
||||
{
|
||||
rtc::CritScope crit(&timing_params_lock_);
|
||||
|
|
|
@ -79,8 +79,8 @@ class VCMEncodedFrameCallback : public EncodedImageCallback {
|
|||
private:
|
||||
// For non-internal-source encoders, returns encode started time and fixes
|
||||
// capture timestamp for the frame, if corrupted by the encoder.
|
||||
rtc::Optional<int64_t> ExtractEncodeStartTime(size_t simulcast_svc_idx,
|
||||
EncodedImage* encoded_image)
|
||||
absl::optional<int64_t> ExtractEncodeStartTime(size_t simulcast_svc_idx,
|
||||
EncodedImage* encoded_image)
|
||||
RTC_EXCLUSIVE_LOCKS_REQUIRED(timing_params_lock_);
|
||||
|
||||
void FillTimingInfo(size_t simulcast_svc_idx, EncodedImage* encoded_image);
|
||||
|
|
|
@ -219,9 +219,9 @@ void H264SpsPpsTracker::InsertSpsPpsNalus(const std::vector<uint8_t>& sps,
|
|||
RTC_LOG(LS_WARNING) << "SPS Nalu header missing";
|
||||
return;
|
||||
}
|
||||
rtc::Optional<SpsParser::SpsState> parsed_sps = SpsParser::ParseSps(
|
||||
absl::optional<SpsParser::SpsState> parsed_sps = SpsParser::ParseSps(
|
||||
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);
|
||||
|
||||
if (!parsed_sps) {
|
||||
|
|
|
@ -34,7 +34,7 @@ class MockVCMReceiveCallback : public VCMReceiveCallback {
|
|||
virtual ~MockVCMReceiveCallback() {}
|
||||
|
||||
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(OnIncomingPayloadType, void(int));
|
||||
MOCK_METHOD1(OnDecoderImplementationName, void(const char*));
|
||||
|
|
|
@ -58,8 +58,8 @@ class MockDecodedImageCallback : public DecodedImageCallback {
|
|||
int64_t decode_time_ms));
|
||||
MOCK_METHOD3(Decoded,
|
||||
void(VideoFrame& decodedImage, // NOLINT
|
||||
rtc::Optional<int32_t> decode_time_ms,
|
||||
rtc::Optional<uint8_t> qp));
|
||||
absl::optional<int32_t> decode_time_ms,
|
||||
absl::optional<uint8_t> qp));
|
||||
MOCK_METHOD1(ReceivedDecodedReferenceFrame,
|
||||
int32_t(const uint64_t pictureId));
|
||||
MOCK_METHOD1(ReceivedDecodedFrame, int32_t(const uint64_t pictureId));
|
||||
|
|
|
@ -70,7 +70,7 @@ struct VCMFrameCount {
|
|||
class VCMReceiveCallback {
|
||||
public:
|
||||
virtual int32_t FrameToRender(VideoFrame& videoFrame, // NOLINT
|
||||
rtc::Optional<uint8_t> qp,
|
||||
absl::optional<uint8_t> qp,
|
||||
VideoContentType content_type) = 0;
|
||||
|
||||
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId);
|
||||
|
|
|
@ -199,12 +199,12 @@ void PacketBuffer::PaddingReceived(uint16_t seq_num) {
|
|||
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_);
|
||||
return last_received_packet_ms_;
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> PacketBuffer::LastReceivedKeyframePacketMs() const {
|
||||
absl::optional<int64_t> PacketBuffer::LastReceivedKeyframePacketMs() const {
|
||||
rtc::CritScope lock(&crit_);
|
||||
return last_received_keyframe_packet_ms_;
|
||||
}
|
||||
|
|
|
@ -58,8 +58,8 @@ class PacketBuffer {
|
|||
void PaddingReceived(uint16_t seq_num);
|
||||
|
||||
// Timestamp (not RTP timestamp) of the last received packet/keyframe packet.
|
||||
rtc::Optional<int64_t> LastReceivedPacketMs() const;
|
||||
rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const;
|
||||
absl::optional<int64_t> LastReceivedPacketMs() const;
|
||||
absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
|
||||
|
||||
// Returns number of different frames seen in the packet buffer
|
||||
int GetUniqueFramesSeen() const;
|
||||
|
@ -159,13 +159,13 @@ class PacketBuffer {
|
|||
OnReceivedFrameCallback* const received_frame_callback_;
|
||||
|
||||
// Timestamp (not RTP timestamp) of the last received packet/keyframe packet.
|
||||
rtc::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_packet_ms_ RTC_GUARDED_BY(crit_);
|
||||
absl::optional<int64_t> last_received_keyframe_packet_ms_
|
||||
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_
|
||||
RTC_GUARDED_BY(crit_);
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ RtpFrameReferenceFinder::ManageFrameGeneric(RtpFrameObject* frame,
|
|||
|
||||
RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp8(
|
||||
RtpFrameObject* frame) {
|
||||
rtc::Optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader();
|
||||
absl::optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader();
|
||||
if (!rtp_codec_header) {
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Failed to get codec header from frame, dropping frame.";
|
||||
|
@ -393,7 +393,7 @@ void RtpFrameReferenceFinder::UpdateLayerInfoVp8(
|
|||
|
||||
RtpFrameReferenceFinder::FrameDecision RtpFrameReferenceFinder::ManageFrameVp9(
|
||||
RtpFrameObject* frame) {
|
||||
rtc::Optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader();
|
||||
absl::optional<RTPVideoTypeHeader> rtp_codec_header = frame->GetCodecHeader();
|
||||
if (!rtp_codec_header) {
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Failed to get codec header from frame, dropping frame.";
|
||||
|
|
|
@ -239,7 +239,7 @@ void VCMTiming::SetTimingFrameInfo(const TimingFrameInfo& info) {
|
|||
timing_frame_info_.emplace(info);
|
||||
}
|
||||
|
||||
rtc::Optional<TimingFrameInfo> VCMTiming::GetTimingFrameInfo() {
|
||||
absl::optional<TimingFrameInfo> VCMTiming::GetTimingFrameInfo() {
|
||||
rtc::CritScope cs(&crit_sect_);
|
||||
return timing_frame_info_;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ class VCMTiming {
|
|||
int* render_delay_ms) const;
|
||||
|
||||
void SetTimingFrameInfo(const TimingFrameInfo& info);
|
||||
rtc::Optional<TimingFrameInfo> GetTimingFrameInfo();
|
||||
absl::optional<TimingFrameInfo> GetTimingFrameInfo();
|
||||
|
||||
enum { kDefaultRenderDelayMs = 10 };
|
||||
enum { kDelayMaxChangeMsPerS = 100 };
|
||||
|
@ -124,7 +124,7 @@ class VCMTiming {
|
|||
int current_delay_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_);
|
||||
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_);
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
|
|
@ -23,13 +23,13 @@ void MovingAverage::AddSample(int sample) {
|
|||
sum_history_[count_ % sum_history_.size()] = sum_;
|
||||
}
|
||||
|
||||
rtc::Optional<int> MovingAverage::GetAverage() const {
|
||||
absl::optional<int> MovingAverage::GetAverage() const {
|
||||
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)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
int sum = sum_ - sum_history_[(count_ - num_samples) % sum_history_.size()];
|
||||
return sum / static_cast<int>(num_samples);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
|
||||
namespace webrtc {
|
||||
class MovingAverage {
|
||||
|
@ -21,8 +21,8 @@ class MovingAverage {
|
|||
explicit MovingAverage(size_t s);
|
||||
~MovingAverage();
|
||||
void AddSample(int sample);
|
||||
rtc::Optional<int> GetAverage() const;
|
||||
rtc::Optional<int> GetAverage(size_t num_samples) const;
|
||||
absl::optional<int> GetAverage() const;
|
||||
absl::optional<int> GetAverage(size_t num_samples) const;
|
||||
void Reset();
|
||||
size_t size() const;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue