Migrate absl::optional to std::optional

Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
This commit is contained in:
Florent Castelli 2024-08-29 13:00:40 +00:00 committed by WebRTC LUCI CQ
parent 787b907e94
commit 8037fc6ffa
1644 changed files with 8648 additions and 9155 deletions

View File

@ -127,7 +127,6 @@ rtc_library("rtp_headers") {
"../rtc_base/system:rtc_export",
"units:timestamp",
"video:video_rtp_headers",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -147,14 +146,12 @@ rtc_library("rtp_packet_info") {
"../rtc_base/system:rtc_export",
"units:time_delta",
"units:timestamp",
"//third_party/abseil-cpp/absl/types:optional",
]
}
rtc_source_set("video_track_source_constraints") {
visibility = [ "*" ]
sources = [ "video_track_source_constraints.h" ]
deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
rtc_library("media_stream_interface") {
@ -181,7 +178,6 @@ rtc_library("media_stream_interface") {
"video:recordable_encoded_frame",
"video:video_frame",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -243,7 +239,6 @@ rtc_library("dtls_transport_interface") {
"../rtc_base:ssl",
"../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -391,7 +386,6 @@ rtc_library("libjingle_peerconnection_api") {
"//third_party/abseil-cpp/absl/functional:any_invocable",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
# Basically, don't add stuff here. You might break sensitive downstream
# targets like pnacl. API should not depend on anything outside of this
@ -421,7 +415,6 @@ rtc_source_set("frame_transformer_interface") {
"units:timestamp",
"video:encoded_frame",
"video:video_frame_metadata",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -437,7 +430,6 @@ rtc_library("rtc_error") {
"../rtc_base:macromagic",
"../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -498,7 +490,6 @@ rtc_source_set("video_quality_analyzer_api") {
"video:video_rtp_headers",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -542,7 +533,6 @@ rtc_library("rtp_parameters") {
"video_codecs:scalability_mode",
"//third_party/abseil-cpp/absl/container:inlined_vector",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -634,7 +624,6 @@ rtc_source_set("peer_connection_quality_test_fixture_api") {
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -649,7 +638,6 @@ rtc_source_set("frame_generator_api") {
":scoped_refptr",
"../rtc_base:checks",
"video:video_frame",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -688,7 +676,6 @@ if (rtc_include_tests) {
"transport:bitrate_settings",
"transport:network_control",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -758,7 +745,6 @@ rtc_library("create_frame_generator") {
"environment:environment_factory",
"//third_party/abseil-cpp/absl/base:nullability",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -777,7 +763,6 @@ rtc_library("create_peer_connection_quality_test_frame_generator") {
"../test:fileutils",
"test/pclf:media_configuration",
"units:time_delta",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -824,7 +809,6 @@ rtc_source_set("rtc_stats_api") {
"../rtc_base:refcount",
"../rtc_base/system:rtc_export",
"units:timestamp",
"//third_party/abseil-cpp/absl/types:optional",
"//third_party/abseil-cpp/absl/types:variant",
]
}
@ -840,7 +824,6 @@ rtc_library("audio_options_api") {
":array_view",
"../rtc_base:stringutils",
"../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -875,7 +858,6 @@ rtc_source_set("simulated_network_api") {
"../rtc_base:random",
"units:data_rate",
"//third_party/abseil-cpp/absl/functional:any_invocable",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -905,7 +887,6 @@ rtc_source_set("network_emulation_manager_api") {
"units:data_size",
"units:timestamp",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1052,7 +1033,6 @@ if (rtc_include_tests) {
"//third_party/abseil-cpp/absl/flags:flag",
"//third_party/abseil-cpp/absl/flags:parse",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
}
@ -1089,7 +1069,6 @@ if (rtc_include_tests) {
"../api/units:frequency",
"../rtc_base:stringutils",
"video:video_frame_type",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1104,7 +1083,6 @@ if (rtc_include_tests) {
"video:encoded_image",
"video:video_frame",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1143,7 +1121,6 @@ if (rtc_include_tests) {
deps = [
"../api:media_stream_interface",
"../test:test_support",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1160,7 +1137,6 @@ if (rtc_include_tests) {
"../rtc_base:refcount",
"../test:test_support",
"//third_party/abseil-cpp/absl/functional:any_invocable",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1238,7 +1214,6 @@ if (rtc_include_tests) {
"../test:test_support",
"units:data_rate",
"video:render_resolution",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1329,7 +1304,6 @@ if (rtc_include_tests) {
"transport:bandwidth_estimation_settings",
"transport:bitrate_settings",
"transport:network_control",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1414,7 +1388,6 @@ if (rtc_include_tests) {
"crypto:frame_encryptor_interface",
"transport/rtp:rtp_source",
"video_codecs:video_codecs_api",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1428,7 +1401,6 @@ if (rtc_include_tests) {
":frame_transformer_interface",
"../api/units:timestamp",
"../test:test_support",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1443,7 +1415,6 @@ if (rtc_include_tests) {
"../test:test_support",
"units:timestamp",
"video:video_frame_metadata",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1498,7 +1469,6 @@ if (rtc_include_tests) {
"../test:test_support",
"video:encoded_image",
"video:video_frame",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -1630,7 +1600,6 @@ if (rtc_include_tests) {
"//third_party/abseil-cpp/absl/functional:any_invocable",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -20,7 +20,6 @@ rtc_source_set("audio_device") {
"../../rtc_base:checks",
"../../rtc_base:stringutils",
"../task_queue",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -41,7 +40,6 @@ rtc_library("audio_frame_api") {
"../../rtc_base:logging",
"../../rtc_base:macromagic",
"../../rtc_base:timeutils",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -83,7 +81,6 @@ rtc_source_set("audio_processing") {
"../task_queue",
"//third_party/abseil-cpp/absl/base:nullability",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -93,10 +90,7 @@ rtc_source_set("audio_processing_statistics") {
"audio_processing_statistics.cc",
"audio_processing_statistics.h",
]
deps = [
"../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/types:optional",
]
deps = [ "../../rtc_base/system:rtc_export" ]
}
rtc_library("aec3_config") {
@ -125,7 +119,6 @@ rtc_library("aec3_factory") {
":echo_control",
"../../modules/audio_processing/aec3",
"../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -11,7 +11,7 @@
#ifndef API_AUDIO_AUDIO_DEVICE_H_
#define API_AUDIO_AUDIO_DEVICE_H_
#include "absl/types/optional.h"
#include <optional>
#include "api/audio/audio_device_defines.h"
#include "api/ref_count.h"
#include "api/scoped_refptr.h"
@ -169,7 +169,7 @@ class AudioDeviceModule : public webrtc::RefCountInterface {
// Used to generate RTC stats. If not implemented, RTCAudioPlayoutStats will
// not be present in the stats.
virtual absl::optional<Stats> GetStats() const { return absl::nullopt; }
virtual std::optional<Stats> GetStats() const { return std::nullopt; }
// Only supported on iOS.
#if defined(WEBRTC_IOS)

View File

@ -14,9 +14,9 @@
#include <stddef.h>
#include <cstdint>
#include <optional>
#include <string>
#include "absl/types/optional.h"
#include "rtc_base/strings/string_builder.h"
namespace webrtc {
@ -57,7 +57,7 @@ class AudioTransport {
uint32_t currentMicLevel,
bool keyPressed,
uint32_t& newMicLevel,
absl::optional<int64_t> estimatedCaptureTimeNS) { // NOLINT
std::optional<int64_t> estimatedCaptureTimeNS) { // NOLINT
// TODO(webrtc:13620) Make the default behaver of the new API to behave as
// the old API. This can be pure virtual if all uses of the old API is
// removed.

View File

@ -13,8 +13,8 @@
#include <string.h>
#include <cstdint>
#include <optional>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/audio_view.h"
#include "api/audio/channel_layout.h"
@ -62,7 +62,7 @@ void AudioFrame::ResetWithoutMuting() {
vad_activity_ = kVadUnknown;
profile_timestamp_ms_ = 0;
packet_infos_ = RtpPacketInfos();
absolute_capture_timestamp_ms_ = absl::nullopt;
absolute_capture_timestamp_ms_ = std::nullopt;
}
void AudioFrame::UpdateFrame(uint32_t timestamp,

View File

@ -15,8 +15,8 @@
#include <stdint.h>
#include <array>
#include <optional>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/audio_view.h"
#include "api/audio/channel_layout.h"
@ -164,7 +164,7 @@ class AudioFrame {
absolute_capture_timestamp_ms_ = absolute_capture_time_stamp_ms;
}
absl::optional<int64_t> absolute_capture_timestamp_ms() const {
std::optional<int64_t> absolute_capture_timestamp_ms() const {
return absolute_capture_timestamp_ms_;
}
@ -189,7 +189,7 @@ class AudioFrame {
// Typically used for measuring elapsed time between two different points in
// the audio path. No lock is used to save resources and we are thread safe
// by design.
// TODO(nisse@webrtc.org): consider using absl::optional.
// TODO(nisse@webrtc.org): consider using std::optional.
int64_t profile_timestamp_ms_ = 0;
// Information about packets used to assemble this audio frame. This is needed
@ -222,7 +222,7 @@ class AudioFrame {
// This is only valid for audio frames captured on this machine. The absolute
// capture timestamp of a received frame is found in `packet_infos_`.
// This timestamp MUST be based on the same clock as rtc::TimeMillis().
absl::optional<int64_t> absolute_capture_timestamp_ms_;
std::optional<int64_t> absolute_capture_timestamp_ms_;
};
} // namespace webrtc

View File

@ -24,12 +24,12 @@
#include <array>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include "absl/base/nullability.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio/audio_processing_statistics.h"
#include "api/audio/echo_control.h"
@ -931,8 +931,8 @@ class EchoDetector : public RefCountInterface {
rtc::ArrayView<const float> capture_audio) = 0;
struct Metrics {
absl::optional<double> echo_likelihood;
absl::optional<double> echo_likelihood_recent_max;
std::optional<double> echo_likelihood;
std::optional<double> echo_likelihood_recent_max;
};
// Collect current metrics from the echo detector.

View File

@ -13,7 +13,8 @@
#include <stdint.h>
#include "absl/types/optional.h"
#include <optional>
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -30,16 +31,16 @@ struct RTC_EXPORT AudioProcessingStats {
// It is conservative in flagging audio as speech, with low likelihood of
// incorrectly flagging a frame as voice.
// Only reported if voice detection is enabled in AudioProcessing::Config.
absl::optional<bool> voice_detected;
std::optional<bool> voice_detected;
// AEC Statistics.
// ERL = 10log_10(P_far / P_echo)
absl::optional<double> echo_return_loss;
std::optional<double> echo_return_loss;
// ERLE = 10log_10(P_echo / P_out)
absl::optional<double> echo_return_loss_enhancement;
std::optional<double> echo_return_loss_enhancement;
// Fraction of time that the AEC linear filter is divergent, in a 1-second
// non-overlapped aggregation window.
absl::optional<double> divergent_filter_fraction;
std::optional<double> divergent_filter_fraction;
// The delay metrics consists of the delay median and standard deviation. It
// also consists of the fraction of delay estimates that can make the echo
@ -48,18 +49,18 @@ struct RTC_EXPORT AudioProcessingStats {
// second. Note that if there are several clients pulling metrics from
// `GetStatistics()` during a session the first call from any of them will
// change to one second aggregation window for all.
absl::optional<int32_t> delay_median_ms;
absl::optional<int32_t> delay_standard_deviation_ms;
std::optional<int32_t> delay_median_ms;
std::optional<int32_t> delay_standard_deviation_ms;
// Residual echo detector likelihood.
absl::optional<double> residual_echo_likelihood;
std::optional<double> residual_echo_likelihood;
// Maximum residual echo likelihood from the last time period.
absl::optional<double> residual_echo_likelihood_recent_max;
std::optional<double> residual_echo_likelihood_recent_max;
// The instantaneous delay estimate produced in the AEC. The unit is in
// milliseconds and the value is the instantaneous value at the time of the
// call to `GetStatistics()`.
absl::optional<int32_t> delay_ms;
std::optional<int32_t> delay_ms;
};
} // namespace webrtc

View File

@ -10,8 +10,8 @@
#include "api/audio/echo_canceller3_factory.h"
#include <memory>
#include <optional>
#include "absl/types/optional.h"
#include "api/audio/echo_canceller3_config.h"
#include "api/audio/echo_control.h"
#include "modules/audio_processing/aec3/echo_canceller3.h"
@ -28,7 +28,7 @@ std::unique_ptr<EchoControl> EchoCanceller3Factory::Create(
int num_render_channels,
int num_capture_channels) {
return std::make_unique<EchoCanceller3>(
config_, /*multichannel_config=*/absl::nullopt, sample_rate_hz,
config_, /*multichannel_config=*/std::nullopt, sample_rate_hz,
num_render_channels, num_capture_channels);
}

View File

@ -48,7 +48,6 @@ rtc_library("audio_codecs_api") {
"//third_party/abseil-cpp/absl/base:nullability",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -65,7 +64,6 @@ rtc_library("builtin_audio_decoder_factory") {
"L16:audio_decoder_L16",
"g711:audio_decoder_g711",
"g722:audio_decoder_g722",
"//third_party/abseil-cpp/absl/types:optional",
]
defines = []
if (rtc_include_ilbc) {
@ -99,14 +97,12 @@ rtc_library("builtin_audio_encoder_factory") {
"L16:audio_encoder_L16",
"g711:audio_encoder_g711",
"g722:audio_encoder_g722",
"//third_party/abseil-cpp/absl/types:optional",
]
defines = []
if (rtc_include_ilbc) {
deps += [
"..:field_trials_view",
"ilbc:audio_encoder_ilbc",
"//third_party/abseil-cpp/absl/types:optional",
]
defines += [ "WEBRTC_USE_BUILTIN_ILBC=1" ]
} else {
@ -136,7 +132,6 @@ rtc_library("opus_audio_decoder_factory") {
"..:scoped_refptr",
"opus:audio_decoder_multiopus",
"opus:audio_decoder_opus",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -153,6 +148,5 @@ rtc_library("opus_audio_encoder_factory") {
"..:scoped_refptr",
"opus:audio_encoder_multiopus",
"opus:audio_encoder_opus",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -29,7 +29,6 @@ rtc_library("audio_encoder_L16") {
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -47,6 +46,5 @@ rtc_library("audio_decoder_L16") {
"../../../rtc_base:safe_conversions",
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -11,10 +11,10 @@
#include "api/audio_codecs/L16/audio_decoder_L16.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -25,7 +25,7 @@
namespace webrtc {
absl::optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
std::optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
const SdpAudioFormat& format) {
Config config;
config.sample_rate_hz = format.clockrate_hz;
@ -33,7 +33,7 @@ absl::optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
if (absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()) {
return config;
}
return absl::nullopt;
return std::nullopt;
}
void AudioDecoderL16::AppendSupportedDecoders(
@ -43,7 +43,7 @@ void AudioDecoderL16::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderL16::MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
if (!config.IsOk()) {
return nullptr;

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_L16_AUDIO_DECODER_L16_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -36,11 +36,11 @@ struct RTC_EXPORT AudioDecoderL16 {
int sample_rate_hz = 8000;
int num_channels = 1;
};
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -14,11 +14,11 @@
#include <map>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -32,11 +32,11 @@
namespace webrtc {
absl::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
std::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
const SdpAudioFormat& format) {
if (!rtc::IsValueInRangeForNumericType<int>(format.num_channels)) {
RTC_DCHECK_NOTREACHED();
return absl::nullopt;
return std::nullopt;
}
Config config;
config.sample_rate_hz = format.clockrate_hz;
@ -51,7 +51,7 @@ absl::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
if (absl::EqualsIgnoreCase(format.name, "L16") && config.IsOk()) {
return config;
}
return absl::nullopt;
return std::nullopt;
}
void AudioEncoderL16::AppendSupportedEncoders(
@ -70,7 +70,7 @@ AudioCodecInfo AudioEncoderL16::QueryAudioEncoder(
std::unique_ptr<AudioEncoder> AudioEncoderL16::MakeAudioEncoder(
const AudioEncoderL16::Config& config,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
AudioEncoderPcm16B::Config c;
c.sample_rate_hz = config.sample_rate_hz;

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_L16_AUDIO_ENCODER_L16_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -39,13 +39,13 @@ struct RTC_EXPORT AudioEncoderL16 {
int num_channels = 1;
int frame_size_ms = 10;
};
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
static AudioCodecInfo QueryAudioEncoder(const Config& config);
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -13,10 +13,10 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "rtc_base/buffer.h"
#include "rtc_base/checks.h"
@ -37,14 +37,14 @@ class OldStyleEncodedFrame final : public AudioDecoder::EncodedAudioFrame {
return ret < 0 ? 0 : static_cast<size_t>(ret);
}
absl::optional<DecodeResult> Decode(
std::optional<DecodeResult> Decode(
rtc::ArrayView<int16_t> decoded) const override {
auto speech_type = AudioDecoder::kSpeech;
const int ret = decoder_->Decode(
payload_.data(), payload_.size(), decoder_->SampleRateHz(),
decoded.size() * sizeof(int16_t), decoded.data(), &speech_type);
return ret < 0 ? absl::nullopt
: absl::optional<DecodeResult>(
return ret < 0 ? std::nullopt
: std::optional<DecodeResult>(
{static_cast<size_t>(ret), speech_type});
}

View File

@ -15,9 +15,9 @@
#include <stdint.h>
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "rtc_base/buffer.h"
@ -57,11 +57,11 @@ class AudioDecoder {
// Decodes this frame of audio and writes the result in `decoded`.
// `decoded` must be large enough to store as many samples as indicated by a
// call to Duration() . On success, returns an absl::optional containing the
// call to Duration() . On success, returns an std::optional containing the
// total number of samples across all channels, as well as whether the
// decoder produced comfort noise or speech. On failure, returns an empty
// absl::optional. Decode may be called at most once per frame object.
virtual absl::optional<DecodeResult> Decode(
// std::optional. Decode may be called at most once per frame object.
virtual std::optional<DecodeResult> Decode(
rtc::ArrayView<int16_t> decoded) const = 0;
};

View File

@ -12,10 +12,10 @@
#define API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/base/nullability.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -49,7 +49,7 @@ class AudioDecoderFactory : public RefCountInterface {
[[deprecated("bugs.webrtc.org/356878416 - Use `Create` instead")]] //
virtual std::unique_ptr<AudioDecoder>
MakeAudioDecoder(const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
RTC_DCHECK_NOTREACHED();
return nullptr;
}
@ -59,7 +59,7 @@ class AudioDecoderFactory : public RefCountInterface {
virtual absl::Nullable<std::unique_ptr<AudioDecoder>> Create(
const Environment& env,
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return MakeAudioDecoder(format, codec_pair_id);

View File

@ -12,10 +12,10 @@
#define API_AUDIO_CODECS_AUDIO_DECODER_FACTORY_TEMPLATE_H_
#include <memory>
#include <optional>
#include <type_traits>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_decoder_factory.h"
@ -40,7 +40,7 @@ struct Helper<> {
static absl::Nullable<std::unique_ptr<AudioDecoder>> MakeAudioDecoder(
const Environment& env,
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
return nullptr;
}
};
@ -54,13 +54,13 @@ template <typename Trait,
decltype(Trait::MakeAudioDecoder(
std::declval<Environment>(),
std::declval<typename Trait::Config>(),
std::declval<absl::optional<AudioCodecPairId>>())),
std::declval<std::optional<AudioCodecPairId>>())),
std::unique_ptr<AudioDecoder>>>>
absl::Nullable<std::unique_ptr<AudioDecoder>> CreateDecoder(
Rank1,
const Environment& env,
const typename Trait::Config& config,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
return Trait::MakeAudioDecoder(env, config, codec_pair_id);
}
@ -68,13 +68,13 @@ template <typename Trait,
typename = std::enable_if_t<std::is_convertible_v<
decltype(Trait::MakeAudioDecoder(
std::declval<typename Trait::Config>(),
std::declval<absl::optional<AudioCodecPairId>>())),
std::declval<std::optional<AudioCodecPairId>>())),
std::unique_ptr<AudioDecoder>>>>
absl::Nullable<std::unique_ptr<AudioDecoder>> CreateDecoder(
Rank0,
const Environment& env,
const typename Trait::Config& config,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
return Trait::MakeAudioDecoder(config, codec_pair_id);
}
@ -89,16 +89,16 @@ struct Helper<T, Ts...> {
static bool IsSupportedDecoder(const SdpAudioFormat& format) {
auto opt_config = T::SdpToConfig(format);
static_assert(std::is_same<decltype(opt_config),
absl::optional<typename T::Config>>::value,
std::optional<typename T::Config>>::value,
"T::SdpToConfig() must return a value of type "
"absl::optional<T::Config>");
"std::optional<T::Config>");
return opt_config ? true : Helper<Ts...>::IsSupportedDecoder(format);
}
static absl::Nullable<std::unique_ptr<AudioDecoder>> MakeAudioDecoder(
const Environment& env,
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
auto opt_config = T::SdpToConfig(format);
return opt_config.has_value()
? CreateDecoder<T>(Rank1{}, env, *opt_config, codec_pair_id)
@ -122,7 +122,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
absl::Nullable<std::unique_ptr<AudioDecoder>> Create(
const Environment& env,
const SdpAudioFormat& format,
absl::optional<AudioCodecPairId> codec_pair_id) override {
std::optional<AudioCodecPairId> codec_pair_id) override {
return Helper<Ts...>::MakeAudioDecoder(env, format, codec_pair_id);
}
};
@ -137,7 +137,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
// // Converts `audio_format` to a ConfigType instance. Returns an empty
// // optional if `audio_format` doesn't correctly specify a decoder of our
// // type.
// absl::optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
// std::optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
//
// // Appends zero or more AudioCodecSpecs to the list that will be returned
// // by AudioDecoderFactory::GetSupportedDecoders().
@ -148,11 +148,11 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
// std::unique_ptr<AudioEncoder> MakeAudioDecoder(
// const Environment& env,
// const ConfigType& config,
// absl::optional<AudioCodecPairId> codec_pair_id);
// std::optional<AudioCodecPairId> codec_pair_id);
// or
// std::unique_ptr<AudioDecoder> MakeAudioDecoder(
// const ConfigType& config,
// absl::optional<AudioCodecPairId> codec_pair_id);
// std::optional<AudioCodecPairId> codec_pair_id);
//
// ConfigType should be a type that encapsulates all the settings needed to
// create an AudioDecoder. T::Config (where T is the decoder struct) should

View File

@ -13,9 +13,9 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "rtc_base/buffer.h"
@ -96,12 +96,12 @@ void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
}
void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
OnReceivedUplinkBandwidth(target_audio_bitrate_bps, absl::nullopt);
OnReceivedUplinkBandwidth(target_audio_bitrate_bps, std::nullopt);
}
void AudioEncoder::OnReceivedUplinkBandwidth(
int target_audio_bitrate_bps,
absl::optional<int64_t> bwe_period_ms) {}
std::optional<int64_t> bwe_period_ms) {}
void AudioEncoder::OnReceivedUplinkAllocation(BitrateAllocationUpdate update) {
OnReceivedUplinkBandwidth(update.target_bitrate.bps(),

View File

@ -15,12 +15,12 @@
#include <stdint.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/call/bitrate_allocation.h"
#include "api/units/data_rate.h"
@ -39,30 +39,30 @@ struct ANAStats {
// Number of actions taken by the ANA bitrate controller since the start of
// the call. If this value is not set, it indicates that the bitrate
// controller is disabled.
absl::optional<uint32_t> bitrate_action_counter;
std::optional<uint32_t> bitrate_action_counter;
// Number of actions taken by the ANA channel controller since the start of
// the call. If this value is not set, it indicates that the channel
// controller is disabled.
absl::optional<uint32_t> channel_action_counter;
std::optional<uint32_t> channel_action_counter;
// Number of actions taken by the ANA DTX controller since the start of the
// call. If this value is not set, it indicates that the DTX controller is
// disabled.
absl::optional<uint32_t> dtx_action_counter;
std::optional<uint32_t> dtx_action_counter;
// Number of actions taken by the ANA FEC controller since the start of the
// call. If this value is not set, it indicates that the FEC controller is
// disabled.
absl::optional<uint32_t> fec_action_counter;
std::optional<uint32_t> fec_action_counter;
// Number of times the ANA frame length controller decided to increase the
// frame length since the start of the call. If this value is not set, it
// indicates that the frame length controller is disabled.
absl::optional<uint32_t> frame_length_increase_counter;
std::optional<uint32_t> frame_length_increase_counter;
// Number of times the ANA frame length controller decided to decrease the
// frame length since the start of the call. If this value is not set, it
// indicates that the frame length controller is disabled.
absl::optional<uint32_t> frame_length_decrease_counter;
std::optional<uint32_t> frame_length_decrease_counter;
// The uplink packet loss fractions as set by the ANA FEC controller. If this
// value is not set, it indicates that the ANA FEC controller is not active.
absl::optional<float> uplink_packet_loss_fraction;
std::optional<float> uplink_packet_loss_fraction;
};
// This is the interface class for encoders in AudioCoding module. Each codec
@ -223,7 +223,7 @@ class AudioEncoder {
// Provides target audio bitrate and corresponding probing interval of
// the bandwidth estimator to this encoder to allow it to adapt.
virtual void OnReceivedUplinkBandwidth(int target_audio_bitrate_bps,
absl::optional<int64_t> bwe_period_ms);
std::optional<int64_t> bwe_period_ms);
// Provides target audio bitrate and corresponding probing interval of
// the bandwidth estimator to this encoder to allow it to adapt.
@ -247,15 +247,14 @@ class AudioEncoder {
// The range of frame lengths that are supported or nullopt if there's no such
// information. This is used together with the bitrate range to calculate the
// full bitrate range, including overhead.
virtual absl::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
virtual std::optional<std::pair<TimeDelta, TimeDelta>> GetFrameLengthRange()
const = 0;
// The range of payload bitrates that are supported. This is used together
// with the frame length range to calculate the full bitrate range, including
// overhead.
virtual absl::optional<std::pair<DataRate, DataRate>> GetBitrateRange()
const {
return absl::nullopt;
virtual std::optional<std::pair<DataRate, DataRate>> GetBitrateRange() const {
return std::nullopt;
}
// The maximum number of audio channels supported by WebRTC encoders.

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -44,7 +44,7 @@ class AudioEncoderFactory : public RefCountInterface {
// Note: Implementations need to be robust against combinations other than
// one encoder, one decoder getting the same ID; such encoders must still
// work.
absl::optional<AudioCodecPairId> codec_pair_id;
std::optional<AudioCodecPairId> codec_pair_id;
};
// Returns a prioritized list of audio codecs, to use for signaling etc.
@ -53,7 +53,7 @@ class AudioEncoderFactory : public RefCountInterface {
// Returns information about how this format would be encoded, provided it's
// supported. More format and format variations may be supported than those
// returned by GetSupportedEncoders().
virtual absl::optional<AudioCodecInfo> QueryAudioEncoder(
virtual std::optional<AudioCodecInfo> QueryAudioEncoder(
const SdpAudioFormat& format) = 0;
// Creates an AudioEncoder for the specified format.

View File

@ -12,11 +12,11 @@
#define API_AUDIO_CODECS_AUDIO_ENCODER_FACTORY_TEMPLATE_H_
#include <memory>
#include <optional>
#include <type_traits>
#include <vector>
#include "absl/base/nullability.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_encoder_factory.h"
@ -36,9 +36,9 @@ struct Helper;
template <>
struct Helper<> {
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {}
static absl::optional<AudioCodecInfo> QueryAudioEncoder(
static std::optional<AudioCodecInfo> QueryAudioEncoder(
const SdpAudioFormat& format) {
return absl::nullopt;
return std::nullopt;
}
static absl::Nullable<std::unique_ptr<AudioEncoder>> CreateAudioEncoder(
const Environment& env,
@ -72,7 +72,7 @@ template <typename Trait,
decltype(Trait::MakeAudioEncoder(
std::declval<typename Trait::Config>(),
int{},
std::declval<absl::optional<AudioCodecPairId>>())),
std::declval<std::optional<AudioCodecPairId>>())),
std::unique_ptr<AudioEncoder>>>>
absl::Nullable<std::unique_ptr<AudioEncoder>> CreateEncoder(
Rank0,
@ -91,14 +91,14 @@ struct Helper<T, Ts...> {
T::AppendSupportedEncoders(specs);
Helper<Ts...>::AppendSupportedEncoders(specs);
}
static absl::optional<AudioCodecInfo> QueryAudioEncoder(
static std::optional<AudioCodecInfo> QueryAudioEncoder(
const SdpAudioFormat& format) {
auto opt_config = T::SdpToConfig(format);
static_assert(std::is_same<decltype(opt_config),
absl::optional<typename T::Config>>::value,
std::optional<typename T::Config>>::value,
"T::SdpToConfig() must return a value of type "
"absl::optional<T::Config>");
return opt_config ? absl::optional<AudioCodecInfo>(
"std::optional<T::Config>");
return opt_config ? std::optional<AudioCodecInfo>(
T::QueryAudioEncoder(*opt_config))
: Helper<Ts...>::QueryAudioEncoder(format);
}
@ -123,7 +123,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
return specs;
}
absl::optional<AudioCodecInfo> QueryAudioEncoder(
std::optional<AudioCodecInfo> QueryAudioEncoder(
const SdpAudioFormat& format) override {
return Helper<Ts...>::QueryAudioEncoder(format);
}
@ -146,7 +146,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
// // Converts `audio_format` to a ConfigType instance. Returns an empty
// // optional if `audio_format` doesn't correctly specify an encoder of our
// // type.
// absl::optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
// std::optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
//
// // Appends zero or more AudioCodecSpecs to the list that will be returned
// // by AudioEncoderFactory::GetSupportedEncoders().
@ -166,7 +166,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
// std::unique_ptr<AudioEncoder> MakeAudioEncoder(
// const ConfigType& config,
// int payload_type,
// absl::optional<AudioCodecPairId> codec_pair_id);
// std::optional<AudioCodecPairId> codec_pair_id);
//
// ConfigType should be a type that encapsulates all the settings needed to
// create an AudioEncoder. T::Config (where T is the encoder struct) should

View File

@ -11,9 +11,9 @@
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/L16/audio_decoder_L16.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
@ -39,8 +39,7 @@ namespace {
template <typename T>
struct NotAdvertised {
using Config = typename T::Config;
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format);
}
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
@ -48,7 +47,7 @@ struct NotAdvertised {
}
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt) {
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt) {
return T::MakeAudioDecoder(config, codec_pair_id);
}
};

View File

@ -11,9 +11,9 @@
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/L16/audio_encoder_L16.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
@ -40,8 +40,7 @@ namespace {
template <typename T>
struct NotAdvertised {
using Config = typename T::Config;
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format);
}
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {
@ -53,7 +52,7 @@ struct NotAdvertised {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr) {
return T::MakeAudioEncoder(config, payload_type, codec_pair_id,
field_trials);

View File

@ -29,7 +29,6 @@ rtc_library("audio_encoder_g711") {
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -48,6 +47,5 @@ rtc_library("audio_decoder_g711") {
"../../../rtc_base:safe_conversions",
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -12,10 +12,10 @@
#include <initializer_list>
#include <memory>
#include <optional>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -26,7 +26,7 @@
namespace webrtc {
absl::optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
std::optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
const SdpAudioFormat& format) {
const bool is_pcmu = absl::EqualsIgnoreCase(format.name, "PCMU");
const bool is_pcma = absl::EqualsIgnoreCase(format.name, "PCMA");
@ -37,11 +37,11 @@ absl::optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
config.num_channels = rtc::dchecked_cast<int>(format.num_channels);
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();
return absl::nullopt;
return std::nullopt;
}
return config;
} else {
return absl::nullopt;
return std::nullopt;
}
}
@ -54,7 +54,7 @@ void AudioDecoderG711::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderG711::MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_G711_AUDIO_DECODER_G711_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -36,11 +36,11 @@ struct RTC_EXPORT AudioDecoderG711 {
Type type;
int num_channels;
};
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -15,11 +15,11 @@
#include <initializer_list>
#include <map>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -32,7 +32,7 @@
namespace webrtc {
absl::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
std::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
const SdpAudioFormat& format) {
const bool is_pcmu = absl::EqualsIgnoreCase(format.name, "PCMU");
const bool is_pcma = absl::EqualsIgnoreCase(format.name, "PCMA");
@ -51,11 +51,11 @@ absl::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
}
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();
return absl::nullopt;
return std::nullopt;
}
return config;
} else {
return absl::nullopt;
return std::nullopt;
}
}
@ -75,7 +75,7 @@ AudioCodecInfo AudioEncoderG711::QueryAudioEncoder(const Config& config) {
std::unique_ptr<AudioEncoder> AudioEncoderG711::MakeAudioEncoder(
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_G711_AUDIO_ENCODER_G711_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -38,14 +38,14 @@ struct RTC_EXPORT AudioEncoderG711 {
int num_channels = 1;
int frame_size_ms = 20;
};
static absl::optional<AudioEncoderG711::Config> SdpToConfig(
static std::optional<AudioEncoderG711::Config> SdpToConfig(
const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
static AudioCodecInfo QueryAudioEncoder(const Config& config);
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -36,7 +36,6 @@ rtc_library("audio_encoder_g722") {
"../../../rtc_base:stringutils",
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -55,6 +54,5 @@ rtc_library("audio_decoder_g722") {
"../../../rtc_base:safe_conversions",
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -11,10 +11,10 @@
#include "api/audio_codecs/g722/audio_decoder_g722.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -25,14 +25,14 @@
namespace webrtc {
absl::optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
std::optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
const SdpAudioFormat& format) {
if (absl::EqualsIgnoreCase(format.name, "G722") &&
format.clockrate_hz == 8000 &&
(format.num_channels == 1 || format.num_channels == 2)) {
return Config{rtc::dchecked_cast<int>(format.num_channels)};
}
return absl::nullopt;
return std::nullopt;
}
void AudioDecoderG722::AppendSupportedDecoders(
@ -42,7 +42,7 @@ void AudioDecoderG722::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_G722_AUDIO_DECODER_G722_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -30,11 +30,11 @@ struct RTC_EXPORT AudioDecoderG722 {
bool IsOk() const { return num_channels == 1 || num_channels == 2; }
int num_channels;
};
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -14,11 +14,11 @@
#include <map>
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -32,11 +32,11 @@
namespace webrtc {
absl::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
std::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
const SdpAudioFormat& format) {
if (!absl::EqualsIgnoreCase(format.name, "g722") ||
format.clockrate_hz != 8000) {
return absl::nullopt;
return std::nullopt;
}
AudioEncoderG722Config config;
@ -51,7 +51,7 @@ absl::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
}
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();
return absl::nullopt;
return std::nullopt;
}
return config;
}
@ -73,7 +73,7 @@ AudioCodecInfo AudioEncoderG722::QueryAudioEncoder(
std::unique_ptr<AudioEncoder> AudioEncoderG722::MakeAudioEncoder(
const AudioEncoderG722Config& config,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_G722_AUDIO_ENCODER_G722_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -28,14 +28,14 @@ namespace webrtc {
// CreateAudioEncoderFactory<...>().
struct RTC_EXPORT AudioEncoderG722 {
using Config = AudioEncoderG722Config;
static absl::optional<AudioEncoderG722Config> SdpToConfig(
static std::optional<AudioEncoderG722Config> SdpToConfig(
const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderG722Config& config);
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const AudioEncoderG722Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -34,7 +34,6 @@ rtc_library("audio_encoder_ilbc") {
"../../../rtc_base:safe_minmax",
"../../../rtc_base:stringutils",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -50,6 +49,5 @@ rtc_library("audio_decoder_ilbc") {
"../../../api:field_trials_view",
"../../../modules/audio_coding:ilbc",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -11,10 +11,10 @@
#include "api/audio_codecs/ilbc/audio_decoder_ilbc.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -23,13 +23,13 @@
namespace webrtc {
absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
std::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
const SdpAudioFormat& format) {
if (absl::EqualsIgnoreCase(format.name, "ILBC") &&
format.clockrate_hz == 8000 && format.num_channels == 1) {
return Config();
}
return absl::nullopt;
return std::nullopt;
}
void AudioDecoderIlbc::AppendSupportedDecoders(
@ -39,7 +39,7 @@ void AudioDecoderIlbc::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
return std::make_unique<AudioDecoderIlbcImpl>();
}

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_ILBC_AUDIO_DECODER_ILBC_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -26,11 +26,11 @@ namespace webrtc {
// CreateAudioDecoderFactory<...>().
struct AudioDecoderIlbc {
struct Config {}; // Empty---no config values needed!
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
Config config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -12,12 +12,12 @@
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -46,11 +46,11 @@ int GetIlbcBitrate(int ptime) {
}
} // namespace
absl::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
std::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
const SdpAudioFormat& format) {
if (!absl::EqualsIgnoreCase(format.name.c_str(), "ILBC") ||
format.clockrate_hz != 8000 || format.num_channels != 1) {
return absl::nullopt;
return std::nullopt;
}
AudioEncoderIlbcConfig config;
@ -64,7 +64,7 @@ absl::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
}
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();
return absl::nullopt;
return std::nullopt;
}
return config;
}
@ -85,7 +85,7 @@ AudioCodecInfo AudioEncoderIlbc::QueryAudioEncoder(
std::unique_ptr<AudioEncoder> AudioEncoderIlbc::MakeAudioEncoder(
const AudioEncoderIlbcConfig& config,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_ILBC_AUDIO_ENCODER_ILBC_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -27,14 +27,14 @@ namespace webrtc {
// CreateAudioEncoderFactory<...>().
struct AudioEncoderIlbc {
using Config = AudioEncoderIlbcConfig;
static absl::optional<AudioEncoderIlbcConfig> SdpToConfig(
static std::optional<AudioEncoderIlbcConfig> SdpToConfig(
const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderIlbcConfig& config);
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const AudioEncoderIlbcConfig& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -20,10 +20,7 @@ rtc_library("audio_encoder_opus_config") {
"audio_encoder_opus_config.cc",
"audio_encoder_opus_config.h",
]
deps = [
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/types:optional",
]
deps = [ "../../../rtc_base/system:rtc_export" ]
defines = []
if (rtc_opus_variable_complexity) {
defines += [ "WEBRTC_OPUS_VARIABLE_COMPLEXITY=1" ]
@ -50,7 +47,6 @@ rtc_library("audio_encoder_opus") {
"../../../rtc_base:checks",
"../../../rtc_base/system:rtc_export",
"../../environment",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -68,7 +64,6 @@ rtc_library("audio_decoder_opus") {
"../../../rtc_base/system:rtc_export",
"../../environment",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -83,7 +78,6 @@ rtc_library("audio_encoder_multiopus") {
"../../../modules/audio_coding:webrtc_multiopus",
"../../../rtc_base/system:rtc_export",
"../opus:audio_encoder_opus_config",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -102,6 +96,5 @@ rtc_library("audio_decoder_multiopus") {
"../../../rtc_base/system:rtc_export",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -11,10 +11,10 @@
#include "api/audio_codecs/opus/audio_decoder_multi_channel_opus.h"
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -24,7 +24,7 @@
namespace webrtc {
absl::optional<AudioDecoderMultiChannelOpusConfig>
std::optional<AudioDecoderMultiChannelOpusConfig>
AudioDecoderMultiChannelOpus::SdpToConfig(const SdpAudioFormat& format) {
return AudioDecoderMultiChannelOpusImpl::SdpToConfig(format);
}
@ -68,7 +68,7 @@ void AudioDecoderMultiChannelOpus::AppendSupportedDecoders(
std::unique_ptr<AudioDecoder> AudioDecoderMultiChannelOpus::MakeAudioDecoder(
AudioDecoderMultiChannelOpusConfig config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
return AudioDecoderMultiChannelOpusImpl::MakeAudioDecoder(config);
}

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_OPUS_AUDIO_DECODER_MULTI_CHANNEL_OPUS_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -28,12 +28,12 @@ namespace webrtc {
// CreateAudioDecoderFactory<...>().
struct RTC_EXPORT AudioDecoderMultiChannelOpus {
using Config = AudioDecoderMultiChannelOpusConfig;
static absl::optional<AudioDecoderMultiChannelOpusConfig> SdpToConfig(
static std::optional<AudioDecoderMultiChannelOpusConfig> SdpToConfig(
const SdpAudioFormat& audio_format);
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
AudioDecoderMultiChannelOpusConfig config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -12,12 +12,12 @@
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/match.h"
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -38,9 +38,9 @@ bool AudioDecoderOpus::Config::IsOk() const {
return true;
}
absl::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
std::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
const SdpAudioFormat& format) {
const auto num_channels = [&]() -> absl::optional<int> {
const auto num_channels = [&]() -> std::optional<int> {
auto stereo = format.parameters.find("stereo");
if (stereo != format.parameters.end()) {
if (stereo->second == "0") {
@ -48,7 +48,7 @@ absl::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
} else if (stereo->second == "1") {
return 2;
} else {
return absl::nullopt; // Bad stereo parameter.
return std::nullopt; // Bad stereo parameter.
}
}
return 1; // Default to mono.
@ -60,11 +60,11 @@ absl::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
config.num_channels = *num_channels;
if (!config.IsOk()) {
RTC_DCHECK_NOTREACHED();
return absl::nullopt;
return std::nullopt;
}
return config;
} else {
return absl::nullopt;
return std::nullopt;
}
}

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_OPUS_AUDIO_DECODER_OPUS_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_format.h"
@ -31,7 +31,7 @@ struct RTC_EXPORT AudioDecoderOpus {
int sample_rate_hz = 48000;
int num_channels = 1;
};
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(const Environment& env,
@ -39,7 +39,7 @@ struct RTC_EXPORT AudioDecoderOpus {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Environment& env,
Config config,
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
std::optional<AudioCodecPairId> /*codec_pair_id*/) {
return MakeAudioDecoder(env, config);
}
};

View File

@ -16,7 +16,7 @@
namespace webrtc {
absl::optional<AudioEncoderMultiChannelOpusConfig>
std::optional<AudioEncoderMultiChannelOpusConfig>
AudioEncoderMultiChannelOpus::SdpToConfig(const SdpAudioFormat& format) {
return AudioEncoderMultiChannelOpusImpl::SdpToConfig(format);
}
@ -66,7 +66,7 @@ AudioCodecInfo AudioEncoderMultiChannelOpus::QueryAudioEncoder(
std::unique_ptr<AudioEncoder> AudioEncoderMultiChannelOpus::MakeAudioEncoder(
const AudioEncoderMultiChannelOpusConfig& config,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/,
std::optional<AudioCodecPairId> /*codec_pair_id*/,
const FieldTrialsView* field_trials) {
return AudioEncoderMultiChannelOpusImpl::MakeAudioEncoder(config,
payload_type);

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_MULTI_CHANNEL_OPUS_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_format.h"
@ -28,13 +28,13 @@ namespace webrtc {
// CreateAudioEncoderFactory<...>().
struct RTC_EXPORT AudioEncoderMultiChannelOpus {
using Config = AudioEncoderMultiChannelOpusConfig;
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
static AudioCodecInfo QueryAudioEncoder(const Config& config);
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr);
};

View File

@ -11,9 +11,9 @@
#include "api/audio_codecs/opus/audio_encoder_opus.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_encoder_factory.h"
@ -24,7 +24,7 @@
namespace webrtc {
absl::optional<AudioEncoderOpusConfig> AudioEncoderOpus::SdpToConfig(
std::optional<AudioEncoderOpusConfig> AudioEncoderOpus::SdpToConfig(
const SdpAudioFormat& format) {
return AudioEncoderOpusImpl::SdpToConfig(format);
}

View File

@ -12,9 +12,9 @@
#define API_AUDIO_CODECS_OPUS_AUDIO_ENCODER_OPUS_H_
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_encoder_factory.h"
#include "api/audio_codecs/audio_format.h"
@ -28,7 +28,7 @@ namespace webrtc {
// CreateAudioEncoderFactory<...>().
struct RTC_EXPORT AudioEncoderOpus {
using Config = AudioEncoderOpusConfig;
static absl::optional<AudioEncoderOpusConfig> SdpToConfig(
static std::optional<AudioEncoderOpusConfig> SdpToConfig(
const SdpAudioFormat& audio_format);
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderOpusConfig& config);

View File

@ -13,9 +13,9 @@
#include <stddef.h>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
@ -43,7 +43,7 @@ struct RTC_EXPORT AudioEncoderOpusConfig {
// NOTE: This member must always be set.
// TODO(kwiberg): Turn it into just an int.
absl::optional<int> bitrate_bps;
std::optional<int> bitrate_bps;
bool fec_enabled;
bool cbr_enabled;

View File

@ -11,9 +11,9 @@
#include "api/audio_codecs/opus_audio_decoder_factory.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
#include "api/audio_codecs/audio_decoder_factory.h"
@ -31,8 +31,7 @@ namespace {
template <typename T>
struct NotAdvertised {
using Config = typename T::Config;
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format);
}
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
@ -40,7 +39,7 @@ struct NotAdvertised {
}
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt) {
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt) {
return T::MakeAudioDecoder(config, codec_pair_id);
}
};

View File

@ -11,9 +11,9 @@
#include "api/audio_codecs/opus_audio_encoder_factory.h"
#include <memory>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
#include "api/audio_codecs/audio_encoder_factory.h"
@ -31,8 +31,7 @@ namespace {
template <typename T>
struct NotAdvertised {
using Config = typename T::Config;
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return T::SdpToConfig(audio_format);
}
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {
@ -44,7 +43,7 @@ struct NotAdvertised {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config& config,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt,
std::optional<AudioCodecPairId> codec_pair_id = std::nullopt,
const FieldTrialsView* field_trials = nullptr) {
return T::MakeAudioEncoder(config, payload_type, codec_pair_id,
field_trials);

View File

@ -37,7 +37,6 @@ if (rtc_include_tests) {
"../ilbc:audio_encoder_ilbc",
"../opus:audio_decoder_opus",
"../opus:audio_encoder_opus",
"//third_party/abseil-cpp/absl/types:optional",
]
}
}

View File

@ -11,10 +11,10 @@
#include "api/audio_codecs/audio_decoder_factory_template.h"
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/L16/audio_decoder_L16.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_decoder.h"
@ -59,13 +59,12 @@ struct AudioDecoderFakeApi {
SdpAudioFormat audio_format;
};
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
if (Params::AudioFormat() == audio_format) {
Config config = {audio_format};
return config;
} else {
return absl::nullopt;
return std::nullopt;
}
}
@ -79,7 +78,7 @@ struct AudioDecoderFakeApi {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config&,
absl::optional<AudioCodecPairId> /*codec_pair_id*/ = absl::nullopt) {
std::optional<AudioCodecPairId> /*codec_pair_id*/ = std::nullopt) {
auto dec = std::make_unique<testing::StrictMock<MockAudioDecoder>>();
EXPECT_CALL(*dec, SampleRateHz())
.WillOnce(::testing::Return(Params::CodecInfo().sample_rate_hz));
@ -95,8 +94,7 @@ struct BaseAudioDecoderApi {
static SdpAudioFormat AudioFormat() { return {"fake", 16'000, 2, {}}; }
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return Config();
}
@ -114,7 +112,7 @@ struct TraitWithTwoMakeAudioDecoders : BaseAudioDecoderApi {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
auto decoder = std::make_unique<NiceMock<MockAudioDecoder>>();
ON_CALL(*decoder, SampleRateHz).WillByDefault(Return(kRateWithoutEnv));
return decoder;
@ -123,7 +121,7 @@ struct TraitWithTwoMakeAudioDecoders : BaseAudioDecoderApi {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Environment& env,
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
auto decoder = std::make_unique<NiceMock<MockAudioDecoder>>();
ON_CALL(*decoder, SampleRateHz).WillByDefault(Return(kRateWithEnv));
return decoder;
@ -143,7 +141,7 @@ TEST(AudioDecoderFactoryTemplateTest,
struct AudioDecoderApiWithV1Make : BaseAudioDecoderApi {
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
const Config& config,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
return std::make_unique<NiceMock<MockAudioDecoder>>();
}
};
@ -163,7 +161,7 @@ TEST(AudioDecoderFactoryTemplateTest, NoDecoderTypes) {
audio_decoder_factory_template_impl::AudioDecoderFactoryT<>>());
EXPECT_THAT(factory->GetSupportedDecoders(), ::testing::IsEmpty());
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, absl::nullopt));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, std::nullopt));
}
TEST(AudioDecoderFactoryTemplateTest, OneDecoderType) {
@ -174,8 +172,8 @@ TEST(AudioDecoderFactoryTemplateTest, OneDecoderType) {
AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}}));
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"bogus", 8000, 1}));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, absl::nullopt));
auto dec = factory->Create(env, {"bogus", 8000, 1}, absl::nullopt);
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, std::nullopt));
auto dec = factory->Create(env, {"bogus", 8000, 1}, std::nullopt);
ASSERT_NE(nullptr, dec);
EXPECT_EQ(8000, dec->SampleRateHz());
}
@ -193,13 +191,13 @@ TEST(AudioDecoderFactoryTemplateTest, TwoDecoderTypes) {
EXPECT_TRUE(factory->IsSupportedDecoder({"bogus", 8000, 1}));
EXPECT_TRUE(
factory->IsSupportedDecoder({"sham", 16000, 2, {{"param", "value"}}}));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, absl::nullopt));
auto dec1 = factory->Create(env, {"bogus", 8000, 1}, absl::nullopt);
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, std::nullopt));
auto dec1 = factory->Create(env, {"bogus", 8000, 1}, std::nullopt);
ASSERT_NE(nullptr, dec1);
EXPECT_EQ(8000, dec1->SampleRateHz());
EXPECT_EQ(nullptr, factory->Create(env, {"sham", 16000, 2}, absl::nullopt));
EXPECT_EQ(nullptr, factory->Create(env, {"sham", 16000, 2}, std::nullopt));
auto dec2 = factory->Create(env, {"sham", 16000, 2, {{"param", "value"}}},
absl::nullopt);
std::nullopt);
ASSERT_NE(nullptr, dec2);
EXPECT_EQ(16000, dec2->SampleRateHz());
}
@ -214,11 +212,11 @@ TEST(AudioDecoderFactoryTemplateTest, G711) {
EXPECT_FALSE(factory->IsSupportedDecoder({"G711", 8000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"PCMU", 8000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"pcma", 8000, 1}));
EXPECT_EQ(nullptr, factory->Create(env, {"pcmu", 16000, 1}, absl::nullopt));
auto dec1 = factory->Create(env, {"pcmu", 8000, 1}, absl::nullopt);
EXPECT_EQ(nullptr, factory->Create(env, {"pcmu", 16000, 1}, std::nullopt));
auto dec1 = factory->Create(env, {"pcmu", 8000, 1}, std::nullopt);
ASSERT_NE(nullptr, dec1);
EXPECT_EQ(8000, dec1->SampleRateHz());
auto dec2 = factory->Create(env, {"PCMA", 8000, 1}, absl::nullopt);
auto dec2 = factory->Create(env, {"PCMA", 8000, 1}, std::nullopt);
ASSERT_NE(nullptr, dec2);
EXPECT_EQ(8000, dec2->SampleRateHz());
}
@ -231,16 +229,16 @@ TEST(AudioDecoderFactoryTemplateTest, G722) {
AudioCodecSpec{{"G722", 8000, 1}, {16000, 1, 64000}}));
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"G722", 8000, 1}));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, absl::nullopt));
auto dec1 = factory->Create(env, {"G722", 8000, 1}, absl::nullopt);
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, std::nullopt));
auto dec1 = factory->Create(env, {"G722", 8000, 1}, std::nullopt);
ASSERT_NE(nullptr, dec1);
EXPECT_EQ(16000, dec1->SampleRateHz());
EXPECT_EQ(1u, dec1->Channels());
auto dec2 = factory->Create(env, {"G722", 8000, 2}, absl::nullopt);
auto dec2 = factory->Create(env, {"G722", 8000, 2}, std::nullopt);
ASSERT_NE(nullptr, dec2);
EXPECT_EQ(16000, dec2->SampleRateHz());
EXPECT_EQ(2u, dec2->Channels());
auto dec3 = factory->Create(env, {"G722", 8000, 3}, absl::nullopt);
auto dec3 = factory->Create(env, {"G722", 8000, 3}, std::nullopt);
ASSERT_EQ(nullptr, dec3);
}
@ -252,8 +250,8 @@ TEST(AudioDecoderFactoryTemplateTest, Ilbc) {
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}}));
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1}));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 8000, 1}, absl::nullopt));
auto dec = factory->Create(env, {"ilbc", 8000, 1}, absl::nullopt);
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 8000, 1}, std::nullopt));
auto dec = factory->Create(env, {"ilbc", 8000, 1}, std::nullopt);
ASSERT_NE(nullptr, dec);
EXPECT_EQ(8000, dec->SampleRateHz());
}
@ -273,8 +271,8 @@ TEST(AudioDecoderFactoryTemplateTest, L16) {
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"L16", 48000, 1}));
EXPECT_FALSE(factory->IsSupportedDecoder({"L16", 96000, 1}));
EXPECT_EQ(nullptr, factory->Create(env, {"L16", 8000, 0}, absl::nullopt));
auto dec = factory->Create(env, {"L16", 48000, 2}, absl::nullopt);
EXPECT_EQ(nullptr, factory->Create(env, {"L16", 8000, 0}, std::nullopt));
auto dec = factory->Create(env, {"L16", 48000, 2}, std::nullopt);
ASSERT_NE(nullptr, dec);
EXPECT_EQ(48000, dec->SampleRateHz());
}
@ -291,8 +289,8 @@ TEST(AudioDecoderFactoryTemplateTest, Opus) {
::testing::ElementsAre(AudioCodecSpec{opus_format, opus_info}));
EXPECT_FALSE(factory->IsSupportedDecoder({"opus", 48000, 1}));
EXPECT_TRUE(factory->IsSupportedDecoder({"opus", 48000, 2}));
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, absl::nullopt));
auto dec = factory->Create(env, {"opus", 48000, 2}, absl::nullopt);
EXPECT_EQ(nullptr, factory->Create(env, {"bar", 16000, 1}, std::nullopt));
auto dec = factory->Create(env, {"opus", 48000, 2}, std::nullopt);
ASSERT_NE(nullptr, dec);
EXPECT_EQ(48000, dec->SampleRateHz());
}

View File

@ -11,10 +11,10 @@
#include "api/audio_codecs/audio_encoder_factory_template.h"
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio_codecs/L16/audio_encoder_L16.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_encoder.h"
@ -59,13 +59,12 @@ struct AudioEncoderFakeApi {
SdpAudioFormat audio_format;
};
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
if (Params::AudioFormat() == audio_format) {
Config config = {audio_format};
return config;
} else {
return absl::nullopt;
return std::nullopt;
}
}
@ -80,7 +79,7 @@ struct AudioEncoderFakeApi {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config&,
int payload_type,
absl::optional<AudioCodecPairId> /*codec_pair_id*/ = absl::nullopt) {
std::optional<AudioCodecPairId> /*codec_pair_id*/ = std::nullopt) {
auto enc = std::make_unique<testing::StrictMock<MockAudioEncoder>>();
EXPECT_CALL(*enc, SampleRateHz())
.WillOnce(::testing::Return(Params::CodecInfo().sample_rate_hz));
@ -101,8 +100,7 @@ struct BaseAudioEncoderApi {
static SdpAudioFormat AudioFormat() { return {"fake", 16'000, 2, {}}; }
static AudioCodecInfo CodecInfo() { return {16'000, 2, 23456}; }
static absl::optional<Config> SdpToConfig(
const SdpAudioFormat& audio_format) {
static std::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
return Config();
}
@ -117,7 +115,7 @@ struct AudioEncoderApiWithV1Make : BaseAudioEncoderApi {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config&,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>();
ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV1SameRate));
return encoder;
@ -139,7 +137,7 @@ struct AudioEncoderApiWithBothV1AndV2Make : BaseAudioEncoderApi {
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
const Config&,
int payload_type,
absl::optional<AudioCodecPairId> codec_pair_id) {
std::optional<AudioCodecPairId> codec_pair_id) {
auto encoder = std::make_unique<NiceMock<MockAudioEncoder>>();
ON_CALL(*encoder, SampleRateHz).WillByDefault(Return(kV1SameRate));
return encoder;
@ -190,7 +188,7 @@ TEST(AudioEncoderFactoryTemplateTest, NoEncoderTypes) {
rtc::make_ref_counted<
audio_encoder_factory_template_impl::AudioEncoderFactoryT<>>());
EXPECT_THAT(factory->GetSupportedEncoders(), ::testing::IsEmpty());
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_THAT(factory->Create(env, {"bar", 16000, 1}, {}), IsNull());
}
@ -201,7 +199,7 @@ TEST(AudioEncoderFactoryTemplateTest, OneEncoderType) {
EXPECT_THAT(factory->GetSupportedEncoders(),
::testing::ElementsAre(
AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}}));
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(AudioCodecInfo(8000, 1, 12345),
factory->QueryAudioEncoder({"bogus", 8000, 1}));
@ -219,7 +217,7 @@ TEST(AudioEncoderFactoryTemplateTest, TwoEncoderTypes) {
AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}},
AudioCodecSpec{{"sham", 16000, 2, {{"param", "value"}}},
{16000, 2, 23456}}));
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(AudioCodecInfo(8000, 1, 12345),
factory->QueryAudioEncoder({"bogus", 8000, 1}));
EXPECT_EQ(
@ -242,7 +240,7 @@ TEST(AudioEncoderFactoryTemplateTest, G711) {
::testing::ElementsAre(
AudioCodecSpec{{"PCMU", 8000, 1}, {8000, 1, 64000}},
AudioCodecSpec{{"PCMA", 8000, 1}, {8000, 1, 64000}}));
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"PCMA", 16000, 1}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"PCMA", 16000, 1}));
EXPECT_EQ(AudioCodecInfo(8000, 1, 64000),
factory->QueryAudioEncoder({"PCMA", 8000, 1}));
@ -259,7 +257,7 @@ TEST(AudioEncoderFactoryTemplateTest, G722) {
EXPECT_THAT(factory->GetSupportedEncoders(),
::testing::ElementsAre(
AudioCodecSpec{{"G722", 8000, 1}, {16000, 1, 64000}}));
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(AudioCodecInfo(16000, 1, 64000),
factory->QueryAudioEncoder({"G722", 8000, 1}));
@ -274,7 +272,7 @@ TEST(AudioEncoderFactoryTemplateTest, Ilbc) {
EXPECT_THAT(factory->GetSupportedEncoders(),
::testing::ElementsAre(
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13333}}));
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(AudioCodecInfo(8000, 1, 13333),
factory->QueryAudioEncoder({"ilbc", 8000, 1}));
@ -295,7 +293,7 @@ TEST(AudioEncoderFactoryTemplateTest, L16) {
AudioCodecSpec{{"L16", 8000, 2}, {8000, 2, 8000 * 16 * 2}},
AudioCodecSpec{{"L16", 16000, 2}, {16000, 2, 16000 * 16 * 2}},
AudioCodecSpec{{"L16", 32000, 2}, {32000, 2, 32000 * 16 * 2}}));
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"L16", 8000, 0}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"L16", 8000, 0}));
EXPECT_EQ(AudioCodecInfo(48000, 1, 48000 * 16),
factory->QueryAudioEncoder({"L16", 48000, 1}));
@ -315,7 +313,7 @@ TEST(AudioEncoderFactoryTemplateTest, Opus) {
::testing::ElementsAre(AudioCodecSpec{
{"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}},
info}));
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(std::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
EXPECT_EQ(
info,
factory->QueryAudioEncoder(

View File

@ -19,14 +19,14 @@ namespace {
template <class T>
void ToStringIfSet(rtc::SimpleStringBuilder* result,
const char* key,
const absl::optional<T>& val) {
const std::optional<T>& val) {
if (val) {
(*result) << key << ": " << *val << ", ";
}
}
template <typename T>
void SetFrom(absl::optional<T>* s, const absl::optional<T>& o) {
void SetFrom(std::optional<T>* s, const std::optional<T>& o) {
if (o) {
*s = o;
}

View File

@ -11,9 +11,9 @@
#ifndef API_AUDIO_OPTIONS_H_
#define API_AUDIO_OPTIONS_H_
#include <optional>
#include <string>
#include "absl/types/optional.h"
#include "rtc_base/system/rtc_export.h"
namespace cricket {
@ -34,38 +34,38 @@ struct RTC_EXPORT AudioOptions {
// Audio processing that attempts to filter away the output signal from
// later inbound pickup.
absl::optional<bool> echo_cancellation;
std::optional<bool> echo_cancellation;
#if defined(WEBRTC_IOS)
// Forces software echo cancellation on iOS. This is a temporary workaround
// (until Apple fixes the bug) for a device with non-functioning AEC. May
// improve performance on that particular device, but will cause unpredictable
// behavior in all other cases. See http://bugs.webrtc.org/8682.
absl::optional<bool> ios_force_software_aec_HACK;
std::optional<bool> ios_force_software_aec_HACK;
#endif
// Audio processing to adjust the sensitivity of the local mic dynamically.
absl::optional<bool> auto_gain_control;
std::optional<bool> auto_gain_control;
// Audio processing to filter out background noise.
absl::optional<bool> noise_suppression;
std::optional<bool> noise_suppression;
// Audio processing to remove background noise of lower frequencies.
absl::optional<bool> highpass_filter;
std::optional<bool> highpass_filter;
// Audio processing to swap the left and right channels.
absl::optional<bool> stereo_swapping;
std::optional<bool> stereo_swapping;
// Audio receiver jitter buffer (NetEq) max capacity in number of packets.
absl::optional<int> audio_jitter_buffer_max_packets;
std::optional<int> audio_jitter_buffer_max_packets;
// Audio receiver jitter buffer (NetEq) fast accelerate mode.
absl::optional<bool> audio_jitter_buffer_fast_accelerate;
std::optional<bool> audio_jitter_buffer_fast_accelerate;
// Audio receiver jitter buffer (NetEq) minimum target delay in milliseconds.
absl::optional<int> audio_jitter_buffer_min_delay_ms;
std::optional<int> audio_jitter_buffer_min_delay_ms;
// Enable audio network adaptor.
// TODO(webrtc:11717): Remove this API in favor of adaptivePtime in
// RtpEncodingParameters.
absl::optional<bool> audio_network_adaptor;
std::optional<bool> audio_network_adaptor;
// Config string for audio network adaptor.
absl::optional<std::string> audio_network_adaptor_config;
std::optional<std::string> audio_network_adaptor_config;
// Pre-initialize the ADM for recording when starting to send. Default to
// true.
// TODO(webrtc:13566): Remove this option. See issue for details.
absl::optional<bool> init_recording_on_send;
std::optional<bool> init_recording_on_send;
};
} // namespace cricket

View File

@ -27,12 +27,12 @@ uint16_t DataChannelInterface::maxRetransmits() const {
return 0;
}
absl::optional<int> DataChannelInterface::maxRetransmitsOpt() const {
return absl::nullopt;
std::optional<int> DataChannelInterface::maxRetransmitsOpt() const {
return std::nullopt;
}
absl::optional<int> DataChannelInterface::maxPacketLifeTime() const {
return absl::nullopt;
std::optional<int> DataChannelInterface::maxPacketLifeTime() const {
return std::nullopt;
}
std::string DataChannelInterface::protocol() const {

View File

@ -17,10 +17,10 @@
#include <stddef.h>
#include <stdint.h>
#include <optional>
#include <string>
#include "absl/functional/any_invocable.h"
#include "absl/types/optional.h"
#include "api/priority.h"
#include "api/ref_count.h"
#include "api/rtc_error.h"
@ -31,7 +31,7 @@
namespace webrtc {
// C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelinit
// TODO(deadbeef): Use absl::optional for the "-1 if unset" things.
// TODO(deadbeef): Use std::optional for the "-1 if unset" things.
struct DataChannelInit {
// Deprecated. Reliability is assumed, and channel will be unreliable if
// maxRetransmitTime or MaxRetransmits is set.
@ -46,13 +46,13 @@ struct DataChannelInit {
// Cannot be set along with `maxRetransmits`.
// This is called `maxPacketLifeTime` in the WebRTC JS API.
// Negative values are ignored, and positive values are clamped to [0-65535]
absl::optional<int> maxRetransmitTime;
std::optional<int> maxRetransmitTime;
// The max number of retransmissions.
//
// Cannot be set along with `maxRetransmitTime`.
// Negative values are ignored, and positive values are clamped to [0-65535]
absl::optional<int> maxRetransmits;
std::optional<int> maxRetransmits;
// This is set by the application and opaque to the WebRTC implementation.
std::string protocol;
@ -67,7 +67,7 @@ struct DataChannelInit {
int id = -1;
// https://w3c.github.io/webrtc-priority/#new-rtcdatachannelinit-member
absl::optional<PriorityValue> priority;
std::optional<PriorityValue> priority;
};
// At the JavaScript level, data can be passed in as a string or a blob, so
@ -163,8 +163,8 @@ class RTC_EXPORT DataChannelInterface : public RefCountInterface {
// TODO(hta): Deprecate and remove the following two functions.
virtual uint16_t maxRetransmitTime() const;
virtual uint16_t maxRetransmits() const;
virtual absl::optional<int> maxRetransmitsOpt() const;
virtual absl::optional<int> maxPacketLifeTime() const;
virtual std::optional<int> maxRetransmitsOpt() const;
virtual std::optional<int> maxPacketLifeTime() const;
virtual std::string protocol() const;
virtual bool negotiated() const;

View File

@ -11,9 +11,9 @@
#include "api/dtls_transport_interface.h"
#include <memory>
#include <optional>
#include <utility>
#include "absl/types/optional.h"
#include "rtc_base/ssl_certificate.h"
namespace webrtc {
@ -26,10 +26,10 @@ DtlsTransportInformation::DtlsTransportInformation(DtlsTransportState state)
DtlsTransportInformation::DtlsTransportInformation(
DtlsTransportState state,
absl::optional<DtlsTransportTlsRole> role,
absl::optional<int> tls_version,
absl::optional<int> ssl_cipher_suite,
absl::optional<int> srtp_cipher_suite,
std::optional<DtlsTransportTlsRole> role,
std::optional<int> tls_version,
std::optional<int> ssl_cipher_suite,
std::optional<int> srtp_cipher_suite,
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates)
: state_(state),
role_(role),
@ -41,12 +41,12 @@ DtlsTransportInformation::DtlsTransportInformation(
// Deprecated version
DtlsTransportInformation::DtlsTransportInformation(
DtlsTransportState state,
absl::optional<int> tls_version,
absl::optional<int> ssl_cipher_suite,
absl::optional<int> srtp_cipher_suite,
std::optional<int> tls_version,
std::optional<int> ssl_cipher_suite,
std::optional<int> srtp_cipher_suite,
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates)
: state_(state),
role_(absl::nullopt),
role_(std::nullopt),
tls_version_(tls_version),
ssl_cipher_suite_(ssl_cipher_suite),
srtp_cipher_suite_(srtp_cipher_suite),

View File

@ -12,9 +12,9 @@
#define API_DTLS_TRANSPORT_INTERFACE_H_
#include <memory>
#include <optional>
#include "absl/base/attributes.h"
#include "absl/types/optional.h"
#include "api/ice_transport_interface.h"
#include "api/ref_count.h"
#include "api/rtc_error.h"
@ -49,17 +49,17 @@ class RTC_EXPORT DtlsTransportInformation {
explicit DtlsTransportInformation(DtlsTransportState state);
DtlsTransportInformation(
DtlsTransportState state,
absl::optional<DtlsTransportTlsRole> role,
absl::optional<int> tls_version,
absl::optional<int> ssl_cipher_suite,
absl::optional<int> srtp_cipher_suite,
std::optional<DtlsTransportTlsRole> role,
std::optional<int> tls_version,
std::optional<int> ssl_cipher_suite,
std::optional<int> srtp_cipher_suite,
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates);
ABSL_DEPRECATED("Use version with role parameter")
DtlsTransportInformation(
DtlsTransportState state,
absl::optional<int> tls_version,
absl::optional<int> ssl_cipher_suite,
absl::optional<int> srtp_cipher_suite,
std::optional<int> tls_version,
std::optional<int> ssl_cipher_suite,
std::optional<int> srtp_cipher_suite,
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates);
// Copy and assign
@ -71,10 +71,10 @@ class RTC_EXPORT DtlsTransportInformation {
default;
DtlsTransportState state() const { return state_; }
absl::optional<DtlsTransportTlsRole> role() const { return role_; }
absl::optional<int> tls_version() const { return tls_version_; }
absl::optional<int> ssl_cipher_suite() const { return ssl_cipher_suite_; }
absl::optional<int> srtp_cipher_suite() const { return srtp_cipher_suite_; }
std::optional<DtlsTransportTlsRole> role() const { return role_; }
std::optional<int> tls_version() const { return tls_version_; }
std::optional<int> ssl_cipher_suite() const { return ssl_cipher_suite_; }
std::optional<int> srtp_cipher_suite() const { return srtp_cipher_suite_; }
// The accessor returns a temporary pointer, it does not release ownership.
const rtc::SSLCertChain* remote_ssl_certificates() const {
return remote_ssl_certificates_.get();
@ -82,10 +82,10 @@ class RTC_EXPORT DtlsTransportInformation {
private:
DtlsTransportState state_;
absl::optional<DtlsTransportTlsRole> role_;
absl::optional<int> tls_version_;
absl::optional<int> ssl_cipher_suite_;
absl::optional<int> srtp_cipher_suite_;
std::optional<DtlsTransportTlsRole> role_;
std::optional<int> tls_version_;
std::optional<int> ssl_cipher_suite_;
std::optional<int> srtp_cipher_suite_;
std::unique_ptr<rtc::SSLCertChain> remote_ssl_certificates_;
};

View File

@ -58,7 +58,6 @@ if (rtc_include_tests) {
"../units:timestamp",
"//third_party/abseil-cpp/absl/functional:any_invocable",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
}

View File

@ -11,13 +11,13 @@
#include "api/environment/environment.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/environment/environment_factory.h"
#include "api/field_trials_view.h"
#include "api/rtc_event_log/rtc_event.h"
@ -168,10 +168,10 @@ TEST(EnvironmentTest, KeepsUtilityAliveWhileEnvironmentIsAlive) {
/*on_destroyed=*/[&] { utility_destroyed = true; });
// Wrap Environment into optional to have explicit control when it is deleted.
absl::optional<Environment> env = CreateEnvironment(std::move(field_trials));
std::optional<Environment> env = CreateEnvironment(std::move(field_trials));
EXPECT_FALSE(utility_destroyed);
env = absl::nullopt;
env = std::nullopt;
EXPECT_TRUE(utility_destroyed);
}
@ -180,13 +180,13 @@ TEST(EnvironmentTest, KeepsUtilityAliveWhileCopyOfEnvironmentIsAlive) {
auto field_trials = std::make_unique<FakeFieldTrials>(
/*on_destroyed=*/[&] { utility_destroyed = true; });
absl::optional<Environment> env1 = CreateEnvironment(std::move(field_trials));
absl::optional<Environment> env2 = env1;
std::optional<Environment> env1 = CreateEnvironment(std::move(field_trials));
std::optional<Environment> env2 = env1;
EXPECT_FALSE(utility_destroyed);
env1 = absl::nullopt;
env1 = std::nullopt;
EXPECT_FALSE(utility_destroyed);
env2 = absl::nullopt;
env2 = std::nullopt;
EXPECT_TRUE(utility_destroyed);
}
@ -234,27 +234,27 @@ TEST(EnvironmentTest, FactoryCanCreateNewEnvironmentFromExistingOne) {
TEST(EnvironmentTest, KeepsOwnershipsWhenCreateNewEnvironmentFromExistingOne) {
bool utility1_destroyed = false;
bool utility2_destroyed = false;
absl::optional<Environment> env1 =
std::optional<Environment> env1 =
CreateEnvironment(std::make_unique<FakeTaskQueueFactory>(
/*on_destroyed=*/[&] { utility1_destroyed = true; }));
absl::optional<EnvironmentFactory> factory = EnvironmentFactory(*env1);
std::optional<EnvironmentFactory> factory = EnvironmentFactory(*env1);
// Destroy env1, check utility1 it was using is still alive.
env1 = absl::nullopt;
env1 = std::nullopt;
EXPECT_FALSE(utility1_destroyed);
factory->Set(std::make_unique<FakeFieldTrials>(
/*on_destroyed=*/[&] { utility2_destroyed = true; }));
absl::optional<Environment> env2 = factory->Create();
std::optional<Environment> env2 = factory->Create();
// Destroy the factory, check all utilities used by env2 are alive.
factory = absl::nullopt;
factory = std::nullopt;
EXPECT_FALSE(utility1_destroyed);
EXPECT_FALSE(utility2_destroyed);
// Once last Environment object is deleted, utilties should be deleted too.
env2 = absl::nullopt;
env2 = std::nullopt;
EXPECT_TRUE(utility1_destroyed);
EXPECT_TRUE(utility2_destroyed);
}
@ -266,11 +266,11 @@ TEST(EnvironmentTest, DestroysUtilitiesInReverseProvidedOrder) {
auto task_queue_factory = std::make_unique<FakeTaskQueueFactory>(
/*on_destroyed=*/[&] { destroyed.push_back("task_queue_factory"); });
absl::optional<Environment> env =
std::optional<Environment> env =
CreateEnvironment(std::move(field_trials), std::move(task_queue_factory));
ASSERT_THAT(destroyed, IsEmpty());
env = absl::nullopt;
env = std::nullopt;
EXPECT_THAT(destroyed, ElementsAre("task_queue_factory", "field_trials"));
}

View File

@ -13,9 +13,9 @@
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/ref_count.h"
#include "api/scoped_refptr.h"
@ -56,8 +56,8 @@ class TransformableFrameInterface {
// TODO(https://bugs.webrtc.org/14878): Change this to pure virtual after it
// is implemented everywhere.
virtual absl::optional<Timestamp> GetCaptureTimeIdentifier() const {
return absl::nullopt;
virtual std::optional<Timestamp> GetCaptureTimeIdentifier() const {
return std::nullopt;
}
enum class Direction {
@ -91,9 +91,9 @@ class TransformableAudioFrameInterface : public TransformableFrameInterface {
virtual rtc::ArrayView<const uint32_t> GetContributingSources() const = 0;
virtual const absl::optional<uint16_t> SequenceNumber() const = 0;
virtual const std::optional<uint16_t> SequenceNumber() const = 0;
virtual absl::optional<uint64_t> AbsoluteCaptureTimestamp() const = 0;
virtual std::optional<uint64_t> AbsoluteCaptureTimestamp() const = 0;
enum class FrameType { kEmptyFrame, kAudioFrameSpeech, kAudioFrameCN };
@ -104,11 +104,11 @@ class TransformableAudioFrameInterface : public TransformableFrameInterface {
// Audio level in -dBov. Values range from 0 to 127, representing 0 to -127
// dBov. 127 represents digital silence. Only present on remote frames if
// the audio level header extension was included.
virtual absl::optional<uint8_t> AudioLevel() const = 0;
virtual std::optional<uint8_t> AudioLevel() const = 0;
// Timestamp at which the packet has been first seen on the network interface.
// Only defined for received audio packet.
virtual absl::optional<Timestamp> ReceiveTime() const = 0;
virtual std::optional<Timestamp> ReceiveTime() const = 0;
};
// Objects implement this interface to be notified with the transformed frame.

View File

@ -40,7 +40,7 @@ const char* SdpTypeToString(SdpType type) {
return "";
}
absl::optional<SdpType> SdpTypeFromString(const std::string& type_str) {
std::optional<SdpType> SdpTypeFromString(const std::string& type_str) {
if (type_str == SessionDescriptionInterface::kOffer) {
return SdpType::kOffer;
} else if (type_str == SessionDescriptionInterface::kPrAnswer) {
@ -50,7 +50,7 @@ absl::optional<SdpType> SdpTypeFromString(const std::string& type_str) {
} else if (type_str == SessionDescriptionInterface::kRollback) {
return SdpType::kRollback;
} else {
return absl::nullopt;
return std::nullopt;
}
}

View File

@ -23,10 +23,10 @@
#include <stddef.h>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/ref_count.h"
#include "api/rtc_error.h"
#include "rtc_base/system/rtc_export.h"
@ -117,7 +117,7 @@ RTC_EXPORT const char* SdpTypeToString(SdpType type);
// Returns the SdpType from its string form. The string form can be one of the
// constants defined in SessionDescriptionInterface. Passing in any other string
// results in nullopt.
RTC_EXPORT absl::optional<SdpType> SdpTypeFromString(
RTC_EXPORT std::optional<SdpType> SdpTypeFromString(
const std::string& type_str);
// Class representation of an SDP session description.

View File

@ -19,10 +19,10 @@
#include <stddef.h>
#include <stdint.h>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/audio/audio_processing_statistics.h"
#include "api/audio_options.h"
#include "api/ref_count.h"
@ -131,7 +131,7 @@ class VideoTrackSourceInterface : public MediaSourceInterface,
// depending on video codec.
// TODO(perkj): Remove this once denoising is done by the source, and not by
// the encoder.
virtual absl::optional<bool> needs_denoising() const = 0;
virtual std::optional<bool> needs_denoising() const = 0;
// Returns false if no stats are available, e.g, for a remote source, or a
// source which has not seen its first frame yet.
@ -217,7 +217,7 @@ class AudioTrackSinkInterface {
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
absl::optional<int64_t> absolute_capture_timestamp_ms) {
std::optional<int64_t> absolute_capture_timestamp_ms) {
// TODO(bugs.webrtc.org/10739): Deprecate the old OnData and make this one
// pure virtual.
return OnData(audio_data, bits_per_sample, sample_rate, number_of_channels,

View File

@ -25,7 +25,6 @@ rtc_source_set("neteq_api") {
"../audio_codecs:audio_codecs_api",
"../environment",
"../units:timestamp",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -57,7 +56,6 @@ rtc_source_set("neteq_controller_api") {
":neteq_api",
":tick_timer",
"../environment",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -15,10 +15,10 @@
#include <stdint.h>
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/audio_codecs/audio_codec_pair_id.h"
#include "api/audio_codecs/audio_format.h"
@ -136,7 +136,7 @@ class NetEq {
bool enable_fast_accelerate = false;
bool enable_muted_state = false;
bool enable_rtx_handling = false;
absl::optional<AudioCodecPairId> codec_pair_id;
std::optional<AudioCodecPairId> codec_pair_id;
bool for_test_no_time_stretching = false; // Use only for testing.
};
@ -223,7 +223,7 @@ class NetEq {
AudioFrame* audio_frame,
bool* muted = nullptr,
int* current_sample_rate_hz = nullptr,
absl::optional<Operation> action_override = absl::nullopt) = 0;
std::optional<Operation> action_override = std::nullopt) = 0;
// Replaces the current set of decoders with the given one.
virtual void SetCodecs(const std::map<int, SdpAudioFormat>& codecs) = 0;
@ -289,7 +289,7 @@ class NetEq {
// Returns the RTP timestamp for the last sample delivered by GetAudio().
// The return value will be empty if no valid timestamp is available.
virtual absl::optional<uint32_t> GetPlayoutTimestamp() const = 0;
virtual std::optional<uint32_t> GetPlayoutTimestamp() const = 0;
// Returns the sample rate in Hz of the audio produced in the last GetAudio
// call. If GetAudio has not been called yet, the configured sample rate
@ -299,14 +299,14 @@ class NetEq {
// Returns the decoder info for the given payload type. Returns empty if no
// such payload type was registered.
[[deprecated(
"Use GetCurrentDecoderFormat")]] virtual absl::optional<DecoderFormat>
"Use GetCurrentDecoderFormat")]] virtual std::optional<DecoderFormat>
GetDecoderFormat(int payload_type) const {
return absl::nullopt;
return std::nullopt;
}
// Returns info for the most recently used decoder.
virtual absl::optional<DecoderFormat> GetCurrentDecoderFormat() const {
return absl::nullopt;
virtual std::optional<DecoderFormat> GetCurrentDecoderFormat() const {
return std::nullopt;
}
// Flushes both the packet buffer and the sync buffer.

View File

@ -15,8 +15,8 @@
#include <cstdint>
#include <functional>
#include <memory>
#include <optional>
#include "absl/types/optional.h"
#include "api/neteq/neteq.h"
#include "api/neteq/tick_timer.h"
@ -86,7 +86,7 @@ class NetEqController {
uint32_t target_timestamp;
int16_t expand_mutefactor;
size_t last_packet_samples;
absl::optional<PacketInfo> next_packet;
std::optional<PacketInfo> next_packet;
NetEq::Mode last_mode;
bool play_dtmf;
size_t generated_noise_samples;
@ -161,9 +161,9 @@ class NetEqController {
// Notify the NetEqController that a packet has arrived. Returns the relative
// arrival delay, if it can be computed.
virtual absl::optional<int> PacketArrived(int fs_hz,
bool should_update_stats,
const PacketArrivedInfo& info) = 0;
virtual std::optional<int> PacketArrived(int fs_hz,
bool should_update_stats,
const PacketArrivedInfo& info) = 0;
// Notify the NetEqController that we are currently in muted state.
// TODO(bugs.webrtc.org/14270): Make pure virtual when downstream is updated.

View File

@ -73,12 +73,12 @@
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/adaptation/resource.h"
#include "api/async_dns_resolver.h"
#include "api/audio/audio_device.h"
@ -433,7 +433,7 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// The below fields correspond to constraints from the deprecated
// constraints interface for constructing a PeerConnection.
//
// absl::optional fields can be "missing", in which case the implementation
// std::optional fields can be "missing", in which case the implementation
// default will be used.
//////////////////////////////////////////////////////////////////////////
@ -457,7 +457,7 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// Minimum bitrate at which screencast video tracks will be encoded at.
// This means adding padding bits up to this bitrate, which can help
// when switching from a static scene to one with motion.
absl::optional<int> screencast_min_bitrate;
std::optional<int> screencast_min_bitrate;
/////////////////////////////////////////////////
// The below fields are not part of the standard.
@ -581,28 +581,28 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// 3) ice_check_min_interval defines the minimal interval (equivalently the
// maximum rate) that overrides the above two intervals when either of them
// is less.
absl::optional<int> ice_check_interval_strong_connectivity;
absl::optional<int> ice_check_interval_weak_connectivity;
absl::optional<int> ice_check_min_interval;
std::optional<int> ice_check_interval_strong_connectivity;
std::optional<int> ice_check_interval_weak_connectivity;
std::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 in the ICE implementation if set.
absl::optional<int> ice_unwritable_timeout;
std::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 in the ICE implementation if set.
absl::optional<int> ice_unwritable_min_checks;
std::optional<int> ice_unwritable_min_checks;
// The min time period for which a candidate pair must wait for response to
// connectivity checks it becomes inactive. This parameter overrides the
// default value in the ICE implementation if set.
absl::optional<int> ice_inactive_timeout;
std::optional<int> ice_inactive_timeout;
// The interval in milliseconds at which STUN candidates will resend STUN
// binding requests to keep NAT bindings open.
absl::optional<int> stun_candidate_keepalive_interval;
std::optional<int> stun_candidate_keepalive_interval;
// Optional TurnCustomizer.
// With this class one can modify outgoing TURN messages.
@ -614,7 +614,7 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// A candidate pair on a preferred network has a higher precedence in ICE
// than one on an un-preferred network, regardless of priority or network
// cost.
absl::optional<rtc::AdapterType> network_preference;
std::optional<rtc::AdapterType> network_preference;
// Configure the SDP semantics used by this PeerConnection. By default, this
// is Unified Plan which is compliant to the WebRTC 1.0 specification. It is
@ -648,7 +648,7 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// Defines advanced optional cryptographic settings related to SRTP and
// frame encryption for native WebRTC. Setting this will overwrite any
// settings set in PeerConnectionFactory (which is deprecated).
absl::optional<CryptoOptions> crypto_options;
std::optional<CryptoOptions> crypto_options;
// Configure if we should include the SDP attribute extmap-allow-mixed in
// our offer on session level.
@ -665,11 +665,11 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// The delay before doing a usage histogram report for long-lived
// PeerConnections. Used for testing only.
absl::optional<int> report_usage_pattern_delay_ms;
std::optional<int> report_usage_pattern_delay_ms;
// The ping interval (ms) when the connection is stable and writable. This
// parameter overrides the default value in the ICE implementation if set.
absl::optional<int> stable_writable_connection_ping_interval_ms;
std::optional<int> stable_writable_connection_ping_interval_ms;
// Whether this PeerConnection will avoid VPNs (kAvoidVpn), prefer VPNs
// (kPreferVpn), only work over VPN (kOnlyUseVpn) or only work over non-VPN
@ -685,7 +685,7 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
PortAllocatorConfig port_allocator_config;
// The burst interval of the pacer, see TaskQueuePacedSender constructor.
absl::optional<TimeDelta> pacer_burst_interval;
std::optional<TimeDelta> pacer_burst_interval;
//
// Don't forget to update operator== if adding something.
@ -1187,7 +1187,7 @@ class RTC_EXPORT PeerConnectionInterface : public webrtc::RefCountInterface {
// Returns the current state of canTrickleIceCandidates per
// https://w3c.github.io/webrtc-pc/#attributes-1
virtual absl::optional<bool> can_trickle_ice_candidates() = 0;
virtual std::optional<bool> can_trickle_ice_candidates() = 0;
// When a resource is overused, the PeerConnection will try to reduce the load
// on the sysem, for example by reducing the resolution or frame rate of

View File

@ -13,11 +13,11 @@
#include <stdint.h>
#include <optional>
#include <string>
#include <utility> // For std::move.
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "rtc_base/system/rtc_export.h"
@ -137,7 +137,7 @@ class RTC_EXPORT RTCError {
RTCErrorDetailType error_detail() const { return error_detail_; }
void set_error_detail(RTCErrorDetailType detail) { error_detail_ = detail; }
absl::optional<uint16_t> sctp_cause_code() const { return sctp_cause_code_; }
std::optional<uint16_t> sctp_cause_code() const { return sctp_cause_code_; }
void set_sctp_cause_code(uint16_t cause_code) {
sctp_cause_code_ = cause_code;
}
@ -150,7 +150,7 @@ class RTC_EXPORT RTCError {
RTCErrorType type_ = RTCErrorType::NONE;
std::string message_;
RTCErrorDetailType error_detail_ = RTCErrorDetailType::NONE;
absl::optional<uint16_t> sctp_cause_code_;
std::optional<uint16_t> sctp_cause_code_;
};
// Outputs the error as a friendly string. Update this method when adding a new
@ -309,7 +309,7 @@ class RTCErrorOr {
private:
RTCError error_;
absl::optional<T> value_;
std::optional<T> value_;
};
} // namespace webrtc

View File

@ -14,9 +14,9 @@
#include <stddef.h>
#include <stdint.h>
#include <optional>
#include <string>
#include "absl/types/optional.h"
#include "api/units/timestamp.h"
#include "api/video/color_space.h"
#include "api/video/video_content_type.h"
@ -75,7 +75,7 @@ struct AbsoluteCaptureTime {
// systems NTP clock:
//
// Capture NTP Clock = Sender NTP Clock + Capture Clock Offset
absl::optional<int64_t> estimated_capture_clock_offset;
std::optional<int64_t> estimated_capture_clock_offset;
};
// The audio level extension is used to indicate the voice activity and the
@ -131,16 +131,16 @@ struct RTPHeaderExtension {
int32_t transmissionTimeOffset;
bool hasAbsoluteSendTime;
uint32_t absoluteSendTime;
absl::optional<AbsoluteCaptureTime> absolute_capture_time;
std::optional<AbsoluteCaptureTime> absolute_capture_time;
bool hasTransportSequenceNumber;
uint16_t transportSequenceNumber;
absl::optional<FeedbackRequest> feedback_request;
std::optional<FeedbackRequest> feedback_request;
// Audio Level includes both level in dBov and voiced/unvoiced bit. See:
// https://tools.ietf.org/html/rfc6464#section-3
absl::optional<AudioLevel> audio_level() const { return audio_level_; }
std::optional<AudioLevel> audio_level() const { return audio_level_; }
void set_audio_level(absl::optional<AudioLevel> audio_level) {
void set_audio_level(std::optional<AudioLevel> audio_level) {
audio_level_ = audio_level;
}
@ -150,7 +150,7 @@ struct RTPHeaderExtension {
bool hasVideoRotation;
VideoRotation videoRotation;
// TODO(ilnik): Refactor this and one above to be absl::optional() and remove
// TODO(ilnik): Refactor this and one above to be std::optional() and remove
// a corresponding bool flag.
bool hasVideoContentType;
VideoContentType videoContentType;
@ -169,10 +169,10 @@ struct RTPHeaderExtension {
// https://tools.ietf.org/html/rfc8843
std::string mid;
absl::optional<ColorSpace> color_space;
std::optional<ColorSpace> color_space;
private:
absl::optional<AudioLevel> audio_level_;
std::optional<AudioLevel> audio_level_;
};
enum { kRtpCsrcSize = 15 }; // RFC 3550 page 13

View File

@ -12,10 +12,10 @@
#define API_RTP_PACKET_INFO_H_
#include <cstdint>
#include <optional>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/rtp_headers.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
@ -56,26 +56,26 @@ class RTC_EXPORT RtpPacketInfo {
Timestamp receive_time() const { return receive_time_; }
void set_receive_time(Timestamp value) { receive_time_ = value; }
absl::optional<uint8_t> audio_level() const { return audio_level_; }
RtpPacketInfo& set_audio_level(absl::optional<uint8_t> value) {
std::optional<uint8_t> audio_level() const { return audio_level_; }
RtpPacketInfo& set_audio_level(std::optional<uint8_t> value) {
audio_level_ = value;
return *this;
}
const absl::optional<AbsoluteCaptureTime>& absolute_capture_time() const {
const std::optional<AbsoluteCaptureTime>& absolute_capture_time() const {
return absolute_capture_time_;
}
RtpPacketInfo& set_absolute_capture_time(
const absl::optional<AbsoluteCaptureTime>& value) {
const std::optional<AbsoluteCaptureTime>& value) {
absolute_capture_time_ = value;
return *this;
}
const absl::optional<TimeDelta>& local_capture_clock_offset() const {
const std::optional<TimeDelta>& local_capture_clock_offset() const {
return local_capture_clock_offset_;
}
RtpPacketInfo& set_local_capture_clock_offset(
absl::optional<TimeDelta> value) {
std::optional<TimeDelta> value) {
local_capture_clock_offset_ = value;
return *this;
}
@ -92,18 +92,18 @@ class RTC_EXPORT RtpPacketInfo {
// Fields from the Audio Level header extension:
// https://tools.ietf.org/html/rfc6464#section-3
absl::optional<uint8_t> audio_level_;
std::optional<uint8_t> audio_level_;
// Fields from the Absolute Capture Time header extension:
// http://www.webrtc.org/experiments/rtp-hdrext/abs-capture-time
absl::optional<AbsoluteCaptureTime> absolute_capture_time_;
std::optional<AbsoluteCaptureTime> absolute_capture_time_;
// Clock offset between the local clock and the capturer's clock.
// Do not confuse with `AbsoluteCaptureTime::estimated_capture_clock_offset`
// which instead represents the clock offset between a remote sender and the
// capturer. The following holds:
// Capture's NTP Clock = Local NTP Clock + Local-Capture Clock Offset
absl::optional<TimeDelta> local_capture_clock_offset_;
std::optional<TimeDelta> local_capture_clock_offset_;
};
bool operator==(const RtpPacketInfo& lhs, const RtpPacketInfo& rhs);

View File

@ -11,9 +11,9 @@
#include "api/rtp_packet_info.h"
#include <cstdint>
#include <optional>
#include <vector>
#include "absl/types/optional.h"
#include "api/rtp_headers.h"
#include "api/units/time_delta.h"
#include "api/units/timestamp.h"
@ -134,7 +134,7 @@ TEST(RtpPacketInfoTest, ReceiveTimeMs) {
}
TEST(RtpPacketInfoTest, AudioLevel) {
constexpr absl::optional<uint8_t> kValue = 31;
constexpr std::optional<uint8_t> kValue = 31;
RtpPacketInfo lhs;
RtpPacketInfo rhs;
@ -163,7 +163,7 @@ TEST(RtpPacketInfoTest, AudioLevel) {
}
TEST(RtpPacketInfoTest, AbsoluteCaptureTime) {
constexpr absl::optional<AbsoluteCaptureTime> kValue = AbsoluteCaptureTime{
constexpr std::optional<AbsoluteCaptureTime> kValue = AbsoluteCaptureTime{
.absolute_capture_timestamp = 12, .estimated_capture_clock_offset = 34};
RtpPacketInfo lhs;
@ -213,7 +213,7 @@ TEST(RtpPacketInfoTest, LocalCaptureClockOffset) {
EXPECT_FALSE(lhs != rhs);
rhs = RtpPacketInfo();
EXPECT_EQ(rhs.local_capture_clock_offset(), absl::nullopt);
EXPECT_EQ(rhs.local_capture_clock_offset(), std::nullopt);
rhs = RtpPacketInfo(/*ssrc=*/{}, /*csrcs=*/{}, /*rtp_timestamp=*/{},
/*receive_time=*/Timestamp::Zero());

View File

@ -14,12 +14,12 @@
#include <stdint.h>
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "absl/container/inlined_vector.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/media_types.h"
#include "api/priority.h"
#include "api/rtp_transceiver_direction.h"
@ -109,7 +109,7 @@ struct RTC_EXPORT RtcpFeedback {
// 1. It's an enum instead of a string.
// 2. Generic NACK feedback is represented by a GENERIC_NACK message type,
// rather than an unset "parameter" value.
absl::optional<RtcpFeedbackMessageType> message_type;
std::optional<RtcpFeedbackMessageType> message_type;
// Constructors for convenience.
RtcpFeedback();
@ -139,14 +139,14 @@ struct RTC_EXPORT RtpCodec {
cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO;
// If unset, the implementation default is used.
absl::optional<int> clock_rate;
std::optional<int> clock_rate;
// The number of audio channels used. Unset for video codecs. If unset for
// audio, the implementation default is used.
// TODO(deadbeef): The "implementation default" part isn't fully implemented.
// Only defaults to 1, even though some codecs (such as opus) should really
// default to 2.
absl::optional<int> num_channels;
std::optional<int> num_channels;
// Feedback mechanisms to be used for this codec.
// TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
@ -180,7 +180,7 @@ struct RTC_EXPORT RtpCodecCapability : public RtpCodec {
// Default payload type for this codec. Mainly needed for codecs that have
// statically assigned payload types.
absl::optional<int> preferred_payload_type;
std::optional<int> preferred_payload_type;
// List of scalability modes supported by the video codec.
absl::InlinedVector<ScalabilityMode, kScalabilityModeCount> scalability_modes;
@ -209,7 +209,7 @@ struct RTC_EXPORT RtpHeaderExtensionCapability {
std::string uri;
// Preferred value of ID that goes in the packet.
absl::optional<int> preferred_id;
std::optional<int> preferred_id;
// If true, it's preferred that the value in the header is encrypted.
// TODO(deadbeef): Not implemented.
@ -397,7 +397,7 @@ struct RTC_EXPORT RtpExtension {
struct RTC_EXPORT RtpFecParameters {
// If unset, a value is chosen by the implementation.
// Works just like RtpEncodingParameters::ssrc.
absl::optional<uint32_t> ssrc;
std::optional<uint32_t> ssrc;
FecMechanism mechanism = FecMechanism::RED;
@ -417,7 +417,7 @@ struct RTC_EXPORT RtpFecParameters {
struct RTC_EXPORT RtpRtxParameters {
// If unset, a value is chosen by the implementation.
// Works just like RtpEncodingParameters::ssrc.
absl::optional<uint32_t> ssrc;
std::optional<uint32_t> ssrc;
// Constructors for convenience.
RtpRtxParameters();
@ -440,7 +440,7 @@ struct RTC_EXPORT RtpEncodingParameters {
// may change due to an SSRC conflict, in which case the conflict is handled
// internally without any event. Another way of looking at this is that an
// unset SSRC acts as a "wildcard" SSRC.
absl::optional<uint32_t> ssrc;
std::optional<uint32_t> ssrc;
// The relative bitrate priority of this encoding. Currently this is
// implemented for the entire rtp sender by using the value of the first
@ -475,24 +475,24 @@ struct RTC_EXPORT RtpEncodingParameters {
// bandwidth for the entire bandwidth estimator (audio and video). This is
// just always how "b=AS" was handled, but it's not correct and should be
// fixed.
absl::optional<int> max_bitrate_bps;
std::optional<int> max_bitrate_bps;
// Specifies the minimum bitrate in bps for video.
absl::optional<int> min_bitrate_bps;
std::optional<int> min_bitrate_bps;
// Specifies the maximum framerate in fps for video.
absl::optional<double> max_framerate;
std::optional<double> max_framerate;
// Specifies the number of temporal layers for video (if the feature is
// supported by the codec implementation).
// Screencast support is experimental.
absl::optional<int> num_temporal_layers;
std::optional<int> num_temporal_layers;
// For video, scale the resolution down by this factor.
absl::optional<double> scale_resolution_down_by;
std::optional<double> scale_resolution_down_by;
// https://w3c.github.io/webrtc-svc/#rtcrtpencodingparameters
absl::optional<std::string> scalability_mode;
std::optional<std::string> scalability_mode;
// Requested encode resolution.
//
@ -510,7 +510,7 @@ struct RTC_EXPORT RtpEncodingParameters {
//
// It is an error to set both `requested_resolution` and
// `scale_resolution_down_by`.
absl::optional<Resolution> requested_resolution;
std::optional<Resolution> requested_resolution;
// For an RtpSender, set to true to cause this encoding to be encoded and
// sent, and false for it not to be encoded and sent. This allows control
@ -530,7 +530,7 @@ struct RTC_EXPORT RtpEncodingParameters {
bool adaptive_ptime = false;
// Allow changing the used codec for this encoding.
absl::optional<RtpCodec> codec;
std::optional<RtpCodec> codec;
bool operator==(const RtpEncodingParameters& o) const {
return ssrc == o.ssrc && bitrate_priority == o.bitrate_priority &&
@ -597,7 +597,7 @@ struct RtcpParameters final {
// The SSRC to be used in the "SSRC of packet sender" field. If not set, one
// will be chosen by the implementation.
// TODO(deadbeef): Not implemented.
absl::optional<uint32_t> ssrc;
std::optional<uint32_t> ssrc;
// The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
//
@ -653,7 +653,7 @@ struct RTC_EXPORT RtpParameters {
// When bandwidth is constrained and the RtpSender needs to choose between
// degrading resolution or degrading framerate, degradationPreference
// indicates which is preferred. Only for video tracks.
absl::optional<DegradationPreference> degradation_preference;
std::optional<DegradationPreference> degradation_preference;
bool operator==(const RtpParameters& o) const {
return mid == o.mid && codecs == o.codecs &&

View File

@ -14,11 +14,11 @@
#ifndef API_RTP_RECEIVER_INTERFACE_H_
#define API_RTP_RECEIVER_INTERFACE_H_
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/crypto/frame_decryptor_interface.h"
#include "api/dtls_transport_interface.h"
#include "api/frame_transformer_interface.h"
@ -91,7 +91,7 @@ class RTC_EXPORT RtpReceiverInterface : public webrtc::RefCountInterface,
// positive value including 0.0 measured in seconds. `nullopt` means default
// value must be used.
virtual void SetJitterBufferMinimumDelay(
absl::optional<double> delay_seconds) = 0;
std::optional<double> delay_seconds) = 0;
// TODO(zhihuang): Remove the default implementation once the subclasses
// implement this. Currently, the only relevant subclass is the

View File

@ -53,7 +53,7 @@ class RTC_EXPORT RtpSenderInterface : public webrtc::RefCountInterface,
// Returns primary SSRC used by this sender for sending media.
// Returns 0 if not yet determined.
// TODO(deadbeef): Change to absl::optional.
// TODO(deadbeef): Change to std::optional.
// TODO(deadbeef): Remove? With GetParameters this should be redundant.
virtual uint32_t ssrc() const = 0;

View File

@ -20,9 +20,9 @@ RtpTransceiverInit::RtpTransceiverInit(const RtpTransceiverInit& rhs) = default;
RtpTransceiverInit::~RtpTransceiverInit() = default;
absl::optional<RtpTransceiverDirection>
std::optional<RtpTransceiverDirection>
RtpTransceiverInterface::fired_direction() const {
return absl::nullopt;
return std::nullopt;
}
bool RtpTransceiverInterface::stopping() const {

View File

@ -11,11 +11,11 @@
#ifndef API_RTP_TRANSCEIVER_INTERFACE_H_
#define API_RTP_TRANSCEIVER_INTERFACE_H_
#include <optional>
#include <string>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/media_types.h"
#include "api/ref_count.h"
@ -69,7 +69,7 @@ class RTC_EXPORT RtpTransceiverInterface : public webrtc::RefCountInterface {
// remote descriptions. Before negotiation is complete, the mid value may be
// null. After rollbacks, the value may change from a non-null value to null.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
virtual absl::optional<std::string> mid() const = 0;
virtual std::optional<std::string> mid() const = 0;
// The sender attribute exposes the RtpSender corresponding to the RTP media
// that may be sent with the transceiver's mid. The sender is always present,
@ -119,14 +119,14 @@ class RTC_EXPORT RtpTransceiverInterface : public webrtc::RefCountInterface {
// for this transceiver. If this transceiver has never been represented in an
// offer/answer exchange, or if the transceiver is stopped, the value is null.
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
virtual absl::optional<RtpTransceiverDirection> current_direction() const = 0;
virtual std::optional<RtpTransceiverDirection> current_direction() const = 0;
// An internal slot designating for which direction the relevant
// PeerConnection events have been fired. This is to ensure that events like
// OnAddTrack only get fired once even if the same session description is
// applied again.
// Exposed in the public interface for use by Chromium.
virtual absl::optional<RtpTransceiverDirection> fired_direction() const;
virtual std::optional<RtpTransceiverDirection> fired_direction() const;
// Initiates a stop of the transceiver.
// The stop is complete when stopped() returns true.

View File

@ -20,8 +20,8 @@ SctpTransportInformation::SctpTransportInformation(SctpTransportState state)
SctpTransportInformation::SctpTransportInformation(
SctpTransportState state,
rtc::scoped_refptr<DtlsTransportInterface> dtls_transport,
absl::optional<double> max_message_size,
absl::optional<int> max_channels)
std::optional<double> max_message_size,
std::optional<int> max_channels)
: state_(state),
dtls_transport_(std::move(dtls_transport)),
max_message_size_(max_message_size),

View File

@ -11,7 +11,8 @@
#ifndef API_SCTP_TRANSPORT_INTERFACE_H_
#define API_SCTP_TRANSPORT_INTERFACE_H_
#include "absl/types/optional.h"
#include <optional>
#include "api/dtls_transport_interface.h"
#include "api/ref_count.h"
#include "api/scoped_refptr.h"
@ -41,22 +42,22 @@ class RTC_EXPORT SctpTransportInformation {
SctpTransportInformation(
SctpTransportState state,
rtc::scoped_refptr<DtlsTransportInterface> dtls_transport,
absl::optional<double> max_message_size,
absl::optional<int> max_channels);
std::optional<double> max_message_size,
std::optional<int> max_channels);
~SctpTransportInformation();
// The DTLS transport that supports this SCTP transport.
rtc::scoped_refptr<DtlsTransportInterface> dtls_transport() const {
return dtls_transport_;
}
SctpTransportState state() const { return state_; }
absl::optional<double> MaxMessageSize() const { return max_message_size_; }
absl::optional<int> MaxChannels() const { return max_channels_; }
std::optional<double> MaxMessageSize() const { return max_message_size_; }
std::optional<int> MaxChannels() const { return max_channels_; }
private:
SctpTransportState state_ = SctpTransportState::kNew;
rtc::scoped_refptr<DtlsTransportInterface> dtls_transport_;
absl::optional<double> max_message_size_;
absl::optional<int> max_channels_;
std::optional<double> max_message_size_;
std::optional<int> max_channels_;
};
class SctpTransportObserverInterface {

View File

@ -13,10 +13,10 @@
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "absl/types/variant.h"
#include "rtc_base/checks.h"
#include "rtc_base/system/rtc_export.h"
@ -24,30 +24,30 @@
namespace webrtc {
// A light-weight wrapper of an RTCStats attribute, i.e. an individual metric of
// type absl::optional<T>.
// type std::optional<T>.
class RTC_EXPORT Attribute {
public:
// All supported attribute types.
typedef absl::variant<const absl::optional<bool>*,
const absl::optional<int32_t>*,
const absl::optional<uint32_t>*,
const absl::optional<int64_t>*,
const absl::optional<uint64_t>*,
const absl::optional<double>*,
const absl::optional<std::string>*,
const absl::optional<std::vector<bool>>*,
const absl::optional<std::vector<int32_t>>*,
const absl::optional<std::vector<uint32_t>>*,
const absl::optional<std::vector<int64_t>>*,
const absl::optional<std::vector<uint64_t>>*,
const absl::optional<std::vector<double>>*,
const absl::optional<std::vector<std::string>>*,
const absl::optional<std::map<std::string, uint64_t>>*,
const absl::optional<std::map<std::string, double>>*>
typedef absl::variant<const std::optional<bool>*,
const std::optional<int32_t>*,
const std::optional<uint32_t>*,
const std::optional<int64_t>*,
const std::optional<uint64_t>*,
const std::optional<double>*,
const std::optional<std::string>*,
const std::optional<std::vector<bool>>*,
const std::optional<std::vector<int32_t>>*,
const std::optional<std::vector<uint32_t>>*,
const std::optional<std::vector<int64_t>>*,
const std::optional<std::vector<uint64_t>>*,
const std::optional<std::vector<double>>*,
const std::optional<std::vector<std::string>>*,
const std::optional<std::map<std::string, uint64_t>>*,
const std::optional<std::map<std::string, double>>*>
StatVariant;
template <typename T>
Attribute(const char* name, const absl::optional<T>* attribute)
Attribute(const char* name, const std::optional<T>* attribute)
: name_(name), attribute_(attribute) {}
const char* name() const;
@ -56,18 +56,18 @@ class RTC_EXPORT Attribute {
bool has_value() const;
template <typename T>
bool holds_alternative() const {
return absl::holds_alternative<const absl::optional<T>*>(attribute_);
return absl::holds_alternative<const std::optional<T>*>(attribute_);
}
template <typename T>
const absl::optional<T>& as_optional() const {
const std::optional<T>& as_optional() const {
RTC_CHECK(holds_alternative<T>());
return *absl::get<const absl::optional<T>*>(attribute_);
return *absl::get<const std::optional<T>*>(attribute_);
}
template <typename T>
const T& get() const {
RTC_CHECK(holds_alternative<T>());
RTC_CHECK(has_value());
return absl::get<const absl::optional<T>*>(attribute_)->value();
return absl::get<const std::optional<T>*>(attribute_)->value();
}
bool is_sequence() const;

View File

@ -16,11 +16,11 @@
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/stats/attribute.h"
#include "api/units/timestamp.h"
#include "rtc_base/checks.h"
@ -39,7 +39,7 @@ namespace webrtc {
// Use the `WEBRTC_RTCSTATS_IMPL` macro when implementing subclasses, see macro
// for details.
//
// Derived classes list their dictionary attributes, absl::optional<T>, as
// Derived classes list their dictionary attributes, std::optional<T>, as
// public fields, allowing the following:
//
// RTCFooStats foo("fooId", Timestamp::Micros(GetCurrentTime()));
@ -73,13 +73,12 @@ class RTC_EXPORT RTCStats {
// metrics as viewed via the Attribute wrapper.
std::vector<Attribute> Attributes() const;
template <typename T>
Attribute GetAttribute(const absl::optional<T>& stat) const {
Attribute GetAttribute(const std::optional<T>& stat) const {
for (const auto& attribute : Attributes()) {
if (!attribute.holds_alternative<T>()) {
continue;
}
if (absl::get<const absl::optional<T>*>(attribute.as_variant()) ==
&stat) {
if (absl::get<const std::optional<T>*>(attribute.as_variant()) == &stat) {
return attribute;
}
}
@ -136,8 +135,8 @@ class RTC_EXPORT RTCStats {
//
// RTCFooStats(const std::string& id, Timestamp timestamp);
//
// absl::optional<int32_t> foo;
// absl::optional<int32_t> bar;
// std::optional<int32_t> foo;
// std::optional<int32_t> bar;
// };
//
// rtcfoostats.cc:

View File

@ -15,10 +15,10 @@
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/stats/rtc_stats.h"
#include "rtc_base/system/rtc_export.h"
@ -31,10 +31,10 @@ class RTC_EXPORT RTCCertificateStats final : public RTCStats {
RTCCertificateStats(std::string id, Timestamp timestamp);
~RTCCertificateStats() override;
absl::optional<std::string> fingerprint;
absl::optional<std::string> fingerprint_algorithm;
absl::optional<std::string> base64_certificate;
absl::optional<std::string> issuer_certificate_id;
std::optional<std::string> fingerprint;
std::optional<std::string> fingerprint_algorithm;
std::optional<std::string> base64_certificate;
std::optional<std::string> issuer_certificate_id;
};
// https://w3c.github.io/webrtc-stats/#codec-dict*
@ -44,12 +44,12 @@ class RTC_EXPORT RTCCodecStats final : public RTCStats {
RTCCodecStats(std::string id, Timestamp timestamp);
~RTCCodecStats() override;
absl::optional<std::string> transport_id;
absl::optional<uint32_t> payload_type;
absl::optional<std::string> mime_type;
absl::optional<uint32_t> clock_rate;
absl::optional<uint32_t> channels;
absl::optional<std::string> sdp_fmtp_line;
std::optional<std::string> transport_id;
std::optional<uint32_t> payload_type;
std::optional<std::string> mime_type;
std::optional<uint32_t> clock_rate;
std::optional<uint32_t> channels;
std::optional<std::string> sdp_fmtp_line;
};
// https://w3c.github.io/webrtc-stats/#dcstats-dict*
@ -59,14 +59,14 @@ class RTC_EXPORT RTCDataChannelStats final : public RTCStats {
RTCDataChannelStats(std::string id, Timestamp timestamp);
~RTCDataChannelStats() override;
absl::optional<std::string> label;
absl::optional<std::string> protocol;
absl::optional<int32_t> data_channel_identifier;
absl::optional<std::string> state;
absl::optional<uint32_t> messages_sent;
absl::optional<uint64_t> bytes_sent;
absl::optional<uint32_t> messages_received;
absl::optional<uint64_t> bytes_received;
std::optional<std::string> label;
std::optional<std::string> protocol;
std::optional<int32_t> data_channel_identifier;
std::optional<std::string> state;
std::optional<uint32_t> messages_sent;
std::optional<uint64_t> bytes_sent;
std::optional<uint32_t> messages_received;
std::optional<uint64_t> bytes_received;
};
// https://w3c.github.io/webrtc-stats/#candidatepair-dict*
@ -76,35 +76,35 @@ class RTC_EXPORT RTCIceCandidatePairStats final : public RTCStats {
RTCIceCandidatePairStats(std::string id, Timestamp timestamp);
~RTCIceCandidatePairStats() override;
absl::optional<std::string> transport_id;
absl::optional<std::string> local_candidate_id;
absl::optional<std::string> remote_candidate_id;
absl::optional<std::string> state;
std::optional<std::string> transport_id;
std::optional<std::string> local_candidate_id;
std::optional<std::string> remote_candidate_id;
std::optional<std::string> state;
// Obsolete: priority
absl::optional<uint64_t> priority;
absl::optional<bool> nominated;
std::optional<uint64_t> priority;
std::optional<bool> nominated;
// `writable` does not exist in the spec and old comments suggest it used to
// exist but was incorrectly implemented.
// TODO(https://crbug.com/webrtc/14171): Standardize and/or modify
// implementation.
absl::optional<bool> writable;
absl::optional<uint64_t> packets_sent;
absl::optional<uint64_t> packets_received;
absl::optional<uint64_t> bytes_sent;
absl::optional<uint64_t> bytes_received;
absl::optional<double> total_round_trip_time;
absl::optional<double> current_round_trip_time;
absl::optional<double> available_outgoing_bitrate;
absl::optional<double> available_incoming_bitrate;
absl::optional<uint64_t> requests_received;
absl::optional<uint64_t> requests_sent;
absl::optional<uint64_t> responses_received;
absl::optional<uint64_t> responses_sent;
absl::optional<uint64_t> consent_requests_sent;
absl::optional<uint64_t> packets_discarded_on_send;
absl::optional<uint64_t> bytes_discarded_on_send;
absl::optional<double> last_packet_received_timestamp;
absl::optional<double> last_packet_sent_timestamp;
std::optional<bool> writable;
std::optional<uint64_t> packets_sent;
std::optional<uint64_t> packets_received;
std::optional<uint64_t> bytes_sent;
std::optional<uint64_t> bytes_received;
std::optional<double> total_round_trip_time;
std::optional<double> current_round_trip_time;
std::optional<double> available_outgoing_bitrate;
std::optional<double> available_incoming_bitrate;
std::optional<uint64_t> requests_received;
std::optional<uint64_t> requests_sent;
std::optional<uint64_t> responses_received;
std::optional<uint64_t> responses_sent;
std::optional<uint64_t> consent_requests_sent;
std::optional<uint64_t> packets_discarded_on_send;
std::optional<uint64_t> bytes_discarded_on_send;
std::optional<double> last_packet_received_timestamp;
std::optional<double> last_packet_sent_timestamp;
};
// https://w3c.github.io/webrtc-stats/#icecandidate-dict*
@ -113,28 +113,28 @@ class RTC_EXPORT RTCIceCandidateStats : public RTCStats {
WEBRTC_RTCSTATS_DECL();
~RTCIceCandidateStats() override;
absl::optional<std::string> transport_id;
std::optional<std::string> transport_id;
// Obsolete: is_remote
absl::optional<bool> is_remote;
absl::optional<std::string> network_type;
absl::optional<std::string> ip;
absl::optional<std::string> address;
absl::optional<int32_t> port;
absl::optional<std::string> protocol;
absl::optional<std::string> relay_protocol;
absl::optional<std::string> candidate_type;
absl::optional<int32_t> priority;
absl::optional<std::string> url;
absl::optional<std::string> foundation;
absl::optional<std::string> related_address;
absl::optional<int32_t> related_port;
absl::optional<std::string> username_fragment;
absl::optional<std::string> tcp_type;
std::optional<bool> is_remote;
std::optional<std::string> network_type;
std::optional<std::string> ip;
std::optional<std::string> address;
std::optional<int32_t> port;
std::optional<std::string> protocol;
std::optional<std::string> relay_protocol;
std::optional<std::string> candidate_type;
std::optional<int32_t> priority;
std::optional<std::string> url;
std::optional<std::string> foundation;
std::optional<std::string> related_address;
std::optional<int32_t> related_port;
std::optional<std::string> username_fragment;
std::optional<std::string> tcp_type;
// The following metrics are NOT exposed to JavaScript. We should consider
// standardizing or removing them.
absl::optional<bool> vpn;
absl::optional<std::string> network_adapter_type;
std::optional<bool> vpn;
std::optional<std::string> network_adapter_type;
protected:
RTCIceCandidateStats(std::string id, Timestamp timestamp, bool is_remote);
@ -169,8 +169,8 @@ class RTC_EXPORT RTCPeerConnectionStats final : public RTCStats {
RTCPeerConnectionStats(std::string id, Timestamp timestamp);
~RTCPeerConnectionStats() override;
absl::optional<uint32_t> data_channels_opened;
absl::optional<uint32_t> data_channels_closed;
std::optional<uint32_t> data_channels_opened;
std::optional<uint32_t> data_channels_closed;
};
// https://w3c.github.io/webrtc-stats/#streamstats-dict*
@ -179,10 +179,10 @@ class RTC_EXPORT RTCRtpStreamStats : public RTCStats {
WEBRTC_RTCSTATS_DECL();
~RTCRtpStreamStats() override;
absl::optional<uint32_t> ssrc;
absl::optional<std::string> kind;
absl::optional<std::string> transport_id;
absl::optional<std::string> codec_id;
std::optional<uint32_t> ssrc;
std::optional<std::string> kind;
std::optional<std::string> transport_id;
std::optional<std::string> codec_id;
protected:
RTCRtpStreamStats(std::string id, Timestamp timestamp);
@ -194,8 +194,8 @@ class RTC_EXPORT RTCReceivedRtpStreamStats : public RTCRtpStreamStats {
WEBRTC_RTCSTATS_DECL();
~RTCReceivedRtpStreamStats() override;
absl::optional<double> jitter;
absl::optional<int32_t> packets_lost; // Signed per RFC 3550
std::optional<double> jitter;
std::optional<int32_t> packets_lost; // Signed per RFC 3550
protected:
RTCReceivedRtpStreamStats(std::string id, Timestamp timestamp);
@ -207,8 +207,8 @@ class RTC_EXPORT RTCSentRtpStreamStats : public RTCRtpStreamStats {
WEBRTC_RTCSTATS_DECL();
~RTCSentRtpStreamStats() override;
absl::optional<uint64_t> packets_sent;
absl::optional<uint64_t> bytes_sent;
std::optional<uint64_t> packets_sent;
std::optional<uint64_t> bytes_sent;
protected:
RTCSentRtpStreamStats(std::string id, Timestamp timestamp);
@ -222,51 +222,51 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
RTCInboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCInboundRtpStreamStats() override;
absl::optional<std::string> playout_id;
absl::optional<std::string> track_identifier;
absl::optional<std::string> mid;
absl::optional<std::string> remote_id;
absl::optional<uint32_t> packets_received;
absl::optional<uint64_t> packets_discarded;
absl::optional<uint64_t> fec_packets_received;
absl::optional<uint64_t> fec_bytes_received;
absl::optional<uint64_t> fec_packets_discarded;
std::optional<std::string> playout_id;
std::optional<std::string> track_identifier;
std::optional<std::string> mid;
std::optional<std::string> remote_id;
std::optional<uint32_t> packets_received;
std::optional<uint64_t> packets_discarded;
std::optional<uint64_t> fec_packets_received;
std::optional<uint64_t> fec_bytes_received;
std::optional<uint64_t> fec_packets_discarded;
// Inbound FEC SSRC. Only present if a mechanism like FlexFEC is negotiated.
absl::optional<uint32_t> fec_ssrc;
absl::optional<uint64_t> bytes_received;
absl::optional<uint64_t> header_bytes_received;
std::optional<uint32_t> fec_ssrc;
std::optional<uint64_t> bytes_received;
std::optional<uint64_t> header_bytes_received;
// Inbound RTX stats. Only defined when RTX is used and it is therefore
// possible to distinguish retransmissions.
absl::optional<uint64_t> retransmitted_packets_received;
absl::optional<uint64_t> retransmitted_bytes_received;
absl::optional<uint32_t> rtx_ssrc;
std::optional<uint64_t> retransmitted_packets_received;
std::optional<uint64_t> retransmitted_bytes_received;
std::optional<uint32_t> rtx_ssrc;
absl::optional<double> last_packet_received_timestamp;
absl::optional<double> jitter_buffer_delay;
absl::optional<double> jitter_buffer_target_delay;
absl::optional<double> jitter_buffer_minimum_delay;
absl::optional<uint64_t> jitter_buffer_emitted_count;
absl::optional<uint64_t> total_samples_received;
absl::optional<uint64_t> concealed_samples;
absl::optional<uint64_t> silent_concealed_samples;
absl::optional<uint64_t> concealment_events;
absl::optional<uint64_t> inserted_samples_for_deceleration;
absl::optional<uint64_t> removed_samples_for_acceleration;
absl::optional<double> audio_level;
absl::optional<double> total_audio_energy;
absl::optional<double> total_samples_duration;
std::optional<double> last_packet_received_timestamp;
std::optional<double> jitter_buffer_delay;
std::optional<double> jitter_buffer_target_delay;
std::optional<double> jitter_buffer_minimum_delay;
std::optional<uint64_t> jitter_buffer_emitted_count;
std::optional<uint64_t> total_samples_received;
std::optional<uint64_t> concealed_samples;
std::optional<uint64_t> silent_concealed_samples;
std::optional<uint64_t> concealment_events;
std::optional<uint64_t> inserted_samples_for_deceleration;
std::optional<uint64_t> removed_samples_for_acceleration;
std::optional<double> audio_level;
std::optional<double> total_audio_energy;
std::optional<double> total_samples_duration;
// Stats below are only implemented or defined for video.
absl::optional<uint32_t> frames_received;
absl::optional<uint32_t> frame_width;
absl::optional<uint32_t> frame_height;
absl::optional<double> frames_per_second;
absl::optional<uint32_t> frames_decoded;
absl::optional<uint32_t> key_frames_decoded;
absl::optional<uint32_t> frames_dropped;
absl::optional<double> total_decode_time;
absl::optional<double> total_processing_delay;
absl::optional<double> total_assembly_time;
absl::optional<uint32_t> frames_assembled_from_multiple_packets;
std::optional<uint32_t> frames_received;
std::optional<uint32_t> frame_width;
std::optional<uint32_t> frame_height;
std::optional<double> frames_per_second;
std::optional<uint32_t> frames_decoded;
std::optional<uint32_t> key_frames_decoded;
std::optional<uint32_t> frames_dropped;
std::optional<double> total_decode_time;
std::optional<double> total_processing_delay;
std::optional<double> total_assembly_time;
std::optional<uint32_t> frames_assembled_from_multiple_packets;
// TODO(https://crbug.com/webrtc/15600): Implement framesRendered, which is
// incremented at the same time that totalInterFrameDelay and
// totalSquaredInterFrameDelay is incremented. (Dividing inter-frame delay by
@ -278,43 +278,43 @@ class RTC_EXPORT RTCInboundRtpStreamStats final
// at delivery to sink, not at actual render time. When we have an actual
// frame rendered callback, move the calculating of these metrics to there in
// order to make them more accurate.
absl::optional<double> total_inter_frame_delay;
absl::optional<double> total_squared_inter_frame_delay;
absl::optional<uint32_t> pause_count;
absl::optional<double> total_pauses_duration;
absl::optional<uint32_t> freeze_count;
absl::optional<double> total_freezes_duration;
std::optional<double> total_inter_frame_delay;
std::optional<double> total_squared_inter_frame_delay;
std::optional<uint32_t> pause_count;
std::optional<double> total_pauses_duration;
std::optional<uint32_t> freeze_count;
std::optional<double> total_freezes_duration;
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcinboundrtpstreamstats-contenttype
absl::optional<std::string> content_type;
std::optional<std::string> content_type;
// Only populated if audio/video sync is enabled.
// TODO(https://crbug.com/webrtc/14177): Expose even if A/V sync is off?
absl::optional<double> estimated_playout_timestamp;
std::optional<double> estimated_playout_timestamp;
// Only defined for video.
// In JavaScript, this is only exposed if HW exposure is allowed.
absl::optional<std::string> decoder_implementation;
std::optional<std::string> decoder_implementation;
// FIR and PLI counts are only defined for |kind == "video"|.
absl::optional<uint32_t> fir_count;
absl::optional<uint32_t> pli_count;
absl::optional<uint32_t> nack_count;
absl::optional<uint64_t> qp_sum;
std::optional<uint32_t> fir_count;
std::optional<uint32_t> pli_count;
std::optional<uint32_t> nack_count;
std::optional<uint64_t> qp_sum;
// This is a remnant of the legacy getStats() API. When the "video-timing"
// header extension is used,
// https://webrtc.github.io/webrtc-org/experiments/rtp-hdrext/video-timing/,
// `googTimingFrameInfo` is exposed with the value of
// TimingFrameInfo::ToString().
// TODO(https://crbug.com/webrtc/14586): Unship or standardize this metric.
absl::optional<std::string> goog_timing_frame_info;
std::optional<std::string> goog_timing_frame_info;
// In JavaScript, this is only exposed if HW exposure is allowed.
absl::optional<bool> power_efficient_decoder;
std::optional<bool> power_efficient_decoder;
// The following metrics are NOT exposed to JavaScript. We should consider
// standardizing or removing them.
absl::optional<uint64_t> jitter_buffer_flushes;
absl::optional<uint64_t> delayed_packet_outage_samples;
absl::optional<double> relative_packet_arrival_delay;
absl::optional<uint32_t> interruption_count;
absl::optional<double> total_interruption_duration;
absl::optional<double> min_playout_delay;
std::optional<uint64_t> jitter_buffer_flushes;
std::optional<uint64_t> delayed_packet_outage_samples;
std::optional<double> relative_packet_arrival_delay;
std::optional<uint32_t> interruption_count;
std::optional<double> total_interruption_duration;
std::optional<double> min_playout_delay;
};
// https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*
@ -325,46 +325,46 @@ class RTC_EXPORT RTCOutboundRtpStreamStats final
RTCOutboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCOutboundRtpStreamStats() override;
absl::optional<std::string> media_source_id;
absl::optional<std::string> remote_id;
absl::optional<std::string> mid;
absl::optional<std::string> rid;
absl::optional<uint64_t> retransmitted_packets_sent;
absl::optional<uint64_t> header_bytes_sent;
absl::optional<uint64_t> retransmitted_bytes_sent;
absl::optional<double> target_bitrate;
absl::optional<uint32_t> frames_encoded;
absl::optional<uint32_t> key_frames_encoded;
absl::optional<double> total_encode_time;
absl::optional<uint64_t> total_encoded_bytes_target;
absl::optional<uint32_t> frame_width;
absl::optional<uint32_t> frame_height;
absl::optional<double> frames_per_second;
absl::optional<uint32_t> frames_sent;
absl::optional<uint32_t> huge_frames_sent;
absl::optional<double> total_packet_send_delay;
absl::optional<std::string> quality_limitation_reason;
absl::optional<std::map<std::string, double>> quality_limitation_durations;
std::optional<std::string> media_source_id;
std::optional<std::string> remote_id;
std::optional<std::string> mid;
std::optional<std::string> rid;
std::optional<uint64_t> retransmitted_packets_sent;
std::optional<uint64_t> header_bytes_sent;
std::optional<uint64_t> retransmitted_bytes_sent;
std::optional<double> target_bitrate;
std::optional<uint32_t> frames_encoded;
std::optional<uint32_t> key_frames_encoded;
std::optional<double> total_encode_time;
std::optional<uint64_t> total_encoded_bytes_target;
std::optional<uint32_t> frame_width;
std::optional<uint32_t> frame_height;
std::optional<double> frames_per_second;
std::optional<uint32_t> frames_sent;
std::optional<uint32_t> huge_frames_sent;
std::optional<double> total_packet_send_delay;
std::optional<std::string> quality_limitation_reason;
std::optional<std::map<std::string, double>> quality_limitation_durations;
// https://w3c.github.io/webrtc-stats/#dom-rtcoutboundrtpstreamstats-qualitylimitationresolutionchanges
absl::optional<uint32_t> quality_limitation_resolution_changes;
std::optional<uint32_t> quality_limitation_resolution_changes;
// https://w3c.github.io/webrtc-provisional-stats/#dom-rtcoutboundrtpstreamstats-contenttype
absl::optional<std::string> content_type;
std::optional<std::string> content_type;
// In JavaScript, this is only exposed if HW exposure is allowed.
// Only implemented for video.
// TODO(https://crbug.com/webrtc/14178): Implement for audio as well.
absl::optional<std::string> encoder_implementation;
std::optional<std::string> encoder_implementation;
// FIR and PLI counts are only defined for |kind == "video"|.
absl::optional<uint32_t> fir_count;
absl::optional<uint32_t> pli_count;
absl::optional<uint32_t> nack_count;
absl::optional<uint64_t> qp_sum;
absl::optional<bool> active;
std::optional<uint32_t> fir_count;
std::optional<uint32_t> pli_count;
std::optional<uint32_t> nack_count;
std::optional<uint64_t> qp_sum;
std::optional<bool> active;
// In JavaScript, this is only exposed if HW exposure is allowed.
absl::optional<bool> power_efficient_encoder;
absl::optional<std::string> scalability_mode;
std::optional<bool> power_efficient_encoder;
std::optional<std::string> scalability_mode;
// RTX ssrc. Only present if RTX is negotiated.
absl::optional<uint32_t> rtx_ssrc;
std::optional<uint32_t> rtx_ssrc;
};
// https://w3c.github.io/webrtc-stats/#remoteinboundrtpstats-dict*
@ -375,11 +375,11 @@ class RTC_EXPORT RTCRemoteInboundRtpStreamStats final
RTCRemoteInboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCRemoteInboundRtpStreamStats() override;
absl::optional<std::string> local_id;
absl::optional<double> round_trip_time;
absl::optional<double> fraction_lost;
absl::optional<double> total_round_trip_time;
absl::optional<int32_t> round_trip_time_measurements;
std::optional<std::string> local_id;
std::optional<double> round_trip_time;
std::optional<double> fraction_lost;
std::optional<double> total_round_trip_time;
std::optional<int32_t> round_trip_time_measurements;
};
// https://w3c.github.io/webrtc-stats/#remoteoutboundrtpstats-dict*
@ -390,12 +390,12 @@ class RTC_EXPORT RTCRemoteOutboundRtpStreamStats final
RTCRemoteOutboundRtpStreamStats(std::string id, Timestamp timestamp);
~RTCRemoteOutboundRtpStreamStats() override;
absl::optional<std::string> local_id;
absl::optional<double> remote_timestamp;
absl::optional<uint64_t> reports_sent;
absl::optional<double> round_trip_time;
absl::optional<uint64_t> round_trip_time_measurements;
absl::optional<double> total_round_trip_time;
std::optional<std::string> local_id;
std::optional<double> remote_timestamp;
std::optional<uint64_t> reports_sent;
std::optional<double> round_trip_time;
std::optional<uint64_t> round_trip_time_measurements;
std::optional<double> total_round_trip_time;
};
// https://w3c.github.io/webrtc-stats/#dom-rtcmediasourcestats
@ -404,8 +404,8 @@ class RTC_EXPORT RTCMediaSourceStats : public RTCStats {
WEBRTC_RTCSTATS_DECL();
~RTCMediaSourceStats() override;
absl::optional<std::string> track_identifier;
absl::optional<std::string> kind;
std::optional<std::string> track_identifier;
std::optional<std::string> kind;
protected:
RTCMediaSourceStats(std::string id, Timestamp timestamp);
@ -418,11 +418,11 @@ class RTC_EXPORT RTCAudioSourceStats final : public RTCMediaSourceStats {
RTCAudioSourceStats(std::string id, Timestamp timestamp);
~RTCAudioSourceStats() override;
absl::optional<double> audio_level;
absl::optional<double> total_audio_energy;
absl::optional<double> total_samples_duration;
absl::optional<double> echo_return_loss;
absl::optional<double> echo_return_loss_enhancement;
std::optional<double> audio_level;
std::optional<double> total_audio_energy;
std::optional<double> total_samples_duration;
std::optional<double> echo_return_loss;
std::optional<double> echo_return_loss_enhancement;
};
// https://w3c.github.io/webrtc-stats/#dom-rtcvideosourcestats
@ -432,10 +432,10 @@ class RTC_EXPORT RTCVideoSourceStats final : public RTCMediaSourceStats {
RTCVideoSourceStats(std::string id, Timestamp timestamp);
~RTCVideoSourceStats() override;
absl::optional<uint32_t> width;
absl::optional<uint32_t> height;
absl::optional<uint32_t> frames;
absl::optional<double> frames_per_second;
std::optional<uint32_t> width;
std::optional<uint32_t> height;
std::optional<uint32_t> frames;
std::optional<double> frames_per_second;
};
// https://w3c.github.io/webrtc-stats/#transportstats-dict*
@ -445,23 +445,23 @@ class RTC_EXPORT RTCTransportStats final : public RTCStats {
RTCTransportStats(std::string id, Timestamp timestamp);
~RTCTransportStats() override;
absl::optional<uint64_t> bytes_sent;
absl::optional<uint64_t> packets_sent;
absl::optional<uint64_t> bytes_received;
absl::optional<uint64_t> packets_received;
absl::optional<std::string> rtcp_transport_stats_id;
absl::optional<std::string> dtls_state;
absl::optional<std::string> selected_candidate_pair_id;
absl::optional<std::string> local_certificate_id;
absl::optional<std::string> remote_certificate_id;
absl::optional<std::string> tls_version;
absl::optional<std::string> dtls_cipher;
absl::optional<std::string> dtls_role;
absl::optional<std::string> srtp_cipher;
absl::optional<uint32_t> selected_candidate_pair_changes;
absl::optional<std::string> ice_role;
absl::optional<std::string> ice_local_username_fragment;
absl::optional<std::string> ice_state;
std::optional<uint64_t> bytes_sent;
std::optional<uint64_t> packets_sent;
std::optional<uint64_t> bytes_received;
std::optional<uint64_t> packets_received;
std::optional<std::string> rtcp_transport_stats_id;
std::optional<std::string> dtls_state;
std::optional<std::string> selected_candidate_pair_id;
std::optional<std::string> local_certificate_id;
std::optional<std::string> remote_certificate_id;
std::optional<std::string> tls_version;
std::optional<std::string> dtls_cipher;
std::optional<std::string> dtls_role;
std::optional<std::string> srtp_cipher;
std::optional<uint32_t> selected_candidate_pair_changes;
std::optional<std::string> ice_role;
std::optional<std::string> ice_local_username_fragment;
std::optional<std::string> ice_state;
};
// https://w3c.github.io/webrtc-stats/#playoutstats-dict*
@ -471,12 +471,12 @@ class RTC_EXPORT RTCAudioPlayoutStats final : public RTCStats {
RTCAudioPlayoutStats(const std::string& id, Timestamp timestamp);
~RTCAudioPlayoutStats() override;
absl::optional<std::string> kind;
absl::optional<double> synthesized_samples_duration;
absl::optional<uint64_t> synthesized_samples_events;
absl::optional<double> total_samples_duration;
absl::optional<double> total_playout_delay;
absl::optional<uint64_t> total_samples_count;
std::optional<std::string> kind;
std::optional<double> synthesized_samples_duration;
std::optional<uint64_t> synthesized_samples_events;
std::optional<double> total_samples_duration;
std::optional<double> total_playout_delay;
std::optional<uint64_t> total_samples_count;
};
} // namespace webrtc

View File

@ -13,12 +13,12 @@
#include <cstdint>
#include <cstdio>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "absl/base/nullability.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/environment/environment.h"
#include "api/environment/environment_factory.h"
#include "api/test/frame_generator_interface.h"
@ -32,8 +32,8 @@ namespace test {
std::unique_ptr<FrameGeneratorInterface> CreateSquareFrameGenerator(
int width,
int height,
absl::optional<FrameGeneratorInterface::OutputType> type,
absl::optional<int> num_squares) {
std::optional<FrameGeneratorInterface::OutputType> type,
std::optional<int> num_squares) {
return std::make_unique<SquareGenerator>(
width, height, type.value_or(FrameGeneratorInterface::OutputType::kI420),
num_squares.value_or(10));

View File

@ -14,12 +14,12 @@
#include <cstddef>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <vector>
#include "absl/base/nullability.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/environment/environment.h"
#include "api/test/frame_generator_interface.h"
#include "system_wrappers/include/clock.h"
@ -34,8 +34,8 @@ namespace test {
std::unique_ptr<FrameGeneratorInterface> CreateSquareFrameGenerator(
int width,
int height,
absl::optional<FrameGeneratorInterface::OutputType> type,
absl::optional<int> num_squares);
std::optional<FrameGeneratorInterface::OutputType> type,
std::optional<int> num_squares);
// Creates a frame generator that repeatedly plays a set of yuv files.
// The frame_repeat_count determines how many times each frame is shown,

View File

@ -11,11 +11,11 @@
#include "api/test/create_peer_connection_quality_test_frame_generator.h"
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/test/create_frame_generator.h"
#include "api/test/frame_generator_interface.h"
#include "api/test/pclf/media_configuration.h"
@ -55,9 +55,9 @@ void ValidateScreenShareConfig(const VideoConfig& video_config,
std::unique_ptr<test::FrameGeneratorInterface> CreateSquareFrameGenerator(
const VideoConfig& video_config,
absl::optional<test::FrameGeneratorInterface::OutputType> type) {
std::optional<test::FrameGeneratorInterface::OutputType> type) {
return test::CreateSquareFrameGenerator(
video_config.width, video_config.height, std::move(type), absl::nullopt);
video_config.width, video_config.height, std::move(type), std::nullopt);
}
std::unique_ptr<test::FrameGeneratorInterface> CreateFromYuvFileFrameGenerator(

View File

@ -11,9 +11,9 @@
#define API_TEST_CREATE_PEER_CONNECTION_QUALITY_TEST_FRAME_GENERATOR_H_
#include <memory>
#include <optional>
#include <string>
#include "absl/types/optional.h"
#include "api/test/frame_generator_interface.h"
#include "api/test/pclf/media_configuration.h"
@ -26,7 +26,7 @@ namespace webrtc_pc_e2e {
// weight and height.
std::unique_ptr<test::FrameGeneratorInterface> CreateSquareFrameGenerator(
const VideoConfig& video_config,
absl::optional<test::FrameGeneratorInterface::OutputType> type);
std::optional<test::FrameGeneratorInterface::OutputType> type);
// Creates a frame generator that plays frames from the yuv file.
std::unique_ptr<test::FrameGeneratorInterface> CreateFromYuvFileFrameGenerator(

View File

@ -12,9 +12,9 @@
#define API_TEST_FRAME_GENERATOR_INTERFACE_H_
#include <cstddef>
#include <optional>
#include <utility>
#include "absl/types/optional.h"
#include "api/scoped_refptr.h"
#include "api/video/video_frame.h"
#include "api/video/video_frame_buffer.h"
@ -30,11 +30,11 @@ class FrameGeneratorInterface {
};
struct VideoFrameData {
VideoFrameData(rtc::scoped_refptr<VideoFrameBuffer> buffer,
absl::optional<VideoFrame::UpdateRect> update_rect)
std::optional<VideoFrame::UpdateRect> update_rect)
: buffer(std::move(buffer)), update_rect(update_rect) {}
rtc::scoped_refptr<VideoFrameBuffer> buffer;
absl::optional<VideoFrame::UpdateRect> update_rect;
std::optional<VideoFrame::UpdateRect> update_rect;
};
enum class OutputType { kI420, kI420A, kI010, kNV12 };
@ -56,8 +56,8 @@ class FrameGeneratorInterface {
// Returns the frames per second this generator is supposed to provide
// according to its data source. Not all frame generators know the frames per
// second of the data source, in such case this method returns absl::nullopt.
virtual absl::optional<int> fps() const = 0;
// second of the data source, in such case this method returns std::nullopt.
virtual std::optional<int> fps() const = 0;
};
} // namespace test

View File

@ -49,10 +49,7 @@ rtc_library("metric") {
"metric.cc",
"metric.h",
]
deps = [
"../../../api/units:timestamp",
"//third_party/abseil-cpp/absl/types:optional",
]
deps = [ "../../../api/units:timestamp" ]
}
rtc_library("metrics_logger") {
@ -71,7 +68,6 @@ rtc_library("metrics_logger") {
"../../numerics",
"../../units:timestamp",
"//third_party/abseil-cpp/absl/strings:string_view",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -111,7 +107,6 @@ rtc_library("stdout_metrics_exporter") {
":metrics_exporter",
"../..:array_view",
"../../../rtc_base:stringutils",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -203,7 +198,6 @@ if (rtc_include_tests) {
"../../../test:test_support",
"../../numerics",
"../../units:timestamp",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -215,7 +209,6 @@ if (rtc_include_tests) {
":metrics_accumulator",
"../../../test:test_support",
"../../units:timestamp",
"//third_party/abseil-cpp/absl/types:optional",
]
}
@ -251,7 +244,6 @@ if (rtc_include_tests) {
":metrics_logger",
"../../../system_wrappers",
"../../../test:test_support",
"//third_party/abseil-cpp/absl/types:optional",
]
}

View File

@ -11,11 +11,11 @@
#include <map>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/types/optional.h"
#include "api/test/metrics/metric.h"
#include "api/test/metrics/metrics_exporter.h"
#include "api/test/metrics/metrics_logger.h"
@ -91,10 +91,10 @@ TEST(ExportPerfMetricTest, CollectedMetricsAreExporter) {
EXPECT_THAT(metric.time_series.samples[0].value, Eq(10.0));
EXPECT_THAT(metric.time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, absl::nullopt);
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, std::nullopt);
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(10.0));
}
TEST(ExportPerfMetricTest, OneFailedExporterDoesNotPreventExportToOthers) {

View File

@ -12,10 +12,10 @@
#define API_TEST_METRICS_METRIC_H_
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/units/timestamp.h"
namespace webrtc {
@ -66,12 +66,12 @@ struct Metric {
struct Stats {
// Sample mean of the metric
// (https://en.wikipedia.org/wiki/Sample_mean_and_covariance).
absl::optional<double> mean;
std::optional<double> mean;
// Standard deviation (https://en.wikipedia.org/wiki/Standard_deviation).
// Is undefined if `time_series` contains only a single value.
absl::optional<double> stddev;
absl::optional<double> min;
absl::optional<double> max;
std::optional<double> stddev;
std::optional<double> min;
std::optional<double> max;
};
// Metric name, for example PSNR, SSIM, decode_time, etc.

View File

@ -10,10 +10,10 @@
#include "api/test/metrics/metrics_accumulator.h"
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/test/metrics/metric.h"
#include "api/units/timestamp.h"
#include "test/gmock.h"
@ -49,10 +49,10 @@ TEST(MetricsAccumulatorTest, AddSampleToTheNewMetricWillCreateOne) {
Eq(Timestamp::Seconds(1)));
EXPECT_THAT(metric.time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{{"key", "value"}}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, absl::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, std::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(10.0));
}
TEST(MetricsAccumulatorTest, AddSamplesToExistingMetricWontCreateNewOne) {
@ -88,10 +88,10 @@ TEST(MetricsAccumulatorTest, AddSamplesToExistingMetricWontCreateNewOne) {
Eq(Timestamp::Seconds(2)));
EXPECT_THAT(metric.time_series.samples[1].sample_metadata,
Eq(std::map<std::string, std::string>{{"key2", "value2"}}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(15.0));
ASSERT_THAT(metric.stats.stddev, absl::optional<double>(5.0));
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(20.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(15.0));
ASSERT_THAT(metric.stats.stddev, std::optional<double>(5.0));
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(20.0));
}
TEST(MetricsAccumulatorTest, AddSampleToDifferentMetricsWillCreateBoth) {
@ -121,10 +121,10 @@ TEST(MetricsAccumulatorTest, AddSampleToDifferentMetricsWillCreateBoth) {
Eq(Timestamp::Seconds(1)));
EXPECT_THAT(metrics[0].time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{{"key1", "value1"}}));
ASSERT_THAT(metrics[0].stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.stddev, absl::optional<double>(0.0));
ASSERT_THAT(metrics[0].stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.stddev, std::optional<double>(0.0));
ASSERT_THAT(metrics[0].stats.min, std::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.max, std::optional<double>(10.0));
EXPECT_THAT(metrics[1].name, Eq("metric_name2"));
EXPECT_THAT(metrics[1].test_case, Eq("test_case_name2"));
EXPECT_THAT(metrics[1].unit, Eq(Unit::kUnitless));
@ -137,10 +137,10 @@ TEST(MetricsAccumulatorTest, AddSampleToDifferentMetricsWillCreateBoth) {
Eq(Timestamp::Seconds(2)));
EXPECT_THAT(metrics[1].time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{{"key2", "value2"}}));
ASSERT_THAT(metrics[1].stats.mean, absl::optional<double>(20.0));
ASSERT_THAT(metrics[1].stats.stddev, absl::optional<double>(0.0));
ASSERT_THAT(metrics[1].stats.min, absl::optional<double>(20.0));
ASSERT_THAT(metrics[1].stats.max, absl::optional<double>(20.0));
ASSERT_THAT(metrics[1].stats.mean, std::optional<double>(20.0));
ASSERT_THAT(metrics[1].stats.stddev, std::optional<double>(0.0));
ASSERT_THAT(metrics[1].stats.min, std::optional<double>(20.0));
ASSERT_THAT(metrics[1].stats.max, std::optional<double>(20.0));
}
TEST(MetricsAccumulatorTest, AddMetadataToTheNewMetricWillCreateOne) {
@ -162,10 +162,10 @@ TEST(MetricsAccumulatorTest, AddMetadataToTheNewMetricWillCreateOne) {
EXPECT_THAT(metric.metric_metadata,
Eq(std::map<std::string, std::string>{{"key", "value"}}));
ASSERT_THAT(metric.time_series.samples, IsEmpty());
ASSERT_THAT(metric.stats.mean, absl::nullopt);
ASSERT_THAT(metric.stats.stddev, absl::nullopt);
ASSERT_THAT(metric.stats.min, absl::nullopt);
ASSERT_THAT(metric.stats.max, absl::nullopt);
ASSERT_THAT(metric.stats.mean, std::nullopt);
ASSERT_THAT(metric.stats.stddev, std::nullopt);
ASSERT_THAT(metric.stats.min, std::nullopt);
ASSERT_THAT(metric.stats.max, std::nullopt);
}
TEST(MetricsAccumulatorTest,
@ -194,10 +194,10 @@ TEST(MetricsAccumulatorTest,
EXPECT_THAT(metric.metric_metadata,
Eq(std::map<std::string, std::string>{{"key2", "value2"}}));
ASSERT_THAT(metric.time_series.samples, IsEmpty());
ASSERT_THAT(metric.stats.mean, absl::nullopt);
ASSERT_THAT(metric.stats.stddev, absl::nullopt);
ASSERT_THAT(metric.stats.min, absl::nullopt);
ASSERT_THAT(metric.stats.max, absl::nullopt);
ASSERT_THAT(metric.stats.mean, std::nullopt);
ASSERT_THAT(metric.stats.stddev, std::nullopt);
ASSERT_THAT(metric.stats.min, std::nullopt);
ASSERT_THAT(metric.stats.max, std::nullopt);
}
TEST(MetricsAccumulatorTest, AddMetadataToDifferentMetricsWillCreateBoth) {
@ -224,10 +224,10 @@ TEST(MetricsAccumulatorTest, AddMetadataToDifferentMetricsWillCreateBoth) {
EXPECT_THAT(metrics[0].metric_metadata,
Eq(std::map<std::string, std::string>{{"key1", "value1"}}));
ASSERT_THAT(metrics[0].time_series.samples, IsEmpty());
ASSERT_THAT(metrics[0].stats.mean, absl::nullopt);
ASSERT_THAT(metrics[0].stats.stddev, absl::nullopt);
ASSERT_THAT(metrics[0].stats.min, absl::nullopt);
ASSERT_THAT(metrics[0].stats.max, absl::nullopt);
ASSERT_THAT(metrics[0].stats.mean, std::nullopt);
ASSERT_THAT(metrics[0].stats.stddev, std::nullopt);
ASSERT_THAT(metrics[0].stats.min, std::nullopt);
ASSERT_THAT(metrics[0].stats.max, std::nullopt);
EXPECT_THAT(metrics[1].name, Eq("metric_name2"));
EXPECT_THAT(metrics[1].test_case, Eq("test_case_name2"));
EXPECT_THAT(metrics[1].unit, Eq(Unit::kBytes));
@ -236,10 +236,10 @@ TEST(MetricsAccumulatorTest, AddMetadataToDifferentMetricsWillCreateBoth) {
EXPECT_THAT(metrics[1].metric_metadata,
Eq(std::map<std::string, std::string>{{"key2", "value2"}}));
ASSERT_THAT(metrics[1].time_series.samples, IsEmpty());
ASSERT_THAT(metrics[1].stats.mean, absl::nullopt);
ASSERT_THAT(metrics[1].stats.stddev, absl::nullopt);
ASSERT_THAT(metrics[1].stats.min, absl::nullopt);
ASSERT_THAT(metrics[1].stats.max, absl::nullopt);
ASSERT_THAT(metrics[1].stats.mean, std::nullopt);
ASSERT_THAT(metrics[1].stats.stddev, std::nullopt);
ASSERT_THAT(metrics[1].stats.min, std::nullopt);
ASSERT_THAT(metrics[1].stats.max, std::nullopt);
}
TEST(MetricsAccumulatorTest, AddMetadataAfterAddingSampleWontCreateNewMetric) {
@ -271,10 +271,10 @@ TEST(MetricsAccumulatorTest, AddMetadataAfterAddingSampleWontCreateNewMetric) {
Eq(Timestamp::Seconds(1)));
EXPECT_THAT(metric.time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{{"key_s", "value_s"}}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, absl::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, std::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(10.0));
}
TEST(MetricsAccumulatorTest, AddSampleAfterAddingMetadataWontCreateNewMetric) {
@ -306,10 +306,10 @@ TEST(MetricsAccumulatorTest, AddSampleAfterAddingMetadataWontCreateNewMetric) {
Eq(Timestamp::Seconds(1)));
EXPECT_THAT(metric.time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{{"key_s", "value_s"}}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, absl::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, std::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(10.0));
}
} // namespace

View File

@ -10,12 +10,12 @@
#include "api/test/metrics/metrics_logger.h"
#include <map>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "api/numerics/samples_stats_counter.h"
#include "api/test/metrics/metric.h"
#include "api/units/timestamp.h"
@ -55,7 +55,7 @@ void DefaultMetricsLogger::LogSingleValueMetric(
Metric::TimeSeries{.samples = std::vector{Metric::TimeSeries::Sample{
.timestamp = Now(), .value = value}}},
.stats = Metric::Stats{
.mean = value, .stddev = absl::nullopt, .min = value, .max = value}});
.mean = value, .stddev = std::nullopt, .min = value, .max = value}});
}
void DefaultMetricsLogger::LogMetric(

View File

@ -10,10 +10,10 @@
#include "api/test/metrics/metrics_logger.h"
#include <map>
#include <optional>
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "api/numerics/samples_stats_counter.h"
#include "api/test/metrics/metric.h"
#include "api/units/timestamp.h"
@ -54,10 +54,10 @@ TEST(DefaultMetricsLoggerTest, LogSingleValueMetricRecordsMetric) {
EXPECT_THAT(metric.time_series.samples[0].value, Eq(10.0));
EXPECT_THAT(metric.time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, absl::nullopt);
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, std::nullopt);
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(10.0));
}
TEST(DefaultMetricsLoggerTest, LogMetricWithSamplesStatsCounterRecordsMetric) {
@ -95,10 +95,10 @@ TEST(DefaultMetricsLoggerTest, LogMetricWithSamplesStatsCounterRecordsMetric) {
EXPECT_THAT(metric.time_series.samples[1].value, Eq(20.0));
EXPECT_THAT(metric.time_series.samples[1].sample_metadata,
Eq(std::map<std::string, std::string>{{"point_key2", "value2"}}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(15.0));
ASSERT_THAT(metric.stats.stddev, absl::optional<double>(5.0));
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(20.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(15.0));
ASSERT_THAT(metric.stats.stddev, std::optional<double>(5.0));
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(20.0));
}
TEST(DefaultMetricsLoggerTest,
@ -113,10 +113,10 @@ TEST(DefaultMetricsLoggerTest,
EXPECT_THAT(metrics[0].name, Eq("metric_name"));
EXPECT_THAT(metrics[0].test_case, Eq("test_case_name"));
EXPECT_THAT(metrics[0].time_series.samples, IsEmpty());
ASSERT_THAT(metrics[0].stats.mean, Eq(absl::nullopt));
ASSERT_THAT(metrics[0].stats.stddev, Eq(absl::nullopt));
ASSERT_THAT(metrics[0].stats.min, Eq(absl::nullopt));
ASSERT_THAT(metrics[0].stats.max, Eq(absl::nullopt));
ASSERT_THAT(metrics[0].stats.mean, Eq(std::nullopt));
ASSERT_THAT(metrics[0].stats.stddev, Eq(std::nullopt));
ASSERT_THAT(metrics[0].stats.min, Eq(std::nullopt));
ASSERT_THAT(metrics[0].stats.max, Eq(std::nullopt));
}
TEST(DefaultMetricsLoggerTest, LogMetricWithStatsRecordsMetric) {
@ -137,10 +137,10 @@ TEST(DefaultMetricsLoggerTest, LogMetricWithStatsRecordsMetric) {
EXPECT_THAT(metric.metric_metadata,
Eq(std::map<std::string, std::string>{{"key", "value"}}));
ASSERT_THAT(metric.time_series.samples, IsEmpty());
ASSERT_THAT(metric.stats.mean, absl::optional<double>(15.0));
ASSERT_THAT(metric.stats.stddev, absl::optional<double>(5.0));
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(20.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(15.0));
ASSERT_THAT(metric.stats.stddev, std::optional<double>(5.0));
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(20.0));
}
TEST(DefaultMetricsLoggerTest, LogSingleValueMetricRecordsMultipleMetrics) {
@ -267,10 +267,10 @@ TEST(DefaultMetricsLoggerTest, AccumulatedMetricsReturnedInCollectedMetrics) {
Eq(Timestamp::Seconds(1)));
EXPECT_THAT(metric.time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{{"key", "value"}}));
ASSERT_THAT(metric.stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, absl::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metric.stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.stddev, std::optional<double>(0.0));
ASSERT_THAT(metric.stats.min, std::optional<double>(10.0));
ASSERT_THAT(metric.stats.max, std::optional<double>(10.0));
}
TEST(DefaultMetricsLoggerTest,
@ -300,10 +300,10 @@ TEST(DefaultMetricsLoggerTest,
Eq(Timestamp::Seconds(1)));
EXPECT_THAT(metrics[0].time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{{"key_s", "value_s"}}));
ASSERT_THAT(metrics[0].stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.stddev, absl::optional<double>(0.0));
ASSERT_THAT(metrics[0].stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.stddev, std::optional<double>(0.0));
ASSERT_THAT(metrics[0].stats.min, std::optional<double>(10.0));
ASSERT_THAT(metrics[0].stats.max, std::optional<double>(10.0));
EXPECT_THAT(metrics[1].name, Eq("metric_name1"));
EXPECT_THAT(metrics[1].test_case, Eq("test_case_name1"));
EXPECT_THAT(metrics[1].unit, Eq(Unit::kMilliseconds));
@ -315,10 +315,10 @@ TEST(DefaultMetricsLoggerTest,
EXPECT_THAT(metrics[1].time_series.samples[0].value, Eq(10.0));
EXPECT_THAT(metrics[1].time_series.samples[0].sample_metadata,
Eq(std::map<std::string, std::string>{}));
ASSERT_THAT(metrics[1].stats.mean, absl::optional<double>(10.0));
ASSERT_THAT(metrics[1].stats.stddev, absl::nullopt);
ASSERT_THAT(metrics[1].stats.min, absl::optional<double>(10.0));
ASSERT_THAT(metrics[1].stats.max, absl::optional<double>(10.0));
ASSERT_THAT(metrics[1].stats.mean, std::optional<double>(10.0));
ASSERT_THAT(metrics[1].stats.stddev, std::nullopt);
ASSERT_THAT(metrics[1].stats.min, std::optional<double>(10.0));
ASSERT_THAT(metrics[1].stats.max, std::optional<double>(10.0));
}
} // namespace

View File

@ -12,9 +12,9 @@
#include <stdio.h>
#include <cmath>
#include <optional>
#include <string>
#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/test/metrics/metric.h"
#include "rtc_base/strings/string_builder.h"

View File

@ -13,8 +13,8 @@
#include <cstddef>
#include <cstdint>
#include <optional>
#include "absl/types/optional.h"
#include "api/media_stream_interface.h"
#include "test/gmock.h"
@ -38,7 +38,7 @@ class MockAudioSink : public webrtc::AudioTrackSinkInterface {
int sample_rate,
size_t number_of_channels,
size_t number_of_frames,
absl::optional<int64_t> absolute_capture_timestamp_ms),
std::optional<int64_t> absolute_capture_timestamp_ms),
(override));
};

View File

@ -12,10 +12,10 @@
#define API_TEST_MOCK_DATA_CHANNEL_H_
#include <cstdint>
#include <optional>
#include <string>
#include "absl/functional/any_invocable.h"
#include "absl/types/optional.h"
#include "api/data_channel_interface.h"
#include "api/priority.h"
#include "api/rtc_error.h"
@ -43,8 +43,8 @@ class MockDataChannelInterface
MOCK_METHOD(bool, ordered, (), (const, override));
MOCK_METHOD(uint16_t, maxRetransmitTime, (), (const, override));
MOCK_METHOD(uint16_t, maxRetransmits, (), (const, override));
MOCK_METHOD(absl::optional<int>, maxRetransmitsOpt, (), (const, override));
MOCK_METHOD(absl::optional<int>, maxPacketLifeTime, (), (const, override));
MOCK_METHOD(std::optional<int>, maxRetransmitsOpt, (), (const, override));
MOCK_METHOD(std::optional<int>, maxPacketLifeTime, (), (const, override));
MOCK_METHOD(std::string, protocol, (), (const, override));
MOCK_METHOD(bool, negotiated, (), (const, override));
MOCK_METHOD(int, id, (), (const, override));

View File

@ -11,7 +11,8 @@
#ifndef API_TEST_MOCK_ENCODER_SELECTOR_H_
#define API_TEST_MOCK_ENCODER_SELECTOR_H_
#include "absl/types/optional.h"
#include <optional>
#include "api/units/data_rate.h"
#include "api/video/render_resolution.h"
#include "api/video_codecs/sdp_video_format.h"
@ -28,17 +29,17 @@ class MockEncoderSelector
(const SdpVideoFormat& format),
(override));
MOCK_METHOD(absl::optional<SdpVideoFormat>,
MOCK_METHOD(std::optional<SdpVideoFormat>,
OnAvailableBitrate,
(const DataRate& rate),
(override));
MOCK_METHOD(absl::optional<SdpVideoFormat>,
MOCK_METHOD(std::optional<SdpVideoFormat>,
OnResolutionChange,
(const RenderResolution& resolution),
(override));
MOCK_METHOD(absl::optional<SdpVideoFormat>, OnEncoderBroken, (), (override));
MOCK_METHOD(std::optional<SdpVideoFormat>, OnEncoderBroken, (), (override));
};
} // namespace webrtc

Some files were not shown because too many files have changed in this diff Show More