Replace rtc::Optional with absl::optional in pc

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

This CL generated by running script with parameter 'pc'

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: Ide3b9eb32df7f25991f898ac58fcb119c9f8ae12
Reviewed-on: https://webrtc-review.googlesource.com/84181
Reviewed-by: Per Kjellander <perkj@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23669}
This commit is contained in:
Danil Chapovalov 2018-06-19 16:47:43 +02:00 committed by Commit Bot
parent 751a817044
commit 66cadcc6b9
52 changed files with 196 additions and 191 deletions

View File

@ -68,7 +68,6 @@ rtc_static_library("rtc_pc_base") {
"../api:array_view",
"../api:call_api",
"../api:libjingle_peerconnection_api",
"../api:optional",
"../api:ortc_api",
"../api/video:video_frame",
"../call:rtp_interfaces",
@ -86,6 +85,7 @@ rtc_static_library("rtc_pc_base") {
"../rtc_base:rtc_task_queue",
"../rtc_base:stringutils",
"../system_wrappers:metrics_api",
"//third_party/abseil-cpp/absl/types:optional",
]
if (rtc_build_libsrtp) {
@ -193,7 +193,6 @@ rtc_static_library("peerconnection") {
"../api:call_api",
"../api:fec_controller_api",
"../api:libjingle_peerconnection_api",
"../api:optional",
"../api:rtc_stats_api",
"../api/video:video_frame",
"../api/video_codecs:video_codecs_api",
@ -215,6 +214,7 @@ rtc_static_library("peerconnection") {
"../stats",
"../system_wrappers",
"../system_wrappers:field_trial_api",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -506,7 +506,6 @@ if (rtc_include_tests) {
"../api:callfactory_api",
"../api:fakemetricsobserver",
"../api:libjingle_peerconnection_test_api",
"../api:optional",
"../api:rtc_stats_api",
"../api/audio_codecs:audio_codecs_api",
"../api/audio_codecs:builtin_audio_decoder_factory",
@ -538,6 +537,7 @@ if (rtc_include_tests) {
"../system_wrappers:runtime_enabled_features_default",
"../test:audio_codec_mocks",
"../test:test_support",
"//third_party/abseil-cpp/absl/types:optional",
]
if (is_android) {

View File

@ -363,7 +363,7 @@ void BaseChannel::OnWritableState(bool writable) {
}
void BaseChannel::OnNetworkRouteChanged(
rtc::Optional<rtc::NetworkRoute> network_route) {
absl::optional<rtc::NetworkRoute> network_route) {
RTC_DCHECK(network_thread_->IsCurrent());
rtc::NetworkRoute new_route;
if (network_route) {

View File

@ -218,7 +218,7 @@ class BaseChannel : public rtc::MessageHandler,
// From RtpTransportInternal
void OnWritableState(bool writable);
void OnNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute> network_route);
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route);
bool PacketIsRtcp(const rtc::PacketTransportInternal* transport,
const char* data,

View File

@ -863,7 +863,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
// The transport channel becomes disconnected.
fake_rtp_dtls_transport1_->ice_transport()->SignalNetworkRouteChanged(
rtc::Optional<rtc::NetworkRoute>(network_route));
absl::optional<rtc::NetworkRoute>(network_route));
});
WaitForThreads();
EXPECT_EQ(1, media_channel1->num_network_route_changes());
@ -880,7 +880,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
// The transport channel becomes connected.
fake_rtp_dtls_transport1_->ice_transport()->SignalNetworkRouteChanged(
rtc::Optional<rtc::NetworkRoute>(network_route));
absl::optional<rtc::NetworkRoute>(network_route));
});
WaitForThreads();
EXPECT_EQ(1, media_channel1->num_network_route_changes());
@ -1348,7 +1348,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
return channel1_->SetRemoteContent(&content, SdpType::kOffer, NULL);
}
webrtc::RtpParameters BitrateLimitedParameters(rtc::Optional<int> limit) {
webrtc::RtpParameters BitrateLimitedParameters(absl::optional<int> limit) {
webrtc::RtpParameters parameters;
webrtc::RtpEncodingParameters encoding;
encoding.max_bitrate_bps = std::move(limit);
@ -1357,7 +1357,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
}
void VerifyMaxBitrate(const webrtc::RtpParameters& parameters,
rtc::Optional<int> expected_bitrate) {
absl::optional<int> expected_bitrate) {
EXPECT_EQ(1UL, parameters.encodings.size());
EXPECT_EQ(expected_bitrate, parameters.encodings[0].max_bitrate_bps);
}
@ -1368,7 +1368,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
SdpType::kOffer, NULL));
EXPECT_EQ(media_channel1_->max_bps(), -1);
VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1),
rtc::nullopt);
absl::nullopt);
}
// Test that when a channel gets new RtpTransport with a call to

View File

@ -88,8 +88,8 @@ class DtlsSrtpTransport : public SrtpTransport {
cricket::DtlsTransportInternal* rtcp_dtls_transport_ = nullptr;
// The encrypted header extension IDs.
rtc::Optional<std::vector<int>> send_extension_ids_;
rtc::Optional<std::vector<int>> recv_extension_ids_;
absl::optional<std::vector<int>> send_extension_ids_;
absl::optional<std::vector<int>> recv_extension_ids_;
bool active_reset_srtp_params_ = false;
};

View File

