[Stats] Replace all uses of is_defined() with has_value().
Same method, different name. Unblocks replacing RTCStatsMember<T> with
absl::optional<T>.
Bug: webrtc:15164
Change-Id: I251dd44d3b0f9576b3b68915fe0406d1b3381e5c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/334641
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41573}
diff --git a/api/stats/rtc_stats_member.h b/api/stats/rtc_stats_member.h
index d2aa539..2f01a18 100644
--- a/api/stats/rtc_stats_member.h
+++ b/api/stats/rtc_stats_member.h
@@ -56,7 +56,7 @@
virtual Type type() const = 0;
virtual bool is_sequence() const = 0;
virtual bool is_string() const = 0;
- virtual bool is_defined() const = 0;
+ virtual bool has_value() const = 0;
// Type and value comparator. The names are not compared. These operators are
// exposed for testing.
bool operator==(const RTCStatsMemberInterface& other) const {
@@ -97,7 +97,6 @@
Type type() const override { return StaticType(); }
bool is_sequence() const override;
bool is_string() const override;
- bool is_defined() const override { return value_.has_value(); }
std::string ValueToString() const override;
std::string ValueToJson() const override;
@@ -124,7 +123,7 @@
// Getter methods that look the same as absl::optional<T>. Please prefer these
// in order to unblock replacing RTCStatsMember<T> with absl::optional<T> in
// the future (https://crbug.com/webrtc/15164).
- bool has_value() const { return value_.has_value(); }
+ bool has_value() const override { return value_.has_value(); }
const T& value() const { return value_.value(); }
T& value() { return value_.value(); }
T& operator*() {
diff --git a/pc/peer_connection_encodings_integrationtest.cc b/pc/peer_connection_encodings_integrationtest.cc
index 979032c..4a93e91 100644
--- a/pc/peer_connection_encodings_integrationtest.cc
+++ b/pc/peer_connection_encodings_integrationtest.cc
@@ -77,7 +77,7 @@
std::string GetCurrentCodecMimeType(
rtc::scoped_refptr<const RTCStatsReport> report,
const RTCOutboundRtpStreamStats& outbound_rtp) {
- return outbound_rtp.codec_id.is_defined()
+ return outbound_rtp.codec_id.has_value()
? *report->GetAs<RTCCodecStats>(*outbound_rtp.codec_id)->mime_type
: "";
}
@@ -92,7 +92,7 @@
const std::vector<const RTCOutboundRtpStreamStats*>& outbound_rtps,
const absl::string_view& rid) {
for (const auto* outbound_rtp : outbound_rtps) {
- if (outbound_rtp->rid.is_defined() && *outbound_rtp->rid == rid) {
+ if (outbound_rtp->rid.has_value() && *outbound_rtp->rid == rid) {
return outbound_rtp;
}
}
@@ -261,7 +261,7 @@
}
size_t num_sending_layers = 0;
for (const auto* outbound_rtp : outbound_rtps) {
- if (outbound_rtp->bytes_sent.is_defined() &&
+ if (outbound_rtp->bytes_sent.has_value() &&
*outbound_rtp->bytes_sent > 0u) {
++num_sending_layers;
}
@@ -278,11 +278,11 @@
std::vector<const RTCOutboundRtpStreamStats*> outbound_rtps =
report->GetStatsOfType<RTCOutboundRtpStreamStats>();
auto* outbound_rtp = FindOutboundRtpByRid(outbound_rtps, rid);
- if (!outbound_rtp || !outbound_rtp->scalability_mode.is_defined() ||
+ if (!outbound_rtp || !outbound_rtp->scalability_mode.has_value() ||
*outbound_rtp->scalability_mode != expected_scalability_mode) {
return false;
}
- if (outbound_rtp->frame_height.is_defined()) {
+ if (outbound_rtp->frame_height.has_value()) {
RTC_LOG(LS_INFO) << "Waiting for target resolution (" << frame_height
<< "p). Currently at " << *outbound_rtp->frame_height
<< "p...";
@@ -290,7 +290,7 @@
RTC_LOG(LS_INFO)
<< "Waiting for target resolution. No frames encoded yet...";
}
- if (!outbound_rtp->frame_height.is_defined() ||
+ if (!outbound_rtp->frame_height.has_value() ||
*outbound_rtp->frame_height != frame_height) {
// Sleep to avoid log spam when this is used in ASSERT_TRUE_WAIT().
rtc::Thread::Current()->SleepMs(1000);
@@ -312,8 +312,8 @@
} else if (outbound_rtps.size() == 1u) {
outbound_rtp = outbound_rtps[0];
}
- if (!outbound_rtp || !outbound_rtp->frame_width.is_defined() ||
- !outbound_rtp->frame_height.is_defined()) {
+ if (!outbound_rtp || !outbound_rtp->frame_width.has_value() ||
+ !outbound_rtp->frame_height.has_value()) {
// RTP not found by rid or has not encoded a frame yet.
RTC_LOG(LS_ERROR) << "rid=" << resolution.rid << " does not have "
<< "resolution metrics";
diff --git a/pc/peer_connection_field_trial_tests.cc b/pc/peer_connection_field_trial_tests.cc
index 4cbe249..ae56635 100644
--- a/pc/peer_connection_field_trial_tests.cc
+++ b/pc/peer_connection_field_trial_tests.cc
@@ -264,7 +264,7 @@
std::vector<const RTCOutboundRtpStreamStats*> outbound_rtp_stats =
caller->GetStats()->GetStatsOfType<RTCOutboundRtpStreamStats>();
ASSERT_GE(outbound_rtp_stats.size(), 1u);
- ASSERT_TRUE(outbound_rtp_stats[0]->target_bitrate.is_defined());
+ ASSERT_TRUE(outbound_rtp_stats[0]->target_bitrate.has_value());
// Link capacity is limited to 500k, so BWE is expected to be close to 500k.
ASSERT_LE(*outbound_rtp_stats[0]->target_bitrate, 500'000 * 1.1);
}
diff --git a/pc/peer_connection_integrationtest.cc b/pc/peer_connection_integrationtest.cc
index bfff86e..c960a36 100644
--- a/pc/peer_connection_integrationtest.cc
+++ b/pc/peer_connection_integrationtest.cc
@@ -1356,15 +1356,15 @@
ASSERT_EQ(outbound_stream_stats.size(), 4u);
std::vector<std::string> outbound_track_ids;
for (const auto& stat : outbound_stream_stats) {
- ASSERT_TRUE(stat->bytes_sent.is_defined());
+ ASSERT_TRUE(stat->bytes_sent.has_value());
EXPECT_LT(0u, *stat->bytes_sent);
if (*stat->kind == "video") {
- ASSERT_TRUE(stat->key_frames_encoded.is_defined());
+ ASSERT_TRUE(stat->key_frames_encoded.has_value());
EXPECT_GT(*stat->key_frames_encoded, 0u);
- ASSERT_TRUE(stat->frames_encoded.is_defined());
+ ASSERT_TRUE(stat->frames_encoded.has_value());
EXPECT_GE(*stat->frames_encoded, *stat->key_frames_encoded);
}
- ASSERT_TRUE(stat->media_source_id.is_defined());
+ ASSERT_TRUE(stat->media_source_id.has_value());
const RTCMediaSourceStats* media_source =
static_cast<const RTCMediaSourceStats*>(
caller_report->Get(*stat->media_source_id));
@@ -1381,12 +1381,12 @@
ASSERT_EQ(4u, inbound_stream_stats.size());
std::vector<std::string> inbound_track_ids;
for (const auto& stat : inbound_stream_stats) {
- ASSERT_TRUE(stat->bytes_received.is_defined());
+ ASSERT_TRUE(stat->bytes_received.has_value());
EXPECT_LT(0u, *stat->bytes_received);
if (*stat->kind == "video") {
- ASSERT_TRUE(stat->key_frames_decoded.is_defined());
+ ASSERT_TRUE(stat->key_frames_decoded.has_value());
EXPECT_GT(*stat->key_frames_decoded, 0u);
- ASSERT_TRUE(stat->frames_decoded.is_defined());
+ ASSERT_TRUE(stat->frames_decoded.has_value());
EXPECT_GE(*stat->frames_decoded, *stat->key_frames_decoded);
}
inbound_track_ids.push_back(*stat->track_identifier);
@@ -1417,7 +1417,7 @@
auto inbound_stream_stats =
report->GetStatsOfType<RTCInboundRtpStreamStats>();
ASSERT_EQ(1U, inbound_stream_stats.size());
- ASSERT_TRUE(inbound_stream_stats[0]->bytes_received.is_defined());
+ ASSERT_TRUE(inbound_stream_stats[0]->bytes_received.has_value());
ASSERT_GT(*inbound_stream_stats[0]->bytes_received, 0U);
}
@@ -1464,7 +1464,7 @@
auto inbound_rtps = report->GetStatsOfType<RTCInboundRtpStreamStats>();
auto index = FindFirstMediaStatsIndexByKind("audio", inbound_rtps);
ASSERT_GE(index, 0);
- EXPECT_TRUE(inbound_rtps[index]->audio_level.is_defined());
+ EXPECT_TRUE(inbound_rtps[index]->audio_level.has_value());
}
// Test that DTLS 1.0 is used if both sides only support DTLS 1.0.
@@ -2952,7 +2952,7 @@
auto inbound_rtps = report->GetStatsOfType<RTCInboundRtpStreamStats>();
RTC_CHECK(!inbound_rtps.empty());
auto* inbound_rtp = inbound_rtps[0];
- if (!inbound_rtp->total_audio_energy.is_defined()) {
+ if (!inbound_rtp->total_audio_energy.has_value()) {
return 0.0;
}
return *inbound_rtp->total_audio_energy;
@@ -3776,7 +3776,7 @@
ADD_FAILURE();
return 0;
}
- if (!sender_stats[0]->nack_count.is_defined()) {
+ if (!sender_stats[0]->nack_count.has_value()) {
return 0;
}
return *sender_stats[0]->nack_count;
@@ -3789,7 +3789,7 @@
ADD_FAILURE();
return 0;
}
- if (!receiver_stats[0]->nack_count.is_defined()) {
+ if (!receiver_stats[0]->nack_count.has_value()) {
return 0;
}
return *receiver_stats[0]->nack_count;
diff --git a/pc/peer_connection_rampup_tests.cc b/pc/peer_connection_rampup_tests.cc
index 0fd3c27..6535a7c 100644
--- a/pc/peer_connection_rampup_tests.cc
+++ b/pc/peer_connection_rampup_tests.cc
@@ -309,7 +309,7 @@
auto stats = caller_->GetStats();
auto transport_stats = stats->GetStatsOfType<RTCTransportStats>();
if (transport_stats.size() == 0u ||
- !transport_stats[0]->selected_candidate_pair_id.is_defined()) {
+ !transport_stats[0]->selected_candidate_pair_id.has_value()) {
return 0;
}
std::string selected_ice_id =
@@ -317,7 +317,7 @@
// Use the selected ICE candidate pair ID to get the appropriate ICE stats.
const RTCIceCandidatePairStats ice_candidate_pair_stats =
stats->Get(selected_ice_id)->cast_to<const RTCIceCandidatePairStats>();
- if (ice_candidate_pair_stats.available_outgoing_bitrate.is_defined()) {
+ if (ice_candidate_pair_stats.available_outgoing_bitrate.has_value()) {
return *ice_candidate_pair_stats.available_outgoing_bitrate;
}
// We couldn't get the `available_outgoing_bitrate` for the active candidate
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index c838538..4555ff1 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -551,7 +551,7 @@
stats->ssrc = voice_receiver_info.ssrc();
stats->kind = "audio";
stats->transport_id = transport_id;
- if (inbound_audio_stats.codec_id.is_defined()) {
+ if (inbound_audio_stats.codec_id.has_value()) {
stats->codec_id = *inbound_audio_stats.codec_id;
}
// - RTCSentRtpStreamStats.
@@ -890,7 +890,7 @@
// transport paired with the RTP transport, otherwise the same
// transport is used for RTCP and RTP.
remote_inbound->transport_id =
- transport.rtcp_transport_stats_id.is_defined()
+ transport.rtcp_transport_stats_id.has_value()
? *transport.rtcp_transport_stats_id
: *outbound_rtp.transport_id;
}
@@ -898,13 +898,13 @@
// codec is switched out on the fly we may have received a Report Block
// based on the previous codec and there is no way to tell which point in
// time the codec changed for the remote end.
- const auto* codec_from_id = outbound_rtp.codec_id.is_defined()
+ const auto* codec_from_id = outbound_rtp.codec_id.has_value()
? report.Get(*outbound_rtp.codec_id)
: nullptr;
if (codec_from_id) {
remote_inbound->codec_id = *outbound_rtp.codec_id;
const auto& codec = codec_from_id->cast_to<RTCCodecStats>();
- if (codec.clock_rate.is_defined()) {
+ if (codec.clock_rate.has_value()) {
remote_inbound->jitter =
report_block.jitter(*codec.clock_rate).seconds<double>();
}
@@ -1051,7 +1051,7 @@
auto encodings = sender_selector->GetParametersInternal().encodings;
for (const auto* outbound_rtp :
report->GetStatsOfType<RTCOutboundRtpStreamStats>()) {
- RTC_DCHECK(outbound_rtp->ssrc.is_defined());
+ RTC_DCHECK(outbound_rtp->ssrc.has_value());
auto it = std::find_if(encodings.begin(), encodings.end(),
[ssrc = *outbound_rtp->ssrc](
const RtpEncodingParameters& encoding) {
@@ -1071,7 +1071,7 @@
if (ssrc.has_value()) {
for (const auto* inbound_rtp :
report->GetStatsOfType<RTCInboundRtpStreamStats>()) {
- RTC_DCHECK(inbound_rtp->ssrc.is_defined());
+ RTC_DCHECK(inbound_rtp->ssrc.has_value());
if (*inbound_rtp->ssrc == *ssrc) {
rtpstream_ids.push_back(inbound_rtp->id());
}
diff --git a/pc/rtc_stats_collector_unittest.cc b/pc/rtc_stats_collector_unittest.cc
index 839d8d9..61b3bca 100644
--- a/pc/rtc_stats_collector_unittest.cc
+++ b/pc/rtc_stats_collector_unittest.cc
@@ -2304,7 +2304,7 @@
ASSERT_TRUE(report->Get("ITTransportName1A1"));
auto stats =
report->Get("ITTransportName1A1")->cast_to<RTCInboundRtpStreamStats>();
- ASSERT_FALSE(stats.playout_id.is_defined());
+ ASSERT_FALSE(stats.playout_id.has_value());
}
{
// We do expect a playout id when receiving.
@@ -2315,7 +2315,7 @@
ASSERT_TRUE(report->Get("ITTransportName1A1"));
auto stats =
report->Get("ITTransportName1A1")->cast_to<RTCInboundRtpStreamStats>();
- ASSERT_TRUE(stats.playout_id.is_defined());
+ ASSERT_TRUE(stats.playout_id.has_value());
EXPECT_EQ(*stats.playout_id, "AP");
}
}
@@ -2531,7 +2531,7 @@
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
auto inbound_rtps = report->GetStatsOfType<RTCInboundRtpStreamStats>();
ASSERT_EQ(inbound_rtps.size(), 1u);
- ASSERT_TRUE(inbound_rtps[0]->goog_timing_frame_info.is_defined());
+ ASSERT_TRUE(inbound_rtps[0]->goog_timing_frame_info.has_value());
EXPECT_EQ(*inbound_rtps[0]->goog_timing_frame_info,
"1,2,3,4,5,6,7,8,9,10,11,12,13,1,0");
}
@@ -3140,8 +3140,8 @@
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
ASSERT_TRUE(report->Get("SV42"));
auto video_stats = report->Get("SV42")->cast_to<RTCVideoSourceStats>();
- EXPECT_FALSE(video_stats.frames_per_second.is_defined());
- EXPECT_FALSE(video_stats.frames.is_defined());
+ EXPECT_FALSE(video_stats.frames_per_second.has_value());
+ EXPECT_FALSE(video_stats.frames.has_value());
}
// The track not having a source is not expected to be true in practise, but
@@ -3170,8 +3170,8 @@
rtc::scoped_refptr<const RTCStatsReport> report = stats_->GetStatsReport();
ASSERT_TRUE(report->Get("SV42"));
auto video_stats = report->Get("SV42")->cast_to<RTCVideoSourceStats>();
- EXPECT_FALSE(video_stats.width.is_defined());
- EXPECT_FALSE(video_stats.height.is_defined());
+ EXPECT_FALSE(video_stats.width.has_value());
+ EXPECT_FALSE(video_stats.height.has_value());
}
TEST_F(RTCStatsCollectorTest,
@@ -3372,9 +3372,9 @@
auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id)
->cast_to<RTCRemoteInboundRtpStreamStats>();
- EXPECT_TRUE(remote_inbound_rtp.round_trip_time_measurements.is_defined());
+ EXPECT_TRUE(remote_inbound_rtp.round_trip_time_measurements.has_value());
EXPECT_EQ(0, *remote_inbound_rtp.round_trip_time_measurements);
- EXPECT_FALSE(remote_inbound_rtp.round_trip_time.is_defined());
+ EXPECT_FALSE(remote_inbound_rtp.round_trip_time.has_value());
}
TEST_P(RTCStatsCollectorTestWithParamKind,
@@ -3436,10 +3436,10 @@
auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id)
->cast_to<RTCRemoteInboundRtpStreamStats>();
- EXPECT_TRUE(remote_inbound_rtp.codec_id.is_defined());
+ EXPECT_TRUE(remote_inbound_rtp.codec_id.has_value());
EXPECT_TRUE(report->Get(*remote_inbound_rtp.codec_id));
- EXPECT_TRUE(remote_inbound_rtp.jitter.is_defined());
+ EXPECT_TRUE(remote_inbound_rtp.jitter.has_value());
// The jitter (in seconds) is the report block's jitter divided by the codec's
// clock rate.
EXPECT_EQ(5.0, *remote_inbound_rtp.jitter);
@@ -3476,7 +3476,7 @@
auto& remote_inbound_rtp = report->Get(remote_inbound_rtp_id)
->cast_to<RTCRemoteInboundRtpStreamStats>();
- EXPECT_TRUE(remote_inbound_rtp.transport_id.is_defined());
+ EXPECT_TRUE(remote_inbound_rtp.transport_id.has_value());
EXPECT_EQ("TTransportName2", // 2 for RTCP
*remote_inbound_rtp.transport_id);
EXPECT_TRUE(report->Get(*remote_inbound_rtp.transport_id));
diff --git a/pc/rtc_stats_traversal.cc b/pc/rtc_stats_traversal.cc
index 04de550..dfd0570 100644
--- a/pc/rtc_stats_traversal.cc
+++ b/pc/rtc_stats_traversal.cc
@@ -44,7 +44,7 @@
void AddIdIfDefined(const RTCStatsMember<std::string>& id,
std::vector<const std::string*>* neighbor_ids) {
- if (id.is_defined())
+ if (id.has_value())
neighbor_ids->push_back(&(*id));
}
diff --git a/pc/test/integration_test_helpers.h b/pc/test/integration_test_helpers.h
index a480bc2..6838712 100644
--- a/pc/test/integration_test_helpers.h
+++ b/pc/test/integration_test_helpers.h
@@ -649,8 +649,8 @@
auto received_stats = NewGetStats();
auto rtp_stats =
received_stats->GetStatsOfType<RTCInboundRtpStreamStats>()[0];
- ASSERT_TRUE(rtp_stats->relative_packet_arrival_delay.is_defined());
- ASSERT_TRUE(rtp_stats->packets_received.is_defined());
+ ASSERT_TRUE(rtp_stats->relative_packet_arrival_delay.has_value());
+ ASSERT_TRUE(rtp_stats->packets_received.has_value());
rtp_stats_id_ = rtp_stats->id();
audio_packets_stat_ = *rtp_stats->packets_received;
audio_delay_stat_ = *rtp_stats->relative_packet_arrival_delay;
diff --git a/pc/test/svc_e2e_tests.cc b/pc/test/svc_e2e_tests.cc
index 3501b64..b2382d7 100644
--- a/pc/test/svc_e2e_tests.cc
+++ b/pc/test/svc_e2e_tests.cc
@@ -210,7 +210,7 @@
// Extract the scalability mode reported in the stats.
auto outbound_stats = report->GetStatsOfType<RTCOutboundRtpStreamStats>();
for (const auto& stat : outbound_stats) {
- if (stat->scalability_mode.is_defined()) {
+ if (stat->scalability_mode.has_value()) {
reported_scalability_mode_ = *stat->scalability_mode;
}
}
diff --git a/stats/rtc_stats_unittest.cc b/stats/rtc_stats_unittest.cc
index 8837da7..3ea36a6 100644
--- a/stats/rtc_stats_unittest.cc
+++ b/stats/rtc_stats_unittest.cc
@@ -107,7 +107,7 @@
stats.m_sequence_bool = sequence_bool;
stats.m_sequence_int32 = sequence_int32;
stats.m_sequence_uint32 = sequence_uint32;
- EXPECT_FALSE(stats.m_sequence_int64.is_defined());
+ EXPECT_FALSE(stats.m_sequence_int64.has_value());
stats.m_sequence_int64 = sequence_int64;
stats.m_sequence_uint64 = sequence_uint64;
stats.m_sequence_double = sequence_double;
@@ -382,8 +382,8 @@
// "mUint32" should not be part of the generated JSON object.
int m_uint32;
int m_uint64;
- EXPECT_FALSE(stats.m_uint32.is_defined());
- EXPECT_FALSE(stats.m_uint64.is_defined());
+ EXPECT_FALSE(stats.m_uint32.has_value());
+ EXPECT_FALSE(stats.m_uint64.has_value());
EXPECT_FALSE(rtc::GetIntFromJsonObject(json_output, "mUint32", &m_uint32));
EXPECT_FALSE(rtc::GetIntFromJsonObject(json_output, "mUint64", &m_uint64));
@@ -507,7 +507,7 @@
TEST(RTCStatsDeathTest, ValueOfUndefinedMember) {
RTCTestStats stats("testId", Timestamp::Micros(0));
- EXPECT_FALSE(stats.m_int32.is_defined());
+ EXPECT_FALSE(stats.m_int32.has_value());
EXPECT_DEATH(*stats.m_int32, "");
}
diff --git a/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc b/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc
index 9797f4f..93d8906 100644
--- a/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc
+++ b/test/pc/e2e/analyzer/audio/default_audio_quality_analyzer.cc
@@ -42,7 +42,7 @@
auto stats = report->GetStatsOfType<RTCInboundRtpStreamStats>();
for (auto& stat : stats) {
- if (!stat->kind.is_defined() || !(*stat->kind == "audio")) {
+ if (!stat->kind.has_value() || !(*stat->kind == "audio")) {
continue;
}
diff --git a/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc b/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc
index 3ae7fda..dbcf80e 100644
--- a/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc
+++ b/test/pc/e2e/analyzer/video/video_quality_metrics_reporter.cc
@@ -58,7 +58,7 @@
auto transport_stats = report->GetStatsOfType<RTCTransportStats>();
if (transport_stats.size() == 0u ||
- !transport_stats[0]->selected_candidate_pair_id.is_defined()) {
+ !transport_stats[0]->selected_candidate_pair_id.has_value()) {
return;
}
RTC_DCHECK_EQ(transport_stats.size(), 1);
@@ -71,7 +71,7 @@
auto outbound_rtp_stats = report->GetStatsOfType<RTCOutboundRtpStreamStats>();
StatsSample sample;
for (auto& s : outbound_rtp_stats) {
- if (!s->kind.is_defined()) {
+ if (!s->kind.has_value()) {
continue;
}
if (!(*s->kind == "video")) {
@@ -89,7 +89,7 @@
MutexLock lock(&video_bwe_stats_lock_);
VideoBweStats& video_bwe_stats = video_bwe_stats_[std::string(pc_label)];
- if (ice_candidate_pair_stats.available_outgoing_bitrate.is_defined()) {
+ if (ice_candidate_pair_stats.available_outgoing_bitrate.has_value()) {
video_bwe_stats.available_send_bandwidth.AddSample(
DataRate::BitsPerSec(
*ice_candidate_pair_stats.available_outgoing_bitrate)
diff --git a/test/pc/e2e/cross_media_metrics_reporter.cc b/test/pc/e2e/cross_media_metrics_reporter.cc
index ed87f3c..c153601 100644
--- a/test/pc/e2e/cross_media_metrics_reporter.cc
+++ b/test/pc/e2e/cross_media_metrics_reporter.cc
@@ -48,7 +48,7 @@
sync_group_stats;
for (const auto& stat : inbound_stats) {
if (stat->estimated_playout_timestamp.value_or(0.) > 0 &&
- stat->track_identifier.is_defined()) {
+ stat->track_identifier.has_value()) {
sync_group_stats[reporter_helper_
->GetStreamInfoFromTrackId(*stat->track_identifier)
.sync_group]
@@ -66,8 +66,8 @@
const RTCInboundRtpStreamStats* audio_stat = pair.second[0];
const RTCInboundRtpStreamStats* video_stat = pair.second[1];
- RTC_CHECK(pair.second.size() == 2 && audio_stat->kind.is_defined() &&
- video_stat->kind.is_defined() &&
+ RTC_CHECK(pair.second.size() == 2 && audio_stat->kind.has_value() &&
+ video_stat->kind.has_value() &&
*audio_stat->kind != *video_stat->kind)
<< "Sync group should consist of one audio and one video stream.";
@@ -77,8 +77,8 @@
// Stream labels of a sync group are same for all polls, so we need it add
// it only once.
if (stats_info_.find(sync_group) == stats_info_.end()) {
- RTC_CHECK(audio_stat->track_identifier.is_defined());
- RTC_CHECK(video_stat->track_identifier.is_defined());
+ RTC_CHECK(audio_stat->track_identifier.has_value());
+ RTC_CHECK(video_stat->track_identifier.has_value());
stats_info_[sync_group].audio_stream_info =
reporter_helper_->GetStreamInfoFromTrackId(
*audio_stat->track_identifier);