Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
diff --git a/video/receive_statistics_proxy.cc b/video/receive_statistics_proxy.cc
index 05dafbd..e74968b 100644
--- a/video/receive_statistics_proxy.cc
+++ b/video/receive_statistics_proxy.cc
@@ -96,7 +96,7 @@
}
void ReceiveStatisticsProxy::UpdateHistograms(
- absl::optional<int> fraction_lost,
+ std::optional<int> fraction_lost,
const StreamDataCounters& rtp_stats,
const StreamDataCounters* rtx_stats) {
RTC_DCHECK_RUN_ON(&main_thread_);
@@ -170,7 +170,7 @@
round(render_pixel_tracker_.ComputeTotalRate()));
}
- absl::optional<int> sync_offset_ms =
+ std::optional<int> sync_offset_ms =
sync_offset_counter_.Avg(kMinRequiredSamples);
if (sync_offset_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.AVSyncOffsetInMs",
@@ -197,18 +197,18 @@
<< key_frames_permille << '\n';
}
- absl::optional<int> qp = qp_counters_.vp8.Avg(kMinRequiredSamples);
+ std::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';
}
- absl::optional<int> decode_ms = decode_time_counter_.Avg(kMinRequiredSamples);
+ std::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';
}
- absl::optional<int> jb_delay_ms =
+ std::optional<int> jb_delay_ms =
jitter_delay_counter_.Avg(kMinRequiredSamples);
if (jb_delay_ms) {
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.JitterBufferDelayInMs",
@@ -216,21 +216,21 @@
log_stream << "WebRTC.Video.JitterBufferDelayInMs " << *jb_delay_ms << '\n';
}
- absl::optional<int> target_delay_ms =
+ std::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';
}
- absl::optional<int> current_delay_ms =
+ std::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';
}
- absl::optional<int> delay_ms = oneway_delay_counter_.Avg(kMinRequiredSamples);
+ std::optional<int> delay_ms = oneway_delay_counter_.Avg(kMinRequiredSamples);
if (delay_ms)
RTC_HISTOGRAM_COUNTS_10000("WebRTC.Video.OnewayDelayInMs", *delay_ms);
@@ -242,7 +242,7 @@
auto stats = it.second;
std::string uma_prefix = UmaPrefixForContentType(content_type);
- absl::optional<int> e2e_delay_ms =
+ std::optional<int> e2e_delay_ms =
stats.e2e_delay_counter.Avg(kMinRequiredSamples);
if (e2e_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix + ".EndToEndDelayInMs",
@@ -250,14 +250,14 @@
log_stream << uma_prefix << ".EndToEndDelayInMs"
<< " " << *e2e_delay_ms << '\n';
}
- absl::optional<int> e2e_delay_max_ms = stats.e2e_delay_counter.Max();
+ std::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",
*e2e_delay_max_ms);
log_stream << uma_prefix << ".EndToEndDelayMaxInMs"
<< " " << *e2e_delay_max_ms << '\n';
}
- absl::optional<int> interframe_delay_ms =
+ std::optional<int> interframe_delay_ms =
stats.interframe_delay_counter.Avg(kMinRequiredSamples);
if (interframe_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix + ".InterframeDelayInMs",
@@ -265,7 +265,7 @@
log_stream << uma_prefix << ".InterframeDelayInMs"
<< " " << *interframe_delay_ms << '\n';
}
- absl::optional<int> interframe_delay_max_ms =
+ std::optional<int> interframe_delay_max_ms =
stats.interframe_delay_counter.Max();
if (interframe_delay_max_ms && interframe_delay_ms) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix + ".InterframeDelayMaxInMs",
@@ -274,7 +274,7 @@
<< " " << *interframe_delay_max_ms << '\n';
}
- absl::optional<uint32_t> interframe_delay_95p_ms =
+ std::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(
@@ -284,7 +284,7 @@
<< " " << *interframe_delay_95p_ms << '\n';
}
- absl::optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
+ std::optional<int> width = stats.received_width.Avg(kMinRequiredSamples);
if (width) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix + ".ReceivedWidthInPixels",
*width);
@@ -292,7 +292,7 @@
<< " " << *width << '\n';
}
- absl::optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
+ std::optional<int> height = stats.received_height.Avg(kMinRequiredSamples);
if (height) {
RTC_HISTOGRAM_COUNTS_SPARSE_10000(uma_prefix + ".ReceivedHeightInPixels",
*height);
@@ -300,7 +300,7 @@
<< " " << *height << '\n';
}
- absl::optional<double> corruption_score = stats.corruption_score.GetMean();
+ std::optional<double> corruption_score = stats.corruption_score.GetMean();
if (corruption_score) {
// Granularity level: 2e-3.
RTC_HISTOGRAM_COUNTS_SPARSE(uma_prefix + ".CorruptionLikelihoodPermille",
@@ -336,7 +336,7 @@
<< " " << key_frames_permille << '\n';
}
- absl::optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
+ std::optional<int> qp = stats.qp_counter.Avg(kMinRequiredSamples);
if (qp) {
RTC_HISTOGRAM_COUNTS_SPARSE_200(uma_prefix + ".Decoded.Vp8.Qp", *qp);
log_stream << uma_prefix << ".Decoded.Vp8.Qp"
@@ -409,13 +409,13 @@
stats_.network_frame_rate = static_cast<int>(framerate);
}
-absl::optional<int64_t>
+std::optional<int64_t>
ReceiveStatisticsProxy::GetCurrentEstimatedPlayoutNtpTimestampMs(
int64_t now_ms) const {
RTC_DCHECK_RUN_ON(&main_thread_);
if (!last_estimated_playout_ntp_timestamp_ms_ ||
!last_estimated_playout_time_ms_) {
- return absl::nullopt;
+ return std::nullopt;
}
int64_t elapsed_ms = now_ms - *last_estimated_playout_time_ms_;
return *last_estimated_playout_ntp_timestamp_ms_ + elapsed_ms;
@@ -590,7 +590,7 @@
}
void ReceiveStatisticsProxy::OnDecodedFrame(const VideoFrame& frame,
- absl::optional<uint8_t> qp,
+ std::optional<uint8_t> qp,
TimeDelta decode_time,
VideoContentType content_type,
VideoFrameType frame_type) {
@@ -626,7 +626,7 @@
void ReceiveStatisticsProxy::OnDecodedFrame(
const VideoFrameMetaData& frame_meta,
- absl::optional<uint8_t> qp,
+ std::optional<uint8_t> qp,
TimeDelta decode_time,
TimeDelta processing_delay,
TimeDelta assembly_time,