@ -112,7 +112,7 @@ const char* SdpTypeToString(SdpType type) {
return "";
}
rtc::Optional<SdpType> SdpTypeFromString(const std::string& type_str) {
absl::optional<SdpType> SdpTypeFromString(const std::string& type_str) {
if (type_str == SessionDescriptionInterface::kOffer) {
return SdpType::kOffer;
} else if (type_str == SessionDescriptionInterface::kPrAnswer) {
@ -120,14 +120,14 @@ rtc::Optional<SdpType> SdpTypeFromString(const std::string& type_str) {
} else if (type_str == SessionDescriptionInterface::kAnswer) {
return SdpType::kAnswer;
} else {
return rtc::nullopt;
return absl::nullopt;
}
}
// TODO(steveanton): Remove this default implementation once Chromium has been
// updated.
SdpType SessionDescriptionInterface::GetType() const {
rtc::Optional<SdpType> maybe_type = SdpTypeFromString(type());
absl::optional<SdpType> maybe_type = SdpTypeFromString(type());
if (maybe_type) {
return *maybe_type;
} else {
@ -142,7 +142,7 @@ SdpType SessionDescriptionInterface::GetType() const {
SessionDescriptionInterface* CreateSessionDescription(const std::string& type,
const std::string& sdp,
SdpParseError* error) {
rtc::Optional<SdpType> maybe_type = SdpTypeFromString(type);
absl::optional<SdpType> maybe_type = SdpTypeFromString(type);
if (!maybe_type) {
return nullptr;
}
@ -170,7 +170,7 @@ std::unique_ptr<SessionDescriptionInterface> CreateSessionDescription(
JsepSessionDescription::JsepSessionDescription(SdpType type) : type_(type) {}
JsepSessionDescription::JsepSessionDescription(const std::string& type) {
rtc::Optional<SdpType> maybe_type = SdpTypeFromString(type);
absl::optional<SdpType> maybe_type = SdpTypeFromString(type);
if (maybe_type) {
type_ = *maybe_type;
} else {

View File

@ -284,14 +284,14 @@ void JsepTransport::SetNeedsIceRestartFlag() {
}
}
rtc::Optional<rtc::SSLRole> JsepTransport::GetDtlsRole() const {
absl::optional<rtc::SSLRole> JsepTransport::GetDtlsRole() const {
RTC_DCHECK(rtp_dtls_transport_);
rtc::SSLRole dtls_role;
if (!rtp_dtls_transport_->GetDtlsRole(&dtls_role)) {
return rtc::Optional<rtc::SSLRole>();
return absl::optional<rtc::SSLRole>();
}
return rtc::Optional<rtc::SSLRole>(dtls_role);
return absl::optional<rtc::SSLRole>(dtls_role);
}
bool JsepTransport::GetStats(TransportStats* stats) {
@ -357,7 +357,7 @@ void JsepTransport::SetRemoteIceParameters(
webrtc::RTCError JsepTransport::SetNegotiatedDtlsParameters(
DtlsTransportInternal* dtls_transport,
rtc::Optional<rtc::SSLRole> dtls_role,
absl::optional<rtc::SSLRole> dtls_role,
rtc::SSLFingerprint* remote_fingerprint) {
RTC_DCHECK(dtls_transport);
// Set SSL role. Role must be set before fingerprint is applied, which
@ -483,7 +483,7 @@ webrtc::RTCError JsepTransport::NegotiateAndSetDtlsParameters(
"without applying any offer.");
}
std::unique_ptr<rtc::SSLFingerprint> remote_fingerprint;
rtc::Optional<rtc::SSLRole> negotiated_dtls_role;
absl::optional<rtc::SSLRole> negotiated_dtls_role;
rtc::SSLFingerprint* local_fp =
local_description_->transport_desc.identity_fingerprint.get();
@ -531,7 +531,7 @@ webrtc::RTCError JsepTransport::NegotiateDtlsRole(
SdpType local_description_type,
ConnectionRole local_connection_role,
ConnectionRole remote_connection_role,
rtc::Optional<rtc::SSLRole>* negotiated_dtls_role) {
absl::optional<rtc::SSLRole>* negotiated_dtls_role) {
// From RFC 4145, section-4.1, The following are the values that the
// 'setup' attribute can take in an offer/answer exchange:
// Offer Answer

View File

@ -16,9 +16,9 @@
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/candidate.h"
#include "api/jsep.h"
#include "api/optional.h"
#include "p2p/base/dtlstransport.h"
#include "p2p/base/p2pconstants.h"
#include "p2p/base/transportinfo.h"
@ -125,9 +125,9 @@ class JsepTransport : public sigslot::has_slots<> {
// changed ufrag/password).
bool needs_ice_restart() const { return needs_ice_restart_; }
// Returns role if negotiated, or empty Optional if it hasn't been negotiated
// yet.
rtc::Optional<rtc::SSLRole> GetDtlsRole() const;
// Returns role if negotiated, or empty absl::optional if it hasn't been
// negotiated yet.
absl::optional<rtc::SSLRole> GetDtlsRole() const;
// TODO(deadbeef): Make this const. See comment in transportcontroller.h.
bool GetStats(TransportStats* stats);
@ -200,7 +200,7 @@ class JsepTransport : public sigslot::has_slots<> {
webrtc::SdpType local_description_type,
ConnectionRole local_connection_role,
ConnectionRole remote_connection_role,
rtc::Optional<rtc::SSLRole>* negotiated_dtls_role);
absl::optional<rtc::SSLRole>* negotiated_dtls_role);
// Pushes down the ICE parameters from the local description, such
// as the ICE ufrag and pwd.
@ -212,7 +212,7 @@ class JsepTransport : public sigslot::has_slots<> {
// Pushes down the DTLS parameters obtained via negotiation.
webrtc::RTCError SetNegotiatedDtlsParameters(
DtlsTransportInternal* dtls_transport,
rtc::Optional<rtc::SSLRole> dtls_role,
absl::optional<rtc::SSLRole> dtls_role,
rtc::SSLFingerprint* remote_fingerprint);
bool GetTransportStats(DtlsTransportInternal* dtls_transport,
@ -238,8 +238,8 @@ class JsepTransport : public sigslot::has_slots<> {
RtcpMuxFilter rtcp_mux_negotiator_;
// Cache the encrypted header extension IDs for SDES negoitation.
rtc::Optional<std::vector<int>> send_extension_ids_;
rtc::Optional<std::vector<int>> recv_extension_ids_;
absl::optional<std::vector<int>> send_extension_ids_;
absl::optional<std::vector<int>> recv_extension_ids_;
RTC_DISALLOW_COPY_AND_ASSIGN(JsepTransport);
};

View File

@ -759,7 +759,7 @@ TEST_F(JsepTransport2Test, RemoteOfferWithCurrentNegotiatedDtlsRole) {
.ok());
// Sanity check that role was actually negotiated.
rtc::Optional<rtc::SSLRole> role = jsep_transport_->GetDtlsRole();
absl::optional<rtc::SSLRole> role = jsep_transport_->GetDtlsRole();
ASSERT_TRUE(role);
EXPECT_EQ(rtc::SSL_CLIENT, *role);
@ -804,7 +804,7 @@ TEST_F(JsepTransport2Test, RemoteOfferThatChangesNegotiatedDtlsRole) {
.ok());
// Sanity check that role was actually negotiated.
rtc::Optional<rtc::SSLRole> role = jsep_transport_->GetDtlsRole();
absl::optional<rtc::SSLRole> role = jsep_transport_->GetDtlsRole();
ASSERT_TRUE(role);
EXPECT_EQ(rtc::SSL_CLIENT, *role);
@ -849,7 +849,7 @@ TEST_F(JsepTransport2Test, DtlsSetupWithLegacyAsAnswerer) {
->SetRemoteJsepTransportDescription(remote_desc, SdpType::kAnswer)
.ok());
rtc::Optional<rtc::SSLRole> role = jsep_transport_->GetDtlsRole();
absl::optional<rtc::SSLRole> role = jsep_transport_->GetDtlsRole();
ASSERT_TRUE(role);
// Since legacy answer ommitted setup atribute, and we offered actpass, we
// should act as passive (server).

View File

@ -192,16 +192,16 @@ bool JsepTransportController::NeedsIceRestart(
return transport->needs_ice_restart();
}
rtc::Optional<rtc::SSLRole> JsepTransportController::GetDtlsRole(
absl::optional<rtc::SSLRole> JsepTransportController::GetDtlsRole(
const std::string& mid) const {
if (!network_thread_->IsCurrent()) {
return network_thread_->Invoke<rtc::Optional<rtc::SSLRole>>(
return network_thread_->Invoke<absl::optional<rtc::SSLRole>>(
RTC_FROM_HERE, [&] { return GetDtlsRole(mid); });
}
const cricket::JsepTransport* t = GetJsepTransportForMid(mid);
if (!t) {
return rtc::Optional<rtc::SSLRole>();
return absl::optional<rtc::SSLRole>();
}
return t->GetDtlsRole();
}

View File

@ -146,7 +146,7 @@ class JsepTransportController : public sigslot::has_slots<>,
std::unique_ptr<rtc::SSLCertChain> GetRemoteSSLCertChain(
const std::string& mid) const;
// Get negotiated role, if one has been negotiated.
rtc::Optional<rtc::SSLRole> GetDtlsRole(const std::string& mid) const;
absl::optional<rtc::SSLRole> GetDtlsRole(const std::string& mid) const;
// TODO(deadbeef): GetStats isn't const because all the way down to
// OpenSSLStreamAdapter, GetSslCipherSuite and GetDtlsSrtpCryptoSuite are not
@ -206,8 +206,8 @@ class JsepTransportController : public sigslot::has_slots<>,
const std::vector<int>& encrypted_extension_ids,
int rtp_abs_sendtime_extn_id);
rtc::Optional<std::string> bundled_mid() const {
rtc::Optional<std::string> bundled_mid;
absl::optional<std::string> bundled_mid() const {
absl::optional<std::string> bundled_mid;
if (bundle_group_ && bundle_group_->FirstContentName()) {
bundled_mid = *(bundle_group_->FirstContentName());
}
@ -312,9 +312,9 @@ class JsepTransportController : public sigslot::has_slots<>,
Config config_;
const cricket::SessionDescription* local_desc_ = nullptr;
const cricket::SessionDescription* remote_desc_ = nullptr;
rtc::Optional<bool> initial_offerer_;
absl::optional<bool> initial_offerer_;
rtc::Optional<cricket::ContentGroup> bundle_group_;
absl::optional<cricket::ContentGroup> bundle_group_;
cricket::IceConfig ice_config_;
cricket::IceRole ice_role_ = cricket::ICEROLE_CONTROLLING;

View File

@ -524,7 +524,7 @@ TEST_F(JsepTransportControllerTest, GetDtlsRole) {
->SetLocalDescription(SdpType::kOffer, offer_desc.get())
.ok());
rtc::Optional<rtc::SSLRole> role =
absl::optional<rtc::SSLRole> role =
transport_controller_->GetDtlsRole(kAudioMid1);
// The DTLS role is not decided yet.
EXPECT_FALSE(role);

View File

@ -33,5 +33,5 @@ TEST(LocalAudioSourceTest, InitWithAudioOptions) {
TEST(LocalAudioSourceTest, InitWithNoOptions) {
rtc::scoped_refptr<LocalAudioSource> source =
LocalAudioSource::Create(nullptr);
EXPECT_EQ(rtc::nullopt, source->options().highpass_filter);
EXPECT_EQ(absl::nullopt, source->options().highpass_filter);
}

View File

@ -18,8 +18,8 @@
#include <unordered_map>
#include <utility>
#include "absl/types/optional.h"
#include "api/cryptoparams.h"
#include "api/optional.h"
#include "common_types.h" // NOLINT(build/include)
#include "media/base/h264_profile_level_id.h"
#include "media/base/mediaconstants.h"

View File

@ -609,11 +609,11 @@ std::string GetStreamIdsString(rtc::ArrayView<const std::string> stream_ids) {
return output;
}
rtc::Optional<int> RTCConfigurationToIceConfigOptionalInt(
absl::optional<int> RTCConfigurationToIceConfigOptionalInt(
int rtc_configuration_parameter) {
if (rtc_configuration_parameter ==
webrtc::PeerConnectionInterface::RTCConfiguration::kUndefined) {
return rtc::nullopt;
return absl::nullopt;
}
return rtc_configuration_parameter;
}
@ -665,9 +665,9 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
int max_ipv6_networks;
bool disable_link_local_networks;
bool enable_rtp_data_channel;
rtc::Optional<int> screencast_min_bitrate;
rtc::Optional<bool> combined_audio_video_bwe;
rtc::Optional<bool> enable_dtls_srtp;
absl::optional<int> screencast_min_bitrate;
absl::optional<bool> combined_audio_video_bwe;
absl::optional<bool> enable_dtls_srtp;
TcpCandidatePolicy tcp_candidate_policy;
CandidateNetworkPolicy candidate_network_policy;
int audio_jitter_buffer_max_packets;
@ -681,16 +681,16 @@ bool PeerConnectionInterface::RTCConfiguration::operator==(
bool presume_writable_when_fully_relayed;
bool enable_ice_renomination;
bool redetermine_role_on_ice_restart;
rtc::Optional<int> ice_check_interval_strong_connectivity;
rtc::Optional<int> ice_check_interval_weak_connectivity;
rtc::Optional<int> ice_check_min_interval;
rtc::Optional<int> ice_unwritable_timeout;
rtc::Optional<int> ice_unwritable_min_checks;
rtc::Optional<int> stun_candidate_keepalive_interval;
rtc::Optional<rtc::IntervalRange> ice_regather_interval_range;
absl::optional<int> ice_check_interval_strong_connectivity;
absl::optional<int> ice_check_interval_weak_connectivity;
absl::optional<int> ice_check_min_interval;
absl::optional<int> ice_unwritable_timeout;
absl::optional<int> ice_unwritable_min_checks;
absl::optional<int> stun_candidate_keepalive_interval;
absl::optional<rtc::IntervalRange> ice_regather_interval_range;
webrtc::TurnCustomizer* turn_customizer;
SdpSemantics sdp_semantics;
rtc::Optional<rtc::AdapterType> network_preference;
absl::optional<rtc::AdapterType> network_preference;
bool active_reset_srtp_params;
};
static_assert(sizeof(stuff_being_tested_for_equality) == sizeof(*this),
@ -2714,8 +2714,8 @@ PeerConnection::AssociateTransceiver(cricket::ContentSource source,
if (old_transceiver) {
RTC_LOG(LS_INFO) << "Dissociating transceiver for MID=" << old_mid
<< " since the media section is being recycled.";
old_transceiver->internal()->set_mid(rtc::nullopt);
old_transceiver->internal()->set_mline_index(rtc::nullopt);
old_transceiver->internal()->set_mid(absl::nullopt);
old_transceiver->internal()->set_mline_index(absl::nullopt);
}
}
const MediaContentDescription* media_desc = content.media_description();
@ -3674,9 +3674,9 @@ void PeerConnection::GetOptionsForPlanBOffer(
(offer_answer_options.offer_to_receive_video > 0);
}
rtc::Optional<size_t> audio_index;
rtc::Optional<size_t> video_index;
rtc::Optional<size_t> data_index;
absl::optional<size_t> audio_index;
absl::optional<size_t> video_index;
absl::optional<size_t> data_index;
// If a current description exists, generate m= sections in the same order,
// using the first audio/video/data section that appears and rejecting
// extraneous ones.
@ -3922,9 +3922,9 @@ void PeerConnection::GetOptionsForPlanBAnswer(
recv_video = (offer_answer_options.offer_to_receive_video > 0);
}
rtc::Optional<size_t> audio_index;
rtc::Optional<size_t> video_index;
rtc::Optional<size_t> data_index;
absl::optional<size_t> audio_index;
absl::optional<size_t> video_index;
absl::optional<size_t> data_index;
// Generate m= sections that match those in the offer.
// Note that mediasession.cc will handle intersection our preferred
@ -3983,9 +3983,9 @@ void PeerConnection::GenerateMediaDescriptionOptions(
const SessionDescriptionInterface* session_desc,
RtpTransceiverDirection audio_direction,
RtpTransceiverDirection video_direction,
rtc::Optional<size_t>* audio_index,
rtc::Optional<size_t>* video_index,
rtc::Optional<size_t>* data_index,
absl::optional<size_t>* audio_index,
absl::optional<size_t>* video_index,
absl::optional<size_t>* data_index,
cricket::MediaSessionOptions* session_options) {
for (const cricket::ContentInfo& content :
session_desc->description()->contents()) {
@ -4054,17 +4054,17 @@ PeerConnection::GetMediaDescriptionOptionsForRejectedData(
return options;
}
rtc::Optional<std::string> PeerConnection::GetDataMid() const {
absl::optional<std::string> PeerConnection::GetDataMid() const {
switch (data_channel_type_) {
case cricket::DCT_RTP:
if (!rtp_data_channel_) {
return rtc::nullopt;
return absl::nullopt;
}
return rtp_data_channel_->content_name();
case cricket::DCT_SCTP:
return sctp_mid_;
default:
return rtc::nullopt;
return absl::nullopt;
}
}
@ -4727,7 +4727,7 @@ bool PeerConnection::ReconfigurePortAllocator_n(
int candidate_pool_size,
bool prune_turn_ports,
webrtc::TurnCustomizer* turn_customizer,
rtc::Optional<int> stun_candidate_keepalive_interval) {
absl::optional<int> stun_candidate_keepalive_interval) {
port_allocator_->set_candidate_filter(
ConvertIceTransportTypeToCandidateFilter(type));
// According to JSEP, after setLocalDescription, changing the candidate pool
@ -5123,15 +5123,15 @@ bool PeerConnection::ReadyToSendData() const {
sctp_ready_to_send_data_;
}
rtc::Optional<std::string> PeerConnection::sctp_transport_name() const {
absl::optional<std::string> PeerConnection::sctp_transport_name() const {
if (sctp_mid_ && transport_controller_) {
auto dtls_transport = transport_controller_->GetDtlsTransport(*sctp_mid_);
if (dtls_transport) {
return dtls_transport->transport_name();
}
return rtc::Optional<std::string>();
return absl::optional<std::string>();
}
return rtc::Optional<std::string>();
return absl::optional<std::string>();
}
cricket::CandidateStatsList PeerConnection::GetPooledCandidateStats() const {
@ -5158,7 +5158,7 @@ std::map<std::string, std::string> PeerConnection::GetTransportNamesByMid()
rtp_data_channel_->transport_name();
}
if (sctp_transport_) {
rtc::Optional<std::string> transport_name = sctp_transport_name();
absl::optional<std::string> transport_name = sctp_transport_name();
RTC_DCHECK(transport_name);
transport_names_by_mid[*sctp_mid_] = *transport_name;
}
@ -6036,7 +6036,7 @@ void PeerConnection::ReportTransportStats() {
cricket::MEDIA_TYPE_DATA);
}
rtc::Optional<std::string> transport_name = sctp_transport_name();
absl::optional<std::string> transport_name = sctp_transport_name();
if (transport_name) {
media_types_by_transport_name[*transport_name].insert(
cricket::MEDIA_TYPE_DATA);

View File

@ -247,11 +247,11 @@ class PeerConnection : public PeerConnectionInternal,
return sctp_data_channels_;
}
rtc::Optional<std::string> sctp_content_name() const override {
absl::optional<std::string> sctp_content_name() const override {
return sctp_mid_;
}
rtc::Optional<std::string> sctp_transport_name() const override;
absl::optional<std::string> sctp_transport_name() const override;
cricket::CandidateStatsList GetPooledCandidateStats() const override;
std::map<std::string, std::string> GetTransportNamesByMid() const override;
@ -516,9 +516,9 @@ class PeerConnection : public PeerConnectionInternal,
const SessionDescriptionInterface* session_desc,
RtpTransceiverDirection audio_direction,
RtpTransceiverDirection video_direction,
rtc::Optional<size_t>* audio_index,
rtc::Optional<size_t>* video_index,
rtc::Optional<size_t>* data_index,
absl::optional<size_t>* audio_index,
absl::optional<size_t>* video_index,
absl::optional<size_t>* data_index,
cricket::MediaSessionOptions* session_options);
// Generates the active MediaDescriptionOptions for the local data channel
@ -534,7 +534,7 @@ class PeerConnection : public PeerConnectionInternal,
// Returns the MID for the data section associated with either the
// RtpDataChannel or SCTP data channel, if it has been set. If no data
// channels are configured this will return nullopt.
rtc::Optional<std::string> GetDataMid() const;
absl::optional<std::string> GetDataMid() const;
// Remove all local and remote senders of type |media_type|.
// Called when a media type is rejected (m-line set to port 0).
@ -665,7 +665,7 @@ class PeerConnection : public PeerConnectionInternal,
int candidate_pool_size,
bool prune_turn_ports,
webrtc::TurnCustomizer* turn_customizer,
rtc::Optional<int> stun_candidate_keepalive_interval);
absl::optional<int> stun_candidate_keepalive_interval);
void SetMetricObserver_n(UMAObserver* observer);
@ -976,7 +976,7 @@ class PeerConnection : public PeerConnectionInternal,
std::unique_ptr<cricket::SctpTransportInternal> sctp_transport_;
// |sctp_mid_| is the content name (MID) in SDP.
rtc::Optional<std::string> sctp_mid_;
absl::optional<std::string> sctp_mid_;
// Value cached on signaling thread. Only updated when SctpReadyToSendData
// fires on the signaling thread.
bool sctp_ready_to_send_data_ = false;

View File

@ -66,11 +66,11 @@ class PeerConnectionWrapperForDataChannelTest : public PeerConnectionWrapper {
sctp_transport_factory_ = sctp_transport_factory;
}
rtc::Optional<std::string> sctp_content_name() {
absl::optional<std::string> sctp_content_name() {
return GetInternalPeerConnection()->sctp_content_name();
}
rtc::Optional<std::string> sctp_transport_name() {
absl::optional<std::string> sctp_transport_name() {
return GetInternalPeerConnection()->sctp_transport_name();
}

View File

@ -981,7 +981,7 @@ TEST_F(PeerConnectionIceConfigTest, SetStunCandidateKeepaliveInterval) {
config.ice_candidate_pool_size = 1;
CreatePeerConnection(config);
ASSERT_NE(port_allocator_, nullptr);
rtc::Optional<int> actual_stun_keepalive_interval =
absl::optional<int> actual_stun_keepalive_interval =
port_allocator_->stun_candidate_keepalive_interval();
EXPECT_EQ(actual_stun_keepalive_interval.value_or(-1), 123);
config.stun_candidate_keepalive_interval = 321;

View File

@ -304,7 +304,7 @@ TEST_F(PeerConnectionJsepTest,
auto transceivers = callee->pc()->GetTransceivers();
ASSERT_EQ(2u, transceivers.size());
EXPECT_EQ(rtc::nullopt, transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, transceivers[0]->mid());
EXPECT_EQ(caller_audio->mid(), transceivers[1]->mid());
}
@ -322,7 +322,7 @@ TEST_F(PeerConnectionJsepTest,
auto transceivers = callee->pc()->GetTransceivers();
ASSERT_EQ(2u, transceivers.size());
EXPECT_EQ(rtc::nullopt, transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, transceivers[0]->mid());
EXPECT_EQ(caller->pc()->GetTransceivers()[0]->mid(), transceivers[1]->mid());
EXPECT_EQ(MediaStreamTrackInterface::kAudioKind,
transceivers[1]->receiver()->track()->kind());
@ -341,7 +341,7 @@ TEST_F(PeerConnectionJsepTest,
auto transceivers = callee->pc()->GetTransceivers();
ASSERT_EQ(2u, transceivers.size());
EXPECT_EQ(rtc::nullopt, transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, transceivers[0]->mid());
EXPECT_EQ(caller->pc()->GetTransceivers()[0]->mid(), transceivers[1]->mid());
EXPECT_EQ(MediaStreamTrackInterface::kAudioKind,
transceivers[1]->receiver()->track()->kind());
@ -360,7 +360,7 @@ TEST_F(PeerConnectionJsepTest, SetRemoteOfferDoesNotReuseStoppedTransceiver) {
auto transceivers = callee->pc()->GetTransceivers();
ASSERT_EQ(2u, transceivers.size());
EXPECT_EQ(rtc::nullopt, transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, transceivers[0]->mid());
EXPECT_TRUE(transceivers[0]->stopped());
EXPECT_EQ(caller->pc()->GetTransceivers()[0]->mid(), transceivers[1]->mid());
EXPECT_FALSE(transceivers[1]->stopped());
@ -606,7 +606,7 @@ TEST_F(PeerConnectionJsepTest,
caller->SetRemoteDescription(callee->CreateAnswerAndSetAsLocal()));
EXPECT_TRUE(first_transceiver->stopped());
// First transceivers aren't dissociated yet.
ASSERT_NE(rtc::nullopt, first_transceiver->mid());
ASSERT_NE(absl::nullopt, first_transceiver->mid());
std::string first_mid = *first_transceiver->mid();
EXPECT_EQ(first_mid, callee->pc()->GetTransceivers()[0]->mid());
@ -625,10 +625,10 @@ TEST_F(PeerConnectionJsepTest,
// associate the new transceivers.
ASSERT_TRUE(
caller->SetLocalDescription(CloneSessionDescription(offer.get())));
EXPECT_EQ(rtc::nullopt, first_transceiver->mid());
EXPECT_EQ(absl::nullopt, first_transceiver->mid());
EXPECT_EQ(second_mid, caller->pc()->GetTransceivers()[1]->mid());
ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer)));
EXPECT_EQ(rtc::nullopt, callee->pc()->GetTransceivers()[0]->mid());
EXPECT_EQ(absl::nullopt, callee->pc()->GetTransceivers()[0]->mid());
EXPECT_EQ(second_mid, callee->pc()->GetTransceivers()[1]->mid());
// The new answer should also recycle the m section correctly.
@ -644,11 +644,11 @@ TEST_F(PeerConnectionJsepTest,
ASSERT_TRUE(caller->SetRemoteDescription(std::move(answer)));
auto caller_transceivers = caller->pc()->GetTransceivers();
ASSERT_EQ(2u, caller_transceivers.size());
EXPECT_EQ(rtc::nullopt, caller_transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, caller_transceivers[0]->mid());
EXPECT_EQ(second_mid, caller_transceivers[1]->mid());
auto callee_transceivers = callee->pc()->GetTransceivers();
ASSERT_EQ(2u, callee_transceivers.size());
EXPECT_EQ(rtc::nullopt, callee_transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, callee_transceivers[0]->mid());
EXPECT_EQ(second_mid, callee_transceivers[1]->mid());
}
@ -687,7 +687,7 @@ TEST_F(PeerConnectionJsepTest, CreateOfferRecyclesWhenOfferingTwice) {
// Make sure that the caller's transceivers are associated correctly.
auto caller_transceivers = caller->pc()->GetTransceivers();
ASSERT_EQ(2u, caller_transceivers.size());
EXPECT_EQ(rtc::nullopt, caller_transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, caller_transceivers[0]->mid());
EXPECT_EQ(second_mid, caller_transceivers[1]->mid());
EXPECT_FALSE(caller_transceivers[1]->stopped());
}
@ -737,7 +737,7 @@ TEST_P(RecycleMediaSectionTest, VerifyOfferAnswerAndTransceivers) {
// the MID for the new transceiver.
ASSERT_TRUE(
caller->SetLocalDescription(CloneSessionDescription(offer.get())));
EXPECT_EQ(rtc::nullopt, first_transceiver->mid());
EXPECT_EQ(absl::nullopt, first_transceiver->mid());
EXPECT_EQ(second_mid, second_transceiver->mid());
// Setting the remote offer will dissociate the previous transceiver and
@ -745,7 +745,7 @@ TEST_P(RecycleMediaSectionTest, VerifyOfferAnswerAndTransceivers) {
ASSERT_TRUE(callee->SetRemoteDescription(std::move(offer)));
auto callee_transceivers = callee->pc()->GetTransceivers();
ASSERT_EQ(2u, callee_transceivers.size());
EXPECT_EQ(rtc::nullopt, callee_transceivers[0]->mid());
EXPECT_EQ(absl::nullopt, callee_transceivers[0]->mid());
EXPECT_EQ(first_type_, callee_transceivers[0]->media_type());
EXPECT_EQ(second_mid, callee_transceivers[1]->mid());
EXPECT_EQ(second_type_, callee_transceivers[1]->media_type());

View File

@ -791,10 +791,10 @@ TEST_F(PeerConnectionRtpTestUnifiedPlan,
auto caller = CreatePeerConnection();
auto transceiver = caller->AddTransceiver(cricket::MEDIA_TYPE_AUDIO);
EXPECT_EQ(rtc::nullopt, transceiver->mid());
EXPECT_EQ(absl::nullopt, transceiver->mid());
EXPECT_FALSE(transceiver->stopped());
EXPECT_EQ(RtpTransceiverDirection::kSendRecv, transceiver->direction());
EXPECT_EQ(rtc::nullopt, transceiver->current_direction());
EXPECT_EQ(absl::nullopt, transceiver->current_direction());
}
// Test that adding a transceiver with the audio kind creates an audio sender

View File

@ -270,7 +270,7 @@ CreateForwardingMockDecoderFactory(
.WillRepeatedly(
Invoke([real_decoder_factory](
const webrtc::SdpAudioFormat& format,
rtc::Optional<webrtc::AudioCodecPairId> codec_pair_id,
absl::optional<webrtc::AudioCodecPairId> codec_pair_id,
std::unique_ptr<webrtc::AudioDecoder>* return_value) {
auto real_decoder =
real_decoder_factory->MakeAudioDecoder(format, codec_pair_id);
@ -284,7 +284,7 @@ CreateForwardingMockDecoderFactory(
struct AudioEncoderUnicornSparklesRainbow {
using Config = webrtc::AudioEncoderL16::Config;
static rtc::Optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
static absl::optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
if (STR_CASE_CMP(format.name.c_str(), "UnicornSparklesRainbow") == 0) {
const webrtc::SdpAudioFormat::Parameters expected_params = {
{"num_horns", "1"}};
@ -293,7 +293,7 @@ struct AudioEncoderUnicornSparklesRainbow {
format.name = "L16";
return webrtc::AudioEncoderL16::SdpToConfig(format);
} else {
return rtc::nullopt;
return absl::nullopt;
}
}
static void AppendSupportedEncoders(
@ -313,7 +313,7 @@ struct AudioEncoderUnicornSparklesRainbow {
static std::unique_ptr<webrtc::AudioEncoder> MakeAudioEncoder(
const Config& config,
int payload_type,
rtc::Optional<webrtc::AudioCodecPairId> codec_pair_id = rtc::nullopt) {
absl::optional<webrtc::AudioCodecPairId> codec_pair_id = absl::nullopt) {
return webrtc::AudioEncoderL16::MakeAudioEncoder(config, payload_type,
codec_pair_id);
}
@ -321,7 +321,7 @@ struct AudioEncoderUnicornSparklesRainbow {
struct AudioDecoderUnicornSparklesRainbow {
using Config = webrtc::AudioDecoderL16::Config;
static rtc::Optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
static absl::optional<Config> SdpToConfig(webrtc::SdpAudioFormat format) {
if (STR_CASE_CMP(format.name.c_str(), "UnicornSparklesRainbow") == 0) {
const webrtc::SdpAudioFormat::Parameters expected_params = {
{"num_horns", "1"}};
@ -330,7 +330,7 @@ struct AudioDecoderUnicornSparklesRainbow {
format.name = "L16";
return webrtc::AudioDecoderL16::SdpToConfig(format);
} else {
return rtc::nullopt;
return absl::nullopt;
}
}
static void AppendSupportedDecoders(
@ -346,7 +346,7 @@ struct AudioDecoderUnicornSparklesRainbow {
}
static std::unique_ptr<webrtc::AudioDecoder> MakeAudioDecoder(
const Config& config,
rtc::Optional<webrtc::AudioCodecPairId> codec_pair_id = rtc::nullopt) {
absl::optional<webrtc::AudioCodecPairId> codec_pair_id = absl::nullopt) {
return webrtc::AudioDecoderL16::MakeAudioDecoder(config, codec_pair_id);
}
};
@ -392,14 +392,14 @@ TEST_P(PeerConnectionEndToEndTest, CallWithCustomCodec) {
std::vector<webrtc::AudioCodecSpec> GetSupportedEncoders() override {
return fact_->GetSupportedEncoders();
}
rtc::Optional<webrtc::AudioCodecInfo> QueryAudioEncoder(
absl::optional<webrtc::AudioCodecInfo> QueryAudioEncoder(
const webrtc::SdpAudioFormat& format) override {
return fact_->QueryAudioEncoder(format);
}
std::unique_ptr<webrtc::AudioEncoder> MakeAudioEncoder(
int payload_type,
const webrtc::SdpAudioFormat& format,
rtc::Optional<webrtc::AudioCodecPairId> codec_pair_id) override {
absl::optional<webrtc::AudioCodecPairId> codec_pair_id) override {
EXPECT_TRUE(codec_pair_id.has_value());
codec_ids_->push_back(*codec_pair_id);
return fact_->MakeAudioEncoder(payload_type, format, codec_pair_id);
@ -424,7 +424,7 @@ TEST_P(PeerConnectionEndToEndTest, CallWithCustomCodec) {
}
std::unique_ptr<webrtc::AudioDecoder> MakeAudioDecoder(
const webrtc::SdpAudioFormat& format,
rtc::Optional<webrtc::AudioCodecPairId> codec_pair_id) override {
absl::optional<webrtc::AudioCodecPairId> codec_pair_id) override {
EXPECT_TRUE(codec_pair_id.has_value());
codec_ids_->push_back(*codec_pair_id);
return fact_->MakeAudioDecoder(format, codec_pair_id);

View File

@ -2487,7 +2487,7 @@ TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesPruneTurnPortsFlag) {
// require a very complex set of mocks.
TEST_P(PeerConnectionInterfaceTest, SetConfigurationChangesIceCheckInterval) {
PeerConnectionInterface::RTCConfiguration config;
config.ice_check_min_interval = rtc::nullopt;
config.ice_check_min_interval = absl::nullopt;
CreatePeerConnection(config, nullptr);
config = pc_->GetConfiguration();
config.ice_check_min_interval = 100;

View File

@ -53,8 +53,8 @@ class PeerConnectionInternal : public PeerConnectionInterface {
virtual std::vector<rtc::scoped_refptr<DataChannel>> sctp_data_channels()
const = 0;
virtual rtc::Optional<std::string> sctp_content_name() const = 0;
virtual rtc::Optional<std::string> sctp_transport_name() const = 0;
virtual absl::optional<std::string> sctp_content_name() const = 0;
virtual absl::optional<std::string> sctp_transport_name() const = 0;
virtual cricket::CandidateStatsList GetPooledCandidateStats() const = 0;

View File

@ -17,7 +17,7 @@
#include <string>
#include <vector>
#include "api/optional.h"
#include "absl/types/optional.h"
#include "api/stats/rtcstats_objects.h"
#include "api/stats/rtcstatscollectorcallback.h"
#include "api/stats/rtcstatsreport.h"
@ -145,8 +145,8 @@ class RTCStatsCollector : public virtual rtc::RefCountInterface,
struct RtpTransceiverStatsInfo {
rtc::scoped_refptr<RtpTransceiver> transceiver;
cricket::MediaType media_type;
rtc::Optional<std::string> mid;
rtc::Optional<std::string> transport_name;
absl::optional<std::string> mid;
absl::optional<std::string> transport_name;
std::unique_ptr<TrackMediaInfoMap> track_media_info_map;
};

View File

@ -1096,7 +1096,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCIceCandidatePairStats) {
connection_info.sent_total_bytes = 42;
connection_info.recv_total_bytes = 1234;
connection_info.total_round_trip_time_ms = 0;
connection_info.current_round_trip_time_ms = rtc::nullopt;
connection_info.current_round_trip_time_ms = absl::nullopt;
connection_info.recv_ping_requests = 2020;
connection_info.sent_ping_requests_total = 2020;
connection_info.sent_ping_requests_before_first_response = 2000;
@ -1638,7 +1638,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCInboundRTPStreamStats_Video) {
video_media_info.receivers[0].plis_sent = 6;
video_media_info.receivers[0].nacks_sent = 7;
video_media_info.receivers[0].frames_decoded = 8;
video_media_info.receivers[0].qp_sum = rtc::nullopt;
video_media_info.receivers[0].qp_sum = absl::nullopt;
RtpCodecParameters codec_parameters;
codec_parameters.payload_type = 42;
@ -1757,7 +1757,7 @@ TEST_F(RTCStatsCollectorTest, CollectRTCOutboundRTPStreamStats_Video) {
video_media_info.senders[0].bytes_sent = 6;
video_media_info.senders[0].codec_payload_type = 42;
video_media_info.senders[0].frames_encoded = 8;
video_media_info.senders[0].qp_sum = rtc::nullopt;
video_media_info.senders[0].qp_sum = absl::nullopt;
RtpCodecParameters codec_parameters;
codec_parameters.payload_type = 42;

View File

@ -137,7 +137,7 @@ class AudioRtpReceiver : public ObserverInterface,
const rtc::scoped_refptr<RemoteAudioSource> source_;
const rtc::scoped_refptr<AudioTrackInterface> track_;
cricket::VoiceMediaChannel* media_channel_ = nullptr;
rtc::Optional<uint32_t> ssrc_;
absl::optional<uint32_t> ssrc_;
std::vector<rtc::scoped_refptr<MediaStreamInterface>> streams_;
bool cached_track_enabled_;
double cached_volume_ = 1;
@ -223,7 +223,7 @@ class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInternal> {
rtc::Thread* const worker_thread_;
const std::string id_;
cricket::VideoMediaChannel* media_channel_ = nullptr;
rtc::Optional<uint32_t> ssrc_;
absl::optional<uint32_t> ssrc_;
// |source_| is held here to be able to change the state of the source when
// the VideoRtpReceiver is stopped.
rtc::scoped_refptr<VideoRtpTrackSource> source_;

View File

@ -171,7 +171,7 @@ class AudioRtpSender : public DtmfProviderInterface,
StatsCollector* stats_;
rtc::scoped_refptr<AudioTrackInterface> track_;
rtc::scoped_refptr<DtmfSenderInterface> dtmf_sender_proxy_;
rtc::Optional<std::string> last_transaction_id_;
absl::optional<std::string> last_transaction_id_;
uint32_t ssrc_ = 0;
bool cached_track_enabled_ = false;
bool stopped_ = false;
@ -253,7 +253,7 @@ class VideoRtpSender : public ObserverInterface,
std::vector<std::string> stream_ids_;
cricket::VideoMediaChannel* media_channel_ = nullptr;
rtc::scoped_refptr<VideoTrackInterface> track_;
rtc::Optional<std::string> last_transaction_id_;
absl::optional<std::string> last_transaction_id_;
uint32_t ssrc_ = 0;
VideoTrackInterface::ContentHint cached_track_content_hint_ =
VideoTrackInterface::ContentHint::kNone;

View File

@ -1101,7 +1101,7 @@ TEST_F(RtpSenderReceiverTest,
video_track_->set_enabled(true);
// Sender is not ready to send (no SSRC) so no option should have been set.
EXPECT_EQ(rtc::nullopt, video_media_channel_->options().is_screencast);
EXPECT_EQ(absl::nullopt, video_media_channel_->options().is_screencast);
// Verify that the content hint is accounted for when video_rtp_sender_ does
// get enabled.

View File

@ -148,7 +148,7 @@ cricket::MediaType RtpTransceiver::media_type() const {
return media_type_;
}
rtc::Optional<std::string> RtpTransceiver::mid() const {
absl::optional<std::string> RtpTransceiver::mid() const {
return mid_;
}
@ -203,7 +203,7 @@ void RtpTransceiver::SetDirection(RtpTransceiverDirection new_direction) {
SignalNegotiationNeeded();
}
rtc::Optional<RtpTransceiverDirection> RtpTransceiver::current_direction()
absl::optional<RtpTransceiverDirection> RtpTransceiver::current_direction()
const {
return current_direction_;
}
@ -216,7 +216,7 @@ void RtpTransceiver::Stop() {
receiver->internal()->Stop();
}
stopped_ = true;
current_direction_ = rtc::nullopt;
current_direction_ = absl::nullopt;
}
void RtpTransceiver::SetCodecPreferences(

View File

@ -119,15 +119,15 @@ class RtpTransceiver final
// when setting a local offer we need a way to remember which transceiver was
// used to create which media section in the offer. Storing the mline index
// in CreateOffer is specified in JSEP to allow us to do that.
rtc::Optional<size_t> mline_index() const { return mline_index_; }
void set_mline_index(rtc::Optional<size_t> mline_index) {
absl::optional<size_t> mline_index() const { return mline_index_; }
void set_mline_index(absl::optional<size_t> mline_index) {
mline_index_ = mline_index;
}
// Sets the MID for this transceiver. If the MID is not null, then the
// transceiver is considered "associated" with the media section that has the
// same MID.
void set_mid(const rtc::Optional<std::string>& mid) { mid_ = mid; }
void set_mid(const absl::optional<std::string>& mid) { mid_ = mid; }
// Sets the intended direction for this transceiver. Intended to be used
// internally over SetDirection since this does not trigger a negotiation
@ -160,13 +160,13 @@ class RtpTransceiver final
// RtpTransceiverInterface implementation.
cricket::MediaType media_type() const override;
rtc::Optional<std::string> mid() const override;
absl::optional<std::string> mid() const override;
rtc::scoped_refptr<RtpSenderInterface> sender() const override;
rtc::scoped_refptr<RtpReceiverInterface> receiver() const override;
bool stopped() const override;
RtpTransceiverDirection direction() const override;
void SetDirection(RtpTransceiverDirection new_direction) override;
rtc::Optional<RtpTransceiverDirection> current_direction() const override;
absl::optional<RtpTransceiverDirection> current_direction() const override;
void Stop() override;
void SetCodecPreferences(rtc::ArrayView<RtpCodecCapability> codecs) override;
@ -183,9 +183,9 @@ class RtpTransceiver final
bool stopped_ = false;
RtpTransceiverDirection direction_ = RtpTransceiverDirection::kInactive;
rtc::Optional<RtpTransceiverDirection> current_direction_;
rtc::Optional<std::string> mid_;
rtc::Optional<size_t> mline_index_;
absl::optional<RtpTransceiverDirection> current_direction_;
absl::optional<std::string> mid_;
absl::optional<size_t> mline_index_;
bool created_by_addtrack_ = false;
bool has_ever_been_used_to_send_ = false;
@ -195,13 +195,13 @@ class RtpTransceiver final
BEGIN_SIGNALING_PROXY_MAP(RtpTransceiver)
PROXY_SIGNALING_THREAD_DESTRUCTOR()
PROXY_CONSTMETHOD0(cricket::MediaType, media_type);
PROXY_CONSTMETHOD0(rtc::Optional<std::string>, mid);
PROXY_CONSTMETHOD0(absl::optional<std::string>, mid);
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpSenderInterface>, sender);
PROXY_CONSTMETHOD0(rtc::scoped_refptr<RtpReceiverInterface>, receiver);
PROXY_CONSTMETHOD0(bool, stopped);
PROXY_CONSTMETHOD0(RtpTransceiverDirection, direction);
PROXY_METHOD1(void, SetDirection, RtpTransceiverDirection);
PROXY_CONSTMETHOD0(rtc::Optional<RtpTransceiverDirection>, current_direction);
PROXY_CONSTMETHOD0(absl::optional<RtpTransceiverDirection>, current_direction);
PROXY_METHOD0(void, Stop);
PROXY_METHOD1(void, SetCodecPreferences, rtc::ArrayView<RtpCodecCapability>);
END_PROXY_MAP();

View File

@ -39,7 +39,7 @@ void RtpTransport::SetRtpPacketTransport(
rtp_packet_transport_->SignalWritableState.disconnect(this);
rtp_packet_transport_->SignalSentPacket.disconnect(this);
// Reset the network route of the old transport.
SignalNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute>());
SignalNetworkRouteChanged(absl::optional<rtc::NetworkRoute>());
}
if (new_packet_transport) {
new_packet_transport->SignalReadyToSend.connect(
@ -75,7 +75,7 @@ void RtpTransport::SetRtcpPacketTransport(
rtcp_packet_transport_->SignalWritableState.disconnect(this);
rtcp_packet_transport_->SignalSentPacket.disconnect(this);
// Reset the network route of the old transport.
SignalNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute>());
SignalNetworkRouteChanged(absl::optional<rtc::NetworkRoute>());
}
if (new_packet_transport) {
new_packet_transport->SignalReadyToSend.connect(
@ -217,7 +217,7 @@ void RtpTransport::OnReadyToSend(rtc::PacketTransportInternal* transport) {
}
void RtpTransport::OnNetworkRouteChanged(
rtc::Optional<rtc::NetworkRoute> network_route) {
absl::optional<rtc::NetworkRoute> network_route) {
SignalNetworkRouteChanged(network_route);
}

View File

@ -100,7 +100,7 @@ class RtpTransport : public RtpTransportInternal {
// Overridden by SrtpTransport.
virtual void OnNetworkRouteChanged(
rtc::Optional<rtc::NetworkRoute> network_route);
absl::optional<rtc::NetworkRoute> network_route);
virtual void OnRtpPacketReceived(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketTime& packet_time);
virtual void OnRtcpPacketReceived(rtc::CopyOnWriteBuffer* packet,

View File

@ -78,8 +78,8 @@ class SignalObserver : public sigslot::has_slots<> {
bool ready() const { return ready_; }
void OnReadyToSend(bool ready) { ready_ = ready; }
rtc::Optional<rtc::NetworkRoute> network_route() { return network_route_; }
void OnNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute> network_route) {
absl::optional<rtc::NetworkRoute> network_route() { return network_route_; }
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route) {
network_route_ = std::move(network_route);
}
@ -102,7 +102,7 @@ class SignalObserver : public sigslot::has_slots<> {
int rtcp_transport_sent_count_ = 0;
RtpTransport* transport_ = nullptr;
bool ready_ = false;
rtc::Optional<rtc::NetworkRoute> network_route_;
absl::optional<rtc::NetworkRoute> network_route_;
};
TEST(RtpTransportTest, SettingRtcpAndRtpSignalsReady) {
@ -184,7 +184,7 @@ TEST(RtpTransportTest, SetRtpTransportWithNetworkRouteChanged) {
network_route.remote_network_id = kRemoteNetId;
network_route.last_sent_packet_id = kLastPacketId;
network_route.packet_overhead = kTransportOverheadPerPacket;
fake_rtp.SetNetworkRoute(rtc::Optional<rtc::NetworkRoute>(network_route));
fake_rtp.SetNetworkRoute(absl::optional<rtc::NetworkRoute>(network_route));
transport.SetRtpPacketTransport(&fake_rtp);
ASSERT_TRUE(observer.network_route());
EXPECT_EQ(network_route, *(observer.network_route()));
@ -211,7 +211,7 @@ TEST(RtpTransportTest, SetRtcpTransportWithNetworkRouteChanged) {
network_route.remote_network_id = kRemoteNetId;
network_route.last_sent_packet_id = kLastPacketId;
network_route.packet_overhead = kTransportOverheadPerPacket;
fake_rtcp.SetNetworkRoute(rtc::Optional<rtc::NetworkRoute>(network_route));
fake_rtcp.SetNetworkRoute(absl::optional<rtc::NetworkRoute>(network_route));
transport.SetRtcpPacketTransport(&fake_rtcp);
ASSERT_TRUE(observer.network_route());
EXPECT_EQ(network_route, *(observer.network_route()));

View File

@ -65,7 +65,7 @@ class RtpTransportInternal : public SrtpTransportInterface,
// Called whenever the network route of the P2P layer transport changes.
// The argument is an optional network route.
sigslot::signal1<rtc::Optional<rtc::NetworkRoute>> SignalNetworkRouteChanged;
sigslot::signal1<absl::optional<rtc::NetworkRoute>> SignalNetworkRouteChanged;
// Called whenever a transport's writable state might change. The argument is
// true if the transport is writable, otherwise it is false.

View File

@ -186,8 +186,8 @@ bool SrtpFilter::ResetParams() {
offer_params_.clear();
applied_send_params_ = CryptoParams();
applied_recv_params_ = CryptoParams();
send_cipher_suite_ = rtc::nullopt;
recv_cipher_suite_ = rtc::nullopt;
send_cipher_suite_ = absl::nullopt;
recv_cipher_suite_ = absl::nullopt;
send_key_.Clear();
recv_key_.Clear();
state_ = ST_INIT;

View File

@ -17,10 +17,10 @@
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/cryptoparams.h"
#include "api/jsep.h"
#include "api/optional.h"
#include "pc/sessiondescription.h"
#include "rtc_base/buffer.h"
#include "rtc_base/constructormagic.h"
@ -78,8 +78,8 @@ class SrtpFilter {
bool ResetParams();
rtc::Optional<int> send_cipher_suite() { return send_cipher_suite_; }
rtc::Optional<int> recv_cipher_suite() { return recv_cipher_suite_; }
absl::optional<int> send_cipher_suite() { return send_cipher_suite_; }
absl::optional<int> recv_cipher_suite() { return recv_cipher_suite_; }
rtc::ArrayView<const uint8_t> send_key() { return send_key_; }
rtc::ArrayView<const uint8_t> recv_key() { return recv_key_; }
@ -135,8 +135,8 @@ class SrtpFilter {
std::vector<CryptoParams> offer_params_;
CryptoParams applied_send_params_;
CryptoParams applied_recv_params_;
rtc::Optional<int> send_cipher_suite_;
rtc::Optional<int> recv_cipher_suite_;
absl::optional<int> send_cipher_suite_;
absl::optional<int> recv_cipher_suite_;
rtc::ZeroOnFreeBuffer<uint8_t> send_key_;
rtc::ZeroOnFreeBuffer<uint8_t> recv_key_;
};

View File

@ -237,7 +237,7 @@ void SrtpTransport::OnRtcpPacketReceived(rtc::CopyOnWriteBuffer* packet,
}
void SrtpTransport::OnNetworkRouteChanged(
rtc::Optional<rtc::NetworkRoute> network_route) {
absl::optional<rtc::NetworkRoute> network_route) {
// Only append the SRTP overhead when there is a selected network route.
if (network_route) {
int srtp_overhead = 0;

View File

@ -117,7 +117,7 @@ class SrtpTransport : public RtpTransport {
void OnRtcpPacketReceived(rtc::CopyOnWriteBuffer* packet,
const rtc::PacketTime& packet_time) override;
void OnNetworkRouteChanged(
rtc::Optional<rtc::NetworkRoute> network_route) override;
absl::optional<rtc::NetworkRoute> network_route) override;
// Override the RtpTransport::OnWritableState.
void OnWritableState(rtc::PacketTransportInternal* packet_transport) override;
@ -151,10 +151,10 @@ class SrtpTransport : public RtpTransport {
std::unique_ptr<cricket::SrtpSession> send_rtcp_session_;
std::unique_ptr<cricket::SrtpSession> recv_rtcp_session_;
rtc::Optional<cricket::CryptoParams> send_params_;
rtc::Optional<cricket::CryptoParams> recv_params_;
rtc::Optional<int> send_cipher_suite_;
rtc::Optional<int> recv_cipher_suite_;
absl::optional<cricket::CryptoParams> send_params_;
absl::optional<cricket::CryptoParams> recv_params_;
absl::optional<int> send_cipher_suite_;
absl::optional<int> recv_cipher_suite_;
rtc::ZeroOnFreeBuffer<uint8_t> send_key_;
rtc::ZeroOnFreeBuffer<uint8_t> recv_key_;

View File

@ -266,12 +266,12 @@ class FakePeerConnectionBase : public PeerConnectionInternal {
return {};
}
rtc::Optional<std::string> sctp_content_name() const override {
return rtc::nullopt;
absl::optional<std::string> sctp_content_name() const override {
return absl::nullopt;
}
rtc::Optional<std::string> sctp_transport_name() const override {
return rtc::nullopt;
absl::optional<std::string> sctp_transport_name() const override {
return absl::nullopt;
}
std::map<std::string, std::string> GetTransportNamesByMid() const override {

View File

@ -45,7 +45,7 @@ class FakeVoiceMediaChannelForStats : public cricket::FakeVoiceMediaChannel {
}
private:
rtc::Optional<cricket::VoiceMediaInfo> stats_;
absl::optional<cricket::VoiceMediaInfo> stats_;
};
// Fake VideoMediaChannel where the result of GetStats can be configured.
@ -68,7 +68,7 @@ class FakeVideoMediaChannelForStats : public cricket::FakeVideoMediaChannel {
}
private:
rtc::Optional<cricket::VideoMediaInfo> stats_;
absl::optional<cricket::VideoMediaInfo> stats_;
};
constexpr bool kDefaultRtcpMuxRequired = true;

View File

@ -140,7 +140,7 @@ class FakeRTCCertificateGenerator
void GenerateCertificateAsync(
const rtc::KeyParams& key_params,
const rtc::Optional<uint64_t>& expires_ms,
const absl::optional<uint64_t>& expires_ms,
const rtc::scoped_refptr<rtc::RTCCertificateGeneratorCallback>& callback)
override {
// The certificates are created from constant PEM strings and use its coded

View File

@ -40,8 +40,8 @@ class FakeSctpTransport : public cricket::SctpTransportInternal {
int remote_port() const { return *remote_port_; }
private:
rtc::Optional<int> local_port_;
rtc::Optional<int> remote_port_;
absl::optional<int> local_port_;
absl::optional<int> remote_port_;
};
class FakeSctpTransportFactory : public cricket::SctpTransportInternalFactory {

View File

@ -293,7 +293,7 @@ class MockSetRemoteDescriptionObserver
private:
// Set on complete, on success this is set to an RTCError::OK() error.
rtc::Optional<RTCError> error_;
absl::optional<RTCError> error_;
};
class MockDataChannelObserver : public webrtc::DataChannelObserver {

View File

@ -266,11 +266,11 @@ rtc::scoped_refptr<VideoTrackInterface> TrackMediaInfoMap::GetVideoTrack(
return FindValueOrNull(video_track_by_receiver_info_, &video_receiver_info);
}
rtc::Optional<int> TrackMediaInfoMap::GetAttachmentIdByTrack(
absl::optional<int> TrackMediaInfoMap::GetAttachmentIdByTrack(
const MediaStreamTrackInterface* track) const {
auto it = attachment_id_by_track_.find(track);
return it != attachment_id_by_track_.end() ? rtc::Optional<int>(it->second)
: rtc::nullopt;
return it != attachment_id_by_track_.end() ? absl::optional<int>(it->second)
: absl::nullopt;
}
} // namespace webrtc

View File

@ -79,12 +79,12 @@ class TrackMediaInfoMap {
// It is not going to work if a track is attached multiple times, and
// it is not going to work if a received track is attached as a sending
// track (loopback).
rtc::Optional<int> GetAttachmentIdByTrack(
absl::optional<int> GetAttachmentIdByTrack(
const MediaStreamTrackInterface* track) const;
private:
rtc::Optional<std::string> voice_mid_;
rtc::Optional<std::string> video_mid_;
absl::optional<std::string> voice_mid_;
absl::optional<std::string> video_mid_;
std::unique_ptr<cricket::VoiceMediaInfo> voice_media_info_;
std::unique_ptr<cricket::VideoMediaInfo> video_media_info_;
// These maps map tracks (identified by a pointer) to their corresponding info

View File

@ -408,7 +408,7 @@ TEST_F(TrackMediaInfoMapTest, GetAttachmentIdByTrack) {
CreateMap();
EXPECT_EQ(rtp_senders_[0]->AttachmentId(),
map_->GetAttachmentIdByTrack(local_audio_track_));
EXPECT_EQ(rtc::nullopt, map_->GetAttachmentIdByTrack(local_video_track_));
EXPECT_EQ(absl::nullopt, map_->GetAttachmentIdByTrack(local_video_track_));
}
// Death tests.

View File

@ -242,7 +242,7 @@ const cricket::VideoFormat& GetBestCaptureFormat(
// Return false if the key is mandatory, and the value is invalid.
bool ExtractOption(const MediaConstraintsInterface* all_constraints,
const std::string& key,
rtc::Optional<bool>* option) {
absl::optional<bool>* option) {
size_t mandatory = 0;
bool value;
if (FindConstraint(all_constraints, key, &value, &mandatory)) {

View File

@ -48,7 +48,9 @@ class VideoCapturerTrackSource : public VideoTrackSource,
bool remote);
bool is_screencast() const final { return video_capturer_->IsScreencast(); }
rtc::Optional<bool> needs_denoising() const final { return needs_denoising_; }
absl::optional<bool> needs_denoising() const final {
return needs_denoising_;
}
bool GetStats(Stats* stats) final;
@ -76,7 +78,7 @@ class VideoCapturerTrackSource : public VideoTrackSource,
std::unique_ptr<cricket::VideoCapturer> video_capturer_;
bool started_;
cricket::VideoFormat format_;
rtc::Optional<bool> needs_denoising_;
absl::optional<bool> needs_denoising_;
};
} // namespace webrtc

View File

@ -322,7 +322,7 @@ TEST_F(VideoCapturerTrackSourceTest, SetValidDenoisingConstraint) {
TEST_F(VideoCapturerTrackSourceTest, NoiseReductionConstraintNotSet) {
FakeConstraints constraints;
CreateVideoCapturerSource(&constraints);
EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
EXPECT_EQ(absl::nullopt, source_->needs_denoising());
}
TEST_F(VideoCapturerTrackSourceTest,
@ -357,7 +357,7 @@ TEST_F(VideoCapturerTrackSourceTest, NoiseReductionAndInvalidKeyMandatory) {
EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
kMaxWaitMs);
EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
EXPECT_EQ(absl::nullopt, source_->needs_denoising());
}
TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueOptional) {
@ -370,12 +370,13 @@ TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueOptional) {
EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
kMaxWaitMs);
EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
EXPECT_EQ(absl::nullopt, source_->needs_denoising());
}
TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueMandatory) {
FakeConstraints constraints;
// Optional constraints should be ignored if the mandatory constraints fail.
// absl::optional constraints should be ignored if the mandatory constraints
// fail.
constraints.AddOptional(MediaConstraintsInterface::kNoiseReduction, "false");
// Values are case-sensitive and must be all lower-case.
constraints.AddMandatory(MediaConstraintsInterface::kNoiseReduction, "True");
@ -384,7 +385,7 @@ TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueMandatory) {
EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
kMaxWaitMs);
EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
EXPECT_EQ(absl::nullopt, source_->needs_denoising());
}
TEST_F(VideoCapturerTrackSourceTest, MixedOptionsAndConstraints) {

View File

@ -30,7 +30,9 @@ class VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
bool remote() const override { return remote_; }
bool is_screencast() const override { return false; }
rtc::Optional<bool> needs_denoising() const override { return rtc::nullopt; }
absl::optional<bool> needs_denoising() const override {
return absl::nullopt;
}
bool GetStats(Stats* stats) override { return false; }

View File

@ -2032,7 +2032,7 @@ bool ParseSessionDescription(const std::string& message,
std::string(), error);
}
// Optional lines
// absl::optional lines
// Those are the optional lines, so shouldn't return false if not present.
// RFC 4566
// i=* (session information)

View File

@ -175,7 +175,7 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
// Request certificate. This happens asynchronously, so that the caller gets
// a chance to connect to |SignalCertificateReady|.
cert_generator_->GenerateCertificateAsync(key_params, rtc::nullopt,
cert_generator_->GenerateCertificateAsync(key_params, absl::nullopt,
callback);
}
}