Replace rtc::Optional with absl::optional in media, ortc, p2p
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script with parameters 'media ortc p2p':
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: I19167714af7cc1436d34cfcba6c8b3718d8e677b
Reviewed-on: https://webrtc-review.googlesource.com/83731
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23638}
This commit is contained in:
parent
5a9ba68300
commit
00c7183614
@ -40,9 +40,9 @@ rtc_source_set("rtc_h264_profile_id") {
|
||||
|
||||
deps = [
|
||||
"..:webrtc_common",
|
||||
"../api:optional",
|
||||
"../rtc_base:rtc_base",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
@ -111,7 +111,6 @@ rtc_static_library("rtc_media_base") {
|
||||
":rtc_media_config",
|
||||
"..:webrtc_common",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
"../api/video:video_frame",
|
||||
"../api/video:video_frame_i420",
|
||||
@ -122,6 +121,7 @@ rtc_static_library("rtc_media_base") {
|
||||
"../rtc_base:rtc_base",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"../system_wrappers:field_trial_api",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
if (!build_with_mozilla) {
|
||||
@ -304,7 +304,6 @@ rtc_static_library("rtc_audio_video") {
|
||||
"..:webrtc_common",
|
||||
"../api:call_api",
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api:transport_api",
|
||||
"../api/audio_codecs:audio_codecs_api",
|
||||
"../api/video:video_frame",
|
||||
@ -328,6 +327,7 @@ rtc_static_library("rtc_audio_video") {
|
||||
"../system_wrappers",
|
||||
"../system_wrappers:field_trial_api",
|
||||
"../system_wrappers:metrics_api",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@ -75,7 +75,7 @@ class AdaptedVideoTrackSource
|
||||
cricket::VideoAdapter video_adapter_;
|
||||
|
||||
rtc::CriticalSection stats_crit_;
|
||||
rtc::Optional<Stats> stats_ RTC_GUARDED_BY(stats_crit_);
|
||||
absl::optional<Stats> stats_ RTC_GUARDED_BY(stats_crit_);
|
||||
|
||||
VideoBroadcaster broadcaster_;
|
||||
};
|
||||
|
||||
@ -354,7 +354,7 @@ TEST(CodecTest, TestToCodecParameters) {
|
||||
EXPECT_EQ(cricket::MEDIA_TYPE_VIDEO, codec_params_1.kind);
|
||||
EXPECT_EQ("V", codec_params_1.name);
|
||||
EXPECT_EQ(cricket::kVideoCodecClockrate, codec_params_1.clock_rate);
|
||||
EXPECT_EQ(rtc::nullopt, codec_params_1.num_channels);
|
||||
EXPECT_EQ(absl::nullopt, codec_params_1.num_channels);
|
||||
ASSERT_EQ(1u, codec_params_1.parameters.size());
|
||||
EXPECT_EQ("p1", codec_params_1.parameters.begin()->first);
|
||||
EXPECT_EQ("v1", codec_params_1.parameters.begin()->second);
|
||||
|
||||
@ -118,13 +118,13 @@ static constexpr LevelConstraint kLevelConstraints[] = {
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
rtc::Optional<ProfileLevelId> ParseProfileLevelId(const char* str) {
|
||||
absl::optional<ProfileLevelId> ParseProfileLevelId(const char* str) {
|
||||
// The string should consist of 3 bytes in hexadecimal format.
|
||||
if (strlen(str) != 6u)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
const uint32_t profile_level_id_numeric = strtol(str, nullptr, 16);
|
||||
if (profile_level_id_numeric == 0)
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
|
||||
// Separate into three bytes.
|
||||
const uint8_t level_idc =
|
||||
@ -159,7 +159,7 @@ rtc::Optional<ProfileLevelId> ParseProfileLevelId(const char* str) {
|
||||
break;
|
||||
default:
|
||||
// Unrecognized level_idc.
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// Parse profile_idc/profile_iop into a Profile enum.
|
||||
@ -171,10 +171,10 @@ rtc::Optional<ProfileLevelId> ParseProfileLevelId(const char* str) {
|
||||
}
|
||||
|
||||
// Unrecognized profile_idc/profile_iop combination.
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
rtc::Optional<Level> SupportedLevel(int max_frame_pixel_count, float max_fps) {
|
||||
absl::optional<Level> SupportedLevel(int max_frame_pixel_count, float max_fps) {
|
||||
static const int kPixelsPerMacroblock = 16 * 16;
|
||||
|
||||
for (int i = arraysize(kLevelConstraints) - 1; i >= 0; --i) {
|
||||
@ -188,10 +188,10 @@ rtc::Optional<Level> SupportedLevel(int max_frame_pixel_count, float max_fps) {
|
||||
}
|
||||
|
||||
// No level supported.
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
rtc::Optional<ProfileLevelId> ParseSdpProfileLevelId(
|
||||
absl::optional<ProfileLevelId> ParseSdpProfileLevelId(
|
||||
const CodecParameterMap& params) {
|
||||
// TODO(magjed): The default should really be kProfileBaseline and kLevel1
|
||||
// according to the spec: https://tools.ietf.org/html/rfc6184#section-8.1. In
|
||||
@ -209,7 +209,7 @@ rtc::Optional<ProfileLevelId> ParseSdpProfileLevelId(
|
||||
: ParseProfileLevelId(profile_level_id_it->second.c_str());
|
||||
}
|
||||
|
||||
rtc::Optional<std::string> ProfileLevelIdToString(
|
||||
absl::optional<std::string> ProfileLevelIdToString(
|
||||
const ProfileLevelId& profile_level_id) {
|
||||
// Handle special case level == 1b.
|
||||
if (profile_level_id.level == kLevel1_b) {
|
||||
@ -222,7 +222,7 @@ rtc::Optional<std::string> ProfileLevelIdToString(
|
||||
return {"4d100b"};
|
||||
// Level 1b is not allowed for other profiles.
|
||||
default:
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ rtc::Optional<std::string> ProfileLevelIdToString(
|
||||
break;
|
||||
// Unrecognized profile.
|
||||
default:
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
char str[7];
|
||||
@ -267,9 +267,9 @@ void GenerateProfileLevelIdForAnswer(
|
||||
}
|
||||
|
||||
// Parse profile-level-ids.
|
||||
const rtc::Optional<ProfileLevelId> local_profile_level_id =
|
||||
const absl::optional<ProfileLevelId> local_profile_level_id =
|
||||
ParseSdpProfileLevelId(local_supported_params);
|
||||
const rtc::Optional<ProfileLevelId> remote_profile_level_id =
|
||||
const absl::optional<ProfileLevelId> remote_profile_level_id =
|
||||
ParseSdpProfileLevelId(remote_offered_params);
|
||||
// The local and remote codec must have valid and equal H264 Profiles.
|
||||
RTC_DCHECK(local_profile_level_id);
|
||||
@ -297,9 +297,9 @@ void GenerateProfileLevelIdForAnswer(
|
||||
|
||||
bool IsSameH264Profile(const CodecParameterMap& params1,
|
||||
const CodecParameterMap& params2) {
|
||||
const rtc::Optional<webrtc::H264::ProfileLevelId> profile_level_id =
|
||||
const absl::optional<webrtc::H264::ProfileLevelId> profile_level_id =
|
||||
webrtc::H264::ParseSdpProfileLevelId(params1);
|
||||
const rtc::Optional<webrtc::H264::ProfileLevelId> other_profile_level_id =
|
||||
const absl::optional<webrtc::H264::ProfileLevelId> other_profile_level_id =
|
||||
webrtc::H264::ParseSdpProfileLevelId(params2);
|
||||
// Compare H264 profiles, but not levels.
|
||||
return profile_level_id && other_profile_level_id &&
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "common_types.h" // NOLINT(build/include)
|
||||
|
||||
namespace webrtc {
|
||||
@ -55,24 +55,24 @@ struct ProfileLevelId {
|
||||
// Parse profile level id that is represented as a string of 3 hex bytes.
|
||||
// Nothing will be returned if the string is not a recognized H264
|
||||
// profile level id.
|
||||
rtc::Optional<ProfileLevelId> ParseProfileLevelId(const char* str);
|
||||
absl::optional<ProfileLevelId> ParseProfileLevelId(const char* str);
|
||||
|
||||
// Parse profile level id that is represented as a string of 3 hex bytes
|
||||
// contained in an SDP key-value map. A default profile level id will be
|
||||
// returned if the profile-level-id key is missing. Nothing will be returned if
|
||||
// the key is present but the string is invalid.
|
||||
rtc::Optional<ProfileLevelId> ParseSdpProfileLevelId(
|
||||
absl::optional<ProfileLevelId> ParseSdpProfileLevelId(
|
||||
const CodecParameterMap& params);
|
||||
|
||||
// Given that a decoder supports up to a given frame size (in pixels) at up to a
|
||||
// given number of frames per second, return the highest H.264 level where it
|
||||
// can guarantee that it will be able to support all valid encoded streams that
|
||||
// are within that level.
|
||||
rtc::Optional<Level> SupportedLevel(int max_frame_pixel_count, float max_fps);
|
||||
absl::optional<Level> SupportedLevel(int max_frame_pixel_count, float max_fps);
|
||||
|
||||
// Returns canonical string representation as three hex bytes of the profile
|
||||
// level id, or returns nothing for invalid profile level ids.
|
||||
rtc::Optional<std::string> ProfileLevelIdToString(
|
||||
absl::optional<std::string> ProfileLevelIdToString(
|
||||
const ProfileLevelId& profile_level_id);
|
||||
|
||||
// Generate codec parameters that will be used as answer in an SDP negotiation
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_encoder.h"
|
||||
#include "api/audio_options.h"
|
||||
#include "api/optional.h"
|
||||
#include "api/rtcerror.h"
|
||||
#include "api/rtpparameters.h"
|
||||
#include "api/rtpreceiverinterface.h"
|
||||
@ -62,7 +62,8 @@ struct VideoFormat;
|
||||
const int kScreencastDefaultFps = 5;
|
||||
|
||||
template <class T>
|
||||
static std::string ToStringIfSet(const char* key, const rtc::Optional<T>& val) {
|
||||
static std::string ToStringIfSet(const char* key,
|
||||
const absl::optional<T>& val) {
|
||||
std::string str;
|
||||
if (val) {
|
||||
str = key;
|
||||
@ -122,20 +123,20 @@ struct VideoOptions {
|
||||
// Enable denoising? This flag comes from the getUserMedia
|
||||
// constraint 'googNoiseReduction', and WebRtcVideoEngine passes it
|
||||
// on to the codec options. Disabled by default.
|
||||
rtc::Optional<bool> video_noise_reduction;
|
||||
absl::optional<bool> video_noise_reduction;
|
||||
// Force screencast to use a minimum bitrate. This flag comes from
|
||||
// the PeerConnection constraint 'googScreencastMinBitrate'. It is
|
||||
// copied to the encoder config by WebRtcVideoChannel.
|
||||
rtc::Optional<int> screencast_min_bitrate_kbps;
|
||||
absl::optional<int> screencast_min_bitrate_kbps;
|
||||
// Set by screencast sources. Implies selection of encoding settings
|
||||
// suitable for screencast. Most likely not the right way to do
|
||||
// things, e.g., screencast of a text document and screencast of a
|
||||
// youtube video have different needs.
|
||||
rtc::Optional<bool> is_screencast;
|
||||
absl::optional<bool> is_screencast;
|
||||
|
||||
private:
|
||||
template <typename T>
|
||||
static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) {
|
||||
static void SetFrom(absl::optional<T>* s, const absl::optional<T>& o) {
|
||||
if (o) {
|
||||
*s = o;
|
||||
}
|
||||
@ -328,7 +329,7 @@ struct MediaSenderInfo {
|
||||
float fraction_lost = 0.0f;
|
||||
int64_t rtt_ms = 0;
|
||||
std::string codec_name;
|
||||
rtc::Optional<int> codec_payload_type;
|
||||
absl::optional<int> codec_payload_type;
|
||||
std::vector<SsrcSenderInfo> local_stats;
|
||||
std::vector<SsrcReceiverInfo> remote_stats;
|
||||
};
|
||||
@ -374,7 +375,7 @@ struct MediaReceiverInfo {
|
||||
int packets_lost = 0;
|
||||
float fraction_lost = 0.0f;
|
||||
std::string codec_name;
|
||||
rtc::Optional<int> codec_payload_type;
|
||||
absl::optional<int> codec_payload_type;
|
||||
std::vector<SsrcReceiverInfo> local_stats;
|
||||
std::vector<SsrcSenderInfo> remote_stats;
|
||||
};
|
||||
@ -468,7 +469,7 @@ struct VideoSenderInfo : public MediaSenderInfo {
|
||||
int encode_usage_percent = 0;
|
||||
uint32_t frames_encoded = 0;
|
||||
bool has_entered_low_resolution = false;
|
||||
rtc::Optional<uint64_t> qp_sum;
|
||||
absl::optional<uint64_t> qp_sum;
|
||||
webrtc::VideoContentType content_type = webrtc::VideoContentType::UNSPECIFIED;
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcvideosenderstats-hugeframessent
|
||||
uint32_t huge_frames_sent = 0;
|
||||
@ -496,7 +497,7 @@ struct VideoReceiverInfo : public MediaReceiverInfo {
|
||||
uint32_t frames_received = 0;
|
||||
uint32_t frames_decoded = 0;
|
||||
uint32_t frames_rendered = 0;
|
||||
rtc::Optional<uint64_t> qp_sum;
|
||||
absl::optional<uint64_t> qp_sum;
|
||||
int64_t interframe_delay_max_ms = -1;
|
||||
|
||||
webrtc::VideoContentType content_type = webrtc::VideoContentType::UNSPECIFIED;
|
||||
@ -526,7 +527,7 @@ struct VideoReceiverInfo : public MediaReceiverInfo {
|
||||
|
||||
// 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 DataSenderInfo : public MediaSenderInfo {
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include <limits>
|
||||
#include <utility>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "media/base/mediaconstants.h"
|
||||
#include "media/base/videocommon.h"
|
||||
#include "rtc_base/arraysize.h"
|
||||
@ -256,14 +256,14 @@ bool VideoAdapter::AdaptFrameResolution(int in_width,
|
||||
}
|
||||
|
||||
void VideoAdapter::OnOutputFormatRequest(
|
||||
const rtc::Optional<VideoFormat>& format) {
|
||||
const absl::optional<VideoFormat>& format) {
|
||||
rtc::CritScope cs(&critical_section_);
|
||||
requested_format_ = format;
|
||||
next_frame_timestamp_ns_ = rtc::nullopt;
|
||||
next_frame_timestamp_ns_ = absl::nullopt;
|
||||
}
|
||||
|
||||
void VideoAdapter::OnResolutionFramerateRequest(
|
||||
const rtc::Optional<int>& target_pixel_count,
|
||||
const absl::optional<int>& target_pixel_count,
|
||||
int max_pixel_count,
|
||||
int max_framerate_fps) {
|
||||
rtc::CritScope cs(&critical_section_);
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#ifndef MEDIA_BASE_VIDEOADAPTER_H_
|
||||
#define MEDIA_BASE_VIDEOADAPTER_H_
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "media/base/videocommon.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/criticalsection.h"
|
||||
@ -48,7 +48,7 @@ class VideoAdapter {
|
||||
// requested aspect ratio is orientation agnostic and will be adjusted to
|
||||
// maintain the input orientation, so it doesn't matter if e.g. 1280x720 or
|
||||
// 720x1280 is requested.
|
||||
void OnOutputFormatRequest(const rtc::Optional<VideoFormat>& format);
|
||||
void OnOutputFormatRequest(const absl::optional<VideoFormat>& format);
|
||||
|
||||
// Requests the output frame size from |AdaptFrameResolution| to have as close
|
||||
// as possible to |target_pixel_count| pixels (if set) but no more than
|
||||
@ -58,7 +58,7 @@ class VideoAdapter {
|
||||
// Set |max_pixel_count| and/or |max_framerate_fps| to
|
||||
// std::numeric_limit<int>::max() if no upper limit is desired.
|
||||
void OnResolutionFramerateRequest(
|
||||
const rtc::Optional<int>& target_pixel_count,
|
||||
const absl::optional<int>& target_pixel_count,
|
||||
int max_pixel_count,
|
||||
int max_framerate_fps);
|
||||
|
||||
@ -75,13 +75,13 @@ class VideoAdapter {
|
||||
// Resolution must be divisible by this factor.
|
||||
const int required_resolution_alignment_;
|
||||
// The target timestamp for the next frame based on requested format.
|
||||
rtc::Optional<int64_t> next_frame_timestamp_ns_
|
||||
absl::optional<int64_t> next_frame_timestamp_ns_
|
||||
RTC_GUARDED_BY(critical_section_);
|
||||
|
||||
// Max number of pixels requested via calls to OnOutputFormatRequest,
|
||||
// OnResolutionRequest respectively.
|
||||
// The adapted output format is the minimum of these.
|
||||
rtc::Optional<VideoFormat> requested_format_
|
||||
absl::optional<VideoFormat> requested_format_
|
||||
RTC_GUARDED_BY(critical_section_);
|
||||
int resolution_request_target_pixel_count_ RTC_GUARDED_BY(critical_section_);
|
||||
int resolution_request_max_pixel_count_ RTC_GUARDED_BY(critical_section_);
|
||||
|
||||
@ -379,7 +379,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateOntheFly) {
|
||||
// Do not adapt the frame rate or the resolution. Expect no frame drop, no
|
||||
// cropping, and no resolution change.
|
||||
TEST_F(VideoAdapterTest, AdaptFramerateRequestMax) {
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt,
|
||||
std::numeric_limits<int>::max(),
|
||||
std::numeric_limits<int>::max());
|
||||
|
||||
@ -396,7 +396,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateRequestMax) {
|
||||
}
|
||||
|
||||
TEST_F(VideoAdapterTest, AdaptFramerateRequestZero) {
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt,
|
||||
std::numeric_limits<int>::max(), 0);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
adapter_wrapper_->AdaptFrame(frame_source_->GetFrame());
|
||||
@ -411,7 +411,7 @@ TEST_F(VideoAdapterTest, AdaptFramerateRequestZero) {
|
||||
// the number of dropped frames to be half of the number the captured frames.
|
||||
TEST_F(VideoAdapterTest, AdaptFramerateRequestHalf) {
|
||||
adapter_.OnResolutionFramerateRequest(
|
||||
rtc::nullopt, std::numeric_limits<int>::max(), kDefaultFps / 2);
|
||||
absl::nullopt, std::numeric_limits<int>::max(), kDefaultFps / 2);
|
||||
for (int i = 0; i < 10; ++i)
|
||||
adapter_wrapper_->AdaptFrame(frame_source_->GetFrame());
|
||||
|
||||
@ -732,7 +732,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
||||
EXPECT_EQ(720, out_height_);
|
||||
|
||||
// Adapt down one step.
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 1280 * 720 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 1280 * 720 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -743,7 +743,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
||||
EXPECT_EQ(540, out_height_);
|
||||
|
||||
// Adapt down one step more.
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 960 * 540 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 960 * 540 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -754,7 +754,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInSmallSteps) {
|
||||
EXPECT_EQ(360, out_height_);
|
||||
|
||||
// Adapt down one step more.
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 640 * 360 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 640 * 360 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -810,7 +810,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestMaxZero) {
|
||||
EXPECT_EQ(1280, out_width_);
|
||||
EXPECT_EQ(720, out_height_);
|
||||
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 0,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 0,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_FALSE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -819,7 +819,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestMaxZero) {
|
||||
|
||||
TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
|
||||
// Large step down.
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 640 * 360 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 640 * 360 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -842,7 +842,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestInLargeSteps) {
|
||||
}
|
||||
|
||||
TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 640 * 360 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 640 * 360 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -862,7 +862,7 @@ TEST_F(VideoAdapterTest, TestOnOutputFormatRequestCapsMaxResolution) {
|
||||
EXPECT_EQ(480, out_width_);
|
||||
EXPECT_EQ(270, out_height_);
|
||||
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 960 * 720,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 960 * 720,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -882,7 +882,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
|
||||
EXPECT_EQ(1280, out_width_);
|
||||
EXPECT_EQ(720, out_height_);
|
||||
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 640 * 360 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 640 * 360 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
&cropped_width_, &cropped_height_,
|
||||
@ -892,7 +892,7 @@ TEST_F(VideoAdapterTest, TestOnResolutionRequestReset) {
|
||||
EXPECT_EQ(480, out_width_);
|
||||
EXPECT_EQ(270, out_height_);
|
||||
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt,
|
||||
std::numeric_limits<int>::max(),
|
||||
std::numeric_limits<int>::max());
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(1280, 720, 0,
|
||||
@ -918,7 +918,7 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
|
||||
EXPECT_EQ(360, out_height_);
|
||||
|
||||
// Adapt down one step.
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 640 * 360 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 640 * 360 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
// Expect cropping to 16:9 format and 3/4 scaling.
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(640, 480, 0,
|
||||
@ -930,7 +930,7 @@ TEST_F(VideoAdapterTest, TestCroppingWithResolutionRequest) {
|
||||
EXPECT_EQ(270, out_height_);
|
||||
|
||||
// Adapt down one step more.
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 480 * 270 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 480 * 270 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
// Expect cropping to 16:9 format and 1/2 scaling.
|
||||
EXPECT_TRUE(adapter_.AdaptFrameResolution(640, 480, 0,
|
||||
@ -982,7 +982,7 @@ TEST_F(VideoAdapterTest, TestCroppingOddResolution) {
|
||||
// Ask for 640x360 (16:9 aspect), with 3/16 scaling.
|
||||
adapter_.OnOutputFormatRequest(
|
||||
VideoFormat(640, 360, 0, FOURCC_I420));
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt,
|
||||
640 * 360 * 3 / 16 * 3 / 16,
|
||||
std::numeric_limits<int>::max());
|
||||
|
||||
@ -1004,8 +1004,7 @@ TEST_F(VideoAdapterTest, TestAdaptToVerySmallResolution) {
|
||||
const int w = 1920;
|
||||
const int h = 1080;
|
||||
adapter_.OnOutputFormatRequest(VideoFormat(w, h, 0, FOURCC_I420));
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt,
|
||||
w * h * 1 / 16 * 1 / 16,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, w * h * 1 / 16 * 1 / 16,
|
||||
std::numeric_limits<int>::max());
|
||||
|
||||
// Send 1920x1080 (16:9 aspect).
|
||||
@ -1052,7 +1051,7 @@ TEST_F(VideoAdapterTest, AdaptFrameResolutionDropWithResolutionRequest) {
|
||||
&cropped_width_, &cropped_height_,
|
||||
&out_width_, &out_height_));
|
||||
|
||||
adapter_.OnResolutionFramerateRequest(rtc::nullopt, 640 * 480 - 1,
|
||||
adapter_.OnResolutionFramerateRequest(absl::nullopt, 640 * 480 - 1,
|
||||
std::numeric_limits<int>::max());
|
||||
|
||||
// Still expect all frames to be dropped
|
||||
|
||||
@ -184,7 +184,7 @@ class FakeVideoSendStream final
|
||||
bool framerate_scaling_enabled_;
|
||||
rtc::VideoSourceInterface<webrtc::VideoFrame>* source_;
|
||||
int num_swapped_frames_;
|
||||
rtc::Optional<webrtc::VideoFrame> last_frame_;
|
||||
absl::optional<webrtc::VideoFrame> last_frame_;
|
||||
webrtc::VideoSendStream::Stats stats_;
|
||||
int num_encoder_reconfigurations_ = 0;
|
||||
};
|
||||
|
||||
@ -85,7 +85,7 @@ PayloadTypeMapper::PayloadTypeMapper()
|
||||
|
||||
PayloadTypeMapper::~PayloadTypeMapper() = default;
|
||||
|
||||
rtc::Optional<int> PayloadTypeMapper::GetMappingFor(
|
||||
absl::optional<int> PayloadTypeMapper::GetMappingFor(
|
||||
const webrtc::SdpAudioFormat& format) {
|
||||
auto iter = mappings_.find(format);
|
||||
if (iter != mappings_.end())
|
||||
@ -102,19 +102,19 @@ rtc::Optional<int> PayloadTypeMapper::GetMappingFor(
|
||||
}
|
||||
}
|
||||
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
rtc::Optional<int> PayloadTypeMapper::FindMappingFor(
|
||||
absl::optional<int> PayloadTypeMapper::FindMappingFor(
|
||||
const webrtc::SdpAudioFormat& format) const {
|
||||
auto iter = mappings_.find(format);
|
||||
if (iter != mappings_.end())
|
||||
return iter->second;
|
||||
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
rtc::Optional<AudioCodec> PayloadTypeMapper::ToAudioCodec(
|
||||
absl::optional<AudioCodec> PayloadTypeMapper::ToAudioCodec(
|
||||
const webrtc::SdpAudioFormat& format) {
|
||||
// TODO(ossu): We can safely set bitrate to zero here, since that field is
|
||||
// not presented in the SDP. It is used to ferry around some target bitrate
|
||||
@ -129,7 +129,7 @@ rtc::Optional<AudioCodec> PayloadTypeMapper::ToAudioCodec(
|
||||
return std::move(codec);
|
||||
}
|
||||
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
bool PayloadTypeMapper::SdpAudioFormatOrdering::operator()(
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/audio_codecs/audio_format.h"
|
||||
#include "api/optional.h"
|
||||
#include "media/base/codec.h"
|
||||
|
||||
namespace cricket {
|
||||
@ -30,15 +30,16 @@ class PayloadTypeMapper {
|
||||
// Finds the current payload type for |format| or assigns a new one, if no
|
||||
// current mapping exists. Will return an empty value if it was unable to
|
||||
// create a mapping, i.e. if all dynamic payload type ids have been used up.
|
||||
rtc::Optional<int> GetMappingFor(const webrtc::SdpAudioFormat& format);
|
||||
absl::optional<int> GetMappingFor(const webrtc::SdpAudioFormat& format);
|
||||
|
||||
// Finds the current payload type for |format|, if any. Returns an empty value
|
||||
// if no payload type mapping exists for the format.
|
||||
rtc::Optional<int> FindMappingFor(const webrtc::SdpAudioFormat& format) const;
|
||||
absl::optional<int> FindMappingFor(
|
||||
const webrtc::SdpAudioFormat& format) const;
|
||||
|
||||
// Like GetMappingFor, but fills in an AudioCodec structure with the necessary
|
||||
// information instead.
|
||||
rtc::Optional<AudioCodec> ToAudioCodec(const webrtc::SdpAudioFormat& format);
|
||||
absl::optional<AudioCodec> ToAudioCodec(const webrtc::SdpAudioFormat& format);
|
||||
|
||||
private:
|
||||
struct SdpAudioFormatOrdering {
|
||||
|
||||
@ -358,46 +358,46 @@ bool GetVp9LayersFromFieldTrialGroup(size_t* num_spatial_layers,
|
||||
return true;
|
||||
}
|
||||
|
||||
rtc::Optional<size_t> GetVp9SpatialLayersFromFieldTrial() {
|
||||
absl::optional<size_t> GetVp9SpatialLayersFromFieldTrial() {
|
||||
size_t num_sl;
|
||||
size_t num_tl;
|
||||
if (GetVp9LayersFromFieldTrialGroup(&num_sl, &num_tl)) {
|
||||
return num_sl;
|
||||
}
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
rtc::Optional<size_t> GetVp9TemporalLayersFromFieldTrial() {
|
||||
absl::optional<size_t> GetVp9TemporalLayersFromFieldTrial() {
|
||||
size_t num_sl;
|
||||
size_t num_tl;
|
||||
if (GetVp9LayersFromFieldTrialGroup(&num_sl, &num_tl)) {
|
||||
return num_tl;
|
||||
}
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -493,7 +493,7 @@ DefaultUnsignalledSsrcHandler::DefaultUnsignalledSsrcHandler()
|
||||
UnsignalledSsrcHandler::Action DefaultUnsignalledSsrcHandler::OnUnsignalledSsrc(
|
||||
WebRtcVideoChannel* channel,
|
||||
uint32_t ssrc) {
|
||||
rtc::Optional<uint32_t> default_recv_ssrc =
|
||||
absl::optional<uint32_t> default_recv_ssrc =
|
||||
channel->GetDefaultReceiveStreamSsrc();
|
||||
|
||||
if (default_recv_ssrc) {
|
||||
@ -524,7 +524,7 @@ void DefaultUnsignalledSsrcHandler::SetDefaultSink(
|
||||
WebRtcVideoChannel* channel,
|
||||
rtc::VideoSinkInterface<webrtc::VideoFrame>* sink) {
|
||||
default_sink_ = sink;
|
||||
rtc::Optional<uint32_t> default_recv_ssrc =
|
||||
absl::optional<uint32_t> default_recv_ssrc =
|
||||
channel->GetDefaultReceiveStreamSsrc();
|
||||
if (default_recv_ssrc) {
|
||||
channel->SetSink(*default_recv_ssrc, default_sink_);
|
||||
@ -629,7 +629,7 @@ WebRtcVideoChannel::~WebRtcVideoChannel() {
|
||||
delete kv.second;
|
||||
}
|
||||
|
||||
rtc::Optional<WebRtcVideoChannel::VideoCodecSettings>
|
||||
absl::optional<WebRtcVideoChannel::VideoCodecSettings>
|
||||
WebRtcVideoChannel::SelectSendVideoCodec(
|
||||
const std::vector<VideoCodecSettings>& remote_mapped_codecs) const {
|
||||
const std::vector<VideoCodec> local_supported_codecs =
|
||||
@ -645,7 +645,7 @@ WebRtcVideoChannel::SelectSendVideoCodec(
|
||||
return remote_mapped_codec;
|
||||
}
|
||||
// No remote codec was supported.
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
bool WebRtcVideoChannel::NonFlexfecReceiveCodecsHaveChanged(
|
||||
@ -686,7 +686,7 @@ bool WebRtcVideoChannel::GetChangedSendParameters(
|
||||
}
|
||||
|
||||
// Select one of the remote codecs that will be used as send codec.
|
||||
rtc::Optional<VideoCodecSettings> selected_send_codec =
|
||||
absl::optional<VideoCodecSettings> selected_send_codec =
|
||||
SelectSendVideoCodec(MapCodecs(params.codecs));
|
||||
|
||||
if (!selected_send_codec) {
|
||||
@ -712,7 +712,7 @@ bool WebRtcVideoChannel::GetChangedSendParameters(
|
||||
params.extensions, webrtc::RtpExtension::IsSupportedForVideo, true);
|
||||
if (!send_rtp_extensions_ || (*send_rtp_extensions_ != filtered_extensions)) {
|
||||
changed_params->rtp_header_extensions =
|
||||
rtc::Optional<std::vector<webrtc::RtpExtension>>(filtered_extensions);
|
||||
absl::optional<std::vector<webrtc::RtpExtension>>(filtered_extensions);
|
||||
}
|
||||
|
||||
if (params.mid != send_params_.mid) {
|
||||
@ -965,7 +965,7 @@ bool WebRtcVideoChannel::GetChangedRecvParameters(
|
||||
|
||||
if (NonFlexfecReceiveCodecsHaveChanged(recv_codecs_, mapped_codecs)) {
|
||||
changed_params->codec_settings =
|
||||
rtc::Optional<std::vector<VideoCodecSettings>>(mapped_codecs);
|
||||
absl::optional<std::vector<VideoCodecSettings>>(mapped_codecs);
|
||||
}
|
||||
|
||||
// Handle RTP header extensions.
|
||||
@ -973,7 +973,7 @@ bool WebRtcVideoChannel::GetChangedRecvParameters(
|
||||
params.extensions, webrtc::RtpExtension::IsSupportedForVideo, false);
|
||||
if (filtered_extensions != recv_rtp_extensions_) {
|
||||
changed_params->rtp_header_extensions =
|
||||
rtc::Optional<std::vector<webrtc::RtpExtension>>(filtered_extensions);
|
||||
absl::optional<std::vector<webrtc::RtpExtension>>(filtered_extensions);
|
||||
}
|
||||
|
||||
int flexfec_payload_type = mapped_codecs.front().flexfec_payload_type;
|
||||
@ -1532,9 +1532,9 @@ void WebRtcVideoChannel::SetInterface(NetworkInterface* iface) {
|
||||
kVideoRtpBufferSize);
|
||||
}
|
||||
|
||||
rtc::Optional<uint32_t> WebRtcVideoChannel::GetDefaultReceiveStreamSsrc() {
|
||||
absl::optional<uint32_t> WebRtcVideoChannel::GetDefaultReceiveStreamSsrc() {
|
||||
rtc::CritScope stream_lock(&stream_crit_);
|
||||
rtc::Optional<uint32_t> ssrc;
|
||||
absl::optional<uint32_t> ssrc;
|
||||
for (auto it = receive_streams_.begin(); it != receive_streams_.end(); ++it) {
|
||||
if (it->second->IsDefaultStream()) {
|
||||
ssrc.emplace(it->first);
|
||||
@ -1563,7 +1563,7 @@ WebRtcVideoChannel::WebRtcVideoSendStream::VideoSendStreamParameters::
|
||||
webrtc::VideoSendStream::Config config,
|
||||
const VideoOptions& options,
|
||||
int max_bitrate_bps,
|
||||
const rtc::Optional<VideoCodecSettings>& codec_settings)
|
||||
const absl::optional<VideoCodecSettings>& codec_settings)
|
||||
: config(std::move(config)),
|
||||
options(options),
|
||||
max_bitrate_bps(max_bitrate_bps),
|
||||
@ -1577,8 +1577,8 @@ WebRtcVideoChannel::WebRtcVideoSendStream::WebRtcVideoSendStream(
|
||||
const VideoOptions& options,
|
||||
bool enable_cpu_overuse_detection,
|
||||
int max_bitrate_bps,
|
||||
const rtc::Optional<VideoCodecSettings>& codec_settings,
|
||||
const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions,
|
||||
const absl::optional<VideoCodecSettings>& codec_settings,
|
||||
const absl::optional<std::vector<webrtc::RtpExtension>>& rtp_extensions,
|
||||
// TODO(deadbeef): Don't duplicate information between send_params,
|
||||
// rtp_extensions, options, etc.
|
||||
const VideoSendParameters& send_params)
|
||||
@ -2201,7 +2201,7 @@ WebRtcVideoChannel::WebRtcVideoReceiveStream::GetSsrcs() const {
|
||||
return stream_params_.ssrcs;
|
||||
}
|
||||
|
||||
rtc::Optional<uint32_t>
|
||||
absl::optional<uint32_t>
|
||||
WebRtcVideoChannel::WebRtcVideoReceiveStream::GetFirstPrimarySsrc() const {
|
||||
std::vector<uint32_t> primary_ssrcs;
|
||||
stream_params_.GetPrimarySsrcs(&primary_ssrcs);
|
||||
@ -2209,7 +2209,7 @@ WebRtcVideoChannel::WebRtcVideoReceiveStream::GetFirstPrimarySsrc() const {
|
||||
if (primary_ssrcs.empty()) {
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Empty primary ssrcs vector, returning empty optional";
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
} else {
|
||||
return primary_ssrcs[0];
|
||||
}
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/call/transport.h"
|
||||
#include "api/optional.h"
|
||||
#include "api/video/video_frame.h"
|
||||
#include "api/video/video_sink_interface.h"
|
||||
#include "api/video/video_source_interface.h"
|
||||
@ -162,7 +162,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
// Implemented for VideoMediaChannelTest.
|
||||
bool sending() const { return sending_; }
|
||||
|
||||
rtc::Optional<uint32_t> GetDefaultReceiveStreamSsrc();
|
||||
absl::optional<uint32_t> GetDefaultReceiveStreamSsrc();
|
||||
|
||||
StreamParams unsignaled_stream_params() { return unsignaled_stream_params_; }
|
||||
|
||||
@ -200,22 +200,22 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
|
||||
struct ChangedSendParameters {
|
||||
// These optionals are unset if not changed.
|
||||
rtc::Optional<VideoCodecSettings> codec;
|
||||
rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
|
||||
rtc::Optional<std::string> mid;
|
||||
rtc::Optional<int> max_bandwidth_bps;
|
||||
rtc::Optional<bool> conference_mode;
|
||||
rtc::Optional<webrtc::RtcpMode> rtcp_mode;
|
||||
absl::optional<VideoCodecSettings> codec;
|
||||
absl::optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
|
||||
absl::optional<std::string> mid;
|
||||
absl::optional<int> max_bandwidth_bps;
|
||||
absl::optional<bool> conference_mode;
|
||||
absl::optional<webrtc::RtcpMode> rtcp_mode;
|
||||
};
|
||||
|
||||
struct ChangedRecvParameters {
|
||||
// These optionals are unset if not changed.
|
||||
rtc::Optional<std::vector<VideoCodecSettings>> codec_settings;
|
||||
rtc::Optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
|
||||
absl::optional<std::vector<VideoCodecSettings>> codec_settings;
|
||||
absl::optional<std::vector<webrtc::RtpExtension>> rtp_header_extensions;
|
||||
// Keep track of the FlexFEC payload type separately from |codec_settings|.
|
||||
// This allows us to recreate the FlexfecReceiveStream separately from the
|
||||
// VideoReceiveStream when the FlexFEC payload type is changed.
|
||||
rtc::Optional<int> flexfec_payload_type;
|
||||
absl::optional<int> flexfec_payload_type;
|
||||
};
|
||||
|
||||
bool GetChangedSendParameters(const VideoSendParameters& params,
|
||||
@ -250,8 +250,8 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
const VideoOptions& options,
|
||||
bool enable_cpu_overuse_detection,
|
||||
int max_bitrate_bps,
|
||||
const rtc::Optional<VideoCodecSettings>& codec_settings,
|
||||
const rtc::Optional<std::vector<webrtc::RtpExtension>>& rtp_extensions,
|
||||
const absl::optional<VideoCodecSettings>& codec_settings,
|
||||
const absl::optional<std::vector<webrtc::RtpExtension>>& rtp_extensions,
|
||||
const VideoSendParameters& send_params);
|
||||
virtual ~WebRtcVideoSendStream();
|
||||
|
||||
@ -286,12 +286,12 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
webrtc::VideoSendStream::Config config,
|
||||
const VideoOptions& options,
|
||||
int max_bitrate_bps,
|
||||
const rtc::Optional<VideoCodecSettings>& codec_settings);
|
||||
const absl::optional<VideoCodecSettings>& codec_settings);
|
||||
webrtc::VideoSendStream::Config config;
|
||||
VideoOptions options;
|
||||
int max_bitrate_bps;
|
||||
bool conference_mode;
|
||||
rtc::Optional<VideoCodecSettings> codec_settings;
|
||||
absl::optional<VideoCodecSettings> codec_settings;
|
||||
// Sent resolutions + bitrates etc. by the underlying VideoSendStream,
|
||||
// typically changes when setting a new resolution or reconfiguring
|
||||
// bitrates.
|
||||
@ -402,7 +402,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
|
||||
std::string GetCodecNameFromPayloadType(int payload_type);
|
||||
|
||||
rtc::Optional<uint32_t> GetFirstPrimarySsrc() const;
|
||||
absl::optional<uint32_t> GetFirstPrimarySsrc() const;
|
||||
|
||||
webrtc::Call* const call_;
|
||||
StreamParams stream_params_;
|
||||
@ -444,7 +444,7 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
// Select what video codec will be used for sending, i.e. what codec is used
|
||||
// for local encoding, based on supported remote codecs. The first remote
|
||||
// codec that is supported locally will be selected.
|
||||
rtc::Optional<VideoCodecSettings> SelectSendVideoCodec(
|
||||
absl::optional<VideoCodecSettings> SelectSendVideoCodec(
|
||||
const std::vector<VideoCodecSettings>& remote_mapped_codecs) const;
|
||||
|
||||
static bool NonFlexfecReceiveCodecsHaveChanged(
|
||||
@ -477,8 +477,8 @@ class WebRtcVideoChannel : public VideoMediaChannel, public webrtc::Transport {
|
||||
std::set<uint32_t> send_ssrcs_ RTC_GUARDED_BY(stream_crit_);
|
||||
std::set<uint32_t> receive_ssrcs_ RTC_GUARDED_BY(stream_crit_);
|
||||
|
||||
rtc::Optional<VideoCodecSettings> send_codec_;
|
||||
rtc::Optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_;
|
||||
absl::optional<VideoCodecSettings> send_codec_;
|
||||
absl::optional<std::vector<webrtc::RtpExtension>> send_rtp_extensions_;
|
||||
|
||||
webrtc::VideoEncoderFactory* const encoder_factory_;
|
||||
DecoderFactoryAdapter* const decoder_factory_;
|
||||
|
||||
@ -584,7 +584,7 @@ size_t WebRtcVideoEngineTest::GetEngineCodecIndex(
|
||||
// The tests only use H264 Constrained Baseline. Make sure we don't return
|
||||
// an internal H264 codec from the engine with a different H264 profile.
|
||||
if (CodecNamesEq(name.c_str(), kH264CodecName)) {
|
||||
const rtc::Optional<webrtc::H264::ProfileLevelId> profile_level_id =
|
||||
const absl::optional<webrtc::H264::ProfileLevelId> profile_level_id =
|
||||
webrtc::H264::ParseSdpProfileLevelId(engine_codec.params);
|
||||
if (profile_level_id->profile !=
|
||||
webrtc::H264::kProfileConstrainedBaseline) {
|
||||
@ -5320,7 +5320,7 @@ TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersPriorityOneStream) {
|
||||
// Check that the vector of VideoStreams also was propagated correctly. Note
|
||||
// that this is testing the behavior of the FakeVideoSendStream, which mimics
|
||||
// the calls to CreateEncoderStreams to get the VideoStreams.
|
||||
EXPECT_EQ(rtc::Optional<double>(new_bitrate_priority),
|
||||
EXPECT_EQ(absl::optional<double>(new_bitrate_priority),
|
||||
video_send_stream->GetVideoStreams()[0].bitrate_priority);
|
||||
}
|
||||
|
||||
@ -5381,13 +5381,13 @@ TEST_F(WebRtcVideoChannelTest, SetRtpSendParametersPrioritySimulcastStreams) {
|
||||
// these are created appropriately for the simulcast case.
|
||||
EXPECT_EQ(rtc::checked_cast<size_t>(kNumSimulcastStreams),
|
||||
video_send_stream->GetVideoStreams().size());
|
||||
EXPECT_EQ(rtc::Optional<double>(new_bitrate_priority),
|
||||
EXPECT_EQ(absl::optional<double>(new_bitrate_priority),
|
||||
video_send_stream->GetVideoStreams()[0].bitrate_priority);
|
||||
// Since we are only setting bitrate priority per-sender, the other
|
||||
// VideoStreams should have a bitrate priority of 0.
|
||||
EXPECT_EQ(rtc::nullopt,
|
||||
EXPECT_EQ(absl::nullopt,
|
||||
video_send_stream->GetVideoStreams()[1].bitrate_priority);
|
||||
EXPECT_EQ(rtc::nullopt,
|
||||
EXPECT_EQ(absl::nullopt,
|
||||
video_send_stream->GetVideoStreams()[2].bitrate_priority);
|
||||
EXPECT_TRUE(channel_->SetVideoSend(primary_ssrc, nullptr, nullptr));
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ bool VerifyUniquePayloadTypes(const std::vector<AudioCodec>& codecs) {
|
||||
return it == payload_types.end();
|
||||
}
|
||||
|
||||
rtc::Optional<std::string> GetAudioNetworkAdaptorConfig(
|
||||
absl::optional<std::string> GetAudioNetworkAdaptorConfig(
|
||||
const AudioOptions& options) {
|
||||
if (options.audio_network_adaptor && *options.audio_network_adaptor &&
|
||||
options.audio_network_adaptor_config) {
|
||||
@ -155,14 +155,14 @@ rtc::Optional<std::string> GetAudioNetworkAdaptorConfig(
|
||||
// equals true and |options_.audio_network_adaptor_config| has a value.
|
||||
return options.audio_network_adaptor_config;
|
||||
}
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
// |max_send_bitrate_bps| is the bitrate from "b=" in SDP.
|
||||
// |rtp_max_bitrate_bps| is the bitrate from RtpSender::SetParameters.
|
||||
rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps,
|
||||
rtc::Optional<int> rtp_max_bitrate_bps,
|
||||
const webrtc::AudioCodecSpec& spec) {
|
||||
absl::optional<int> ComputeSendBitrate(int max_send_bitrate_bps,
|
||||
absl::optional<int> rtp_max_bitrate_bps,
|
||||
const webrtc::AudioCodecSpec& spec) {
|
||||
// If application-configured bitrate is set, take minimum of that and SDP
|
||||
// bitrate.
|
||||
const int bps =
|
||||
@ -181,7 +181,7 @@ rtc::Optional<int> ComputeSendBitrate(int max_send_bitrate_bps,
|
||||
<< " to bitrate " << bps << " bps"
|
||||
<< ", requires at least " << spec.info.min_bitrate_bps
|
||||
<< " bps.";
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
if (spec.info.HasFixedBitrate()) {
|
||||
@ -683,7 +683,7 @@ AudioCodecs WebRtcVoiceEngine::CollectCodecs(
|
||||
|
||||
auto map_format = [&mapper](const webrtc::SdpAudioFormat& format,
|
||||
AudioCodecs* out) {
|
||||
rtc::Optional<AudioCodec> opt_codec = mapper.ToAudioCodec(format);
|
||||
absl::optional<AudioCodec> opt_codec = mapper.ToAudioCodec(format);
|
||||
if (opt_codec) {
|
||||
if (out) {
|
||||
out->push_back(*opt_codec);
|
||||
@ -698,7 +698,7 @@ AudioCodecs WebRtcVoiceEngine::CollectCodecs(
|
||||
|
||||
for (const auto& spec : specs) {
|
||||
// We need to do some extra stuff before adding the main codecs to out.
|
||||
rtc::Optional<AudioCodec> opt_codec = map_format(spec.format, nullptr);
|
||||
absl::optional<AudioCodec> opt_codec = map_format(spec.format, nullptr);
|
||||
if (opt_codec) {
|
||||
AudioCodec& codec = *opt_codec;
|
||||
if (spec.info.supports_network_adaption) {
|
||||
@ -750,15 +750,15 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
|
||||
const std::string& mid,
|
||||
const std::string& c_name,
|
||||
const std::string track_id,
|
||||
const rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec>&
|
||||
const absl::optional<webrtc::AudioSendStream::Config::SendCodecSpec>&
|
||||
send_codec_spec,
|
||||
const std::vector<webrtc::RtpExtension>& extensions,
|
||||
int max_send_bitrate_bps,
|
||||
const rtc::Optional<std::string>& audio_network_adaptor_config,
|
||||
const absl::optional<std::string>& audio_network_adaptor_config,
|
||||
webrtc::Call* call,
|
||||
webrtc::Transport* send_transport,
|
||||
const rtc::scoped_refptr<webrtc::AudioEncoderFactory>& encoder_factory,
|
||||
const rtc::Optional<webrtc::AudioCodecPairId> codec_pair_id)
|
||||
const absl::optional<webrtc::AudioCodecPairId> codec_pair_id)
|
||||
: call_(call),
|
||||
config_(send_transport),
|
||||
send_side_bwe_with_overhead_(
|
||||
@ -815,7 +815,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
|
||||
}
|
||||
|
||||
void SetAudioNetworkAdaptorConfig(
|
||||
const rtc::Optional<std::string>& audio_network_adaptor_config) {
|
||||
const absl::optional<std::string>& audio_network_adaptor_config) {
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
if (config_.audio_network_adaptor_config == audio_network_adaptor_config) {
|
||||
return;
|
||||
@ -976,7 +976,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
|
||||
return error;
|
||||
}
|
||||
|
||||
rtc::Optional<int> send_rate;
|
||||
absl::optional<int> send_rate;
|
||||
if (audio_codec_spec_) {
|
||||
send_rate = ComputeSendBitrate(max_send_bitrate_bps_,
|
||||
parameters.encodings[0].max_bitrate_bps,
|
||||
@ -986,7 +986,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
|
||||
}
|
||||
}
|
||||
|
||||
const rtc::Optional<int> old_rtp_max_bitrate =
|
||||
const absl::optional<int> old_rtp_max_bitrate =
|
||||
rtp_parameters_.encodings[0].max_bitrate_bps;
|
||||
double old_priority = rtp_parameters_.encodings[0].bitrate_priority;
|
||||
rtp_parameters_ = parameters;
|
||||
@ -1122,7 +1122,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioSendStream
|
||||
bool muted_ = false;
|
||||
int max_send_bitrate_bps_;
|
||||
webrtc::RtpParameters rtp_parameters_;
|
||||
rtc::Optional<webrtc::AudioCodecSpec> audio_codec_spec_;
|
||||
absl::optional<webrtc::AudioCodecSpec> audio_codec_spec_;
|
||||
|
||||
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(WebRtcAudioSendStream);
|
||||
};
|
||||
@ -1140,7 +1140,7 @@ class WebRtcVoiceMediaChannel::WebRtcAudioReceiveStream {
|
||||
webrtc::Transport* rtcp_send_transport,
|
||||
const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
|
||||
const std::map<int, webrtc::SdpAudioFormat>& decoder_map,
|
||||
rtc::Optional<webrtc::AudioCodecPairId> codec_pair_id,
|
||||
absl::optional<webrtc::AudioCodecPairId> codec_pair_id,
|
||||
size_t jitter_buffer_max_packets,
|
||||
bool jitter_buffer_fast_accelerate)
|
||||
: call_(call), config_() {
|
||||
@ -1515,7 +1515,7 @@ bool WebRtcVoiceMediaChannel::SetOptions(const AudioOptions& options) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rtc::Optional<std::string> audio_network_adaptor_config =
|
||||
absl::optional<std::string> audio_network_adaptor_config =
|
||||
GetAudioNetworkAdaptorConfig(options_);
|
||||
for (auto& it : send_streams_) {
|
||||
it.second->SetAudioNetworkAdaptorConfig(audio_network_adaptor_config);
|
||||
@ -1608,7 +1608,7 @@ bool WebRtcVoiceMediaChannel::SetRecvCodecs(
|
||||
bool WebRtcVoiceMediaChannel::SetSendCodecs(
|
||||
const std::vector<AudioCodec>& codecs) {
|
||||
RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
|
||||
dtmf_payload_type_ = rtc::nullopt;
|
||||
dtmf_payload_type_ = absl::nullopt;
|
||||
dtmf_payload_freq_ = -1;
|
||||
|
||||
// Validate supplied codecs list.
|
||||
@ -1638,9 +1638,10 @@ bool WebRtcVoiceMediaChannel::SetSendCodecs(
|
||||
}
|
||||
|
||||
// Scan through the list to figure out the codec to use for sending.
|
||||
rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec> send_codec_spec;
|
||||
absl::optional<webrtc::AudioSendStream::Config::SendCodecSpec>
|
||||
send_codec_spec;
|
||||
webrtc::BitrateConstraints bitrate_config;
|
||||
rtc::Optional<webrtc::AudioCodecInfo> voice_codec_info;
|
||||
absl::optional<webrtc::AudioCodecInfo> voice_codec_info;
|
||||
for (const AudioCodec& voice_codec : codecs) {
|
||||
if (!(IsCodec(voice_codec, kCnCodecName) ||
|
||||
IsCodec(voice_codec, kDtmfCodecName) ||
|
||||
@ -1811,7 +1812,7 @@ bool WebRtcVoiceMediaChannel::AddSendStream(const StreamParams& sp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rtc::Optional<std::string> audio_network_adaptor_config =
|
||||
absl::optional<std::string> audio_network_adaptor_config =
|
||||
GetAudioNetworkAdaptorConfig(options_);
|
||||
WebRtcAudioSendStream* stream = new WebRtcAudioSendStream(
|
||||
ssrc, mid_, sp.cname, sp.id, send_codec_spec_, send_rtp_extensions_,
|
||||
|
||||
@ -124,10 +124,10 @@ class WebRtcVoiceEngine final {
|
||||
// in case they are missing in the audio options. We need to do this because
|
||||
// SetExtraOptions() will revert to defaults for options which are not
|
||||
// provided.
|
||||
rtc::Optional<bool> extended_filter_aec_;
|
||||
rtc::Optional<bool> delay_agnostic_aec_;
|
||||
rtc::Optional<bool> experimental_ns_;
|
||||
rtc::Optional<bool> intelligibility_enhancer_;
|
||||
absl::optional<bool> extended_filter_aec_;
|
||||
absl::optional<bool> delay_agnostic_aec_;
|
||||
absl::optional<bool> experimental_ns_;
|
||||
absl::optional<bool> intelligibility_enhancer_;
|
||||
// Jitter buffer settings for new streams.
|
||||
size_t audio_jitter_buffer_max_packets_ = 50;
|
||||
bool audio_jitter_buffer_fast_accelerate_ = false;
|
||||
@ -241,7 +241,7 @@ class WebRtcVoiceMediaChannel final : public VoiceMediaChannel,
|
||||
|
||||
int max_send_bitrate_bps_ = 0;
|
||||
AudioOptions options_;
|
||||
rtc::Optional<int> dtmf_payload_type_;
|
||||
absl::optional<int> dtmf_payload_type_;
|
||||
int dtmf_payload_freq_ = -1;
|
||||
bool recv_transport_cc_enabled_ = false;
|
||||
bool recv_nack_enabled_ = false;
|
||||
@ -277,7 +277,7 @@ class WebRtcVoiceMediaChannel final : public VoiceMediaChannel,
|
||||
std::map<uint32_t, WebRtcAudioReceiveStream*> recv_streams_;
|
||||
std::vector<webrtc::RtpExtension> recv_rtp_extensions_;
|
||||
|
||||
rtc::Optional<webrtc::AudioSendStream::Config::SendCodecSpec>
|
||||
absl::optional<webrtc::AudioSendStream::Config::SendCodecSpec>
|
||||
send_codec_spec_;
|
||||
|
||||
// TODO(kwiberg): Per-SSRC codec pair IDs?
|
||||
|
||||
@ -386,11 +386,12 @@ class WebRtcVoiceEngineTestFake : public testing::Test {
|
||||
EXPECT_EQ(expected_bitrate, spec->target_bitrate_bps);
|
||||
}
|
||||
|
||||
rtc::Optional<int> GetCodecBitrate(int32_t ssrc) {
|
||||
absl::optional<int> GetCodecBitrate(int32_t ssrc) {
|
||||
return GetSendStreamConfig(ssrc).send_codec_spec->target_bitrate_bps;
|
||||
}
|
||||
|
||||
const rtc::Optional<std::string>& GetAudioNetworkAdaptorConfig(int32_t ssrc) {
|
||||
const absl::optional<std::string>& GetAudioNetworkAdaptorConfig(
|
||||
int32_t ssrc) {
|
||||
return GetSendStreamConfig(ssrc).audio_network_adaptor_config;
|
||||
}
|
||||
|
||||
@ -1092,7 +1093,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetRtpParametersEncodingsActive) {
|
||||
// Now change it back to active and verify we resume sending.
|
||||
// This should occur even when other parameters are updated.
|
||||
parameters.encodings[0].active = true;
|
||||
parameters.encodings[0].max_bitrate_bps = rtc::Optional<int>(6000);
|
||||
parameters.encodings[0].max_bitrate_bps = absl::optional<int>(6000);
|
||||
EXPECT_TRUE(channel_->SetRtpSendParameters(kSsrcX, parameters).ok());
|
||||
EXPECT_TRUE(GetSendStream(kSsrcX).IsSending());
|
||||
}
|
||||
@ -1344,7 +1345,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecs) {
|
||||
EXPECT_EQ(22000, send_codec_spec.target_bitrate_bps);
|
||||
EXPECT_STRCASEEQ("ISAC", send_codec_spec.format.name.c_str());
|
||||
EXPECT_NE(send_codec_spec.format.clockrate_hz, 8000);
|
||||
EXPECT_EQ(rtc::nullopt, send_codec_spec.cng_payload_type);
|
||||
EXPECT_EQ(absl::nullopt, send_codec_spec.cng_payload_type);
|
||||
EXPECT_FALSE(channel_->CanInsertDtmf());
|
||||
}
|
||||
|
||||
@ -1943,7 +1944,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNNoMatch) {
|
||||
{
|
||||
const auto& send_codec_spec = *GetSendStreamConfig(kSsrcX).send_codec_spec;
|
||||
EXPECT_STRCASEEQ("PCMU", send_codec_spec.format.name.c_str());
|
||||
EXPECT_EQ(rtc::nullopt, send_codec_spec.cng_payload_type);
|
||||
EXPECT_EQ(absl::nullopt, send_codec_spec.cng_payload_type);
|
||||
}
|
||||
// Set PCMU(8K) and CN(8K). VAD should be activated.
|
||||
parameters.codecs[1] = kCn8000Codec;
|
||||
@ -1960,7 +1961,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsCNNoMatch) {
|
||||
{
|
||||
const auto& send_codec_spec = *GetSendStreamConfig(kSsrcX).send_codec_spec;
|
||||
EXPECT_STRCASEEQ("ISAC", send_codec_spec.format.name.c_str());
|
||||
EXPECT_EQ(rtc::nullopt, send_codec_spec.cng_payload_type);
|
||||
EXPECT_EQ(absl::nullopt, send_codec_spec.cng_payload_type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2155,7 +2156,7 @@ TEST_F(WebRtcVoiceEngineTestFake, SetSendCodecsWithMultipleSendStreams) {
|
||||
const auto& send_codec_spec =
|
||||
*call_.GetAudioSendStream(ssrc)->GetConfig().send_codec_spec;
|
||||
EXPECT_STRCASEEQ("PCMU", send_codec_spec.format.name.c_str());
|
||||
EXPECT_EQ(rtc::nullopt, send_codec_spec.cng_payload_type);
|
||||
EXPECT_EQ(absl::nullopt, send_codec_spec.cng_payload_type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2322,7 +2323,7 @@ TEST_F(WebRtcVoiceEngineTestFake, AudioSendResetAudioNetworkAdaptor) {
|
||||
cricket::AudioOptions options;
|
||||
options.audio_network_adaptor = false;
|
||||
SetAudioSend(kSsrcX, true, nullptr, &options);
|
||||
EXPECT_EQ(rtc::nullopt, GetAudioNetworkAdaptorConfig(kSsrcX));
|
||||
EXPECT_EQ(absl::nullopt, GetAudioNetworkAdaptorConfig(kSsrcX));
|
||||
}
|
||||
|
||||
TEST_F(WebRtcVoiceEngineTestFake, AudioNetworkAdaptorNotGetOverridden) {
|
||||
@ -2334,7 +2335,7 @@ TEST_F(WebRtcVoiceEngineTestFake, AudioNetworkAdaptorNotGetOverridden) {
|
||||
GetAudioNetworkAdaptorConfig(kSsrcX));
|
||||
const int initial_num = call_.GetNumCreatedSendStreams();
|
||||
cricket::AudioOptions options;
|
||||
options.audio_network_adaptor = rtc::nullopt;
|
||||
options.audio_network_adaptor = absl::nullopt;
|
||||
// Unvalued |options.audio_network_adaptor|.should not reset audio network
|
||||
// adaptor.
|
||||
SetAudioSend(kSsrcX, true, nullptr, &options);
|
||||
|
||||
@ -34,7 +34,6 @@ rtc_static_library("ortc") {
|
||||
# libjingle_peerconnection.
|
||||
deps = [
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api:ortc_api",
|
||||
"../api/video_codecs:builtin_video_decoder_factory",
|
||||
"../api/video_codecs:builtin_video_encoder_factory",
|
||||
@ -54,6 +53,7 @@ rtc_static_library("ortc") {
|
||||
"../rtc_base:checks",
|
||||
"../rtc_base:rtc_base",
|
||||
"../rtc_base:rtc_base_approved",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
if (!build_with_chromium && is_clang) {
|
||||
|
||||
@ -230,7 +230,7 @@ RTCErrorOr<cricket::StreamParamsVec> ToCricketStreamParamsVec(
|
||||
return std::move(cricket_streams);
|
||||
}
|
||||
|
||||
rtc::Optional<RtcpFeedback> ToRtcpFeedback(
|
||||
absl::optional<RtcpFeedback> ToRtcpFeedback(
|
||||
const cricket::FeedbackParam& cricket_feedback) {
|
||||
if (cricket_feedback.id() == cricket::kRtcpFbParamCcm) {
|
||||
if (cricket_feedback.param() == cricket::kRtcpFbCcmParamFir) {
|
||||
@ -238,7 +238,7 @@ rtc::Optional<RtcpFeedback> ToRtcpFeedback(
|
||||
} else {
|
||||
RTC_LOG(LS_WARNING) << "Unsupported parameter for CCM RTCP feedback: "
|
||||
<< cricket_feedback.param();
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
} else if (cricket_feedback.id() == cricket::kRtcpFbParamNack) {
|
||||
if (cricket_feedback.param().empty()) {
|
||||
@ -249,13 +249,13 @@ rtc::Optional<RtcpFeedback> ToRtcpFeedback(
|
||||
} else {
|
||||
RTC_LOG(LS_WARNING) << "Unsupported parameter for NACK RTCP feedback: "
|
||||
<< cricket_feedback.param();
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
} else if (cricket_feedback.id() == cricket::kRtcpFbParamRemb) {
|
||||
if (!cricket_feedback.param().empty()) {
|
||||
RTC_LOG(LS_WARNING) << "Unsupported parameter for REMB RTCP feedback: "
|
||||
<< cricket_feedback.param();
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
} else {
|
||||
return RtcpFeedback(RtcpFeedbackType::REMB);
|
||||
}
|
||||
@ -264,14 +264,14 @@ rtc::Optional<RtcpFeedback> ToRtcpFeedback(
|
||||
RTC_LOG(LS_WARNING)
|
||||
<< "Unsupported parameter for transport-cc RTCP feedback: "
|
||||
<< cricket_feedback.param();
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
} else {
|
||||
return RtcpFeedback(RtcpFeedbackType::TRANSPORT_CC);
|
||||
}
|
||||
}
|
||||
RTC_LOG(LS_WARNING) << "Unsupported RTCP feedback type: "
|
||||
<< cricket_feedback.id();
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
|
||||
std::vector<RtpEncodingParameters> ToRtpEncodings(
|
||||
@ -328,7 +328,7 @@ RtpCodecCapability ToRtpCodecCapability(const C& cricket_codec) {
|
||||
codec.preferred_payload_type.emplace(cricket_codec.id);
|
||||
for (const cricket::FeedbackParam& cricket_feedback :
|
||||
cricket_codec.feedback_params.params()) {
|
||||
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
||||
absl::optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
||||
if (feedback) {
|
||||
codec.rtcp_feedback.push_back(feedback.value());
|
||||
}
|
||||
@ -368,7 +368,7 @@ RtpCodecParameters ToRtpCodecParameters(const C& cricket_codec) {
|
||||
codec_param.payload_type = cricket_codec.id;
|
||||
for (const cricket::FeedbackParam& cricket_feedback :
|
||||
cricket_codec.feedback_params.params()) {
|
||||
rtc::Optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
||||
absl::optional<RtcpFeedback> feedback = ToRtcpFeedback(cricket_feedback);
|
||||
if (feedback) {
|
||||
codec_param.rtcp_feedback.push_back(feedback.value());
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/rtcerror.h"
|
||||
#include "api/rtpparameters.h"
|
||||
#include "media/base/codec.h"
|
||||
@ -80,7 +80,7 @@ RTCErrorOr<cricket::StreamParamsVec> ToCricketStreamParamsVec(
|
||||
|
||||
// Returns empty value if |cricket_feedback| is a feedback type not
|
||||
// supported/recognized.
|
||||
rtc::Optional<RtcpFeedback> ToRtcpFeedback(
|
||||
absl::optional<RtcpFeedback> ToRtcpFeedback(
|
||||
const cricket::FeedbackParam& cricket_feedback);
|
||||
|
||||
std::vector<RtpEncodingParameters> ToRtpEncodings(
|
||||
|
||||
@ -373,7 +373,7 @@ TEST(RtpParametersConversionTest, ToCricketStreamParamsVecMultipleEncodings) {
|
||||
}
|
||||
|
||||
TEST(RtpParametersConversionTest, ToRtcpFeedback) {
|
||||
rtc::Optional<RtcpFeedback> result = ToRtcpFeedback({"ccm", "fir"});
|
||||
absl::optional<RtcpFeedback> result = ToRtcpFeedback({"ccm", "fir"});
|
||||
EXPECT_EQ(RtcpFeedback(RtcpFeedbackType::CCM, RtcpFeedbackMessageType::FIR),
|
||||
*result);
|
||||
result = ToRtcpFeedback(cricket::FeedbackParam("nack"));
|
||||
@ -391,7 +391,7 @@ TEST(RtpParametersConversionTest, ToRtcpFeedback) {
|
||||
|
||||
TEST(RtpParametersConversionTest, ToRtcpFeedbackErrors) {
|
||||
// CCM with missing or invalid message type.
|
||||
rtc::Optional<RtcpFeedback> result = ToRtcpFeedback({"ccm", "pli"});
|
||||
absl::optional<RtcpFeedback> result = ToRtcpFeedback({"ccm", "pli"});
|
||||
EXPECT_FALSE(result);
|
||||
result = ToRtcpFeedback(cricket::FeedbackParam("ccm"));
|
||||
EXPECT_FALSE(result);
|
||||
|
||||
@ -83,7 +83,6 @@ rtc_static_library("rtc_p2p") {
|
||||
|
||||
deps = [
|
||||
"../api:libjingle_peerconnection_api",
|
||||
"../api:optional",
|
||||
"../api:ortc_api",
|
||||
"../logging:ice_log",
|
||||
"../rtc_base:checks",
|
||||
@ -91,6 +90,7 @@ rtc_static_library("rtc_p2p") {
|
||||
"../rtc_base:safe_minmax",
|
||||
"../rtc_base:stringutils",
|
||||
"../system_wrappers:field_trial_api",
|
||||
"//third_party/abseil-cpp/absl/types:optional",
|
||||
]
|
||||
|
||||
if (build_with_chromium) {
|
||||
|
||||
@ -457,7 +457,7 @@ int DtlsTransport::GetError() {
|
||||
return ice_transport_->GetError();
|
||||
}
|
||||
|
||||
rtc::Optional<rtc::NetworkRoute> DtlsTransport::network_route() const {
|
||||
absl::optional<rtc::NetworkRoute> DtlsTransport::network_route() const {
|
||||
return ice_transport_->network_route();
|
||||
}
|
||||
|
||||
@ -693,7 +693,7 @@ void DtlsTransport::OnDtlsEvent(rtc::StreamInterface* dtls, int sig, int err) {
|
||||
}
|
||||
|
||||
void DtlsTransport::OnNetworkRouteChanged(
|
||||
rtc::Optional<rtc::NetworkRoute> network_route) {
|
||||
absl::optional<rtc::NetworkRoute> network_route) {
|
||||
SignalNetworkRouteChanged(network_route);
|
||||
}
|
||||
|
||||
@ -799,7 +799,7 @@ void DtlsTransport::OnDtlsHandshakeError(rtc::SSLHandshakeError error) {
|
||||
|
||||
void DtlsTransport::ConfigureHandshakeTimeout() {
|
||||
RTC_DCHECK(dtls_);
|
||||
rtc::Optional<int> rtt = ice_transport_->GetRttEstimate();
|
||||
absl::optional<int> rtt = ice_transport_->GetRttEstimate();
|
||||
if (rtt) {
|
||||
// Limit the timeout to a reasonable range in case the ICE RTT takes
|
||||
// extreme values.
|
||||
|
||||
@ -171,7 +171,7 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
|
||||
int GetError() override;
|
||||
|
||||
rtc::Optional<rtc::NetworkRoute> network_route() const override;
|
||||
absl::optional<rtc::NetworkRoute> network_route() const override;
|
||||
|
||||
int SetOption(rtc::Socket::Option opt, int value) override;
|
||||
|
||||
@ -198,7 +198,7 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
void OnReadyToSend(rtc::PacketTransportInternal* transport);
|
||||
void OnReceivingState(rtc::PacketTransportInternal* transport);
|
||||
void OnDtlsEvent(rtc::StreamInterface* stream_, int sig, int err);
|
||||
void OnNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute> network_route);
|
||||
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route);
|
||||
bool SetupDtls();
|
||||
void MaybeStartDtls();
|
||||
bool HandleDtlsPacket(const char* data, size_t size);
|
||||
@ -223,7 +223,7 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
std::vector<int> srtp_ciphers_; // SRTP ciphers to use with DTLS.
|
||||
bool dtls_active_ = false;
|
||||
rtc::scoped_refptr<rtc::RTCCertificate> local_certificate_;
|
||||
rtc::Optional<rtc::SSLRole> dtls_role_;
|
||||
absl::optional<rtc::SSLRole> dtls_role_;
|
||||
rtc::SSLProtocolVersion ssl_max_version_;
|
||||
rtc::CryptoOptions crypto_options_;
|
||||
rtc::Buffer remote_fingerprint_value_;
|
||||
|
||||
@ -225,7 +225,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
|
||||
}
|
||||
int GetError() override { return ice_transport_->GetError(); }
|
||||
|
||||
rtc::Optional<rtc::NetworkRoute> network_route() const override {
|
||||
absl::optional<rtc::NetworkRoute> network_route() const override {
|
||||
return ice_transport_->network_route();
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
|
||||
SignalWritableState(this);
|
||||
}
|
||||
|
||||
void OnNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute> network_route) {
|
||||
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route) {
|
||||
SignalNetworkRouteChanged(network_route);
|
||||
}
|
||||
|
||||
@ -271,7 +271,7 @@ class FakeDtlsTransport : public DtlsTransportInternal {
|
||||
bool do_dtls_ = false;
|
||||
rtc::SSLProtocolVersion ssl_max_version_ = rtc::SSL_PROTOCOL_DTLS_12;
|
||||
rtc::SSLFingerprint dtls_fingerprint_;
|
||||
rtc::Optional<rtc::SSLRole> dtls_role_;
|
||||
absl::optional<rtc::SSLRole> dtls_role_;
|
||||
int crypto_suite_ = rtc::SRTP_AES128_CM_SHA1_80;
|
||||
rtc::CryptoOptions crypto_options_;
|
||||
|
||||
|
||||
@ -168,7 +168,7 @@ class FakeIceTransport : public IceTransportInternal {
|
||||
return true;
|
||||
}
|
||||
|
||||
rtc::Optional<int> GetRttEstimate() override { return rtc::nullopt; }
|
||||
absl::optional<int> GetRttEstimate() override { return absl::nullopt; }
|
||||
|
||||
void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override {
|
||||
}
|
||||
@ -224,10 +224,10 @@ class FakeIceTransport : public IceTransportInternal {
|
||||
|
||||
rtc::CopyOnWriteBuffer last_sent_packet() { return last_sent_packet_; }
|
||||
|
||||
rtc::Optional<rtc::NetworkRoute> network_route() const override {
|
||||
absl::optional<rtc::NetworkRoute> network_route() const override {
|
||||
return network_route_;
|
||||
}
|
||||
void SetNetworkRoute(rtc::Optional<rtc::NetworkRoute> network_route) {
|
||||
void SetNetworkRoute(absl::optional<rtc::NetworkRoute> network_route) {
|
||||
network_route_ = network_route;
|
||||
}
|
||||
|
||||
@ -282,7 +282,7 @@ class FakeIceTransport : public IceTransportInternal {
|
||||
bool receiving_ = false;
|
||||
bool combine_outgoing_packets_ = false;
|
||||
rtc::CopyOnWriteBuffer send_packet_;
|
||||
rtc::Optional<rtc::NetworkRoute> network_route_;
|
||||
absl::optional<rtc::NetworkRoute> network_route_;
|
||||
std::map<rtc::Socket::Option, int> socket_options_;
|
||||
rtc::CopyOnWriteBuffer last_sent_packet_;
|
||||
};
|
||||
|
||||
@ -63,14 +63,14 @@ enum class NominationMode {
|
||||
};
|
||||
|
||||
// Information about ICE configuration.
|
||||
// TODO(deadbeef): Use rtc::Optional to represent unset values, instead of
|
||||
// TODO(deadbeef): Use absl::optional to represent unset values, instead of
|
||||
// -1.
|
||||
struct IceConfig {
|
||||
// The ICE connection receiving timeout value in milliseconds.
|
||||
rtc::Optional<int> receiving_timeout;
|
||||
absl::optional<int> receiving_timeout;
|
||||
// Time interval in milliseconds to ping a backup connection when the ICE
|
||||
// channel is strongly connected.
|
||||
rtc::Optional<int> backup_connection_ping_interval;
|
||||
absl::optional<int> backup_connection_ping_interval;
|
||||
|
||||
ContinualGatheringPolicy continual_gathering_policy = GATHER_ONCE;
|
||||
|
||||
@ -83,7 +83,7 @@ struct IceConfig {
|
||||
bool prioritize_most_likely_candidate_pairs = false;
|
||||
|
||||
// Writable connections are pinged at a slower rate once stablized.
|
||||
rtc::Optional<int> stable_writable_connection_ping_interval;
|
||||
absl::optional<int> stable_writable_connection_ping_interval;
|
||||
|
||||
// If set to true, this means the ICE transport should presume TURN-to-TURN
|
||||
// candidate pairs will succeed, even before a binding response is received.
|
||||
@ -91,16 +91,16 @@ struct IceConfig {
|
||||
|
||||
// Interval to check on all networks and to perform ICE regathering on any
|
||||
// active network having no connection on it.
|
||||
rtc::Optional<int> regather_on_failed_networks_interval;
|
||||
absl::optional<int> regather_on_failed_networks_interval;
|
||||
|
||||
// Interval to perform ICE regathering on all networks
|
||||
// The delay in milliseconds is sampled from the uniform distribution [a, b]
|
||||
rtc::Optional<rtc::IntervalRange> regather_all_networks_interval_range;
|
||||
absl::optional<rtc::IntervalRange> regather_all_networks_interval_range;
|
||||
|
||||
// The time period in which we will not switch the selected connection
|
||||
// when a new connection becomes receiving but the selected connection is not
|
||||
// in case that the selected connection may become receiving soon.
|
||||
rtc::Optional<int> receiving_switching_delay;
|
||||
absl::optional<int> receiving_switching_delay;
|
||||
|
||||
// TODO(honghaiz): Change the default to regular nomination.
|
||||
// Default nomination mode if the remote does not support renomination.
|
||||
@ -110,12 +110,12 @@ struct IceConfig {
|
||||
// for a candidate pair when it is both writable and receiving (strong
|
||||
// connectivity). This parameter overrides the default value given by
|
||||
// |STRONG_PING_INTERVAL| in p2ptransport.h if set.
|
||||
rtc::Optional<int> ice_check_interval_strong_connectivity;
|
||||
absl::optional<int> ice_check_interval_strong_connectivity;
|
||||
// The interval in milliseconds at which ICE checks (STUN pings) will be sent
|
||||
// for a candidate pair when it is either not writable or not receiving (weak
|
||||
// connectivity). This parameter overrides the default value given by
|
||||
// |WEAK_PING_INTERVAL| in p2ptransport.h if set.
|
||||
rtc::Optional<int> ice_check_interval_weak_connectivity;
|
||||
absl::optional<int> ice_check_interval_weak_connectivity;
|
||||
// ICE checks (STUN pings) will not be sent at higher rate (lower interval)
|
||||
// than this, no matter what other settings there are.
|
||||
// Measure in milliseconds.
|
||||
@ -123,23 +123,23 @@ struct IceConfig {
|
||||
// Note that this parameter overrides both the above check intervals for
|
||||
// candidate pairs with strong or weak connectivity, if either of the above
|
||||
// interval is shorter than the min interval.
|
||||
rtc::Optional<int> ice_check_min_interval;
|
||||
absl::optional<int> ice_check_min_interval;
|
||||
// The min time period for which a candidate pair must wait for response to
|
||||
// connectivity checks before it becomes unwritable. This parameter
|
||||
// overrides the default value given by |CONNECTION_WRITE_CONNECT_TIMEOUT|
|
||||
// in port.h if set, when determining the writability of a candidate pair.
|
||||
rtc::Optional<int> ice_unwritable_timeout;
|
||||
absl::optional<int> ice_unwritable_timeout;
|
||||
|
||||
// The min number of connectivity checks that a candidate pair must sent
|
||||
// without receiving response before it becomes unwritable. This parameter
|
||||
// overrides the default value given by |CONNECTION_WRITE_CONNECT_FAILURES| in
|
||||
// port.h if set, when determining the writability of a candidate pair.
|
||||
rtc::Optional<int> ice_unwritable_min_checks;
|
||||
absl::optional<int> ice_unwritable_min_checks;
|
||||
// The interval in milliseconds at which STUN candidates will resend STUN
|
||||
// binding requests to keep NAT bindings open.
|
||||
rtc::Optional<int> stun_keepalive_interval;
|
||||
absl::optional<int> stun_keepalive_interval;
|
||||
|
||||
rtc::Optional<rtc::AdapterType> network_preference;
|
||||
absl::optional<rtc::AdapterType> network_preference;
|
||||
|
||||
IceConfig();
|
||||
IceConfig(int receiving_timeout_ms,
|
||||
@ -154,7 +154,7 @@ struct IceConfig {
|
||||
|
||||
// Helper getters for parameters with implementation-specific default value.
|
||||
// By convention, parameters with default value are represented by
|
||||
// rtc::Optional and setting a parameter to null restores its default value.
|
||||
// absl::optional and setting a parameter to null restores its default value.
|
||||
int receiving_timeout_or_default() const;
|
||||
int backup_connection_ping_interval_or_default() const;
|
||||
int stable_writable_connection_ping_interval_or_default() const;
|
||||
@ -240,8 +240,8 @@ class IceTransportInternal : public rtc::PacketTransportInternal {
|
||||
CandidateStatsList* candidate_stats_list) = 0;
|
||||
|
||||
// Returns RTT estimate over the currently active connection, or an empty
|
||||
// rtc::Optional if there is none.
|
||||
virtual rtc::Optional<int> GetRttEstimate() = 0;
|
||||
// absl::optional if there is none.
|
||||
virtual absl::optional<int> GetRttEstimate() = 0;
|
||||
|
||||
sigslot::signal1<IceTransportInternal*> SignalGatheringState;
|
||||
|
||||
|
||||
@ -57,7 +57,7 @@ class MockIceTransport : public IceTransportInternal {
|
||||
void SetRemoteIceParameters(const IceParameters& ice_params) override {}
|
||||
void SetRemoteIceMode(IceMode mode) override {}
|
||||
void SetIceConfig(const IceConfig& config) override {}
|
||||
rtc::Optional<int> GetRttEstimate() override { return rtc::nullopt; }
|
||||
absl::optional<int> GetRttEstimate() override { return absl::nullopt; }
|
||||
void MaybeStartGathering() override {}
|
||||
void SetMetricsObserver(webrtc::MetricsObserverInterface* observer) override {
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ static constexpr int a_and_b_equal = 0;
|
||||
|
||||
bool LocalCandidateUsesPreferredNetwork(
|
||||
const cricket::Connection* conn,
|
||||
rtc::Optional<rtc::AdapterType> network_preference) {
|
||||
absl::optional<rtc::AdapterType> network_preference) {
|
||||
rtc::AdapterType network_type = conn->port()->Network()->type();
|
||||
return network_preference.has_value() && (network_type == network_preference);
|
||||
}
|
||||
@ -69,7 +69,7 @@ bool LocalCandidateUsesPreferredNetwork(
|
||||
int CompareCandidatePairsByNetworkPreference(
|
||||
const cricket::Connection* a,
|
||||
const cricket::Connection* b,
|
||||
rtc::Optional<rtc::AdapterType> network_preference) {
|
||||
absl::optional<rtc::AdapterType> network_preference) {
|
||||
bool a_uses_preferred_network =
|
||||
LocalCandidateUsesPreferredNetwork(a, network_preference);
|
||||
bool b_uses_preferred_network =
|
||||
@ -236,7 +236,7 @@ bool P2PTransportChannel::ShouldSwitchSelectedConnection(
|
||||
return false;
|
||||
}
|
||||
|
||||
rtc::Optional<int64_t> receiving_unchanged_threshold(
|
||||
absl::optional<int64_t> receiving_unchanged_threshold(
|
||||
rtc::TimeMillis() - config_.receiving_switching_delay_or_default());
|
||||
int cmp = CompareConnections(selected_connection_, new_connection,
|
||||
receiving_unchanged_threshold,
|
||||
@ -331,12 +331,12 @@ IceGatheringState P2PTransportChannel::gathering_state() const {
|
||||
return gathering_state_;
|
||||
}
|
||||
|
||||
rtc::Optional<int> P2PTransportChannel::GetRttEstimate() {
|
||||
absl::optional<int> P2PTransportChannel::GetRttEstimate() {
|
||||
if (selected_connection_ != nullptr
|
||||
&& selected_connection_->rtt_samples() > 0) {
|
||||
return selected_connection_->rtt();
|
||||
} else {
|
||||
return rtc::nullopt;
|
||||
return absl::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
@ -419,9 +419,9 @@ void P2PTransportChannel::SetRemoteIceMode(IceMode mode) {
|
||||
remote_ice_mode_ = mode;
|
||||
}
|
||||
|
||||
// TODO(qingsi): We apply the convention that setting a rtc::Optional parameter
|
||||
// TODO(qingsi): We apply the convention that setting a absl::optional parameter
|
||||
// to null restores its default value in the implementation. However, some
|
||||
// rtc::Optional parameters are only processed below if non-null, e.g.,
|
||||
// absl::optional parameters are only processed below if non-null, e.g.,
|
||||
// regather_on_failed_networks_interval, and thus there is no way to restore the
|
||||
// defaults. Fix this issue later for consistency.
|
||||
void P2PTransportChannel::SetIceConfig(const IceConfig& config) {
|
||||
@ -1261,7 +1261,7 @@ bool P2PTransportChannel::GetStats(ConnectionInfos* candidate_pair_stats_list,
|
||||
return true;
|
||||
}
|
||||
|
||||
rtc::Optional<rtc::NetworkRoute> P2PTransportChannel::network_route() const {
|
||||
absl::optional<rtc::NetworkRoute> P2PTransportChannel::network_route() const {
|
||||
return network_route_;
|
||||
}
|
||||
|
||||
@ -1319,7 +1319,7 @@ void P2PTransportChannel::MaybeStartPinging() {
|
||||
int P2PTransportChannel::CompareCandidatePairNetworks(
|
||||
const Connection* a,
|
||||
const Connection* b,
|
||||
rtc::Optional<rtc::AdapterType> network_preference) const {
|
||||
absl::optional<rtc::AdapterType> network_preference) const {
|
||||
int compare_a_b_by_network_preference =
|
||||
CompareCandidatePairsByNetworkPreference(a, b,
|
||||
config_.network_preference);
|
||||
@ -1345,7 +1345,7 @@ int P2PTransportChannel::CompareCandidatePairNetworks(
|
||||
int P2PTransportChannel::CompareConnectionStates(
|
||||
const Connection* a,
|
||||
const Connection* b,
|
||||
rtc::Optional<int64_t> receiving_unchanged_threshold,
|
||||
absl::optional<int64_t> receiving_unchanged_threshold,
|
||||
bool* missed_receiving_unchanged_threshold) const {
|
||||
// First, prefer a connection that's writable or presumed writable over
|
||||
// one that's not writable.
|
||||
@ -1474,7 +1474,7 @@ bool P2PTransportChannel::IsRemoteCandidatePruned(const Candidate& cand) const {
|
||||
int P2PTransportChannel::CompareConnections(
|
||||
const Connection* a,
|
||||
const Connection* b,
|
||||
rtc::Optional<int64_t> receiving_unchanged_threshold,
|
||||
absl::optional<int64_t> receiving_unchanged_threshold,
|
||||
bool* missed_receiving_unchanged_threshold) const {
|
||||
RTC_CHECK(a != nullptr);
|
||||
RTC_CHECK(b != nullptr);
|
||||
@ -1538,7 +1538,7 @@ void P2PTransportChannel::SortConnectionsAndUpdateState(
|
||||
// TODO(honghaiz): Don't sort; Just use std::max_element in the right places.
|
||||
std::stable_sort(connections_.begin(), connections_.end(),
|
||||
[this](const Connection* a, const Connection* b) {
|
||||
int cmp = CompareConnections(a, b, rtc::nullopt, nullptr);
|
||||
int cmp = CompareConnections(a, b, absl::nullopt, nullptr);
|
||||
if (cmp != 0) {
|
||||
return cmp > 0;
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ class P2PTransportChannel : public IceTransportInternal {
|
||||
// only update the parameter if it is considered set in |config|. For example,
|
||||
// a negative value of receiving_timeout will be considered "not set" and we
|
||||
// will not use it to update the respective parameter in |config_|.
|
||||
// TODO(deadbeef): Use rtc::Optional instead of negative values.
|
||||
// TODO(deadbeef): Use absl::optional instead of negative values.
|
||||
void SetIceConfig(const IceConfig& config) override;
|
||||
const IceConfig& config() const;
|
||||
static webrtc::RTCError ValidateIceConfig(const IceConfig& config);
|
||||
@ -120,7 +120,7 @@ class P2PTransportChannel : public IceTransportInternal {
|
||||
int GetError() override;
|
||||
bool GetStats(std::vector<ConnectionInfo>* candidate_pair_stats_list,
|
||||
std::vector<CandidateStats>* candidate_stats_list) override;
|
||||
rtc::Optional<int> GetRttEstimate() override;
|
||||
absl::optional<int> GetRttEstimate() override;
|
||||
|
||||
// TODO(honghaiz): Remove this method once the reference of it in
|
||||
// Chromoting is removed.
|
||||
@ -138,7 +138,7 @@ class P2PTransportChannel : public IceTransportInternal {
|
||||
|
||||
void PruneAllPorts();
|
||||
int check_receiving_interval() const;
|
||||
rtc::Optional<rtc::NetworkRoute> network_route() const override;
|
||||
absl::optional<rtc::NetworkRoute> network_route() const override;
|
||||
|
||||
// Helper method used only in unittest.
|
||||
rtc::DiffServCodePoint DefaultDscpValue() const;
|
||||
@ -202,7 +202,7 @@ class P2PTransportChannel : public IceTransportInternal {
|
||||
int CompareCandidatePairNetworks(
|
||||
const Connection* a,
|
||||
const Connection* b,
|
||||
rtc::Optional<rtc::AdapterType> network_preference) const;
|
||||
absl::optional<rtc::AdapterType> network_preference) const;
|
||||
|
||||
// The methods below return a positive value if |a| is preferable to |b|,
|
||||
// a negative value if |b| is preferable, and 0 if they're equally preferable.
|
||||
@ -214,7 +214,7 @@ class P2PTransportChannel : public IceTransportInternal {
|
||||
int CompareConnectionStates(
|
||||
const cricket::Connection* a,
|
||||
const cricket::Connection* b,
|
||||
rtc::Optional<int64_t> receiving_unchanged_threshold,
|
||||
absl::optional<int64_t> receiving_unchanged_threshold,
|
||||
bool* missed_receiving_unchanged_threshold) const;
|
||||
int CompareConnectionCandidates(const cricket::Connection* a,
|
||||
const cricket::Connection* b) const;
|
||||
@ -225,7 +225,7 @@ class P2PTransportChannel : public IceTransportInternal {
|
||||
// Returns a positive value if |a| is better than |b|.
|
||||
int CompareConnections(const cricket::Connection* a,
|
||||
const cricket::Connection* b,
|
||||
rtc::Optional<int64_t> receiving_unchanged_threshold,
|
||||
absl::optional<int64_t> receiving_unchanged_threshold,
|
||||
bool* missed_receiving_unchanged_threshold) const;
|
||||
|
||||
bool PresumedWritable(const cricket::Connection* conn) const;
|
||||
@ -408,7 +408,7 @@ class P2PTransportChannel : public IceTransportInternal {
|
||||
|
||||
rtc::AsyncInvoker invoker_;
|
||||
webrtc::MetricsObserverInterface* metrics_observer_ = nullptr;
|
||||
rtc::Optional<rtc::NetworkRoute> network_route_;
|
||||
absl::optional<rtc::NetworkRoute> network_route_;
|
||||
webrtc::IceEventLog ice_event_log_;
|
||||
|
||||
RTC_DISALLOW_COPY_AND_ASSIGN(P2PTransportChannel);
|
||||
|
||||
@ -113,7 +113,7 @@ enum { MSG_ADD_CANDIDATES, MSG_REMOVE_CANDIDATES };
|
||||
cricket::IceConfig CreateIceConfig(
|
||||
int receiving_timeout,
|
||||
cricket::ContinualGatheringPolicy continual_gathering_policy,
|
||||
rtc::Optional<int> backup_ping_interval = rtc::nullopt) {
|
||||
absl::optional<int> backup_ping_interval = absl::nullopt) {
|
||||
cricket::IceConfig config;
|
||||
config.receiving_timeout = receiving_timeout;
|
||||
config.continual_gathering_policy = continual_gathering_policy;
|
||||
@ -709,7 +709,7 @@ class P2PTransportChannelTestBase : public testing::Test,
|
||||
}
|
||||
}
|
||||
|
||||
void OnNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute> network_route) {
|
||||
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route) {
|
||||
// If the |network_route| is unset, don't count. This is used in the case
|
||||
// when the network on remote side is down, the signal will be fired with an
|
||||
// unset network route and it shouldn't trigger a connection switch.
|
||||
@ -3153,7 +3153,7 @@ class P2PTransportChannelPingTest : public testing::Test,
|
||||
conn->SignalNominated(conn);
|
||||
}
|
||||
|
||||
void OnNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute> network_route) {
|
||||
void OnNetworkRouteChanged(absl::optional<rtc::NetworkRoute> network_route) {
|
||||
last_network_route_ = network_route;
|
||||
if (last_network_route_) {
|
||||
last_sent_packet_id_ = last_network_route_->last_sent_packet_id;
|
||||
@ -3220,7 +3220,7 @@ class P2PTransportChannelPingTest : public testing::Test,
|
||||
int last_sent_packet_id_ = -1;
|
||||
bool channel_ready_to_send_ = false;
|
||||
IceTransportState channel_state_ = IceTransportState::STATE_INIT;
|
||||
rtc::Optional<rtc::NetworkRoute> last_network_route_;
|
||||
absl::optional<rtc::NetworkRoute> last_network_route_;
|
||||
};
|
||||
|
||||
TEST_F(P2PTransportChannelPingTest, TestTriggeredChecks) {
|
||||
|
||||
@ -24,8 +24,8 @@ bool PacketTransportInternal::GetOption(rtc::Socket::Option opt, int* value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
rtc::Optional<NetworkRoute> PacketTransportInternal::network_route() const {
|
||||
return rtc::Optional<NetworkRoute>();
|
||||
absl::optional<NetworkRoute> PacketTransportInternal::network_route() const {
|
||||
return absl::optional<NetworkRoute>();
|
||||
}
|
||||
|
||||
} // namespace rtc
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
// This is included for PacketOptions.
|
||||
#include "api/ortc/packettransportinterface.h"
|
||||
#include "p2p/base/port.h"
|
||||
@ -66,7 +66,7 @@ class PacketTransportInternal : public virtual webrtc::PacketTransportInterface,
|
||||
|
||||
// Returns the current network route with transport overhead.
|
||||
// TODO(zhihuang): Make it pure virtual once the Chrome/remoting is updated.
|
||||
virtual rtc::Optional<NetworkRoute> network_route() const;
|
||||
virtual absl::optional<NetworkRoute> network_route() const;
|
||||
|
||||
// Emitted when the writable state, represented by |writable()|, changes.
|
||||
sigslot::signal1<PacketTransportInternal*> SignalWritableState;
|
||||
@ -94,7 +94,7 @@ class PacketTransportInternal : public virtual webrtc::PacketTransportInterface,
|
||||
SignalSentPacket;
|
||||
|
||||
// Signalled when the current network route has changed.
|
||||
sigslot::signal1<rtc::Optional<rtc::NetworkRoute>> SignalNetworkRouteChanged;
|
||||
sigslot::signal1<absl::optional<rtc::NetworkRoute>> SignalNetworkRouteChanged;
|
||||
|
||||
protected:
|
||||
PacketTransportInternal();
|
||||
|
||||
@ -1740,7 +1740,7 @@ void Connection::MaybeSetRemoteIceParametersAndGeneration(
|
||||
}
|
||||
// TODO(deadbeef): A value of '0' for the generation is used for both
|
||||
// generation 0 and "generation unknown". It should be changed to an
|
||||
// rtc::Optional to fix this.
|
||||
// absl::optional to fix this.
|
||||
if (remote_candidate_.username() == ice_params.ufrag &&
|
||||
remote_candidate_.password() == ice_params.pwd &&
|
||||
remote_candidate_.generation() == 0) {
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/candidate.h"
|
||||
#include "api/optional.h"
|
||||
#include "api/rtcerror.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
|
||||
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
|
||||
@ -107,7 +107,7 @@ class CandidateStats {
|
||||
|
||||
Candidate candidate;
|
||||
// STUN port stats if this candidate is a STUN candidate.
|
||||
rtc::Optional<StunStats> stun_stats;
|
||||
absl::optional<StunStats> stun_stats;
|
||||
};
|
||||
|
||||
typedef std::vector<CandidateStats> CandidateStatsList;
|
||||
@ -152,7 +152,7 @@ struct ConnectionInfo {
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-totalroundtriptime
|
||||
uint64_t total_round_trip_time_ms;
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-currentroundtriptime
|
||||
rtc::Optional<uint32_t> current_round_trip_time_ms;
|
||||
absl::optional<uint32_t> current_round_trip_time_ms;
|
||||
};
|
||||
|
||||
// Information about all the candidate pairs of a channel.
|
||||
@ -379,7 +379,7 @@ class Port : public PortInterface, public rtc::MessageHandler,
|
||||
|
||||
int16_t network_cost() const { return network_cost_; }
|
||||
|
||||
void GetStunStats(rtc::Optional<StunStats>* stats) override{};
|
||||
void GetStunStats(absl::optional<StunStats>* stats) override{};
|
||||
|
||||
protected:
|
||||
enum { MSG_DESTROY_IF_DEAD = 0, MSG_FIRST_AVAILABLE };
|
||||
@ -554,11 +554,11 @@ class Connection : public CandidatePairInterface,
|
||||
int rtt() const { return rtt_; }
|
||||
|
||||
int unwritable_timeout() const;
|
||||
void set_unwritable_timeout(const rtc::Optional<int>& value_ms) {
|
||||
void set_unwritable_timeout(const absl::optional<int>& value_ms) {
|
||||
unwritable_timeout_ = value_ms;
|
||||
}
|
||||
int unwritable_min_checks() const;
|
||||
void set_unwritable_min_checks(const rtc::Optional<int>& value) {
|
||||
void set_unwritable_min_checks(const absl::optional<int>& value) {
|
||||
unwritable_min_checks_ = value;
|
||||
}
|
||||
|
||||
@ -626,7 +626,7 @@ class Connection : public CandidatePairInterface,
|
||||
}
|
||||
|
||||
int receiving_timeout() const;
|
||||
void set_receiving_timeout(rtc::Optional<int> receiving_timeout_ms) {
|
||||
void set_receiving_timeout(absl::optional<int> receiving_timeout_ms) {
|
||||
receiving_timeout_ = receiving_timeout_ms;
|
||||
}
|
||||
|
||||
@ -801,7 +801,7 @@ class Connection : public CandidatePairInterface,
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-totalroundtriptime
|
||||
uint64_t total_round_trip_time_ms_ = 0;
|
||||
// https://w3c.github.io/webrtc-stats/#dom-rtcicecandidatepairstats-currentroundtriptime
|
||||
rtc::Optional<uint32_t> current_round_trip_time_ms_;
|
||||
absl::optional<uint32_t> current_round_trip_time_ms_;
|
||||
int64_t last_ping_sent_; // last time we sent a ping to the other side
|
||||
int64_t last_ping_received_; // last time we received a ping from the other
|
||||
// side
|
||||
@ -812,17 +812,17 @@ class Connection : public CandidatePairInterface,
|
||||
|
||||
PacketLossEstimator packet_loss_estimator_;
|
||||
|
||||
rtc::Optional<int> unwritable_timeout_;
|
||||
rtc::Optional<int> unwritable_min_checks_;
|
||||
absl::optional<int> unwritable_timeout_;
|
||||
absl::optional<int> unwritable_min_checks_;
|
||||
|
||||
bool reported_;
|
||||
IceCandidatePairState state_;
|
||||
// Time duration to switch from receiving to not receiving.
|
||||
rtc::Optional<int> receiving_timeout_;
|
||||
absl::optional<int> receiving_timeout_;
|
||||
int64_t time_created_ms_;
|
||||
int num_pings_sent_ = 0;
|
||||
|
||||
rtc::Optional<webrtc::IceCandidatePairDescription> log_description_;
|
||||
absl::optional<webrtc::IceCandidatePairDescription> log_description_;
|
||||
uint32_t hash_;
|
||||
webrtc::IceEventLog* ice_event_log_ = nullptr;
|
||||
|
||||
|
||||
@ -502,7 +502,7 @@ class PortTest : public testing::Test, public sigslot::has_slots<> {
|
||||
PacketSocketFactory* socket_factory) {
|
||||
return UDPPort::Create(&main_, socket_factory, MakeNetwork(addr), 0, 0,
|
||||
username_, password_, std::string(), true,
|
||||
rtc::nullopt);
|
||||
absl::nullopt);
|
||||
}
|
||||
TCPPort* CreateTcpPort(const SocketAddress& addr) {
|
||||
return CreateTcpPort(addr, &socket_factory_);
|
||||
@ -518,7 +518,7 @@ class PortTest : public testing::Test, public sigslot::has_slots<> {
|
||||
stun_servers.insert(kStunAddr);
|
||||
return StunPort::Create(&main_, factory, MakeNetwork(addr), 0, 0, username_,
|
||||
password_, stun_servers, std::string(),
|
||||
rtc::nullopt);
|
||||
absl::nullopt);
|
||||
}
|
||||
Port* CreateRelayPort(const SocketAddress& addr, RelayType rtype,
|
||||
ProtocolType int_proto, ProtocolType ext_proto) {
|
||||
|
||||
@ -127,7 +127,7 @@ bool PortAllocator::SetConfiguration(
|
||||
int candidate_pool_size,
|
||||
bool prune_turn_ports,
|
||||
webrtc::TurnCustomizer* turn_customizer,
|
||||
const rtc::Optional<int>& stun_candidate_keepalive_interval) {
|
||||
const absl::optional<int>& stun_candidate_keepalive_interval) {
|
||||
CheckRunOnValidThreadIfInitialized();
|
||||
bool ice_servers_changed =
|
||||
(stun_servers != stun_servers_ || turn_servers != turn_servers_);
|
||||
|
||||
@ -250,7 +250,7 @@ class PortAllocatorSession : public sigslot::has_slots<> {
|
||||
// The default value of the interval in implementation is restored if a null
|
||||
// optional value is passed.
|
||||
virtual void SetStunKeepaliveIntervalForReadyPorts(
|
||||
const rtc::Optional<int>& stun_keepalive_interval) {}
|
||||
const absl::optional<int>& stun_keepalive_interval) {}
|
||||
// Another way of getting the information provided by the signals below.
|
||||
//
|
||||
// Ports and candidates are not guaranteed to be in the same order as the
|
||||
@ -353,8 +353,8 @@ class PortAllocator : public sigslot::has_slots<> {
|
||||
int candidate_pool_size,
|
||||
bool prune_turn_ports,
|
||||
webrtc::TurnCustomizer* turn_customizer = nullptr,
|
||||
const rtc::Optional<int>&
|
||||
stun_candidate_keepalive_interval = rtc::nullopt);
|
||||
const absl::optional<int>&
|
||||
stun_candidate_keepalive_interval = absl::nullopt);
|
||||
|
||||
const ServerAddresses& stun_servers() const {
|
||||
CheckRunOnValidThreadIfInitialized();
|
||||
@ -371,7 +371,7 @@ class PortAllocator : public sigslot::has_slots<> {
|
||||
return candidate_pool_size_;
|
||||
}
|
||||
|
||||
const rtc::Optional<int>& stun_candidate_keepalive_interval() const {
|
||||
const absl::optional<int>& stun_candidate_keepalive_interval() const {
|
||||
CheckRunOnValidThreadIfInitialized();
|
||||
return stun_candidate_keepalive_interval_;
|
||||
}
|
||||
@ -607,7 +607,7 @@ class PortAllocator : public sigslot::has_slots<> {
|
||||
// all TurnPort(s) created.
|
||||
webrtc::TurnCustomizer* turn_customizer_ = nullptr;
|
||||
|
||||
rtc::Optional<int> stun_candidate_keepalive_interval_;
|
||||
absl::optional<int> stun_candidate_keepalive_interval_;
|
||||
};
|
||||
|
||||
} // namespace cricket
|
||||
|
||||
@ -14,8 +14,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/candidate.h"
|
||||
#include "api/optional.h"
|
||||
#include "p2p/base/transportdescription.h"
|
||||
#include "rtc_base/asyncpacketsocket.h"
|
||||
#include "rtc_base/socketaddress.h"
|
||||
@ -127,7 +127,7 @@ class PortInterface {
|
||||
|
||||
virtual std::string ToString() const = 0;
|
||||
|
||||
virtual void GetStunStats(rtc::Optional<StunStats>* stats) = 0;
|
||||
virtual void GetStunStats(absl::optional<StunStats>* stats) = 0;
|
||||
|
||||
protected:
|
||||
PortInterface();
|
||||
|
||||
@ -14,7 +14,7 @@ namespace webrtc {
|
||||
|
||||
using Config = BasicRegatheringController::Config;
|
||||
|
||||
Config::Config(const rtc::Optional<rtc::IntervalRange>&
|
||||
Config::Config(const absl::optional<rtc::IntervalRange>&
|
||||
regather_on_all_networks_interval_range,
|
||||
int regather_on_failed_networks_interval)
|
||||
: regather_on_all_networks_interval_range(
|
||||
|
||||
@ -46,13 +46,13 @@ namespace webrtc {
|
||||
class BasicRegatheringController : public sigslot::has_slots<> {
|
||||
public:
|
||||
struct Config {
|
||||
Config(const rtc::Optional<rtc::IntervalRange>&
|
||||
Config(const absl::optional<rtc::IntervalRange>&
|
||||
regather_on_all_networks_interval_range,
|
||||
int regather_on_failed_networks_interval);
|
||||
Config(const Config& other);
|
||||
~Config();
|
||||
Config& operator=(const Config& other);
|
||||
rtc::Optional<rtc::IntervalRange> regather_on_all_networks_interval_range;
|
||||
absl::optional<rtc::IntervalRange> regather_on_all_networks_interval_range;
|
||||
int regather_on_failed_networks_interval;
|
||||
};
|
||||
|
||||
@ -82,7 +82,7 @@ class BasicRegatheringController : public sigslot::has_slots<> {
|
||||
void OnIceTransportStateChanged(cricket::IceTransportInternal*) {}
|
||||
void OnIceTransportWritableState(rtc::PacketTransportInternal*) {}
|
||||
void OnIceTransportReceivingState(rtc::PacketTransportInternal*) {}
|
||||
void OnIceTransportNetworkRouteChanged(rtc::Optional<rtc::NetworkRoute>) {}
|
||||
void OnIceTransportNetworkRouteChanged(absl::optional<rtc::NetworkRoute>) {}
|
||||
// Schedules delayed and repeated regathering of local candidates on all
|
||||
// networks, where the delay in milliseconds is randomly sampled from the
|
||||
// range in the config. The delay of each repetition is independently sampled
|
||||
|
||||
@ -54,7 +54,7 @@ class RegatheringControllerTest : public testing::Test,
|
||||
ice_transport_(new cricket::MockIceTransport()),
|
||||
allocator_(
|
||||
new cricket::FakePortAllocator(rtc::Thread::Current(), nullptr)) {
|
||||
BasicRegatheringController::Config regathering_config(rtc::nullopt, 0);
|
||||
BasicRegatheringController::Config regathering_config(absl::nullopt, 0);
|
||||
regathering_controller_.reset(new BasicRegatheringController(
|
||||
regathering_config, ice_transport_.get(), rtc::Thread::Current()));
|
||||
}
|
||||
@ -171,7 +171,7 @@ TEST_F(RegatheringControllerTest,
|
||||
rtc::ScopedFakeClock clock;
|
||||
InitializeAndGatherOnceWithSessionCleared();
|
||||
|
||||
BasicRegatheringController::Config config(rtc::nullopt, 2000);
|
||||
BasicRegatheringController::Config config(absl::nullopt, 2000);
|
||||
regathering_controller()->SetConfig(config);
|
||||
regathering_controller()->Start();
|
||||
SIMULATED_WAIT(false, 3000, clock);
|
||||
|
||||
@ -314,11 +314,11 @@ ProtocolType UDPPort::GetProtocol() const {
|
||||
return PROTO_UDP;
|
||||
}
|
||||
|
||||
void UDPPort::GetStunStats(rtc::Optional<StunStats>* stats) {
|
||||
void UDPPort::GetStunStats(absl::optional<StunStats>* stats) {
|
||||
*stats = stats_;
|
||||
}
|
||||
|
||||
void UDPPort::set_stun_keepalive_delay(const rtc::Optional<int>& delay) {
|
||||
void UDPPort::set_stun_keepalive_delay(const absl::optional<int>& delay) {
|
||||
stun_keepalive_delay_ = delay.value_or(STUN_KEEPALIVE_INTERVAL);
|
||||
}
|
||||
|
||||
@ -555,7 +555,7 @@ StunPort* StunPort::Create(rtc::Thread* thread,
|
||||
const std::string& password,
|
||||
const ServerAddresses& servers,
|
||||
const std::string& origin,
|
||||
rtc::Optional<int> stun_keepalive_interval) {
|
||||
absl::optional<int> stun_keepalive_interval) {
|
||||
StunPort* port = new StunPort(thread, factory, network, min_port, max_port,
|
||||
username, password, servers, origin);
|
||||
port->set_stun_keepalive_delay(stun_keepalive_interval);
|
||||
|
||||
@ -43,7 +43,7 @@ class UDPPort : public Port {
|
||||
const std::string& password,
|
||||
const std::string& origin,
|
||||
bool emit_local_for_anyaddress,
|
||||
rtc::Optional<int> stun_keepalive_interval) {
|
||||
absl::optional<int> stun_keepalive_interval) {
|
||||
UDPPort* port = new UDPPort(thread, factory, network, socket, username,
|
||||
password, origin, emit_local_for_anyaddress);
|
||||
port->set_stun_keepalive_delay(stun_keepalive_interval);
|
||||
@ -63,7 +63,7 @@ class UDPPort : public Port {
|
||||
const std::string& password,
|
||||
const std::string& origin,
|
||||
bool emit_local_for_anyaddress,
|
||||
rtc::Optional<int> stun_keepalive_interval) {
|
||||
absl::optional<int> stun_keepalive_interval) {
|
||||
UDPPort* port =
|
||||
new UDPPort(thread, factory, network, min_port, max_port, username,
|
||||
password, origin, emit_local_for_anyaddress);
|
||||
@ -105,9 +105,9 @@ class UDPPort : public Port {
|
||||
bool SupportsProtocol(const std::string& protocol) const override;
|
||||
ProtocolType GetProtocol() const override;
|
||||
|
||||
void GetStunStats(rtc::Optional<StunStats>* stats) override;
|
||||
void GetStunStats(absl::optional<StunStats>* stats) override;
|
||||
|
||||
void set_stun_keepalive_delay(const rtc::Optional<int>& delay);
|
||||
void set_stun_keepalive_delay(const absl::optional<int>& delay);
|
||||
int stun_keepalive_delay() const {
|
||||
return stun_keepalive_delay_;
|
||||
}
|
||||
@ -267,7 +267,7 @@ class StunPort : public UDPPort {
|
||||
const std::string& password,
|
||||
const ServerAddresses& servers,
|
||||
const std::string& origin,
|
||||
rtc::Optional<int> stun_keepalive_interval);
|
||||
absl::optional<int> stun_keepalive_interval);
|
||||
|
||||
void PrepareAddress() override;
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ class StunPortTestBase : public testing::Test, public sigslot::has_slots<> {
|
||||
stun_port_.reset(cricket::StunPort::Create(
|
||||
rtc::Thread::Current(), &socket_factory_, &network_, 0, 0,
|
||||
rtc::CreateRandomString(16), rtc::CreateRandomString(22), stun_servers,
|
||||
std::string(), rtc::nullopt));
|
||||
std::string(), absl::nullopt));
|
||||
stun_port_->set_stun_keepalive_delay(stun_keepalive_delay_);
|
||||
// If |stun_keepalive_lifetime_| is negative, let the stun port
|
||||
// choose its lifetime from the network type.
|
||||
@ -94,7 +94,7 @@ class StunPortTestBase : public testing::Test, public sigslot::has_slots<> {
|
||||
stun_port_.reset(cricket::UDPPort::Create(
|
||||
rtc::Thread::Current(), &socket_factory_, &network_, socket_.get(),
|
||||
rtc::CreateRandomString(16), rtc::CreateRandomString(22), std::string(),
|
||||
false, rtc::nullopt));
|
||||
false, absl::nullopt));
|
||||
ASSERT_TRUE(stun_port_ != NULL);
|
||||
ServerAddresses stun_servers;
|
||||
stun_servers.insert(server_addr);
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "p2p/base/stun.h"
|
||||
#include "rtc_base/asyncpacketsocket.h"
|
||||
#include "rtc_base/byteorder.h"
|
||||
@ -151,7 +151,7 @@ class TurnEntry : public sigslot::has_slots<> {
|
||||
|
||||
// If the destruction timestamp is set, that means destruction has been
|
||||
// scheduled (will occur TURN_PERMISSION_TIMEOUT after it's scheduled).
|
||||
rtc::Optional<int64_t> destruction_timestamp() {
|
||||
absl::optional<int64_t> destruction_timestamp() {
|
||||
return destruction_timestamp_;
|
||||
}
|
||||
void set_destruction_timestamp(int64_t destruction_timestamp) {
|
||||
@ -185,7 +185,7 @@ class TurnEntry : public sigslot::has_slots<> {
|
||||
// is also used as an ID of the event scheduling. When the destruction event
|
||||
// actually fires, the TurnEntry will be destroyed only if the timestamp here
|
||||
// matches the one in the firing event.
|
||||
rtc::Optional<int64_t> destruction_timestamp_;
|
||||
absl::optional<int64_t> destruction_timestamp_;
|
||||
};
|
||||
|
||||
TurnPort::TurnPort(rtc::Thread* thread,
|
||||
|
||||
@ -336,7 +336,7 @@ class TurnPortTest : public testing::Test,
|
||||
void CreateUdpPort(const SocketAddress& address) {
|
||||
udp_port_.reset(UDPPort::Create(
|
||||
&main_, &socket_factory_, MakeNetwork(address), 0, 0, kIceUfrag2,
|
||||
kIcePwd2, std::string(), false, rtc::nullopt));
|
||||
kIcePwd2, std::string(), false, absl::nullopt));
|
||||
// UDP port will be controlled.
|
||||
udp_port_->SetIceRole(ICEROLE_CONTROLLED);
|
||||
udp_port_->SignalPortComplete.connect(
|
||||
|
||||
@ -96,11 +96,11 @@ int UdpTransport::SendPacket(const char* data,
|
||||
return result;
|
||||
}
|
||||
|
||||
rtc::Optional<rtc::NetworkRoute> UdpTransport::network_route() const {
|
||||
absl::optional<rtc::NetworkRoute> UdpTransport::network_route() const {
|
||||
rtc::NetworkRoute network_route;
|
||||
network_route.packet_overhead =
|
||||
/*kUdpOverhead=*/8 + GetIpOverhead(GetLocalAddress().family());
|
||||
return rtc::Optional<rtc::NetworkRoute>(network_route);
|
||||
return absl::optional<rtc::NetworkRoute>(network_route);
|
||||
}
|
||||
|
||||
int UdpTransport::SetOption(rtc::Socket::Option opt, int value) {
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "api/optional.h"
|
||||
#include "absl/types/optional.h"
|
||||
#include "api/ortc/udptransportinterface.h"
|
||||
#include "p2p/base/packettransportinternal.h"
|
||||
#include "rtc_base/asyncpacketsocket.h" // For PacketOptions.
|
||||
@ -61,7 +61,7 @@ class UdpTransport : public rtc::PacketTransportInternal,
|
||||
|
||||
int GetError() override;
|
||||
|
||||
rtc::Optional<rtc::NetworkRoute> network_route() const override;
|
||||
absl::optional<rtc::NetworkRoute> network_route() const override;
|
||||
|
||||
protected:
|
||||
PacketTransportInternal* GetInternal() override;
|
||||
|
||||
@ -456,7 +456,7 @@ void BasicPortAllocatorSession::Regather(
|
||||
}
|
||||
|
||||
void BasicPortAllocatorSession::SetStunKeepaliveIntervalForReadyPorts(
|
||||
const rtc::Optional<int>& stun_keepalive_interval) {
|
||||
const absl::optional<int>& stun_keepalive_interval) {
|
||||
auto ports = ReadyPorts();
|
||||
for (PortInterface* port : ports) {
|
||||
// The port type and protocol can be used to identify different subclasses
|
||||
|
||||
@ -138,7 +138,7 @@ class BasicPortAllocatorSession : public PortAllocatorSession,
|
||||
void RegatherOnFailedNetworks() override;
|
||||
void RegatherOnAllNetworks() override;
|
||||
void SetStunKeepaliveIntervalForReadyPorts(
|
||||
const rtc::Optional<int>& stun_keepalive_interval) override;
|
||||
const absl::optional<int>& stun_keepalive_interval) override;
|
||||
void PruneAllPorts() override;
|
||||
|
||||
protected:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user