Replace rtc::Optional with absl::optional in audio, call and video
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script with parameters 'audio call video':
#!/bin/bash
find $@ -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+
find $@ -type f -name BUILD.gn \
-exec sed -r -i 's|"(../)*api:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+;
git cl format
Bug: webrtc:9078
Change-Id: I02c5db956846a88a268a300ba086703a02d62e36
Reviewed-on: https://webrtc-review.googlesource.com/83722
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23628}
diff --git a/audio/BUILD.gn b/audio/BUILD.gn
index 75a62c2..709fd7f 100644
--- a/audio/BUILD.gn
+++ b/audio/BUILD.gn
@@ -49,7 +49,6 @@
"../api:array_view",
"../api:call_api",
"../api:libjingle_peerconnection_api",
- "../api:optional",
"../api:transport_api",
"../api/audio:aec3_factory",
"../api/audio:audio_frame_api",
@@ -87,6 +86,7 @@
"../system_wrappers:field_trial_api",
"../system_wrappers:metrics_api",
"utility:audio_frame_operations",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
if (rtc_include_tests) {
diff --git a/audio/audio_receive_stream.cc b/audio/audio_receive_stream.cc
index 941439f..b52563b 100644
--- a/audio/audio_receive_stream.cc
+++ b/audio/audio_receive_stream.cc
@@ -257,7 +257,7 @@
return config_.rtp.remote_ssrc;
}
-rtc::Optional<Syncable::Info> AudioReceiveStream::GetInfo() const {
+absl::optional<Syncable::Info> AudioReceiveStream::GetInfo() const {
RTC_DCHECK_RUN_ON(&module_process_thread_checker_);
Syncable::Info info;
@@ -270,14 +270,14 @@
if (!rtp_receiver->GetLatestTimestamps(
&info.latest_received_capture_timestamp,
&info.latest_receive_time_ms)) {
- return rtc::nullopt;
+ return absl::nullopt;
}
if (rtp_rtcp->RemoteNTP(&info.capture_time_ntp_secs,
&info.capture_time_ntp_frac,
nullptr,
nullptr,
&info.capture_time_source_clock) != 0) {
- return rtc::nullopt;
+ return absl::nullopt;
}
info.current_delay_ms = channel_proxy_->GetDelayEstimate();
diff --git a/audio/audio_receive_stream.h b/audio/audio_receive_stream.h
index 09007f0..64552e3 100644
--- a/audio/audio_receive_stream.h
+++ b/audio/audio_receive_stream.h
@@ -80,7 +80,7 @@
// Syncable
int id() const override;
- rtc::Optional<Syncable::Info> GetInfo() const override;
+ absl::optional<Syncable::Info> GetInfo() const override;
uint32_t GetPlayoutTimestamp() const override;
void SetMinimumPlayoutDelay(int delay_ms) override;
diff --git a/audio/audio_send_stream.cc b/audio/audio_send_stream.cc
index fe95559..8ed78eb 100644
--- a/audio/audio_send_stream.cc
+++ b/audio/audio_send_stream.cc
@@ -91,7 +91,7 @@
BitrateAllocator* bitrate_allocator,
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats,
- const rtc::Optional<RtpState>& suspended_rtp_state,
+ const absl::optional<RtpState>& suspended_rtp_state,
TimeInterval* overall_call_lifetime)
: AudioSendStream(config,
audio_state,
@@ -115,7 +115,7 @@
BitrateAllocator* bitrate_allocator,
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats,
- const rtc::Optional<RtpState>& suspended_rtp_state,
+ const absl::optional<RtpState>& suspended_rtp_state,
TimeInterval* overall_call_lifetime,
std::unique_ptr<voe::ChannelProxy> channel_proxy)
: worker_queue_(worker_queue),
@@ -445,8 +445,8 @@
void AudioSendStream::OnPacketFeedbackVector(
const std::vector<PacketFeedback>& packet_feedback_vector) {
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
- rtc::Optional<float> plr;
- rtc::Optional<float> rplr;
+ absl::optional<float> plr;
+ absl::optional<float> rplr;
{
rtc::CritScope lock(&packet_loss_tracker_cs_);
packet_loss_tracker_.OnPacketFeedbackVector(packet_feedback_vector);
@@ -584,7 +584,7 @@
return SetupSendCodec(stream, new_config);
}
- const rtc::Optional<int>& new_target_bitrate_bps =
+ const absl::optional<int>& new_target_bitrate_bps =
new_config.send_codec_spec->target_bitrate_bps;
// If a bitrate has been specified for the codec, use it over the
// codec's default.
diff --git a/audio/audio_send_stream.h b/audio/audio_send_stream.h
index c51c7a3..efc9c0e 100644
--- a/audio/audio_send_stream.h
+++ b/audio/audio_send_stream.h
@@ -49,7 +49,7 @@
BitrateAllocator* bitrate_allocator,
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats,
- const rtc::Optional<RtpState>& suspended_rtp_state,
+ const absl::optional<RtpState>& suspended_rtp_state,
TimeInterval* overall_call_lifetime);
// For unit tests, which need to supply a mock channel proxy.
AudioSendStream(const webrtc::AudioSendStream::Config& config,
@@ -59,7 +59,7 @@
BitrateAllocator* bitrate_allocator,
RtcEventLog* event_log,
RtcpRttStats* rtcp_rtt_stats,
- const rtc::Optional<RtpState>& suspended_rtp_state,
+ const absl::optional<RtpState>& suspended_rtp_state,
TimeInterval* overall_call_lifetime,
std::unique_ptr<voe::ChannelProxy> channel_proxy);
~AudioSendStream() override;
@@ -146,7 +146,7 @@
RTC_GUARDED_BY(&packet_loss_tracker_cs_);
RtpRtcp* rtp_rtcp_module_;
- rtc::Optional<RtpState> const suspended_rtp_state_;
+ absl::optional<RtpState> const suspended_rtp_state_;
std::unique_ptr<TimedTransport> timed_send_transport_adapter_;
TimeInterval active_lifetime_;
diff --git a/audio/audio_send_stream_unittest.cc b/audio/audio_send_stream_unittest.cc
index d399120..d0bc45f 100644
--- a/audio/audio_send_stream_unittest.cc
+++ b/audio/audio_send_stream_unittest.cc
@@ -109,17 +109,17 @@
std::begin(kCodecSpecs), std::end(kCodecSpecs))));
ON_CALL(*factory.get(), QueryAudioEncoder(_))
.WillByDefault(Invoke(
- [](const SdpAudioFormat& format) -> rtc::Optional<AudioCodecInfo> {
+ [](const SdpAudioFormat& format) -> absl::optional<AudioCodecInfo> {
for (const auto& spec : kCodecSpecs) {
if (format == spec.format) {
return spec.info;
}
}
- return rtc::nullopt;
+ return absl::nullopt;
}));
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _, _))
.WillByDefault(Invoke([](int payload_type, const SdpAudioFormat& format,
- rtc::Optional<AudioCodecPairId> codec_pair_id,
+ absl::optional<AudioCodecPairId> codec_pair_id,
std::unique_ptr<AudioEncoder>* return_value) {
*return_value = SetupAudioEncoderMock(payload_type, format);
}));
@@ -166,7 +166,7 @@
return std::unique_ptr<internal::AudioSendStream>(
new internal::AudioSendStream(
stream_config_, audio_state_, &worker_queue_, &rtp_transport_,
- &bitrate_allocator_, &event_log_, &rtcp_rtt_stats_, rtc::nullopt,
+ &bitrate_allocator_, &event_log_, &rtcp_rtt_stats_, absl::nullopt,
&active_lifetime_,
std::unique_ptr<voe::ChannelProxy>(channel_proxy_)));
}
@@ -424,7 +424,7 @@
EXPECT_CALL(helper.mock_encoder_factory(), MakeAudioEncoderMock(_, _, _, _))
.WillOnce(Invoke([&kAnaConfigString, &kAnaReconfigString](
int payload_type, const SdpAudioFormat& format,
- rtc::Optional<AudioCodecPairId> codec_pair_id,
+ absl::optional<AudioCodecPairId> codec_pair_id,
std::unique_ptr<AudioEncoder>* return_value) {
auto mock_encoder = SetupAudioEncoderMock(payload_type, format);
EXPECT_CALL(*mock_encoder,
diff --git a/audio/channel.cc b/audio/channel.cc
index e5dc5c2..ecde172 100644
--- a/audio/channel.cc
+++ b/audio/channel.cc
@@ -509,7 +509,7 @@
0,
false,
rtc::scoped_refptr<AudioDecoderFactory>(),
- rtc::nullopt) {
+ absl::nullopt) {
RTC_DCHECK(encoder_queue);
encoder_queue_ = encoder_queue;
}
@@ -520,7 +520,7 @@
size_t jitter_buffer_max_packets,
bool jitter_buffer_fast_playout,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
- rtc::Optional<AudioCodecPairId> codec_pair_id)
+ absl::optional<AudioCodecPairId> codec_pair_id)
: event_log_proxy_(new RtcEventLogProxy()),
rtp_payload_registry_(new RTPPayloadRegistry()),
rtp_receive_statistics_(
diff --git a/audio/channel.h b/audio/channel.h
index 6f79868..9830a25 100644
--- a/audio/channel.h
+++ b/audio/channel.h
@@ -16,11 +16,11 @@
#include <string>
#include <vector>
+#include "absl/types/optional.h"
#include "api/audio/audio_mixer.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/call/audio_sink.h"
#include "api/call/transport.h"
-#include "api/optional.h"
#include "audio/audio_level.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/audio_coding/include/audio_coding_module.h"
@@ -158,7 +158,7 @@
size_t jitter_buffer_max_packets,
bool jitter_buffer_fast_playout,
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory,
- rtc::Optional<AudioCodecPairId> codec_pair_id);
+ absl::optional<AudioCodecPairId> codec_pair_id);
virtual ~Channel();
void SetSink(AudioSinkInterface* sink);
@@ -353,7 +353,7 @@
RemoteNtpTimeEstimator ntp_estimator_ RTC_GUARDED_BY(ts_stats_lock_);
// Timestamp of the audio pulled from NetEq.
- rtc::Optional<uint32_t> jitter_buffer_playout_timestamp_;
+ absl::optional<uint32_t> jitter_buffer_playout_timestamp_;
rtc::CriticalSection video_sync_lock_;
uint32_t playout_timestamp_rtp_ RTC_GUARDED_BY(video_sync_lock_);
diff --git a/audio/time_interval.h b/audio/time_interval.h
index 88b2f7d..79fe29d 100644
--- a/audio/time_interval.h
+++ b/audio/time_interval.h
@@ -13,7 +13,7 @@
#include <stdint.h>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -57,7 +57,7 @@
int64_t first, last;
};
- rtc::Optional<Interval> interval_;
+ absl::optional<Interval> interval_;
};
} // namespace webrtc
diff --git a/audio/transport_feedback_packet_loss_tracker.cc b/audio/transport_feedback_packet_loss_tracker.cc
index 101b6b4..7e0c5c5 100644
--- a/audio/transport_feedback_packet_loss_tracker.cc
+++ b/audio/transport_feedback_packet_loss_tracker.cc
@@ -116,12 +116,12 @@
}
}
-rtc::Optional<float>
-TransportFeedbackPacketLossTracker::GetPacketLossRate() const {
+absl::optional<float> TransportFeedbackPacketLossTracker::GetPacketLossRate()
+ const {
return plr_state_.GetMetric();
}
-rtc::Optional<float>
+absl::optional<float>
TransportFeedbackPacketLossTracker::GetRecoverablePacketLossRate() const {
return rplr_state_.GetMetric();
}
@@ -344,20 +344,20 @@
RTC_CHECK_EQ(rplr_state_.num_recoverable_losses_, recoverable_losses);
}
-rtc::Optional<float>
-TransportFeedbackPacketLossTracker::PlrState::GetMetric() const {
+absl::optional<float> TransportFeedbackPacketLossTracker::PlrState::GetMetric()
+ const {
const size_t total = num_lost_packets_ + num_received_packets_;
if (total < min_num_acked_packets_) {
- return rtc::nullopt;
+ return absl::nullopt;
} else {
return static_cast<float>(num_lost_packets_) / total;
}
}
-rtc::Optional<float>
-TransportFeedbackPacketLossTracker::RplrState::GetMetric() const {
+absl::optional<float> TransportFeedbackPacketLossTracker::RplrState::GetMetric()
+ const {
if (num_acked_pairs_ < min_num_acked_pairs_) {
- return rtc::nullopt;
+ return absl::nullopt;
} else {
return static_cast<float>(num_recoverable_losses_) / num_acked_pairs_;
}
diff --git a/audio/transport_feedback_packet_loss_tracker.h b/audio/transport_feedback_packet_loss_tracker.h
index 4ad4902..7d58d6c 100644
--- a/audio/transport_feedback_packet_loss_tracker.h
+++ b/audio/transport_feedback_packet_loss_tracker.h
@@ -14,7 +14,7 @@
#include <map>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -43,11 +43,11 @@
// Returns the packet loss rate, if the window has enough packet statuses to
// reliably compute it. Otherwise, returns empty.
- rtc::Optional<float> GetPacketLossRate() const;
+ absl::optional<float> GetPacketLossRate() const;
// Returns the first-order-FEC recoverable packet loss rate, if the window has
// enough status pairs to reliably compute it. Otherwise, returns empty.
- rtc::Optional<float> GetRecoverablePacketLossRate() const;
+ absl::optional<float> GetRecoverablePacketLossRate() const;
// Verifies that the internal states are correct. Only used for tests.
void Validate() const;
@@ -108,7 +108,7 @@
num_received_packets_ = 0;
num_lost_packets_ = 0;
}
- rtc::Optional<float> GetMetric() const;
+ absl::optional<float> GetMetric() const;
const size_t min_num_acked_packets_;
size_t num_received_packets_;
size_t num_lost_packets_;
@@ -124,7 +124,7 @@
num_acked_pairs_ = 0;
num_recoverable_losses_ = 0;
}
- rtc::Optional<float> GetMetric() const;
+ absl::optional<float> GetMetric() const;
// Recoverable packets are those which were lost, but immediately followed
// by a properly received packet. If that second packet carried FEC,
// the data from the former (lost) packet could be recovered.
diff --git a/audio/transport_feedback_packet_loss_tracker_unittest.cc b/audio/transport_feedback_packet_loss_tracker_unittest.cc
index 8f8fe05..b190c62 100644
--- a/audio/transport_feedback_packet_loss_tracker_unittest.cc
+++ b/audio/transport_feedback_packet_loss_tracker_unittest.cc
@@ -94,18 +94,18 @@
// value is as expected.
void ValidatePacketLossStatistics(
const TransportFeedbackPacketLossTracker& tracker,
- rtc::Optional<float> expected_plr,
- rtc::Optional<float> expected_rplr) {
- // TODO(eladalon): Comparing the rtc::Optional<float> directly would have
+ absl::optional<float> expected_plr,
+ absl::optional<float> expected_rplr) {
+ // TODO(eladalon): Comparing the absl::optional<float> directly would have
// given concise code, but less readable error messages. If we modify
- // the way rtc::Optional is printed, we can get rid of this.
- rtc::Optional<float> plr = tracker.GetPacketLossRate();
+ // the way absl::optional is printed, we can get rid of this.
+ absl::optional<float> plr = tracker.GetPacketLossRate();
EXPECT_EQ(static_cast<bool>(expected_plr), static_cast<bool>(plr));
if (expected_plr && plr) {
EXPECT_EQ(*expected_plr, *plr);
}
- rtc::Optional<float> rplr = tracker.GetRecoverablePacketLossRate();
+ absl::optional<float> rplr = tracker.GetRecoverablePacketLossRate();
EXPECT_EQ(static_cast<bool>(expected_rplr), static_cast<bool>(rplr));
if (expected_rplr && rplr) {
EXPECT_EQ(*expected_rplr, *rplr);
@@ -127,7 +127,7 @@
TransportFeedbackPacketLossTracker tracker(kDefaultMaxWindowSizeMs, 5, 5);
// PLR and RPLR reported as unknown before reception of first feedback.
- ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
+ ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
}
// A feedback received for an empty window has no effect.
@@ -136,7 +136,7 @@
// Feedback doesn't correspond to any packets - ignored.
AddTransportFeedbackAndValidate(&tracker, base_, {true, false, true});
- ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
+ ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
// After the packets are transmitted, acking them would have an effect.
SendPackets(&tracker, base_, 3, kDefaultSendIntervalMs);
@@ -153,7 +153,7 @@
// Expected window contents: [] -> [1001].
SendPackets(&tracker, base_, 3, kDefaultSendIntervalMs);
AddTransportFeedbackAndValidate(&tracker, base_, {true, false, false, true});
- ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
+ ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
}
// Sanity check on minimum filled window - PLR known, RPLR unknown.
@@ -166,7 +166,7 @@
SendPackets(&tracker, base_, 5, kDefaultSendIntervalMs);
AddTransportFeedbackAndValidate(&tracker, base_,
{true, false, false, true, true});
- ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, rtc::nullopt);
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, absl::nullopt);
}
// Sanity check on minimum filled window - PLR unknown, RPLR known.
@@ -179,7 +179,7 @@
SendPackets(&tracker, base_, 5, kDefaultSendIntervalMs);
AddTransportFeedbackAndValidate(&tracker, base_,
{true, false, false, true, true});
- ValidatePacketLossStatistics(tracker, rtc::nullopt, 1.0f / 4.0f);
+ ValidatePacketLossStatistics(tracker, absl::nullopt, 1.0f / 4.0f);
}
// If packets are sent close enough together that the clock reading for both
@@ -203,7 +203,7 @@
// Expected window contents: [] -> [10011].
AddTransportFeedbackAndValidate(&tracker, base_,
{true, false, false, true, true});
- ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, rtc::nullopt);
+ ValidatePacketLossStatistics(tracker, 2.0f / 5.0f, absl::nullopt);
// Expected window contents: [10011] -> [1001110101].
AddTransportFeedbackAndValidate(&tracker, base_ + 5,
@@ -520,7 +520,7 @@
// A reset occurs.
SendPackets(&tracker, {static_cast<uint16_t>(base_ + 2)},
kDefaultSendIntervalMs);
- ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
+ ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
}
// The window is reset by the sending of a packet which is 0x8000 or more
@@ -539,7 +539,7 @@
// A reset occurs.
SendPackets(&tracker, {static_cast<uint16_t>(base_ + 5 + 0x8000)},
kDefaultSendIntervalMs);
- ValidatePacketLossStatistics(tracker, rtc::nullopt, rtc::nullopt);
+ ValidatePacketLossStatistics(tracker, absl::nullopt, absl::nullopt);
}
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
diff --git a/call/BUILD.gn b/call/BUILD.gn
index d994edd..ff72fd9 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -33,7 +33,6 @@
"../:typedefs",
"../api:fec_controller_api",
"../api:libjingle_peerconnection_api",
- "../api:optional",
"../api:transport_api",
"../api/audio:audio_mixer_api",
"../api/audio_codecs:audio_codecs_api",
@@ -44,6 +43,7 @@
"../rtc_base:audio_format_to_string",
"../rtc_base:rtc_base",
"../rtc_base:rtc_base_approved",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -61,9 +61,9 @@
]
deps = [
"../api:array_view",
- "../api:optional",
"../api/transport:bitrate_settings",
"../rtc_base:rtc_base_approved",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -87,11 +87,11 @@
"..:webrtc_common",
"../api:array_view",
"../api:libjingle_peerconnection_api",
- "../api:optional",
"../modules/rtp_rtcp",
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -177,7 +177,6 @@
":video_stream_api",
"..:webrtc_common",
"../api:callfactory_api",
- "../api:optional",
"../api:transport_api",
"../api/transport:network_control",
"../audio",
@@ -204,6 +203,7 @@
"../system_wrappers:field_trial_api",
"../system_wrappers:metrics_api",
"../video",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -220,7 +220,6 @@
"../:typedefs",
"../:webrtc_common",
"../api:libjingle_peerconnection_api",
- "../api:optional",
"../api:transport_api",
"../api/video:video_frame",
"../api/video_codecs:video_codecs_api",
@@ -228,6 +227,7 @@
"../modules/rtp_rtcp:rtp_rtcp_format",
"../rtc_base:checks",
"../rtc_base:rtc_base_approved",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
diff --git a/call/audio_receive_stream.h b/call/audio_receive_stream.h
index 3c0e58d..56c900b 100644
--- a/call/audio_receive_stream.h
+++ b/call/audio_receive_stream.h
@@ -16,9 +16,9 @@
#include <string>
#include <vector>
+#include "absl/types/optional.h"
#include "api/audio_codecs/audio_decoder_factory.h"
#include "api/call/transport.h"
-#include "api/optional.h"
#include "api/rtpparameters.h"
#include "api/rtpreceiverinterface.h"
#include "call/rtp_config.h"
@@ -40,7 +40,7 @@
uint32_t packets_lost = 0;
float fraction_lost = 0.0f;
std::string codec_name;
- rtc::Optional<int> codec_payload_type;
+ absl::optional<int> codec_payload_type;
uint32_t ext_seqnum = 0;
uint32_t jitter_ms = 0;
uint32_t jitter_buffer_ms = 0;
@@ -120,7 +120,7 @@
rtc::scoped_refptr<AudioDecoderFactory> decoder_factory;
- rtc::Optional<AudioCodecPairId> codec_pair_id;
+ absl::optional<AudioCodecPairId> codec_pair_id;
};
// Reconfigure the stream according to the Configuration.
diff --git a/call/audio_send_stream.h b/call/audio_send_stream.h
index 3bfff12..9119545 100644
--- a/call/audio_send_stream.h
+++ b/call/audio_send_stream.h
@@ -15,12 +15,12 @@
#include <string>
#include <vector>
+#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_encoder_factory.h"
#include "api/audio_codecs/audio_format.h"
#include "api/call/transport.h"
-#include "api/optional.h"
#include "api/rtpparameters.h"
#include "call/rtp_config.h"
#include "modules/audio_processing/include/audio_processing_statistics.h"
@@ -44,7 +44,7 @@
int32_t packets_lost = -1;
float fraction_lost = -1.0f;
std::string codec_name;
- rtc::Optional<int> codec_payload_type;
+ absl::optional<int> codec_payload_type;
int32_t ext_seqnum = -1;
int32_t jitter_ms = -1;
int64_t rtt_ms = -1;
@@ -102,7 +102,7 @@
// Defines whether to turn on audio network adaptor, and defines its config
// string.
- rtc::Optional<std::string> audio_network_adaptor_config;
+ absl::optional<std::string> audio_network_adaptor_config;
struct SendCodecSpec {
SendCodecSpec(int payload_type, const SdpAudioFormat& format);
@@ -118,14 +118,14 @@
SdpAudioFormat format;
bool nack_enabled = false;
bool transport_cc_enabled = false;
- rtc::Optional<int> cng_payload_type;
+ absl::optional<int> cng_payload_type;
// If unset, use the encoder's default target bitrate.
- rtc::Optional<int> target_bitrate_bps;
+ absl::optional<int> target_bitrate_bps;
};
- rtc::Optional<SendCodecSpec> send_codec_spec;
+ absl::optional<SendCodecSpec> send_codec_spec;
rtc::scoped_refptr<AudioEncoderFactory> encoder_factory;
- rtc::Optional<AudioCodecPairId> codec_pair_id;
+ absl::optional<AudioCodecPairId> codec_pair_id;
// Track ID as specified during track creation.
std::string track_id;
diff --git a/call/bitrate_estimator_tests.cc b/call/bitrate_estimator_tests.cc
index 6b69bc0..9e3128c 100644
--- a/call/bitrate_estimator_tests.cc
+++ b/call/bitrate_estimator_tests.cc
@@ -167,7 +167,7 @@
test_->video_encoder_config_.Copy());
RTC_DCHECK_EQ(1, test_->video_encoder_config_.number_of_streams);
frame_generator_capturer_.reset(test::FrameGeneratorCapturer::Create(
- kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt,
+ kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt,
kDefaultFramerate, Clock::GetRealTimeClock()));
send_stream_->SetSource(frame_generator_capturer_.get(),
DegradationPreference::MAINTAIN_FRAMERATE);
diff --git a/call/call.cc b/call/call.cc
index e0105ab..be94f6a 100644
--- a/call/call.cc
+++ b/call/call.cc
@@ -16,7 +16,7 @@
#include <utility>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/transport/network_control.h"
#include "audio/audio_receive_stream.h"
#include "audio/audio_send_stream.h"
@@ -343,10 +343,10 @@
RateCounter received_audio_bytes_per_second_counter_;
RateCounter received_video_bytes_per_second_counter_;
RateCounter received_rtcp_bytes_per_second_counter_;
- rtc::Optional<int64_t> first_received_rtp_audio_ms_;
- rtc::Optional<int64_t> last_received_rtp_audio_ms_;
- rtc::Optional<int64_t> first_received_rtp_video_ms_;
- rtc::Optional<int64_t> last_received_rtp_video_ms_;
+ absl::optional<int64_t> first_received_rtp_audio_ms_;
+ absl::optional<int64_t> last_received_rtp_audio_ms_;
+ absl::optional<int64_t> first_received_rtp_video_ms_;
+ absl::optional<int64_t> last_received_rtp_video_ms_;
TimeInterval sent_rtp_audio_timer_ms_;
rtc::CriticalSection last_bandwidth_bps_crit_;
@@ -584,7 +584,7 @@
event_log_->Log(rtc::MakeUnique<RtcEventAudioSendStreamConfig>(
CreateRtcLogStreamConfig(config)));
- rtc::Optional<RtpState> suspended_rtp_state;
+ absl::optional<RtpState> suspended_rtp_state;
{
const auto& iter = suspended_audio_send_ssrcs_.find(config.rtp.ssrc);
if (iter != suspended_audio_send_ssrcs_.end()) {
diff --git a/call/call_perf_tests.cc b/call/call_perf_tests.cc
index 3b4264f..204134d 100644
--- a/call/call_perf_tests.cc
+++ b/call/call_perf_tests.cc
@@ -914,7 +914,7 @@
send_config->max_bitrate_bps = kOpusBitrateFbBps;
} else {
send_config->send_codec_spec->target_bitrate_bps =
- rtc::Optional<int>(kOpusBitrateFbBps);
+ absl::optional<int>(kOpusBitrateFbBps);
}
}
diff --git a/call/callfactory.cc b/call/callfactory.cc
index 4ab5b89..b5c28d2 100644
--- a/call/callfactory.cc
+++ b/call/callfactory.cc
@@ -14,7 +14,7 @@
#include <string>
#include <utility>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "call/call.h"
#include "call/degraded_call.h"
#include "call/fake_network_pipe.h"
@@ -30,7 +30,7 @@
return (sscanf(group.c_str(), "%d", field) == 1);
}
-rtc::Optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
+absl::optional<webrtc::FakeNetworkPipe::Config> ParseDegradationConfig(
bool send) {
std::string exp_prefix = "WebRTCFakeNetwork";
if (send) {
@@ -62,15 +62,15 @@
}
configured |= ParseConfigParam(exp_prefix + "AvgBurstLossLength",
&config.avg_burst_loss_length);
- return configured ? rtc::Optional<webrtc::FakeNetworkPipe::Config>(config)
- : rtc::nullopt;
+ return configured ? absl::optional<webrtc::FakeNetworkPipe::Config>(config)
+ : absl::nullopt;
}
} // namespace
Call* CallFactory::CreateCall(const Call::Config& config) {
- rtc::Optional<webrtc::FakeNetworkPipe::Config> send_degradation_config =
+ absl::optional<webrtc::FakeNetworkPipe::Config> send_degradation_config =
ParseDegradationConfig(true);
- rtc::Optional<webrtc::FakeNetworkPipe::Config> receive_degradation_config =
+ absl::optional<webrtc::FakeNetworkPipe::Config> receive_degradation_config =
ParseDegradationConfig(false);
if (send_degradation_config || receive_degradation_config) {
diff --git a/call/degraded_call.cc b/call/degraded_call.cc
index 6515b65..697c5f4 100644
--- a/call/degraded_call.cc
+++ b/call/degraded_call.cc
@@ -17,8 +17,8 @@
namespace webrtc {
DegradedCall::DegradedCall(
std::unique_ptr<Call> call,
- rtc::Optional<FakeNetworkPipe::Config> send_config,
- rtc::Optional<FakeNetworkPipe::Config> receive_config)
+ absl::optional<FakeNetworkPipe::Config> send_config,
+ absl::optional<FakeNetworkPipe::Config> receive_config)
: clock_(Clock::GetRealTimeClock()),
call_(std::move(call)),
send_config_(send_config),
diff --git a/call/degraded_call.h b/call/degraded_call.h
index 5658873..4510578 100644
--- a/call/degraded_call.h
+++ b/call/degraded_call.h
@@ -13,8 +13,8 @@
#include <memory>
+#include "absl/types/optional.h"
#include "api/call/transport.h"
-#include "api/optional.h"
#include "call/call.h"
#include "call/fake_network_pipe.h"
#include "modules/utility/include/process_thread.h"
@@ -25,8 +25,8 @@
class DegradedCall : public Call, private Transport, private PacketReceiver {
public:
explicit DegradedCall(std::unique_ptr<Call> call,
- rtc::Optional<FakeNetworkPipe::Config> send_config,
- rtc::Optional<FakeNetworkPipe::Config> receive_config);
+ absl::optional<FakeNetworkPipe::Config> send_config,
+ absl::optional<FakeNetworkPipe::Config> receive_config);
~DegradedCall() override;
// Implements Call.
@@ -90,12 +90,12 @@
Clock* const clock_;
const std::unique_ptr<Call> call_;
- const rtc::Optional<FakeNetworkPipe::Config> send_config_;
+ const absl::optional<FakeNetworkPipe::Config> send_config_;
const std::unique_ptr<ProcessThread> send_process_thread_;
std::unique_ptr<FakeNetworkPipe> send_pipe_;
size_t num_send_streams_;
- const rtc::Optional<FakeNetworkPipe::Config> receive_config_;
+ const absl::optional<FakeNetworkPipe::Config> receive_config_;
std::unique_ptr<FakeNetworkPipe> receive_pipe_;
};
diff --git a/call/fake_network_pipe.cc b/call/fake_network_pipe.cc
index 00b6f0e..ebe551a 100644
--- a/call/fake_network_pipe.cc
+++ b/call/fake_network_pipe.cc
@@ -32,10 +32,10 @@
NetworkPacket::NetworkPacket(rtc::CopyOnWriteBuffer packet,
int64_t send_time,
int64_t arrival_time,
- rtc::Optional<PacketOptions> packet_options,
+ absl::optional<PacketOptions> packet_options,
bool is_rtcp,
MediaType media_type,
- rtc::Optional<PacketTime> packet_time)
+ absl::optional<PacketTime> packet_time)
: packet_(std::move(packet)),
send_time_(send_time),
arrival_time_(arrival_time),
@@ -115,14 +115,14 @@
const PacketOptions& options) {
RTC_DCHECK(HasTransport());
EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), options, false,
- MediaType::ANY, rtc::nullopt);
+ MediaType::ANY, absl::nullopt);
return true;
}
bool FakeNetworkPipe::SendRtcp(const uint8_t* packet, size_t length) {
RTC_DCHECK(HasTransport());
- EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), rtc::nullopt, true,
- MediaType::ANY, rtc::nullopt);
+ EnqueuePacket(rtc::CopyOnWriteBuffer(packet, length), absl::nullopt, true,
+ MediaType::ANY, absl::nullopt);
return true;
}
@@ -130,7 +130,7 @@
MediaType media_type,
rtc::CopyOnWriteBuffer packet,
const PacketTime& packet_time) {
- return EnqueuePacket(std::move(packet), rtc::nullopt, false, media_type,
+ return EnqueuePacket(std::move(packet), absl::nullopt, false, media_type,
packet_time)
? PacketReceiver::DELIVERY_OK
: PacketReceiver::DELIVERY_PACKET_ERROR;
@@ -213,20 +213,20 @@
return true;
}
-rtc::Optional<int64_t> SimulatedNetwork::NextDeliveryTimeUs() const {
+absl::optional<int64_t> SimulatedNetwork::NextDeliveryTimeUs() const {
if (!delay_link_.empty())
return delay_link_.begin()->arrival_time_us;
- return rtc::nullopt;
+ return absl::nullopt;
}
FakeNetworkPipe::StoredPacket::StoredPacket(NetworkPacket&& packet)
: packet(std::move(packet)) {}
bool FakeNetworkPipe::EnqueuePacket(rtc::CopyOnWriteBuffer packet,
- rtc::Optional<PacketOptions> options,
+ absl::optional<PacketOptions> options,
bool is_rtcp,
MediaType media_type,
- rtc::Optional<PacketTime> packet_time) {
+ absl::optional<PacketTime> packet_time) {
int64_t time_now_us = clock_->TimeInMicroseconds();
rtc::CritScope crit(&process_lock_);
size_t packet_size = packet.size();
@@ -413,7 +413,7 @@
packets_to_deliver.pop();
DeliverPacket(&packet);
}
- rtc::Optional<int64_t> delivery_us =
+ absl::optional<int64_t> delivery_us =
network_simulation_->NextDeliveryTimeUs();
next_process_time_us_ = delivery_us
? *delivery_us
diff --git a/call/fake_network_pipe.h b/call/fake_network_pipe.h
index 799970b..c587973 100644
--- a/call/fake_network_pipe.h
+++ b/call/fake_network_pipe.h
@@ -40,10 +40,10 @@
NetworkPacket(rtc::CopyOnWriteBuffer packet,
int64_t send_time,
int64_t arrival_time,
- rtc::Optional<PacketOptions> packet_options,
+ absl::optional<PacketOptions> packet_options,
bool is_rtcp,
MediaType media_type_,
- rtc::Optional<PacketTime> packet_time_);
+ absl::optional<PacketTime> packet_time_);
// Disallow copy constructor and copy assignment (no deep copies of |data_|).
NetworkPacket(const NetworkPacket&) = delete;
NetworkPacket& operator=(const NetworkPacket&) = delete;
@@ -74,14 +74,14 @@
int64_t arrival_time_;
// If using a Transport for outgoing degradation, populate with
// PacketOptions (transport-wide sequence number) for RTP.
- rtc::Optional<PacketOptions> packet_options_;
+ absl::optional<PacketOptions> packet_options_;
bool is_rtcp_;
// If using a PacketReceiver for incoming degradation, populate with
// appropriate MediaType and PacketTime. This type/timing will be kept and
// forwarded. The PacketTime might be altered to reflect time spent in fake
// network pipe.
MediaType media_type_;
- rtc::Optional<PacketTime> packet_time_;
+ absl::optional<PacketTime> packet_time_;
};
struct PacketInFlightInfo {
@@ -108,7 +108,7 @@
// Retrieves all packets that should be delivered by the given receive time.
virtual std::vector<PacketDeliveryInfo> DequeueDeliverablePackets(
int64_t receive_time_us) = 0;
- virtual rtc::Optional<int64_t> NextDeliveryTimeUs() const = 0;
+ virtual absl::optional<int64_t> NextDeliveryTimeUs() const = 0;
virtual ~NetworkSimulationInterface() = default;
};
@@ -144,7 +144,7 @@
std::vector<PacketDeliveryInfo> DequeueDeliverablePackets(
int64_t receive_time_us) override;
- rtc::Optional<int64_t> NextDeliveryTimeUs() const override;
+ absl::optional<int64_t> NextDeliveryTimeUs() const override;
private:
struct PacketInfo {
@@ -260,10 +260,10 @@
// Returns true if enqueued, or false if packet was dropped.
virtual bool EnqueuePacket(rtc::CopyOnWriteBuffer packet,
- rtc::Optional<PacketOptions> options,
- bool is_rtcp,
- MediaType media_type,
- rtc::Optional<PacketTime> packet_time);
+ absl::optional<PacketOptions> options,
+ bool is_rtcp,
+ MediaType media_type,
+ absl::optional<PacketTime> packet_time);
void DeliverPacket(NetworkPacket* packet)
RTC_EXCLUSIVE_LOCKS_REQUIRED(config_lock_);
bool HasTransport() const;
diff --git a/call/receive_time_calculator.h b/call/receive_time_calculator.h
index b2dc003..a8217cd 100644
--- a/call/receive_time_calculator.h
+++ b/call/receive_time_calculator.h
@@ -13,7 +13,7 @@
#include <stdint.h>
#include <memory>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -39,7 +39,7 @@
private:
const int64_t min_delta_us_;
const int64_t max_delta_diff_us_;
- rtc::Optional<int64_t> receive_time_offset_us_;
+ absl::optional<int64_t> receive_time_offset_us_;
int64_t last_packet_time_us_ = 0;
int64_t last_safe_time_us_ = 0;
};
diff --git a/call/rtcp_demuxer.cc b/call/rtcp_demuxer.cc
index 0e78dde..40c9163 100644
--- a/call/rtcp_demuxer.cc
+++ b/call/rtcp_demuxer.cc
@@ -66,7 +66,7 @@
void RtcpDemuxer::OnRtcpPacket(rtc::ArrayView<const uint8_t> packet) {
// Perform sender-SSRC-based demuxing for packets with a sender-SSRC.
- rtc::Optional<uint32_t> sender_ssrc = ParseRtcpPacketSenderSsrc(packet);
+ absl::optional<uint32_t> sender_ssrc = ParseRtcpPacketSenderSsrc(packet);
if (sender_ssrc) {
auto it_range = ssrc_sinks_.equal_range(*sender_ssrc);
for (auto it = it_range.first; it != it_range.second; ++it) {
diff --git a/call/rtp_bitrate_configurator.cc b/call/rtp_bitrate_configurator.cc
index b3bc183..fafd8ec 100644
--- a/call/rtp_bitrate_configurator.cc
+++ b/call/rtp_bitrate_configurator.cc
@@ -33,7 +33,7 @@
return bitrate_config_;
}
-rtc::Optional<BitrateConstraints>
+absl::optional<BitrateConstraints>
RtpBitrateConfigurator::UpdateWithSdpParameters(
const BitrateConstraints& bitrate_config) {
RTC_DCHECK_GE(bitrate_config.min_bitrate_bps, 0);
@@ -42,7 +42,7 @@
RTC_DCHECK_GT(bitrate_config.max_bitrate_bps, 0);
}
- rtc::Optional<int> new_start;
+ absl::optional<int> new_start;
// Only update the "start" bitrate if it's set, and different from the old
// value. In practice, this value comes from the x-google-start-bitrate codec
// parameter in SDP, and setting the same remote description twice shouldn't
@@ -56,15 +56,15 @@
return UpdateConstraints(new_start);
}
-rtc::Optional<BitrateConstraints>
+absl::optional<BitrateConstraints>
RtpBitrateConfigurator::UpdateWithClientPreferences(
const BitrateSettings& bitrate_mask) {
bitrate_config_mask_ = bitrate_mask;
return UpdateConstraints(bitrate_mask.start_bitrate_bps);
}
-rtc::Optional<BitrateConstraints> RtpBitrateConfigurator::UpdateConstraints(
- const rtc::Optional<int>& new_start) {
+absl::optional<BitrateConstraints> RtpBitrateConfigurator::UpdateConstraints(
+ const absl::optional<int>& new_start) {
BitrateConstraints updated;
updated.min_bitrate_bps =
std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0),
@@ -86,7 +86,7 @@
if (updated.min_bitrate_bps == bitrate_config_.min_bitrate_bps &&
updated.max_bitrate_bps == bitrate_config_.max_bitrate_bps &&
!new_start) {
- return rtc::nullopt;
+ return absl::nullopt;
}
if (new_start) {
diff --git a/call/rtp_bitrate_configurator.h b/call/rtp_bitrate_configurator.h
index 14f312b..a311774 100644
--- a/call/rtp_bitrate_configurator.h
+++ b/call/rtp_bitrate_configurator.h
@@ -32,7 +32,7 @@
// implemented. Passing -1 leaves the start bitrate unchanged. Behavior is not
// guaranteed for other negative values or 0.
// The optional return value is set with new configuration if it was updated.
- rtc::Optional<BitrateConstraints> UpdateWithSdpParameters(
+ absl::optional<BitrateConstraints> UpdateWithSdpParameters(
const BitrateConstraints& bitrate_config_);
// The greater min and smaller max set by this and SetSdpBitrateParameters
@@ -41,14 +41,14 @@
// Assumes 0 <= min <= start <= max holds for set parameters.
// Update the bitrate configuration
// The optional return value is set with new configuration if it was updated.
- rtc::Optional<BitrateConstraints> UpdateWithClientPreferences(
+ absl::optional<BitrateConstraints> UpdateWithClientPreferences(
const BitrateSettings& bitrate_mask);
private:
// Applies update to the BitrateConstraints cached in |config_|, resetting
// with |new_start| if set.
- rtc::Optional<BitrateConstraints> UpdateConstraints(
- const rtc::Optional<int>& new_start);
+ absl::optional<BitrateConstraints> UpdateConstraints(
+ const absl::optional<int>& new_start);
// Bitrate config used until valid bitrate estimates are calculated. Also
// used to cap total bitrate used. This comes from the remote connection.
diff --git a/call/rtp_bitrate_configurator_unittest.cc b/call/rtp_bitrate_configurator_unittest.cc
index d5eed23..b177db7 100644
--- a/call/rtp_bitrate_configurator_unittest.cc
+++ b/call/rtp_bitrate_configurator_unittest.cc
@@ -13,7 +13,7 @@
#include "test/gtest.h"
namespace webrtc {
-using rtc::nullopt;
+using absl::nullopt;
class RtpBitrateConfiguratorTest : public testing::Test {
public:
@@ -21,10 +21,10 @@
: configurator_(new RtpBitrateConfigurator(BitrateConstraints())) {}
std::unique_ptr<RtpBitrateConfigurator> configurator_;
void UpdateConfigMatches(BitrateConstraints bitrate_config,
- rtc::Optional<int> min_bitrate_bps,
- rtc::Optional<int> start_bitrate_bps,
- rtc::Optional<int> max_bitrate_bps) {
- rtc::Optional<BitrateConstraints> result =
+ absl::optional<int> min_bitrate_bps,
+ absl::optional<int> start_bitrate_bps,
+ absl::optional<int> max_bitrate_bps) {
+ absl::optional<BitrateConstraints> result =
configurator_->UpdateWithSdpParameters(bitrate_config);
EXPECT_TRUE(result.has_value());
if (start_bitrate_bps.has_value())
@@ -36,10 +36,10 @@
}
void UpdateMaskMatches(BitrateSettings bitrate_mask,
- rtc::Optional<int> min_bitrate_bps,
- rtc::Optional<int> start_bitrate_bps,
- rtc::Optional<int> max_bitrate_bps) {
- rtc::Optional<BitrateConstraints> result =
+ absl::optional<int> min_bitrate_bps,
+ absl::optional<int> start_bitrate_bps,
+ absl::optional<int> max_bitrate_bps) {
+ absl::optional<BitrateConstraints> result =
configurator_->UpdateWithClientPreferences(bitrate_mask);
EXPECT_TRUE(result.has_value());
if (start_bitrate_bps.has_value())
diff --git a/call/rtp_rtcp_demuxer_helper.cc b/call/rtp_rtcp_demuxer_helper.cc
index deabe73..125169b 100644
--- a/call/rtp_rtcp_demuxer_helper.cc
+++ b/call/rtp_rtcp_demuxer_helper.cc
@@ -21,13 +21,13 @@
namespace webrtc {
-rtc::Optional<uint32_t> ParseRtcpPacketSenderSsrc(
+absl::optional<uint32_t> ParseRtcpPacketSenderSsrc(
rtc::ArrayView<const uint8_t> packet) {
rtcp::CommonHeader header;
for (const uint8_t* next_packet = packet.begin(); next_packet < packet.end();
next_packet = header.NextPacket()) {
if (!header.Parse(next_packet, packet.end() - next_packet)) {
- return rtc::nullopt;
+ return absl::nullopt;
}
switch (header.type()) {
@@ -43,13 +43,13 @@
ByteReader<uint32_t>::ReadBigEndian(header.payload());
return ssrc_sender;
} else {
- return rtc::nullopt;
+ return absl::nullopt;
}
}
}
}
- return rtc::nullopt;
+ return absl::nullopt;
}
} // namespace webrtc
diff --git a/call/rtp_rtcp_demuxer_helper.h b/call/rtp_rtcp_demuxer_helper.h
index fef7255..4b66713 100644
--- a/call/rtp_rtcp_demuxer_helper.h
+++ b/call/rtp_rtcp_demuxer_helper.h
@@ -15,8 +15,8 @@
#include <map>
#include <utility>
+#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "api/optional.h"
namespace webrtc {
@@ -89,7 +89,7 @@
return it_range.first != it_range.second;
}
-rtc::Optional<uint32_t> ParseRtcpPacketSenderSsrc(
+absl::optional<uint32_t> ParseRtcpPacketSenderSsrc(
rtc::ArrayView<const uint8_t> packet);
} // namespace webrtc
diff --git a/call/rtp_rtcp_demuxer_helper_unittest.cc b/call/rtp_rtcp_demuxer_helper_unittest.cc
index 5fe8274..9f37886 100644
--- a/call/rtp_rtcp_demuxer_helper_unittest.cc
+++ b/call/rtp_rtcp_demuxer_helper_unittest.cc
@@ -34,7 +34,7 @@
rtcp_packet.SetSenderSsrc(kSsrc);
rtc::Buffer raw_packet = rtcp_packet.Build();
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
EXPECT_EQ(ssrc, kSsrc);
}
@@ -44,7 +44,7 @@
rtcp_packet.SetSenderSsrc(kSsrc);
rtc::Buffer raw_packet = rtcp_packet.Build();
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
EXPECT_EQ(ssrc, kSsrc);
}
@@ -53,7 +53,7 @@
rtcp_packet.SetSenderSsrc(kSsrc);
rtc::Buffer raw_packet = rtcp_packet.Build();
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
EXPECT_EQ(ssrc, kSsrc);
}
@@ -62,7 +62,7 @@
rtcp_packet.SetSenderSsrc(kSsrc);
rtc::Buffer raw_packet = rtcp_packet.Build();
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
EXPECT_EQ(ssrc, kSsrc);
}
@@ -72,7 +72,7 @@
rtcp_packet.SetSenderSsrc(kSsrc);
rtc::Buffer raw_packet = rtcp_packet.Build();
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
EXPECT_EQ(ssrc, kSsrc);
}
@@ -81,7 +81,7 @@
rtcp_packet.SetSenderSsrc(kSsrc);
rtc::Buffer raw_packet = rtcp_packet.Build();
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
EXPECT_EQ(ssrc, kSsrc);
}
@@ -89,7 +89,7 @@
uint8_t garbage[100];
memset(&garbage[0], 0, arraysize(garbage));
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(garbage);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(garbage);
EXPECT_FALSE(ssrc);
}
@@ -98,7 +98,7 @@
webrtc::rtcp::ExtendedJitterReport rtcp_packet; // Has no sender SSRC.
rtc::Buffer raw_packet = rtcp_packet.Build();
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(raw_packet);
EXPECT_FALSE(ssrc);
}
@@ -110,7 +110,7 @@
constexpr size_t rtcp_length_bytes = 8;
ASSERT_EQ(rtcp_length_bytes, raw_packet.size());
- rtc::Optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(
+ absl::optional<uint32_t> ssrc = ParseRtcpPacketSenderSsrc(
rtc::ArrayView<const uint8_t>(raw_packet.data(), rtcp_length_bytes - 1));
EXPECT_FALSE(ssrc);
}
diff --git a/call/rtp_transport_controller_send.cc b/call/rtp_transport_controller_send.cc
index 76ba7f6..a0e47b5 100644
--- a/call/rtp_transport_controller_send.cc
+++ b/call/rtp_transport_controller_send.cc
@@ -237,7 +237,7 @@
void RtpTransportControllerSend::SetSdpBitrateParameters(
const BitrateConstraints& constraints) {
- rtc::Optional<BitrateConstraints> updated =
+ absl::optional<BitrateConstraints> updated =
bitrate_configurator_.UpdateWithSdpParameters(constraints);
if (updated.has_value()) {
send_side_cc_->SetBweBitrates(updated->min_bitrate_bps,
@@ -252,7 +252,7 @@
void RtpTransportControllerSend::SetClientBitratePreferences(
const BitrateSettings& preferences) {
- rtc::Optional<BitrateConstraints> updated =
+ absl::optional<BitrateConstraints> updated =
bitrate_configurator_.UpdateWithClientPreferences(preferences);
if (updated.has_value()) {
send_side_cc_->SetBweBitrates(updated->min_bitrate_bps,
diff --git a/call/rtp_transport_controller_send_interface.h b/call/rtp_transport_controller_send_interface.h
index ad3aa2b..0269b13 100644
--- a/call/rtp_transport_controller_send_interface.h
+++ b/call/rtp_transport_controller_send_interface.h
@@ -15,7 +15,7 @@
#include <string>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/transport/bitrate_settings.h"
#include "call/bitrate_constraints.h"
diff --git a/call/syncable.h b/call/syncable.h
index a97990b..a914793 100644
--- a/call/syncable.h
+++ b/call/syncable.h
@@ -16,7 +16,7 @@
#include <stdint.h>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -34,7 +34,7 @@
virtual ~Syncable();
virtual int id() const = 0;
- virtual rtc::Optional<Info> GetInfo() const = 0;
+ virtual absl::optional<Info> GetInfo() const = 0;
virtual uint32_t GetPlayoutTimestamp() const = 0;
virtual void SetMinimumPlayoutDelay(int delay_ms) = 0;
};
diff --git a/call/video_receive_stream.h b/call/video_receive_stream.h
index 3f01796..a5cd11a 100644
--- a/call/video_receive_stream.h
+++ b/call/video_receive_stream.h
@@ -82,7 +82,7 @@
int render_delay_ms = 10;
int64_t interframe_delay_max_ms = -1;
uint32_t frames_decoded = 0;
- rtc::Optional<uint64_t> qp_sum;
+ absl::optional<uint64_t> qp_sum;
int current_payload_type = -1;
@@ -104,7 +104,7 @@
// Timing frame info: all important timestamps for a full lifetime of a
// single 'timing frame'.
- rtc::Optional<webrtc::TimingFrameInfo> timing_frame_info;
+ absl::optional<webrtc::TimingFrameInfo> timing_frame_info;
};
struct Config {
diff --git a/call/video_send_stream.h b/call/video_send_stream.h
index d5be086..b5bd199 100644
--- a/call/video_send_stream.h
+++ b/call/video_send_stream.h
@@ -68,7 +68,7 @@
uint32_t frames_dropped_by_encoder_queue = 0;
uint32_t frames_dropped_by_rate_limiter = 0;
uint32_t frames_dropped_by_encoder = 0;
- rtc::Optional<uint64_t> qp_sum;
+ absl::optional<uint64_t> qp_sum;
// Bitrate the encoder is currently configured to use due to bandwidth
// limitations.
int target_media_bitrate_bps = 0;
diff --git a/video/BUILD.gn b/video/BUILD.gn
index f56a71d..df50d90 100644
--- a/video/BUILD.gn
+++ b/video/BUILD.gn
@@ -62,7 +62,6 @@
"../:typedefs",
"../api:fec_controller_api",
"../api:libjingle_peerconnection_api",
- "../api:optional",
"../api:transport_api",
"../api/video:video_frame",
"../api/video:video_frame_i420",
@@ -84,6 +83,7 @@
"../rtc_base/system:fallthrough",
"../system_wrappers:field_trial_api",
"../system_wrappers:metrics_api",
+ "//third_party/abseil-cpp/absl/types:optional",
# For RtxReceiveStream.
"../call:rtp_receiver",
@@ -121,7 +121,6 @@
]
deps = [
- "../api:optional",
"../api/video:encoded_frame",
"../api/video:video_frame",
"../api/video:video_stream_decoder",
@@ -130,6 +129,7 @@
"../rtc_base:rtc_base_approved",
"../rtc_base:rtc_task_queue_api",
"../system_wrappers:system_wrappers",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -364,7 +364,6 @@
deps = [
":video",
":video_mocks",
- "../api:optional",
"../api/video:video_frame",
"../api/video:video_frame_i420",
"../api/video_codecs:video_codecs_api",
@@ -417,6 +416,7 @@
"../test:test_support",
"../test:video_test_common",
"//testing/gtest",
+ "//third_party/abseil-cpp/absl/types:optional",
]
if (!build_with_chromium && is_clang) {
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
diff --git a/video/end_to_end_tests/call_operation_tests.cc b/video/end_to_end_tests/call_operation_tests.cc
index ed06aa8..2c45665 100644
--- a/video/end_to_end_tests/call_operation_tests.cc
+++ b/video/end_to_end_tests/call_operation_tests.cc
@@ -134,7 +134,7 @@
// to check that the callbacks are done after processing video.
std::unique_ptr<test::FrameGenerator> frame_generator(
test::FrameGenerator::CreateSquareGenerator(
- kWidth, kHeight, rtc::nullopt, rtc::nullopt));
+ kWidth, kHeight, absl::nullopt, absl::nullopt));
video_send_stream_->SetSource(&frame_forwarder,
DegradationPreference::MAINTAIN_FRAMERATE);
@@ -190,7 +190,7 @@
Start();
frame_generator = test::FrameGenerator::CreateSquareGenerator(
- kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
+ kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
video_send_stream_->SetSource(&frame_forwarder,
DegradationPreference::MAINTAIN_FRAMERATE);
frame_forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
@@ -268,7 +268,7 @@
Start();
frame_generator = test::FrameGenerator::CreateSquareGenerator(
- kDefaultWidth, kDefaultHeight, rtc::nullopt, rtc::nullopt);
+ kDefaultWidth, kDefaultHeight, absl::nullopt, absl::nullopt);
video_send_stream_->SetSource(&forwarder,
DegradationPreference::MAINTAIN_FRAMERATE);
forwarder.IncomingCapturedFrame(*frame_generator->NextFrame());
diff --git a/video/end_to_end_tests/histogram_tests.cc b/video/end_to_end_tests/histogram_tests.cc
index c3a86b4..04255a8 100644
--- a/video/end_to_end_tests/histogram_tests.cc
+++ b/video/end_to_end_tests/histogram_tests.cc
@@ -8,7 +8,7 @@
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/video_coding/codecs/vp8/include/vp8.h"
#include "system_wrappers/include/metrics.h"
#include "system_wrappers/include/metrics_default.h"
@@ -123,7 +123,7 @@
const bool use_fec_;
const bool screenshare_;
test::FunctionVideoEncoderFactory encoder_factory_;
- rtc::Optional<int64_t> start_runtime_ms_;
+ absl::optional<int64_t> start_runtime_ms_;
int num_frames_received_ RTC_GUARDED_BY(&crit_);
} test(use_rtx, use_fec, screenshare);
diff --git a/video/end_to_end_tests/multi_codec_receive_tests.cc b/video/end_to_end_tests/multi_codec_receive_tests.cc
index 5afb147..ffbf8fb 100644
--- a/video/end_to_end_tests/multi_codec_receive_tests.cc
+++ b/video/end_to_end_tests/multi_codec_receive_tests.cc
@@ -132,8 +132,8 @@
}
rtc::CriticalSection crit_;
- rtc::Optional<uint32_t> last_timestamp_;
- rtc::Optional<uint8_t> last_payload_type_;
+ absl::optional<uint32_t> last_timestamp_;
+ absl::optional<uint8_t> last_payload_type_;
int num_sent_frames_ RTC_GUARDED_BY(crit_) = 0;
int num_rendered_frames_ RTC_GUARDED_BY(crit_) = 0;
std::vector<uint32_t> sent_timestamps_ RTC_GUARDED_BY(crit_);
diff --git a/video/end_to_end_tests/multi_stream_tester.cc b/video/end_to_end_tests/multi_stream_tester.cc
index 4ed3af6..92fa938 100644
--- a/video/end_to_end_tests/multi_stream_tester.cc
+++ b/video/end_to_end_tests/multi_stream_tester.cc
@@ -99,7 +99,7 @@
receive_streams[i]->Start();
frame_generators[i] = test::FrameGeneratorCapturer::Create(
- width, height, rtc::nullopt, rtc::nullopt, 30,
+ width, height, absl::nullopt, absl::nullopt, 30,
Clock::GetRealTimeClock());
send_streams[i]->SetSource(frame_generators[i],
DegradationPreference::MAINTAIN_FRAMERATE);
diff --git a/video/end_to_end_tests/retransmission_tests.cc b/video/end_to_end_tests/retransmission_tests.cc
index 425c0c2..fc09141 100644
--- a/video/end_to_end_tests/retransmission_tests.cc
+++ b/video/end_to_end_tests/retransmission_tests.cc
@@ -190,7 +190,7 @@
uint32_t local_ssrc_;
uint32_t remote_ssrc_;
Transport* receive_transport_;
- rtc::Optional<uint16_t> sequence_number_to_retransmit_;
+ absl::optional<uint16_t> sequence_number_to_retransmit_;
} test;
RunBaseTest(&test);
diff --git a/video/end_to_end_tests/rtp_rtcp_tests.cc b/video/end_to_end_tests/rtp_rtcp_tests.cc
index 5317242..1c953ac 100644
--- a/video/end_to_end_tests/rtp_rtcp_tests.cc
+++ b/video/end_to_end_tests/rtp_rtcp_tests.cc
@@ -453,9 +453,9 @@
return SEND_PACKET;
}
- rtc::Optional<uint16_t> last_observed_sequence_number_
+ absl::optional<uint16_t> last_observed_sequence_number_
RTC_GUARDED_BY(crit_);
- rtc::Optional<uint32_t> last_observed_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<uint32_t> last_observed_timestamp_ RTC_GUARDED_BY(crit_);
size_t num_flexfec_packets_sent_ RTC_GUARDED_BY(crit_);
rtc::CriticalSection crit_;
} observer;
diff --git a/video/overuse_frame_detector.cc b/video/overuse_frame_detector.cc
index 4bccdf3..0c56be8 100644
--- a/video/overuse_frame_detector.cc
+++ b/video/overuse_frame_detector.cc
@@ -110,12 +110,12 @@
time_when_first_seen_us));
}
- rtc::Optional<int> FrameSent(
+ absl::optional<int> FrameSent(
uint32_t timestamp,
int64_t time_sent_in_us,
int64_t /* capture_time_us */,
- rtc::Optional<int> /* encode_duration_us */) override {
- rtc::Optional<int> encode_duration_us;
+ absl::optional<int> /* encode_duration_us */) override {
+ absl::optional<int> encode_duration_us;
// Delay before reporting actual encoding time, used to have the ability to
// detect total encoding time when encoding more than one layer. Encoding is
// here assumed to finish within a second (or that we get enough long-time
@@ -241,10 +241,11 @@
int64_t time_when_first_seen_us,
int64_t last_capture_time_us) override {}
- rtc::Optional<int> FrameSent(uint32_t timestamp,
- int64_t time_sent_in_us,
- int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) override {
+ absl::optional<int> FrameSent(
+ uint32_t timestamp,
+ int64_t time_sent_in_us,
+ int64_t capture_time_us,
+ absl::optional<int> encode_duration_us) override {
if (encode_duration_us) {
if (prev_time_us_ != -1) {
AddSample(1e-6 * (*encode_duration_us),
@@ -321,13 +322,13 @@
usage_->FrameCaptured(frame, time_when_first_seen_us, last_capture_time_us);
}
- rtc::Optional<int> FrameSent(
+ absl::optional<int> FrameSent(
// These two argument used by old estimator.
uint32_t timestamp,
int64_t time_sent_in_us,
// And these two by the new estimator.
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) override {
+ absl::optional<int> encode_duration_us) override {
return usage_->FrameSent(timestamp, time_sent_in_us, capture_time_us,
encode_duration_us);
}
@@ -362,7 +363,7 @@
}
}
- rtc::Optional<int> overried_usage_value;
+ absl::optional<int> overried_usage_value;
switch (state_) {
case State::kNormal:
break;
@@ -514,7 +515,7 @@
: check_overuse_task_(nullptr),
metrics_observer_(metrics_observer),
num_process_times_(0),
- // TODO(nisse): Use rtc::Optional
+ // TODO(nisse): Use absl::optional
last_capture_time_us_(-1),
num_pixels_(0),
max_framerate_(kDefaultFrameRate),
@@ -582,7 +583,7 @@
usage_->Reset();
last_capture_time_us_ = -1;
num_process_times_ = 0;
- metrics_ = rtc::nullopt;
+ metrics_ = absl::nullopt;
OnTargetFramerateUpdated(max_framerate_);
}
@@ -610,7 +611,7 @@
void OveruseFrameDetector::FrameSent(uint32_t timestamp,
int64_t time_sent_in_us,
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) {
+ absl::optional<int> encode_duration_us) {
RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_);
encode_duration_us = usage_->FrameSent(timestamp, time_sent_in_us,
capture_time_us, encode_duration_us);
diff --git a/video/overuse_frame_detector.h b/video/overuse_frame_detector.h
index 3525a97..800e53f 100644
--- a/video/overuse_frame_detector.h
+++ b/video/overuse_frame_detector.h
@@ -14,7 +14,7 @@
#include <list>
#include <memory>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/video_coding/utility/quality_scaler.h"
#include "rtc_base/constructormagic.h"
#include "rtc_base/numerics/exp_filter.h"
@@ -90,7 +90,7 @@
void FrameSent(uint32_t timestamp,
int64_t time_sent_in_us,
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us);
+ absl::optional<int> encode_duration_us);
// Interface for cpu load estimation. Intended for internal use only.
class ProcessingUsage {
@@ -101,13 +101,13 @@
int64_t time_when_first_seen_us,
int64_t last_capture_time_us) = 0;
// Returns encode_time in us, if there's a new measurement.
- virtual rtc::Optional<int> FrameSent(
+ virtual absl::optional<int> FrameSent(
// These two argument used by old estimator.
uint32_t timestamp,
int64_t time_sent_in_us,
// And these two by the new estimator.
int64_t capture_time_us,
- rtc::Optional<int> encode_duration_us) = 0;
+ absl::optional<int> encode_duration_us) = 0;
virtual int Value() = 0;
virtual ~ProcessingUsage() = default;
@@ -141,7 +141,7 @@
// Stats metrics.
CpuOveruseMetricsObserver* const metrics_observer_;
- rtc::Optional<CpuOveruseMetrics> metrics_ RTC_GUARDED_BY(task_checker_);
+ absl::optional<CpuOveruseMetrics> metrics_ RTC_GUARDED_BY(task_checker_);
int64_t num_process_times_ RTC_GUARDED_BY(task_checker_);
diff --git a/video/overuse_frame_detector_unittest.cc b/video/overuse_frame_detector_unittest.cc
index 487b36f..bce5642 100644
--- a/video/overuse_frame_detector_unittest.cc
+++ b/video/overuse_frame_detector_unittest.cc
@@ -127,7 +127,7 @@
clock_.AdvanceTimeMicros(delay_us);
overuse_detector_->FrameSent(timestamp, rtc::TimeMicros(),
capture_time_us,
- rtc::Optional<int>(delay_us));
+ absl::optional<int>(delay_us));
overuse_detector_->CheckForOveruse(observer_);
// Avoid turning clock backwards.
diff --git a/video/quality_threshold.cc b/video/quality_threshold.cc
index fc8787a..2b29992 100644
--- a/video/quality_threshold.cc
+++ b/video/quality_threshold.cc
@@ -74,13 +74,13 @@
}
}
-rtc::Optional<bool> QualityThreshold::IsHigh() const {
+absl::optional<bool> QualityThreshold::IsHigh() const {
return is_high_;
}
-rtc::Optional<double> QualityThreshold::CalculateVariance() const {
+absl::optional<double> QualityThreshold::CalculateVariance() const {
if (until_full_ > 0) {
- return rtc::nullopt;
+ return absl::nullopt;
}
double variance = 0;
@@ -91,11 +91,11 @@
return variance / (max_measurements_ - 1);
}
-rtc::Optional<double> QualityThreshold::FractionHigh(
+absl::optional<double> QualityThreshold::FractionHigh(
int min_required_samples) const {
RTC_DCHECK_GT(min_required_samples, 0);
if (num_certain_states_ < min_required_samples)
- return rtc::nullopt;
+ return absl::nullopt;
return static_cast<double>(num_high_states_) / num_certain_states_;
}
diff --git a/video/quality_threshold.h b/video/quality_threshold.h
index 519e2c3..4fad555 100644
--- a/video/quality_threshold.h
+++ b/video/quality_threshold.h
@@ -13,7 +13,7 @@
#include <memory>
-#include "api/optional.h"
+#include "absl/types/optional.h"
namespace webrtc {
@@ -27,9 +27,9 @@
int max_measurements);
void AddMeasurement(int measurement);
- rtc::Optional<bool> IsHigh() const;
- rtc::Optional<double> CalculateVariance() const;
- rtc::Optional<double> FractionHigh(int min_required_samples) const;
+ absl::optional<bool> IsHigh() const;
+ absl::optional<double> CalculateVariance() const;
+ absl::optional<double> FractionHigh(int min_required_samples) const;
private:
const std::unique_ptr<int[]> buffer_;
@@ -39,7 +39,7 @@
const int high_threshold_;
int until_full_;
int next_index_;
- rtc::Optional<bool> is_high_;
+ absl::optional<bool> is_high_;
int sum_;
int count_low_;
int count_high_;
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 0fe366a..53903cf 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -209,7 +209,7 @@
round(render_pixel_tracker_.ComputeTotalRate()));
}
- rtc::Optional<int> sync_offset_ms =
+ absl::optional<int> sync_offset_ms =
sync_offset_counter_.Avg(kMinRequiredSamples);
if (sync_offset_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.AVSyncOffsetInMs",
@@ -236,17 +236,17 @@
<< key_frames_permille << '\n';
}
- rtc::Optional<int> qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
+ absl::optional<int> qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
if (qp) {
RTC_HISTOGRAM_COUNTS_200("WebRTC.Video.Decoded.Vp8.Qp", *qp);
log_stream << "WebRTC.Video.Decoded.Vp8.Qp " << *qp << '\n';
}
- rtc::Optional<int> decode_ms = decode_time_counter_.Avg(kMinRequiredSamples);
+ absl::optional<int> decode_ms = decode_time_counter_.Avg(kMinRequiredSamples);
if (decode_ms) {
RTC_HISTOGRAM_COUNTS_1000("WebRTC.Video.DecodeTimeInMs", *decode_ms);
log_stream << "WebRTC.Video.DecodeTimeInMs " << *decode_ms << '\n';
}
- rtc::Optional<int> jb_delay_ms =
+ absl::optional<int> jb_delay_ms =
jitter_buffer_delay_counter_.Avg(kMinRequiredSamples);
if (jb_delay_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
@@ -254,21 +254,21 @@
log_stream << "WebRTC.Video.JitterBufferDelayInMs " << *jb_delay_ms << '\n';
}
- rtc::Optional<int> target_delay_ms =
+ absl::optional<int> target_delay_ms =
target_delay_counter_.Avg(kMinRequiredSamples);
if (target_delay_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.TargetDelayInMs",
*target_delay_ms);
log_stream << "WebRTC.Video.TargetDelayInMs " << *target_delay_ms << '\n';
}
- rtc::Optional<int> current_delay_ms =
+ absl::optional<int> current_delay_ms =
current_delay_counter_.Avg(kMinRequiredSamples);
if (current_delay_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.CurrentDelayInMs",
*current_delay_ms);
log_stream << "WebRTC.Video.CurrentDelayInMs " << *current_delay_ms << '\n';
}
- rtc::Optional<int> delay_ms = delay_counter_.Avg(kMinRequiredSamples);
+ absl::optional<int> delay_ms = delay_counter_.Avg(kMinRequiredSamples);
if (delay_ms)
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", *delay_ms);
@@ -314,7 +314,7 @@
RTC_DCHECK(videocontenttypehelpers::GetExperimentId(content_type) == 0 ||
videocontenttypehelpers::GetSimulcastId(content_type) == 0);
- rtc::Optional<int> e2e_delay_ms =
+ absl::optional<int> e2e_delay_ms =
stats.e2e_delay_counter.Avg(kMinRequiredSamples);
if (e2e_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -322,14 +322,14 @@
log_stream << uma_prefix << ".EndToEndDelayInMs" << uma_suffix << " "
<< *e2e_delay_ms << '\n';
}
- rtc::Optional<int> e2e_delay_max_ms = stats.e2e_delay_counter.Max();
+ absl::optional<int> e2e_delay_max_ms = stats.e2e_delay_counter.Max();
if (e2e_delay_max_ms && e2e_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_100000(
uma_prefix + ".EndToEndDelayMaxInMs" + uma_suffix, *e2e_delay_max_ms);
log_stream << uma_prefix << ".EndToEndDelayMaxInMs" << uma_suffix << " "
<< *e2e_delay_max_ms << '\n';
}
- rtc::Optional<int> interframe_delay_ms =
+ absl::optional<int> interframe_delay_ms =
stats.interframe_delay_counter.Avg(kMinRequiredSamples);
if (interframe_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -338,7 +338,7 @@
log_stream << uma_prefix << ".InterframeDelayInMs" << uma_suffix << " "
<< *interframe_delay_ms << '\n';
}
- rtc::Optional<int> interframe_delay_max_ms =
+ absl::optional<int> interframe_delay_max_ms =
stats.interframe_delay_counter.Max();
if (interframe_delay_max_ms && interframe_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -348,7 +348,7 @@
<< *interframe_delay_max_ms << '\n';
}
- rtc::Optional<uint32_t> interframe_delay_95p_ms =
+ absl::optional<uint32_t> interframe_delay_95p_ms =
stats.interframe_delay_percentiles.GetPercentile(0.95f);
if (interframe_delay_95p_ms && interframe_delay_ms != -1) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
@@ -358,7 +358,7 @@
<< uma_suffix << " " << *interframe_delay_95p_ms << '\n';
}
- rtc::Optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
+ absl::optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
if (width) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
uma_prefix + ".ReceivedWidthInPixels" + uma_suffix, *width);
@@ -366,7 +366,7 @@
<< *width << '\n';
}
- rtc::Optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
+ absl::optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
if (height) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(
uma_prefix + ".ReceivedHeightInPixels" + uma_suffix, *height);
@@ -401,7 +401,7 @@
<< " " << key_frames_permille << '\n';
}
- rtc::Optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
+ absl::optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
if (qp) {
RTC_HISTOGRAM_COUNTS_SPARSE_200(
uma_prefix + ".Decoded.Vp8.Qp" + uma_suffix, *qp);
@@ -465,19 +465,19 @@
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.Any",
100 * num_bad_states_ / num_certain_states_);
}
- rtc::Optional<double> fps_fraction =
+ absl::optional<double> fps_fraction =
fps_threshold_.FractionHigh(kBadCallMinRequiredSamples);
if (fps_fraction) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.FrameRate",
static_cast<int>(100 * (1 - *fps_fraction)));
}
- rtc::Optional<double> variance_fraction =
+ absl::optional<double> variance_fraction =
variance_threshold_.FractionHigh(kBadCallMinRequiredSamples);
if (variance_fraction) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.FrameRateVariance",
static_cast<int>(100 * *variance_fraction));
}
- rtc::Optional<double> qp_fraction =
+ absl::optional<double> qp_fraction =
qp_threshold_.FractionHigh(kBadCallMinRequiredSamples);
if (qp_fraction) {
RTC_HISTOGRAM_PERCENTAGE("WebRTC.Video.BadCall.Qp",
@@ -496,7 +496,7 @@
double fps =
render_fps_tracker_.ComputeRateForInterval(now - last_sample_time_);
- rtc::Optional<int> qp = qp_sample_.Avg(1);
+ absl::optional<int> qp = qp_sample_.Avg(1);
bool prev_fps_bad = !fps_threshold_.IsHigh().value_or(true);
bool prev_qp_bad = qp_threshold_.IsHigh().value_or(false);
@@ -506,7 +506,7 @@
fps_threshold_.AddMeasurement(static_cast<int>(fps));
if (qp)
qp_threshold_.AddMeasurement(*qp);
- rtc::Optional<double> fps_variance_opt = fps_threshold_.CalculateVariance();
+ absl::optional<double> fps_variance_opt = fps_threshold_.CalculateVariance();
double fps_variance = fps_variance_opt.value_or(0);
if (fps_variance_opt) {
variance_threshold_.AddMeasurement(static_cast<int>(fps_variance));
@@ -699,7 +699,7 @@
total_byte_tracker_.AddSamples(total_bytes - last_total_bytes);
}
-void ReceiveStatisticsProxy::OnDecodedFrame(rtc::Optional<uint8_t> qp,
+void ReceiveStatisticsProxy::OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
VideoContentType content_type) {
@@ -734,7 +734,7 @@
} else if (stats_.qp_sum) {
RTC_LOG(LS_WARNING)
<< "QP sum was already set and no QP was given for a frame.";
- stats_.qp_sum = rtc::nullopt;
+ stats_.qp_sum = absl::nullopt;
}
last_content_type_ = content_type;
decode_fps_estimator_.Update(1, now);
diff --git a/video/receive_statistics_proxy.h b/video/receive_statistics_proxy.h
index 1ec0039..2ccfc93 100644
--- a/video/receive_statistics_proxy.h
+++ b/video/receive_statistics_proxy.h
@@ -16,7 +16,7 @@
#include <string>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "call/video_receive_stream.h"
#include "common_types.h" // NOLINT(build/include)
#include "common_video/include/frame_callback.h"
@@ -52,7 +52,7 @@
VideoReceiveStream::Stats GetStats() const;
- void OnDecodedFrame(rtc::Optional<uint8_t> qp,
+ void OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
VideoContentType content_type);
@@ -183,15 +183,15 @@
mutable std::map<int64_t, size_t> frame_window_ RTC_GUARDED_BY(&crit_);
VideoContentType last_content_type_ RTC_GUARDED_BY(&crit_);
VideoCodecType last_codec_type_ RTC_GUARDED_BY(&crit_);
- rtc::Optional<int64_t> first_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
- rtc::Optional<int64_t> last_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
+ absl::optional<int64_t> first_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
+ absl::optional<int64_t> last_decoded_frame_time_ms_ RTC_GUARDED_BY(&crit_);
size_t num_delayed_frames_rendered_ RTC_GUARDED_BY(&crit_);
int64_t sum_missed_render_deadline_ms_ RTC_GUARDED_BY(&crit_);
// Mutable because calling Max() on MovingMaxCounter is not const. Yet it is
// called from const GetStats().
mutable rtc::MovingMaxCounter<TimingFrameInfo> timing_frame_info_counter_
RTC_GUARDED_BY(&crit_);
- rtc::Optional<int> num_unique_frames_ RTC_GUARDED_BY(crit_);
+ absl::optional<int> num_unique_frames_ RTC_GUARDED_BY(crit_);
rtc::ThreadChecker decode_thread_;
rtc::ThreadChecker network_thread_;
rtc::ThreadChecker main_thread_;
diff --git a/video/receive_statistics_proxy_unittest.cc b/video/receive_statistics_proxy_unittest.cc
index 149c809..c3b9ae7 100644
--- a/video/receive_statistics_proxy_unittest.cc
+++ b/video/receive_statistics_proxy_unittest.cc
@@ -82,7 +82,7 @@
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesFramesDecoded) {
EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded);
for (uint32_t i = 1; i <= 3; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded);
}
@@ -92,8 +92,8 @@
const int kFps = 20;
const int kRequiredSamples = metrics::kMinRunTimeInSeconds * kFps;
for (int i = 0; i < kRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
- VideoContentType::UNSPECIFIED);
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
+ kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps);
}
statistics_proxy_.reset();
@@ -105,8 +105,8 @@
const int kFps = 20;
const int kRequiredSamples = metrics::kMinRunTimeInSeconds * kFps;
for (int i = 0; i < kRequiredSamples - 1; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
- VideoContentType::UNSPECIFIED);
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
+ kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps);
}
statistics_proxy_.reset();
@@ -116,14 +116,14 @@
TEST_F(ReceiveStatisticsProxyTest, DecodedFpsIsReportedWithQpReset) {
const int kFps1 = 10;
for (int i = 0; i < metrics::kMinRunTimeInSeconds * kFps1; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(), kWidth, kHeight,
- VideoContentType::UNSPECIFIED);
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(), kWidth,
+ kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps1);
}
// First QP value received, resets frames decoded.
const int kFps2 = 20;
for (int i = 0; i < metrics::kMinRunTimeInSeconds * kFps2; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::Optional<uint8_t>(1u), kWidth,
+ statistics_proxy_->OnDecodedFrame(absl::optional<uint8_t>(1u), kWidth,
kHeight, VideoContentType::UNSPECIFIED);
fake_clock_.AdvanceTimeMilliseconds(1000 / kFps2);
}
@@ -136,7 +136,7 @@
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithQpResetsFramesDecoded) {
EXPECT_EQ(0u, statistics_proxy_->GetStats().frames_decoded);
for (uint32_t i = 1; i <= 3; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(i, statistics_proxy_->GetStats().frames_decoded);
}
@@ -146,7 +146,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameIncreasesQpSum) {
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
statistics_proxy_->OnDecodedFrame(3u, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
@@ -230,20 +230,20 @@
}
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpQpSumWontExist) {
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
}
TEST_F(ReceiveStatisticsProxyTest, OnDecodedFrameWithoutQpResetsQpSum) {
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
statistics_proxy_->OnDecodedFrame(3u, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
}
TEST_F(ReceiveStatisticsProxyTest, OnRenderedFrameIncreasesFramesRendered) {
@@ -387,7 +387,7 @@
const int64_t kLongEndToEndDelay = 100;
const uint32_t kExpectedRtpTimestamp = 2;
TimingFrameInfo info;
- rtc::Optional<TimingFrameInfo> result;
+ absl::optional<TimingFrameInfo> result;
info.rtp_timestamp = kExpectedRtpTimestamp - 1;
info.capture_time_ms = 0;
info.decode_finish_ms = kShortEndToEndDelay;
@@ -412,7 +412,7 @@
const uint32_t kExpectedRtpTimestamp = 2;
const int64_t kShortDelayMs = 1000;
const int64_t kLongDelayMs = 10000;
- rtc::Optional<TimingFrameInfo> result;
+ absl::optional<TimingFrameInfo> result;
info.rtp_timestamp = kExpectedRtpTimestamp;
info.capture_time_ms = 0;
info.decode_finish_ms = kShortEndToEndDelay;
@@ -741,7 +741,7 @@
// Since OnRenderedFrame is never called the fps in each sample will be 0,
// i.e. bad
frame.set_ntp_time_ms(fake_clock_.CurrentNtpInMilliseconds());
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
statistics_proxy_->OnRenderedFrame(frame);
fake_clock_.AdvanceTimeMilliseconds(1000 / kDefaultFps);
@@ -796,7 +796,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, ZeroDelayReportedIfFrameNotDelayed) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Frame not delayed, delayed frames to render: 0%.
@@ -814,7 +814,7 @@
TEST_F(ReceiveStatisticsProxyTest,
DelayedFrameHistogramsAreNotUpdatedIfMinRuntimeHasNotPassed) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Frame not delayed, delayed frames to render: 0%.
@@ -832,7 +832,7 @@
TEST_F(ReceiveStatisticsProxyTest,
DelayedFramesHistogramsAreNotUpdatedIfNoRenderedFrames) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Min run time has passed. No rendered frames.
@@ -844,7 +844,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, DelayReportedIfFrameIsDelayed) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Frame delayed 1 ms, delayed frames to render: 100%.
@@ -863,7 +863,7 @@
}
TEST_F(ReceiveStatisticsProxyTest, AverageDelayOfDelayedFramesIsReported) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
VideoContentType::UNSPECIFIED);
// Two frames delayed (6 ms, 10 ms), delayed frames to render: 50%.
@@ -937,13 +937,13 @@
const VideoContentType content_type = GetParam();
const int kInterFrameDelayMs = 33;
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// One extra with double the interval.
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -972,18 +972,18 @@
const int kLastFivePercentsSamples = kMinRequiredSamples * 5 / 100;
for (int i = 0; i <= kMinRequiredSamples - kLastFivePercentsSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
// Last 5% of intervals are double in size.
for (int i = 0; i < kLastFivePercentsSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(2 * kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
// Final sample is outlier and 10 times as big.
fake_clock_.AdvanceTimeMilliseconds(10 * kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -1003,7 +1003,7 @@
const VideoContentType content_type = GetParam();
const int kInterFrameDelayMs = 33;
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1023,7 +1023,7 @@
const VideoContentType content_type = GetParam();
const int kInterFrameDelayMs = 33;
for (int i = 0; i <= kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1035,10 +1035,10 @@
// Insert two more frames. The interval during the pause should be disregarded
// in the stats.
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -1068,13 +1068,13 @@
const int kInterFrameDelayMs = 33;
const int kFreezeDelayMs = 200;
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// Add extra freeze.
fake_clock_.AdvanceTimeMilliseconds(kFreezeDelayMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
statistics_proxy_.reset();
@@ -1100,7 +1100,7 @@
const int kInterFrameDelayMs = 33;
const int kPauseDurationMs = 10000;
for (int i = 0; i <= kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1110,7 +1110,7 @@
// Second playback interval with triple the length.
for (int i = 0; i <= kMinRequiredSamples * 3; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1137,15 +1137,15 @@
const int kInterFrameDelayMs = 33;
const int kPauseDurationMs = 10000;
for (int i = 0; i <= kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
statistics_proxy_->OnStreamInactive();
fake_clock_.AdvanceTimeMilliseconds(kPauseDurationMs);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
- content_type);
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
+ content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
@@ -1164,18 +1164,18 @@
const int kInterFrameDelayMs = 20;
// HD frames.
for (int i = 0; i < kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// SD frames.
for (int i = 0; i < 2 * kMinRequiredSamples; ++i) {
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth / 2, kHeight / 2,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth / 2, kHeight / 2,
content_type);
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs);
}
// Extra last frame.
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth / 2, kHeight / 2,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth / 2, kHeight / 2,
content_type);
statistics_proxy_.reset();
const int kExpectedTimeInHdPercents = 33;
@@ -1268,14 +1268,14 @@
videocontenttypehelpers::SetSimulcastId(&content_type, 1);
for (int i = 0; i <= kMinRequiredSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs1);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
videocontenttypehelpers::SetSimulcastId(&content_type, 2);
for (int i = 0; i <= kMinRequiredSamples; ++i) {
fake_clock_.AdvanceTimeMilliseconds(kInterFrameDelayMs2);
- statistics_proxy_->OnDecodedFrame(rtc::nullopt, kWidth, kHeight,
+ statistics_proxy_->OnDecodedFrame(absl::nullopt, kWidth, kHeight,
content_type);
}
statistics_proxy_.reset();
diff --git a/video/rtp_streams_synchronizer.cc b/video/rtp_streams_synchronizer.cc
index c330a44..cc7f893 100644
--- a/video/rtp_streams_synchronizer.cc
+++ b/video/rtp_streams_synchronizer.cc
@@ -76,13 +76,13 @@
}
RTC_DCHECK(sync_.get());
- rtc::Optional<Syncable::Info> audio_info = syncable_audio_->GetInfo();
+ absl::optional<Syncable::Info> audio_info = syncable_audio_->GetInfo();
if (!audio_info || !UpdateMeasurements(&audio_measurement_, *audio_info)) {
return;
}
int64_t last_video_receive_ms = video_measurement_.latest_receive_time_ms;
- rtc::Optional<Syncable::Info> video_info = syncable_video_->GetInfo();
+ absl::optional<Syncable::Info> video_info = syncable_video_->GetInfo();
if (!video_info || !UpdateMeasurements(&video_measurement_, *video_info)) {
return;
}
diff --git a/video/rtp_video_stream_receiver.cc b/video/rtp_video_stream_receiver.cc
index 996154f..271c56f 100644
--- a/video/rtp_video_stream_receiver.cc
+++ b/video/rtp_video_stream_receiver.cc
@@ -354,11 +354,11 @@
nack_module_->UpdateRtt(max_rtt_ms);
}
-rtc::Optional<int64_t> RtpVideoStreamReceiver::LastReceivedPacketMs() const {
+absl::optional<int64_t> RtpVideoStreamReceiver::LastReceivedPacketMs() const {
return packet_buffer_->LastReceivedPacketMs();
}
-rtc::Optional<int64_t> RtpVideoStreamReceiver::LastReceivedKeyframePacketMs()
+absl::optional<int64_t> RtpVideoStreamReceiver::LastReceivedKeyframePacketMs()
const {
return packet_buffer_->LastReceivedKeyframePacketMs();
}
diff --git a/video/rtp_video_stream_receiver.h b/video/rtp_video_stream_receiver.h
index 4c8a4f2..75dcea5 100644
--- a/video/rtp_video_stream_receiver.h
+++ b/video/rtp_video_stream_receiver.h
@@ -129,8 +129,8 @@
// Called by VideoReceiveStream when stats are updated.
void UpdateRtt(int64_t max_rtt_ms);
- rtc::Optional<int64_t> LastReceivedPacketMs() const;
- rtc::Optional<int64_t> LastReceivedKeyframePacketMs() const;
+ absl::optional<int64_t> LastReceivedPacketMs() const;
+ absl::optional<int64_t> LastReceivedKeyframePacketMs() const;
// RtpDemuxer only forwards a given RTP packet to one sink. However, some
// sinks, such as FlexFEC, might wish to be informed of all of the packets
diff --git a/video/send_statistics_proxy.cc b/video/send_statistics_proxy.cc
index 6c86c63..85afbc9 100644
--- a/video/send_statistics_proxy.cc
+++ b/video/send_statistics_proxy.cc
@@ -85,36 +85,36 @@
codec_info->codecSpecific.VP8.temporalIdx == kNoTemporalIdx);
}
-rtc::Optional<int> GetFallbackMaxPixels(const std::string& group) {
+absl::optional<int> GetFallbackMaxPixels(const std::string& group) {
if (group.empty())
- return rtc::nullopt;
+ return absl::nullopt;
int min_pixels;
int max_pixels;
int min_bps;
if (sscanf(group.c_str(), "-%d,%d,%d", &min_pixels, &max_pixels, &min_bps) !=
3) {
- return rtc::Optional<int>();
+ return absl::optional<int>();
}
if (min_pixels <= 0 || max_pixels <= 0 || max_pixels < min_pixels)
- return rtc::Optional<int>();
+ return absl::optional<int>();
- return rtc::Optional<int>(max_pixels);
+ return absl::optional<int>(max_pixels);
}
-rtc::Optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled() {
+absl::optional<int> GetFallbackMaxPixelsIfFieldTrialEnabled() {
std::string group =
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
return (group.find("Enabled") == 0) ? GetFallbackMaxPixels(group.substr(7))
- : rtc::Optional<int>();
+ : absl::optional<int>();
}
-rtc::Optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled() {
+absl::optional<int> GetFallbackMaxPixelsIfFieldTrialDisabled() {
std::string group =
webrtc::field_trial::FindFullName(kVp8ForcedFallbackEncoderFieldTrial);
return (group.find("Disabled") == 0) ? GetFallbackMaxPixels(group.substr(8))
- : rtc::Optional<int>();
+ : absl::optional<int>();
}
} // namespace
diff --git a/video/send_statistics_proxy.h b/video/send_statistics_proxy.h
index bef3b28..7239e7f 100644
--- a/video/send_statistics_proxy.h
+++ b/video/send_statistics_proxy.h
@@ -162,7 +162,7 @@
bool is_active = false;
int on_off_events = 0;
int64_t elapsed_ms = 0;
- rtc::Optional<int64_t> last_update_ms;
+ absl::optional<int64_t> last_update_ms;
const int max_frame_diff_ms = 2000;
};
struct FallbackEncoderInfoDisabled {
@@ -235,8 +235,8 @@
Clock* const clock_;
const std::string payload_name_;
const VideoSendStream::Config::Rtp rtp_config_;
- const rtc::Optional<int> fallback_max_pixels_;
- const rtc::Optional<int> fallback_max_pixels_disabled_;
+ const absl::optional<int> fallback_max_pixels_;
+ const absl::optional<int> fallback_max_pixels_disabled_;
rtc::CriticalSection crit_;
VideoEncoderConfig::ContentType content_type_ RTC_GUARDED_BY(crit_);
const int64_t start_ms_;
@@ -248,7 +248,7 @@
rtc::RateTracker media_byte_rate_tracker_ RTC_GUARDED_BY(crit_);
rtc::RateTracker encoded_frame_rate_tracker_ RTC_GUARDED_BY(crit_);
- rtc::Optional<int64_t> last_outlier_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<int64_t> last_outlier_timestamp_ RTC_GUARDED_BY(crit_);
// Contains stats used for UMA histograms. These stats will be reset if
// content type changes between real-time video and screenshare, since these
diff --git a/video/send_statistics_proxy_unittest.cc b/video/send_statistics_proxy_unittest.cc
index d9e8343..5730317 100644
--- a/video/send_statistics_proxy_unittest.cc
+++ b/video/send_statistics_proxy_unittest.cc
@@ -331,7 +331,7 @@
TEST_F(SendStatisticsProxyTest, OnSendEncodedImageIncreasesQpSum) {
EncodedImage encoded_image;
CodecSpecificInfo codec_info;
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
encoded_image.qp_ = 3;
statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
EXPECT_EQ(3u, statistics_proxy_->GetStats().qp_sum);
@@ -344,9 +344,9 @@
EncodedImage encoded_image;
CodecSpecificInfo codec_info;
encoded_image.qp_ = -1;
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
statistics_proxy_->OnSendEncodedImage(encoded_image, &codec_info);
- EXPECT_EQ(rtc::nullopt, statistics_proxy_->GetStats().qp_sum);
+ EXPECT_EQ(absl::nullopt, statistics_proxy_->GetStats().qp_sum);
}
TEST_F(SendStatisticsProxyTest, GetCpuAdaptationStats) {
diff --git a/video/video_quality_observer.cc b/video/video_quality_observer.cc
index c6663fa..b35a8c8 100644
--- a/video/video_quality_observer.cc
+++ b/video/video_quality_observer.cc
@@ -109,7 +109,7 @@
RTC_LOG(LS_INFO) << log_stream.str();
}
-void VideoQualityObserver::OnDecodedFrame(rtc::Optional<uint8_t> qp,
+void VideoQualityObserver::OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
int64_t now_ms,
@@ -125,7 +125,7 @@
// Process inter-frame delay.
int64_t interframe_delay_ms = now_ms - last_frame_decoded_ms_;
interframe_delays_.Add(interframe_delay_ms);
- rtc::Optional<int> avg_interframe_delay =
+ absl::optional<int> avg_interframe_delay =
interframe_delays_.Avg(kMinFrameSamplesToDetectFreeze);
// Check if it was a freeze.
if (avg_interframe_delay &&
@@ -140,7 +140,7 @@
// Only count inter-frame delay as playback time if there
// was no freeze.
time_in_resolution_ms_[current_resolution_] += interframe_delay_ms;
- rtc::Optional<int> qp_blocky_threshold;
+ absl::optional<int> qp_blocky_threshold;
// TODO(ilnik): add other codec types when we have QP for them.
switch (codec) {
case kVideoCodecVP8:
@@ -150,7 +150,7 @@
qp_blocky_threshold = kBlockyQpThresholdVp9;
break;
default:
- qp_blocky_threshold = rtc::nullopt;
+ qp_blocky_threshold = absl::nullopt;
}
if (qp_blocky_threshold && qp.value_or(0) > *qp_blocky_threshold) {
time_in_blocky_video_ms_ += interframe_delay_ms;
diff --git a/video/video_quality_observer.h b/video/video_quality_observer.h
index cbeab43..8ba4af3 100644
--- a/video/video_quality_observer.h
+++ b/video/video_quality_observer.h
@@ -14,7 +14,7 @@
#include <stdint.h>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/video/video_content_type.h"
#include "common_types.h" // NOLINT(build/include)
#include "rtc_base/numerics/sample_counter.h"
@@ -30,7 +30,7 @@
explicit VideoQualityObserver(VideoContentType content_type);
~VideoQualityObserver();
- void OnDecodedFrame(rtc::Optional<uint8_t> qp,
+ void OnDecodedFrame(absl::optional<uint8_t> qp,
int width,
int height,
int64_t now_ms,
diff --git a/video/video_quality_test.cc b/video/video_quality_test.cc
index f6c48c0..3a174c4 100644
--- a/video/video_quality_test.cc
+++ b/video/video_quality_test.cc
@@ -491,8 +491,8 @@
render_time_ms(render_time_ms),
encoded_frame_size(encoded_frame_size) {}
- rtc::Optional<VideoFrame> reference;
- rtc::Optional<VideoFrame> render;
+ absl::optional<VideoFrame> reference;
+ absl::optional<VideoFrame> render;
bool dropped;
int64_t input_time_ms;
int64_t send_time_ms;
@@ -1028,7 +1028,7 @@
};
// Rendered frame with worst PSNR is saved for further analysis.
- rtc::Optional<FrameWithPsnr> worst_frame_ RTC_GUARDED_BY(comparison_lock_);
+ absl::optional<FrameWithPsnr> worst_frame_ RTC_GUARDED_BY(comparison_lock_);
size_t last_fec_bytes_;
@@ -1052,13 +1052,13 @@
rtc::CriticalSection crit_;
std::deque<VideoFrame> frames_ RTC_GUARDED_BY(crit_);
- rtc::Optional<VideoFrame> last_rendered_frame_ RTC_GUARDED_BY(crit_);
+ absl::optional<VideoFrame> last_rendered_frame_ RTC_GUARDED_BY(crit_);
rtc::TimestampWrapAroundHandler wrap_handler_ RTC_GUARDED_BY(crit_);
std::map<int64_t, int64_t> send_times_ RTC_GUARDED_BY(crit_);
std::map<int64_t, int64_t> recv_times_ RTC_GUARDED_BY(crit_);
std::map<int64_t, size_t> encoded_frame_sizes_ RTC_GUARDED_BY(crit_);
- rtc::Optional<uint32_t> first_encoded_timestamp_ RTC_GUARDED_BY(crit_);
- rtc::Optional<uint32_t> first_sent_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<uint32_t> first_encoded_timestamp_ RTC_GUARDED_BY(crit_);
+ absl::optional<uint32_t> first_sent_timestamp_ RTC_GUARDED_BY(crit_);
const double avg_psnr_threshold_;
const double avg_ssim_threshold_;
bool is_quick_test_enabled_;
@@ -1751,7 +1751,7 @@
for (size_t i = 0; i < num_thumbnail_streams; ++i) {
thumbnail_capturers_.emplace_back(test::FrameGeneratorCapturer::Create(
static_cast<int>(thumbnail.width), static_cast<int>(thumbnail.height),
- rtc::nullopt, rtc::nullopt, thumbnail.max_framerate, clock_));
+ absl::nullopt, absl::nullopt, thumbnail.max_framerate, clock_));
RTC_DCHECK(thumbnail_capturers_.back());
}
}
@@ -1817,13 +1817,13 @@
if (params_.video[video_idx].clip_name == "Generator") {
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
static_cast<int>(params_.video[video_idx].width),
- static_cast<int>(params_.video[video_idx].height), rtc::nullopt,
- rtc::nullopt, params_.video[video_idx].fps, clock_));
+ static_cast<int>(params_.video[video_idx].height), absl::nullopt,
+ absl::nullopt, params_.video[video_idx].fps, clock_));
} else if (params_.video[video_idx].clip_name == "GeneratorI420A") {
video_capturers_[video_idx].reset(test::FrameGeneratorCapturer::Create(
static_cast<int>(params_.video[video_idx].width),
static_cast<int>(params_.video[video_idx].height),
- test::FrameGenerator::OutputType::I420A, rtc::nullopt,
+ test::FrameGenerator::OutputType::I420A, absl::nullopt,
params_.video[video_idx].fps, clock_));
} else if (params_.video[video_idx].clip_name.empty()) {
video_capturers_[video_idx].reset(test::VcmCapturer::Create(
@@ -1836,7 +1836,7 @@
test::FrameGeneratorCapturer::Create(
static_cast<int>(params_.video[video_idx].width),
static_cast<int>(params_.video[video_idx].height),
- rtc::nullopt, rtc::nullopt, params_.video[video_idx].fps,
+ absl::nullopt, absl::nullopt, params_.video[video_idx].fps,
clock_));
}
} else {
diff --git a/video/video_receive_stream.cc b/video/video_receive_stream.cc
index 0e596be..f5c7e2a 100644
--- a/video/video_receive_stream.cc
+++ b/video/video_receive_stream.cc
@@ -16,13 +16,13 @@
#include <string>
#include <utility>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "call/rtp_stream_receiver_controller_interface.h"
#include "call/rtx_receive_stream.h"
#include "common_types.h" // NOLINT(build/include)
#include "common_video/h264/profile_level_id.h"
-#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "common_video/include/incoming_video_stream.h"
+#include "common_video/libyuv/include/webrtc_libyuv.h"
#include "modules/rtp_rtcp/include/rtp_receiver.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
#include "modules/utility/include/process_thread.h"
@@ -375,7 +375,7 @@
return config_.rtp.remote_ssrc;
}
-rtc::Optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
+absl::optional<Syncable::Info> VideoReceiveStream::GetInfo() const {
RTC_DCHECK_CALLED_SEQUENTIALLY(&module_process_sequence_checker_);
Syncable::Info info;
@@ -384,7 +384,7 @@
if (!rtp_receiver->GetLatestTimestamps(
&info.latest_received_capture_timestamp,
&info.latest_receive_time_ms))
- return rtc::nullopt;
+ return absl::nullopt;
RtpRtcp* rtp_rtcp = rtp_video_stream_receiver_.rtp_rtcp();
RTC_DCHECK(rtp_rtcp);
@@ -393,7 +393,7 @@
nullptr,
nullptr,
&info.capture_time_source_clock) != 0) {
- return rtc::nullopt;
+ return absl::nullopt;
}
info.current_delay_ms = video_receiver_.Delay();
@@ -454,9 +454,9 @@
} else {
RTC_DCHECK_EQ(res, video_coding::FrameBuffer::ReturnReason::kTimeout);
int64_t now_ms = clock_->TimeInMilliseconds();
- rtc::Optional<int64_t> last_packet_ms =
+ absl::optional<int64_t> last_packet_ms =
rtp_video_stream_receiver_.LastReceivedPacketMs();
- rtc::Optional<int64_t> last_keyframe_packet_ms =
+ absl::optional<int64_t> last_keyframe_packet_ms =
rtp_video_stream_receiver_.LastReceivedKeyframePacketMs();
// To avoid spamming keyframe requests for a stream that is not active we
diff --git a/video/video_receive_stream.h b/video/video_receive_stream.h
index 2ca4026..5b12894 100644
--- a/video/video_receive_stream.h
+++ b/video/video_receive_stream.h
@@ -108,7 +108,7 @@
// Implements Syncable.
int id() const override;
- rtc::Optional<Syncable::Info> GetInfo() const override;
+ absl::optional<Syncable::Info> GetInfo() const override;
uint32_t GetPlayoutTimestamp() const override;
void SetMinimumPlayoutDelay(int delay_ms) override;
diff --git a/video/video_send_stream.cc b/video/video_send_stream.cc
index e3fd642..3eb2d76 100644
--- a/video/video_send_stream.cc
+++ b/video/video_send_stream.cc
@@ -179,7 +179,7 @@
return stats_proxy_.GetStats();
}
-rtc::Optional<float> VideoSendStream::GetPacingFactorOverride() const {
+absl::optional<float> VideoSendStream::GetPacingFactorOverride() const {
return send_stream_->configured_pacing_factor_;
}
diff --git a/video/video_send_stream.h b/video/video_send_stream.h
index bbf706a..a41add8 100644
--- a/video/video_send_stream.h
+++ b/video/video_send_stream.h
@@ -106,7 +106,7 @@
class ConstructionTask;
- rtc::Optional<float> GetPacingFactorOverride() const;
+ absl::optional<float> GetPacingFactorOverride() const;
rtc::ThreadChecker thread_checker_;
rtc::TaskQueue* const worker_queue_;
diff --git a/video/video_send_stream_impl.cc b/video/video_send_stream_impl.cc
index c8fae7f..d8798b7 100644
--- a/video/video_send_stream_impl.cc
+++ b/video/video_send_stream_impl.cc
@@ -151,25 +151,25 @@
const char kForcedFallbackFieldTrial[] =
"WebRTC-VP8-Forced-Fallback-Encoder-v2";
-rtc::Optional<int> GetFallbackMinBpsFromFieldTrial() {
+absl::optional<int> GetFallbackMinBpsFromFieldTrial() {
if (!webrtc::field_trial::IsEnabled(kForcedFallbackFieldTrial))
- return rtc::nullopt;
+ return absl::nullopt;
std::string group =
webrtc::field_trial::FindFullName(kForcedFallbackFieldTrial);
if (group.empty())
- return rtc::nullopt;
+ return absl::nullopt;
int min_pixels;
int max_pixels;
int min_bps;
if (sscanf(group.c_str(), "Enabled-%d,%d,%d", &min_pixels, &max_pixels,
&min_bps) != 3) {
- return rtc::nullopt;
+ return absl::nullopt;
}
if (min_bps <= 0)
- return rtc::nullopt;
+ return absl::nullopt;
return min_bps;
}
@@ -370,7 +370,7 @@
if (TransportSeqNumExtensionConfigured(*config_)) {
has_packet_feedback_ = true;
- rtc::Optional<AlrExperimentSettings> alr_settings;
+ absl::optional<AlrExperimentSettings> alr_settings;
if (content_type == VideoEncoderConfig::ContentType::kScreen) {
alr_settings = AlrExperimentSettings::CreateFromFieldTrial(
AlrExperimentSettings::kScreenshareProbingBweExperimentName);
diff --git a/video/video_send_stream_impl.h b/video/video_send_stream_impl.h
index 84fca8f..ab9f8d1 100644
--- a/video/video_send_stream_impl.h
+++ b/video/video_send_stream_impl.h
@@ -88,7 +88,7 @@
void SetTransportOverhead(size_t transport_overhead_per_packet);
- rtc::Optional<float> configured_pacing_factor_;
+ absl::optional<float> configured_pacing_factor_;
// From PacketFeedbackObserver.
void OnPacketAdded(uint32_t ssrc, uint16_t seq_num) override;
diff --git a/video/video_send_stream_tests.cc b/video/video_send_stream_tests.cc
index dbcfa09..a11d05e 100644
--- a/video/video_send_stream_tests.cc
+++ b/video/video_send_stream_tests.cc
@@ -58,7 +58,7 @@
explicit VideoSendStreamPeer(webrtc::VideoSendStream* base_class_stream)
: internal_stream_(
static_cast<internal::VideoSendStream*>(base_class_stream)) {}
- rtc::Optional<float> GetPacingFactorOverride() const {
+ absl::optional<float> GetPacingFactorOverride() const {
return internal_stream_->GetPacingFactorOverride();
}
@@ -2065,7 +2065,7 @@
bool WaitBitrateChanged(bool non_zero) {
do {
- rtc::Optional<int> bitrate_kbps;
+ absl::optional<int> bitrate_kbps;
{
rtc::CritScope lock(&crit_);
bitrate_kbps = bitrate_kbps_;
@@ -2085,7 +2085,7 @@
rtc::CriticalSection crit_;
rtc::Event encoder_init_;
rtc::Event bitrate_changed_;
- rtc::Optional<int> bitrate_kbps_ RTC_GUARDED_BY(crit_);
+ absl::optional<int> bitrate_kbps_ RTC_GUARDED_BY(crit_);
};
// This test that if the encoder use an internal source, VideoEncoder::SetRates
@@ -3773,7 +3773,7 @@
class PacingFactorObserver : public test::SendTest {
public:
PacingFactorObserver(bool configure_send_side,
- rtc::Optional<float> expected_pacing_factor)
+ absl::optional<float> expected_pacing_factor)
: test::SendTest(VideoSendStreamTest::kDefaultTimeoutMs),
configure_send_side_(configure_send_side),
expected_pacing_factor_(expected_pacing_factor) {}
@@ -3824,7 +3824,7 @@
private:
const bool configure_send_side_;
- const rtc::Optional<float> expected_pacing_factor_;
+ const absl::optional<float> expected_pacing_factor_;
};
std::string GetAlrProbingExperimentString() {
@@ -3845,7 +3845,7 @@
TEST_F(VideoSendStreamTest, AlrNotConfiguredWhenSendSideOff) {
test::ScopedFieldTrials alr_experiment(GetAlrProbingExperimentString());
// Send-side bwe off, use configuration should not be overridden.
- PacingFactorObserver test_without_send_side(false, rtc::nullopt);
+ PacingFactorObserver test_without_send_side(false, absl::nullopt);
RunBaseTest(&test_without_send_side);
}
diff --git a/video/video_stream_decoder.cc b/video/video_stream_decoder.cc
index 5557c6c..86810dd 100644
--- a/video/video_stream_decoder.cc
+++ b/video/video_stream_decoder.cc
@@ -75,7 +75,7 @@
// thread may have held the lock when calling VideoDecoder::Decode, Reset, or
// Release. Acquiring the same lock in the path of decode callback can deadlock.
int32_t VideoStreamDecoder::FrameToRender(VideoFrame& video_frame,
- rtc::Optional<uint8_t> qp,
+ absl::optional<uint8_t> qp,
VideoContentType content_type) {
receive_stats_callback_->OnDecodedFrame(qp, video_frame.width(),
video_frame.height(), content_type);
diff --git a/video/video_stream_decoder.h b/video/video_stream_decoder.h
index c7d04b7..4bc7406 100644
--- a/video/video_stream_decoder.h
+++ b/video/video_stream_decoder.h
@@ -52,7 +52,7 @@
// Implements VCMReceiveCallback.
int32_t FrameToRender(VideoFrame& video_frame,
- rtc::Optional<uint8_t> qp,
+ absl::optional<uint8_t> qp,
VideoContentType content_type) override;
int32_t ReceivedDecodedReferenceFrame(const uint64_t picture_id) override;
void OnIncomingPayloadType(int payload_type) override;
diff --git a/video/video_stream_decoder_impl.cc b/video/video_stream_decoder_impl.cc
index 46b40a1..1bbf943 100644
--- a/video/video_stream_decoder_impl.cc
+++ b/video/video_stream_decoder_impl.cc
@@ -232,21 +232,21 @@
// VideoDecoder::DecodedImageCallback
int32_t VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image) {
- Decoded(decoded_image, rtc::nullopt, rtc::nullopt);
+ Decoded(decoded_image, absl::nullopt, absl::nullopt);
return WEBRTC_VIDEO_CODEC_OK;
}
// VideoDecoder::DecodedImageCallback
int32_t VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image,
int64_t decode_time_ms) {
- Decoded(decoded_image, decode_time_ms, rtc::nullopt);
+ Decoded(decoded_image, decode_time_ms, absl::nullopt);
return WEBRTC_VIDEO_CODEC_OK;
}
// VideoDecoder::DecodedImageCallback
void VideoStreamDecoderImpl::Decoded(VideoFrame& decoded_image,
- rtc::Optional<int32_t> decode_time_ms,
- rtc::Optional<uint8_t> qp) {
+ absl::optional<int32_t> decode_time_ms,
+ absl::optional<uint8_t> qp) {
int64_t decode_stop_time_ms = rtc::TimeMillis();
bookkeeping_queue_.PostTask([this, decode_stop_time_ms, decoded_image,
@@ -261,11 +261,11 @@
return;
}
- rtc::Optional<int> casted_qp;
+ absl::optional<int> casted_qp;
if (qp)
casted_qp.emplace(*qp);
- rtc::Optional<int> casted_decode_time_ms(decode_time_ms.value_or(
+ absl::optional<int> casted_decode_time_ms(decode_time_ms.value_or(
decode_stop_time_ms - frame_timestamps->decode_start_time_ms));
timing_.StopDecodeTimer(0, *casted_decode_time_ms, decode_stop_time_ms,
diff --git a/video/video_stream_decoder_impl.h b/video/video_stream_decoder_impl.h
index d4de7b6..cd1f953 100644
--- a/video/video_stream_decoder_impl.h
+++ b/video/video_stream_decoder_impl.h
@@ -15,7 +15,7 @@
#include <memory>
#include <utility>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/video/video_stream_decoder.h"
#include "modules/video_coding/frame_buffer2.h"
#include "modules/video_coding/jitter_estimator.h"
@@ -64,8 +64,8 @@
int32_t Decoded(VideoFrame& decodedImage) override;
int32_t Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) override;
void Decoded(VideoFrame& decodedImage,
- rtc::Optional<int32_t> decode_time_ms,
- rtc::Optional<uint8_t> qp) override;
+ absl::optional<int32_t> decode_time_ms,
+ absl::optional<uint8_t> qp) override;
VideoStreamDecoder::Callbacks* const callbacks_
RTC_PT_GUARDED_BY(bookkeeping_queue_);
@@ -83,7 +83,7 @@
VCMTiming timing_;
video_coding::FrameBuffer frame_buffer_;
video_coding::VideoLayerFrameId last_continuous_id_;
- rtc::Optional<int> current_payload_type_;
+ absl::optional<int> current_payload_type_;
std::unique_ptr<VideoDecoder> decoder_;
// Some decoders are pipelined so it is not sufficient to save frame info
diff --git a/video/video_stream_encoder.cc b/video/video_stream_encoder.cc
index 6d214ff..6aee776 100644
--- a/video/video_stream_encoder.cc
+++ b/video/video_stream_encoder.cc
@@ -183,7 +183,7 @@
RTC_LOG(LS_INFO) << "Scaling down resolution, max pixels: "
<< pixels_wanted;
sink_wants_.max_pixel_count = pixels_wanted;
- sink_wants_.target_pixel_count = rtc::nullopt;
+ sink_wants_.target_pixel_count = absl::nullopt;
source_->AddOrUpdateSink(video_stream_encoder_,
GetActiveSinkWantsInternal());
return true;
@@ -606,7 +606,7 @@
// Drop frames and scale down until desired quality is achieved.
// Use experimental thresholds if available.
- rtc::Optional<VideoEncoder::QpThresholds> experimental_thresholds;
+ absl::optional<VideoEncoder::QpThresholds> experimental_thresholds;
if (quality_scaling_experiment_enabled_) {
experimental_thresholds = QualityScalingExperiment::GetQpThresholds(
encoder_config_.codec_type);
@@ -880,7 +880,7 @@
int64_t capture_time_us =
encoded_image.capture_time_ms_ * rtc::kNumMicrosecsPerMillisec;
- rtc::Optional<int> encode_duration_us;
+ absl::optional<int> encode_duration_us;
if (encoded_image.timing_.flags != VideoSendTiming::kInvalid) {
encode_duration_us.emplace(
// TODO(nisse): Maybe use capture_time_ms_ rather than encode_start_ms_?
diff --git a/video/video_stream_encoder.h b/video/video_stream_encoder.h
index 7a48a07..0ea6dec 100644
--- a/video/video_stream_encoder.h
+++ b/video/video_stream_encoder.h
@@ -230,7 +230,7 @@
// Set when configuration must create a new encoder object, e.g.,
// because of a codec change.
bool pending_encoder_creation_ RTC_GUARDED_BY(&encoder_queue_);
- rtc::Optional<VideoFrameInfo> last_frame_info_
+ absl::optional<VideoFrameInfo> last_frame_info_
RTC_GUARDED_BY(&encoder_queue_);
int crop_width_ RTC_GUARDED_BY(&encoder_queue_);
int crop_height_ RTC_GUARDED_BY(&encoder_queue_);
@@ -259,7 +259,7 @@
};
// Stores a snapshot of the last adaptation request triggered by an AdaptUp
// or AdaptDown signal.
- rtc::Optional<AdaptationRequest> last_adaptation_request_
+ absl::optional<AdaptationRequest> last_adaptation_request_
RTC_GUARDED_BY(&encoder_queue_);
rtc::RaceChecker incoming_frame_race_checker_
@@ -274,12 +274,12 @@
int64_t last_frame_log_ms_ RTC_GUARDED_BY(incoming_frame_race_checker_);
int captured_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
int dropped_frame_count_ RTC_GUARDED_BY(&encoder_queue_);
- rtc::Optional<VideoFrame> pending_frame_ RTC_GUARDED_BY(&encoder_queue_);
+ absl::optional<VideoFrame> pending_frame_ RTC_GUARDED_BY(&encoder_queue_);
int64_t pending_frame_post_time_us_ RTC_GUARDED_BY(&encoder_queue_);
VideoBitrateAllocationObserver* bitrate_observer_
RTC_GUARDED_BY(&encoder_queue_);
- rtc::Optional<int64_t> last_parameters_update_ms_
+ absl::optional<int64_t> last_parameters_update_ms_
RTC_GUARDED_BY(&encoder_queue_);
// All public methods are proxied to |encoder_queue_|. It must must be
diff --git a/video/video_stream_encoder_unittest.cc b/video/video_stream_encoder_unittest.cc
index e295393..d83322d 100644
--- a/video/video_stream_encoder_unittest.cc
+++ b/video/video_stream_encoder_unittest.cc
@@ -180,8 +180,8 @@
return last_wants_;
}
- rtc::Optional<int> last_sent_width() const { return last_width_; }
- rtc::Optional<int> last_sent_height() const { return last_height_; }
+ absl::optional<int> last_sent_width() const { return last_width_; }
+ absl::optional<int> last_sent_height() const { return last_height_; }
void IncomingCapturedFrame(const VideoFrame& video_frame) override {
int cropped_width = 0;
@@ -201,8 +201,8 @@
last_width_.emplace(adapted_frame.width());
last_height_.emplace(adapted_frame.height());
} else {
- last_width_ = rtc::nullopt;
- last_height_ = rtc::nullopt;
+ last_width_ = absl::nullopt;
+ last_height_ = absl::nullopt;
}
} else {
test::FrameForwarder::IncomingCapturedFrame(video_frame);
@@ -223,8 +223,8 @@
cricket::VideoAdapter adapter_;
bool adaptation_enabled_ RTC_GUARDED_BY(crit_);
rtc::VideoSinkWants last_wants_ RTC_GUARDED_BY(crit_);
- rtc::Optional<int> last_width_;
- rtc::Optional<int> last_height_;
+ absl::optional<int> last_width_;
+ absl::optional<int> last_height_;
};
class MockableSendStatisticsProxy : public SendStatisticsProxy {
@@ -253,7 +253,7 @@
private:
rtc::CriticalSection lock_;
- rtc::Optional<VideoSendStream::Stats> mock_stats_ RTC_GUARDED_BY(lock_);
+ absl::optional<VideoSendStream::Stats> mock_stats_ RTC_GUARDED_BY(lock_);
};
class MockBitrateObserver : public VideoBitrateAllocationObserver {