mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 05:40:42 +01:00
Replace rtc::Optional with absl::optional in api
This is a no-op change because rtc::Optional is an alias to absl::optional This CL generated by running script with parameter 'api' Then undo changes to optional target itself and optional_unittests find $@ -type f \( -name \*.h -o -name \*.cc \) \ -exec sed -i 's|rtc::Optional|absl::optional|g' {} \+ \ -exec sed -i 's|rtc::nullopt|absl::nullopt|g' {} \+ \ -exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+ find $@ -type f -name BUILD.gn \ -exec sed -r -i 's|"[\./api]*:optional"|"//third_party/abseil-cpp/absl/types:optional"|' {} \+; git cl format Bug: webrtc:9078 Change-Id: I44093da213369d6a502e33792c694f620f53b779 Reviewed-on: https://webrtc-review.googlesource.com/84621 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23707}
This commit is contained in:
parent
1ff41eb784
commit
0bc58cf876
81 changed files with 371 additions and 365 deletions
|
@ -101,13 +101,13 @@ rtc_static_library("libjingle_peerconnection_api") {
|
||||||
":callfactory_api",
|
":callfactory_api",
|
||||||
":fec_controller_api",
|
":fec_controller_api",
|
||||||
":libjingle_logging_api",
|
":libjingle_logging_api",
|
||||||
":optional",
|
|
||||||
":rtc_stats_api",
|
":rtc_stats_api",
|
||||||
"audio:audio_mixer_api",
|
"audio:audio_mixer_api",
|
||||||
"audio_codecs:audio_codecs_api",
|
"audio_codecs:audio_codecs_api",
|
||||||
"transport:bitrate_settings",
|
"transport:bitrate_settings",
|
||||||
"transport:network_control",
|
"transport:network_control",
|
||||||
"video:video_frame",
|
"video:video_frame",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
|
|
||||||
# Basically, don't add stuff here. You might break sensitive downstream
|
# Basically, don't add stuff here. You might break sensitive downstream
|
||||||
# targets like pnacl. API should not depend on anything outside of this
|
# targets like pnacl. API should not depend on anything outside of this
|
||||||
|
@ -160,9 +160,9 @@ rtc_source_set("ortc_api") {
|
||||||
# libjingle_peerconnection_api.
|
# libjingle_peerconnection_api.
|
||||||
deps = [
|
deps = [
|
||||||
":libjingle_peerconnection_api",
|
":libjingle_peerconnection_api",
|
||||||
":optional",
|
|
||||||
"..:webrtc_common",
|
"..:webrtc_common",
|
||||||
"../rtc_base:rtc_base",
|
"../rtc_base:rtc_base",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
if (!build_with_chromium && is_clang) {
|
if (!build_with_chromium && is_clang) {
|
||||||
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
# Suppress warnings from the Chromium Clang plugin (bugs.webrtc.org/163).
|
||||||
|
@ -194,8 +194,8 @@ rtc_source_set("audio_options_api") {
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":optional",
|
|
||||||
"../rtc_base:rtc_base_approved",
|
"../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,7 @@ class AudioFrame {
|
||||||
// Monotonically increasing timestamp intended for profiling of audio frames.
|
// Monotonically increasing timestamp intended for profiling of audio frames.
|
||||||
// Typically used for measuring elapsed time between two different points in
|
// 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
|
// the audio path. No lock is used to save resources and we are thread safe
|
||||||
// by design. Also, rtc::Optional is not used since it will cause a "complex
|
// by design. Also, absl::optional is not used since it will cause a "complex
|
||||||
// class/struct needs an explicit out-of-line destructor" build error.
|
// class/struct needs an explicit out-of-line destructor" build error.
|
||||||
int64_t profile_timestamp_ms_ = 0;
|
int64_t profile_timestamp_ms_ = 0;
|
||||||
|
|
||||||
|
|
|
@ -30,13 +30,13 @@ rtc_source_set("audio_codecs_api") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:array_view",
|
"..:array_view",
|
||||||
"..:optional",
|
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../:typedefs",
|
"../../:typedefs",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:deprecation",
|
"../../rtc_base:deprecation",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base:sanitizer",
|
"../../rtc_base:sanitizer",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,10 @@ rtc_static_library("audio_encoder_L16") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:pcm16b",
|
"../../../modules/audio_coding:pcm16b",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ rtc_static_library("audio_decoder_L16") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:pcm16b",
|
"../../../modules/audio_coding:pcm16b",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,14 +18,14 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
|
absl::optional<AudioDecoderL16::Config> AudioDecoderL16::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
Config config;
|
Config config;
|
||||||
config.sample_rate_hz = format.clockrate_hz;
|
config.sample_rate_hz = format.clockrate_hz;
|
||||||
config.num_channels = rtc::checked_cast<int>(format.num_channels);
|
config.num_channels = rtc::checked_cast<int>(format.num_channels);
|
||||||
return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
|
return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
|
||||||
? rtc::Optional<Config>(config)
|
? absl::optional<Config>(config)
|
||||||
: rtc::nullopt;
|
: absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDecoderL16::AppendSupportedDecoders(
|
void AudioDecoderL16::AppendSupportedDecoders(
|
||||||
|
@ -35,7 +35,7 @@ void AudioDecoderL16::AppendSupportedDecoders(
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> AudioDecoderL16::MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> AudioDecoderL16::MakeAudioDecoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
return config.IsOk() ? rtc::MakeUnique<AudioDecoderPcm16B>(
|
return config.IsOk() ? rtc::MakeUnique<AudioDecoderPcm16B>(
|
||||||
config.sample_rate_hz, config.num_channels)
|
config.sample_rate_hz, config.num_channels)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -35,11 +35,11 @@ struct AudioDecoderL16 {
|
||||||
int sample_rate_hz = 8000;
|
int sample_rate_hz = 8000;
|
||||||
int num_channels = 1;
|
int num_channels = 1;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -18,17 +18,17 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
|
absl::optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
if (!rtc::IsValueInRangeForNumericType<int>(format.num_channels)) {
|
if (!rtc::IsValueInRangeForNumericType<int>(format.num_channels)) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
Config config;
|
Config config;
|
||||||
config.sample_rate_hz = format.clockrate_hz;
|
config.sample_rate_hz = format.clockrate_hz;
|
||||||
config.num_channels = rtc::dchecked_cast<int>(format.num_channels);
|
config.num_channels = rtc::dchecked_cast<int>(format.num_channels);
|
||||||
return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
|
return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
|
||||||
? rtc::Optional<Config>(config)
|
? absl::optional<Config>(config)
|
||||||
: rtc::nullopt;
|
: absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioEncoderL16::AppendSupportedEncoders(
|
void AudioEncoderL16::AppendSupportedEncoders(
|
||||||
|
@ -47,7 +47,7 @@ AudioCodecInfo AudioEncoderL16::QueryAudioEncoder(
|
||||||
std::unique_ptr<AudioEncoder> AudioEncoderL16::MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> AudioEncoderL16::MakeAudioEncoder(
|
||||||
const AudioEncoderL16::Config& config,
|
const AudioEncoderL16::Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
AudioEncoderPcm16B::Config c;
|
AudioEncoderPcm16B::Config c;
|
||||||
c.sample_rate_hz = config.sample_rate_hz;
|
c.sample_rate_hz = config.sample_rate_hz;
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -37,13 +37,13 @@ struct AudioEncoderL16 {
|
||||||
int num_channels = 1;
|
int num_channels = 1;
|
||||||
int frame_size_ms = 10;
|
int frame_size_ms = 10;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static AudioCodecInfo QueryAudioEncoder(const Config& config);
|
static AudioCodecInfo QueryAudioEncoder(const Config& config);
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -33,14 +33,14 @@ class OldStyleEncodedFrame final : public AudioDecoder::EncodedAudioFrame {
|
||||||
return ret < 0 ? 0 : static_cast<size_t>(ret);
|
return ret < 0 ? 0 : static_cast<size_t>(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<DecodeResult> Decode(
|
absl::optional<DecodeResult> Decode(
|
||||||
rtc::ArrayView<int16_t> decoded) const override {
|
rtc::ArrayView<int16_t> decoded) const override {
|
||||||
auto speech_type = AudioDecoder::kSpeech;
|
auto speech_type = AudioDecoder::kSpeech;
|
||||||
const int ret = decoder_->Decode(
|
const int ret = decoder_->Decode(
|
||||||
payload_.data(), payload_.size(), decoder_->SampleRateHz(),
|
payload_.data(), payload_.size(), decoder_->SampleRateHz(),
|
||||||
decoded.size() * sizeof(int16_t), decoded.data(), &speech_type);
|
decoded.size() * sizeof(int16_t), decoded.data(), &speech_type);
|
||||||
return ret < 0 ? rtc::nullopt
|
return ret < 0 ? absl::nullopt
|
||||||
: rtc::Optional<DecodeResult>(
|
: absl::optional<DecodeResult>(
|
||||||
{static_cast<size_t>(ret), speech_type});
|
{static_cast<size_t>(ret), speech_type});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
#include "api/optional.h"
|
|
||||||
#include "rtc_base/buffer.h"
|
#include "rtc_base/buffer.h"
|
||||||
#include "rtc_base/constructormagic.h"
|
#include "rtc_base/constructormagic.h"
|
||||||
#include "typedefs.h" // NOLINT(build/include)
|
#include "typedefs.h" // NOLINT(build/include)
|
||||||
|
@ -53,11 +53,11 @@ class AudioDecoder {
|
||||||
|
|
||||||
// Decodes this frame of audio and writes the result in |decoded|.
|
// 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
|
// |decoded| must be large enough to store as many samples as indicated by a
|
||||||
// call to Duration() . On success, returns an rtc::Optional containing the
|
// call to Duration() . On success, returns an absl::optional containing the
|
||||||
// total number of samples across all channels, as well as whether the
|
// total number of samples across all channels, as well as whether the
|
||||||
// decoder produced comfort noise or speech. On failure, returns an empty
|
// decoder produced comfort noise or speech. On failure, returns an empty
|
||||||
// rtc::Optional. Decode may be called at most once per frame object.
|
// absl::optional. Decode may be called at most once per frame object.
|
||||||
virtual rtc::Optional<DecodeResult> Decode(
|
virtual absl::optional<DecodeResult> Decode(
|
||||||
rtc::ArrayView<int16_t> decoded) const = 0;
|
rtc::ArrayView<int16_t> decoded) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
#include "rtc_base/refcount.h"
|
#include "rtc_base/refcount.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -41,7 +41,7 @@ class AudioDecoderFactory : public rtc::RefCountInterface {
|
||||||
// work.
|
// work.
|
||||||
virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
virtual std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) = 0;
|
absl::optional<AudioCodecPairId> codec_pair_id) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -32,7 +32,7 @@ struct Helper<> {
|
||||||
static bool IsSupportedDecoder(const SdpAudioFormat& format) { return false; }
|
static bool IsSupportedDecoder(const SdpAudioFormat& format) { return false; }
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -48,14 +48,14 @@ struct Helper<T, Ts...> {
|
||||||
static bool IsSupportedDecoder(const SdpAudioFormat& format) {
|
static bool IsSupportedDecoder(const SdpAudioFormat& format) {
|
||||||
auto opt_config = T::SdpToConfig(format);
|
auto opt_config = T::SdpToConfig(format);
|
||||||
static_assert(std::is_same<decltype(opt_config),
|
static_assert(std::is_same<decltype(opt_config),
|
||||||
rtc::Optional<typename T::Config>>::value,
|
absl::optional<typename T::Config>>::value,
|
||||||
"T::SdpToConfig() must return a value of type "
|
"T::SdpToConfig() must return a value of type "
|
||||||
"rtc::Optional<T::Config>");
|
"absl::optional<T::Config>");
|
||||||
return opt_config ? true : Helper<Ts...>::IsSupportedDecoder(format);
|
return opt_config ? true : Helper<Ts...>::IsSupportedDecoder(format);
|
||||||
}
|
}
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||||
auto opt_config = T::SdpToConfig(format);
|
auto opt_config = T::SdpToConfig(format);
|
||||||
return opt_config ? T::MakeAudioDecoder(*opt_config, codec_pair_id)
|
return opt_config ? T::MakeAudioDecoder(*opt_config, codec_pair_id)
|
||||||
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
|
: Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
|
||||||
|
@ -77,7 +77,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) override {
|
absl::optional<AudioCodecPairId> codec_pair_id) override {
|
||||||
return Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
|
return Helper<Ts...>::MakeAudioDecoder(format, codec_pair_id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -92,7 +92,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
|
||||||
// // Converts |audio_format| to a ConfigType instance. Returns an empty
|
// // Converts |audio_format| to a ConfigType instance. Returns an empty
|
||||||
// // optional if |audio_format| doesn't correctly specify an decoder of our
|
// // optional if |audio_format| doesn't correctly specify an decoder of our
|
||||||
// // type.
|
// // type.
|
||||||
// rtc::Optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
|
// absl::optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
//
|
//
|
||||||
// // Appends zero or more AudioCodecSpecs to the list that will be returned
|
// // Appends zero or more AudioCodecSpecs to the list that will be returned
|
||||||
// // by AudioDecoderFactory::GetSupportedDecoders().
|
// // by AudioDecoderFactory::GetSupportedDecoders().
|
||||||
|
@ -102,7 +102,7 @@ class AudioDecoderFactoryT : public AudioDecoderFactory {
|
||||||
// // AudioDecoderFactory::MakeAudioDecoder().
|
// // AudioDecoderFactory::MakeAudioDecoder().
|
||||||
// std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
// std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
// const ConfigType& config,
|
// const ConfigType& config,
|
||||||
// rtc::Optional<AudioCodecPairId> codec_pair_id);
|
// absl::optional<AudioCodecPairId> codec_pair_id);
|
||||||
//
|
//
|
||||||
// ConfigType should be a type that encapsulates all the settings needed to
|
// ConfigType should be a type that encapsulates all the settings needed to
|
||||||
// create an AudioDecoder. T::Config (where T is the decoder struct) should
|
// create an AudioDecoder. T::Config (where T is the decoder struct) should
|
||||||
|
|
|
@ -85,12 +85,12 @@ void AudioEncoder::OnReceivedUplinkRecoverablePacketLossFraction(
|
||||||
float uplink_recoverable_packet_loss_fraction) {}
|
float uplink_recoverable_packet_loss_fraction) {}
|
||||||
|
|
||||||
void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
|
void AudioEncoder::OnReceivedTargetAudioBitrate(int target_audio_bitrate_bps) {
|
||||||
OnReceivedUplinkBandwidth(target_audio_bitrate_bps, rtc::nullopt);
|
OnReceivedUplinkBandwidth(target_audio_bitrate_bps, absl::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioEncoder::OnReceivedUplinkBandwidth(
|
void AudioEncoder::OnReceivedUplinkBandwidth(
|
||||||
int target_audio_bitrate_bps,
|
int target_audio_bitrate_bps,
|
||||||
rtc::Optional<int64_t> bwe_period_ms) {}
|
absl::optional<int64_t> bwe_period_ms) {}
|
||||||
|
|
||||||
void AudioEncoder::OnReceivedRtt(int rtt_ms) {}
|
void AudioEncoder::OnReceivedRtt(int rtt_ms) {}
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
#include "api/optional.h"
|
|
||||||
#include "rtc_base/buffer.h"
|
#include "rtc_base/buffer.h"
|
||||||
#include "rtc_base/deprecation.h"
|
#include "rtc_base/deprecation.h"
|
||||||
#include "typedefs.h" // NOLINT(build/include)
|
#include "typedefs.h" // NOLINT(build/include)
|
||||||
|
@ -34,30 +34,30 @@ struct ANAStats {
|
||||||
// Number of actions taken by the ANA bitrate controller since the start of
|
// 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
|
// the call. If this value is not set, it indicates that the bitrate
|
||||||
// controller is disabled.
|
// controller is disabled.
|
||||||
rtc::Optional<uint32_t> bitrate_action_counter;
|
absl::optional<uint32_t> bitrate_action_counter;
|
||||||
// Number of actions taken by the ANA channel controller since the start of
|
// 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
|
// the call. If this value is not set, it indicates that the channel
|
||||||
// controller is disabled.
|
// controller is disabled.
|
||||||
rtc::Optional<uint32_t> channel_action_counter;
|
absl::optional<uint32_t> channel_action_counter;
|
||||||
// Number of actions taken by the ANA DTX controller since the start of the
|
// 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
|
// call. If this value is not set, it indicates that the DTX controller is
|
||||||
// disabled.
|
// disabled.
|
||||||
rtc::Optional<uint32_t> dtx_action_counter;
|
absl::optional<uint32_t> dtx_action_counter;
|
||||||
// Number of actions taken by the ANA FEC controller since the start of the
|
// 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
|
// call. If this value is not set, it indicates that the FEC controller is
|
||||||
// disabled.
|
// disabled.
|
||||||
rtc::Optional<uint32_t> fec_action_counter;
|
absl::optional<uint32_t> fec_action_counter;
|
||||||
// Number of times the ANA frame length controller decided to increase the
|
// 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
|
// frame length since the start of the call. If this value is not set, it
|
||||||
// indicates that the frame length controller is disabled.
|
// indicates that the frame length controller is disabled.
|
||||||
rtc::Optional<uint32_t> frame_length_increase_counter;
|
absl::optional<uint32_t> frame_length_increase_counter;
|
||||||
// Number of times the ANA frame length controller decided to decrease the
|
// 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
|
// frame length since the start of the call. If this value is not set, it
|
||||||
// indicates that the frame length controller is disabled.
|
// indicates that the frame length controller is disabled.
|
||||||
rtc::Optional<uint32_t> frame_length_decrease_counter;
|
absl::optional<uint32_t> frame_length_decrease_counter;
|
||||||
// The uplink packet loss fractions as set by the ANA FEC controller. If this
|
// 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.
|
// value is not set, it indicates that the ANA FEC controller is not active.
|
||||||
rtc::Optional<float> uplink_packet_loss_fraction;
|
absl::optional<float> uplink_packet_loss_fraction;
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is the interface class for encoders in AudioCoding module. Each codec
|
// This is the interface class for encoders in AudioCoding module. Each codec
|
||||||
|
@ -221,7 +221,7 @@ class AudioEncoder {
|
||||||
// Provides target audio bitrate and corresponding probing interval of
|
// Provides target audio bitrate and corresponding probing interval of
|
||||||
// the bandwidth estimator to this encoder to allow it to adapt.
|
// the bandwidth estimator to this encoder to allow it to adapt.
|
||||||
virtual void OnReceivedUplinkBandwidth(int target_audio_bitrate_bps,
|
virtual void OnReceivedUplinkBandwidth(int target_audio_bitrate_bps,
|
||||||
rtc::Optional<int64_t> bwe_period_ms);
|
absl::optional<int64_t> bwe_period_ms);
|
||||||
|
|
||||||
// Provides RTT to this encoder to allow it to adapt.
|
// Provides RTT to this encoder to allow it to adapt.
|
||||||
virtual void OnReceivedRtt(int rtt_ms);
|
virtual void OnReceivedRtt(int rtt_ms);
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
#include "rtc_base/refcount.h"
|
#include "rtc_base/refcount.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -32,7 +32,7 @@ class AudioEncoderFactory : public rtc::RefCountInterface {
|
||||||
// Returns information about how this format would be encoded, provided it's
|
// Returns information about how this format would be encoded, provided it's
|
||||||
// supported. More format and format variations may be supported than those
|
// supported. More format and format variations may be supported than those
|
||||||
// returned by GetSupportedEncoders().
|
// returned by GetSupportedEncoders().
|
||||||
virtual rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
|
virtual absl::optional<AudioCodecInfo> QueryAudioEncoder(
|
||||||
const SdpAudioFormat& format) = 0;
|
const SdpAudioFormat& format) = 0;
|
||||||
|
|
||||||
// Creates an AudioEncoder for the specified format. The encoder will tags
|
// Creates an AudioEncoder for the specified format. The encoder will tags
|
||||||
|
@ -50,7 +50,7 @@ class AudioEncoderFactory : public rtc::RefCountInterface {
|
||||||
virtual std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
virtual std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
int payload_type,
|
int payload_type,
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) = 0;
|
absl::optional<AudioCodecPairId> codec_pair_id) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -29,14 +29,14 @@ struct Helper;
|
||||||
template <>
|
template <>
|
||||||
struct Helper<> {
|
struct Helper<> {
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {}
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {}
|
||||||
static rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
|
static absl::optional<AudioCodecInfo> QueryAudioEncoder(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
int payload_type,
|
int payload_type,
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -49,21 +49,21 @@ struct Helper<T, Ts...> {
|
||||||
T::AppendSupportedEncoders(specs);
|
T::AppendSupportedEncoders(specs);
|
||||||
Helper<Ts...>::AppendSupportedEncoders(specs);
|
Helper<Ts...>::AppendSupportedEncoders(specs);
|
||||||
}
|
}
|
||||||
static rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
|
static absl::optional<AudioCodecInfo> QueryAudioEncoder(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
auto opt_config = T::SdpToConfig(format);
|
auto opt_config = T::SdpToConfig(format);
|
||||||
static_assert(std::is_same<decltype(opt_config),
|
static_assert(std::is_same<decltype(opt_config),
|
||||||
rtc::Optional<typename T::Config>>::value,
|
absl::optional<typename T::Config>>::value,
|
||||||
"T::SdpToConfig() must return a value of type "
|
"T::SdpToConfig() must return a value of type "
|
||||||
"rtc::Optional<T::Config>");
|
"absl::optional<T::Config>");
|
||||||
return opt_config ? rtc::Optional<AudioCodecInfo>(
|
return opt_config ? absl::optional<AudioCodecInfo>(
|
||||||
T::QueryAudioEncoder(*opt_config))
|
T::QueryAudioEncoder(*opt_config))
|
||||||
: Helper<Ts...>::QueryAudioEncoder(format);
|
: Helper<Ts...>::QueryAudioEncoder(format);
|
||||||
}
|
}
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
int payload_type,
|
int payload_type,
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) {
|
absl::optional<AudioCodecPairId> codec_pair_id) {
|
||||||
auto opt_config = T::SdpToConfig(format);
|
auto opt_config = T::SdpToConfig(format);
|
||||||
if (opt_config) {
|
if (opt_config) {
|
||||||
return T::MakeAudioEncoder(*opt_config, payload_type, codec_pair_id);
|
return T::MakeAudioEncoder(*opt_config, payload_type, codec_pair_id);
|
||||||
|
@ -83,7 +83,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
|
||||||
return specs;
|
return specs;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<AudioCodecInfo> QueryAudioEncoder(
|
absl::optional<AudioCodecInfo> QueryAudioEncoder(
|
||||||
const SdpAudioFormat& format) override {
|
const SdpAudioFormat& format) override {
|
||||||
return Helper<Ts...>::QueryAudioEncoder(format);
|
return Helper<Ts...>::QueryAudioEncoder(format);
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
|
||||||
std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
int payload_type,
|
int payload_type,
|
||||||
const SdpAudioFormat& format,
|
const SdpAudioFormat& format,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id) override {
|
absl::optional<AudioCodecPairId> codec_pair_id) override {
|
||||||
return Helper<Ts...>::MakeAudioEncoder(payload_type, format, codec_pair_id);
|
return Helper<Ts...>::MakeAudioEncoder(payload_type, format, codec_pair_id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -106,7 +106,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
|
||||||
// // Converts |audio_format| to a ConfigType instance. Returns an empty
|
// // Converts |audio_format| to a ConfigType instance. Returns an empty
|
||||||
// // optional if |audio_format| doesn't correctly specify an encoder of our
|
// // optional if |audio_format| doesn't correctly specify an encoder of our
|
||||||
// // type.
|
// // type.
|
||||||
// rtc::Optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
|
// absl::optional<ConfigType> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
//
|
//
|
||||||
// // Appends zero or more AudioCodecSpecs to the list that will be returned
|
// // Appends zero or more AudioCodecSpecs to the list that will be returned
|
||||||
// // by AudioEncoderFactory::GetSupportedEncoders().
|
// // by AudioEncoderFactory::GetSupportedEncoders().
|
||||||
|
@ -121,7 +121,7 @@ class AudioEncoderFactoryT : public AudioEncoderFactory {
|
||||||
// std::unique_ptr<AudioDecoder> MakeAudioEncoder(
|
// std::unique_ptr<AudioDecoder> MakeAudioEncoder(
|
||||||
// const ConfigType& config,
|
// const ConfigType& config,
|
||||||
// int payload_type,
|
// int payload_type,
|
||||||
// rtc::Optional<AudioCodecPairId> codec_pair_id);
|
// absl::optional<AudioCodecPairId> codec_pair_id);
|
||||||
//
|
//
|
||||||
// ConfigType should be a type that encapsulates all the settings needed to
|
// ConfigType should be a type that encapsulates all the settings needed to
|
||||||
// create an AudioEncoder. T::Config (where T is the encoder struct) should
|
// create an AudioEncoder. T::Config (where T is the encoder struct) should
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "rtc_base/checks.h"
|
#include "rtc_base/checks.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct NotAdvertised {
|
struct NotAdvertised {
|
||||||
using Config = typename T::Config;
|
using Config = typename T::Config;
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
|
static absl::optional<Config> SdpToConfig(
|
||||||
|
const SdpAudioFormat& audio_format) {
|
||||||
return T::SdpToConfig(audio_format);
|
return T::SdpToConfig(audio_format);
|
||||||
}
|
}
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs) {
|
||||||
|
@ -41,7 +42,7 @@ struct NotAdvertised {
|
||||||
}
|
}
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt) {
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt) {
|
||||||
return T::MakeAudioDecoder(config, codec_pair_id);
|
return T::MakeAudioDecoder(config, codec_pair_id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,7 +33,8 @@ namespace {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct NotAdvertised {
|
struct NotAdvertised {
|
||||||
using Config = typename T::Config;
|
using Config = typename T::Config;
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
|
static absl::optional<Config> SdpToConfig(
|
||||||
|
const SdpAudioFormat& audio_format) {
|
||||||
return T::SdpToConfig(audio_format);
|
return T::SdpToConfig(audio_format);
|
||||||
}
|
}
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs) {
|
||||||
|
@ -45,7 +46,7 @@ struct NotAdvertised {
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt) {
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt) {
|
||||||
return T::MakeAudioEncoder(config, payload_type, codec_pair_id);
|
return T::MakeAudioEncoder(config, payload_type, codec_pair_id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,11 +21,11 @@ rtc_static_library("audio_encoder_g711") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:g711",
|
"../../../modules/audio_coding:g711",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../rtc_base:safe_minmax",
|
"../../../rtc_base:safe_minmax",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,9 @@ rtc_static_library("audio_decoder_g711") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:g711",
|
"../../../modules/audio_coding:g711",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
|
absl::optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
|
const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
|
||||||
const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
|
const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
|
||||||
|
@ -32,7 +32,7 @@ rtc::Optional<AudioDecoderG711::Config> AudioDecoderG711::SdpToConfig(
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
return config;
|
return config;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ void AudioDecoderG711::AppendSupportedDecoders(
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> AudioDecoderG711::MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> AudioDecoderG711::MakeAudioDecoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
switch (config.type) {
|
switch (config.type) {
|
||||||
case Config::Type::kPcmU:
|
case Config::Type::kPcmU:
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -34,11 +34,11 @@ struct AudioDecoderG711 {
|
||||||
Type type;
|
Type type;
|
||||||
int num_channels;
|
int num_channels;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
|
absl::optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
|
const bool is_pcmu = STR_CASE_CMP(format.name.c_str(), "PCMU") == 0;
|
||||||
const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
|
const bool is_pcma = STR_CASE_CMP(format.name.c_str(), "PCMA") == 0;
|
||||||
|
@ -42,7 +42,7 @@ rtc::Optional<AudioEncoderG711::Config> AudioEncoderG711::SdpToConfig(
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
return config;
|
return config;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ AudioCodecInfo AudioEncoderG711::QueryAudioEncoder(const Config& config) {
|
||||||
std::unique_ptr<AudioEncoder> AudioEncoderG711::MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> AudioEncoderG711::MakeAudioEncoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
switch (config.type) {
|
switch (config.type) {
|
||||||
case Config::Type::kPcmU: {
|
case Config::Type::kPcmU: {
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -36,14 +36,14 @@ struct AudioEncoderG711 {
|
||||||
int num_channels = 1;
|
int num_channels = 1;
|
||||||
int frame_size_ms = 20;
|
int frame_size_ms = 20;
|
||||||
};
|
};
|
||||||
static rtc::Optional<AudioEncoderG711::Config> SdpToConfig(
|
static absl::optional<AudioEncoderG711::Config> SdpToConfig(
|
||||||
const SdpAudioFormat& audio_format);
|
const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static AudioCodecInfo QueryAudioEncoder(const Config& config);
|
static AudioCodecInfo QueryAudioEncoder(const Config& config);
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -29,11 +29,11 @@ rtc_static_library("audio_encoder_g722") {
|
||||||
deps = [
|
deps = [
|
||||||
":audio_encoder_g722_config",
|
":audio_encoder_g722_config",
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:g722",
|
"../../../modules/audio_coding:g722",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../rtc_base:safe_minmax",
|
"../../../rtc_base:safe_minmax",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ rtc_static_library("audio_decoder_g722") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:g722",
|
"../../../modules/audio_coding:g722",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
|
absl::optional<AudioDecoderG722::Config> AudioDecoderG722::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
return STR_CASE_CMP(format.name.c_str(), "G722") == 0 &&
|
return STR_CASE_CMP(format.name.c_str(), "G722") == 0 &&
|
||||||
format.clockrate_hz == 8000 &&
|
format.clockrate_hz == 8000 &&
|
||||||
(format.num_channels == 1 || format.num_channels == 2)
|
(format.num_channels == 1 || format.num_channels == 2)
|
||||||
? rtc::Optional<Config>(
|
? absl::optional<Config>(
|
||||||
Config{rtc::dchecked_cast<int>(format.num_channels)})
|
Config{rtc::dchecked_cast<int>(format.num_channels)})
|
||||||
: rtc::nullopt;
|
: absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDecoderG722::AppendSupportedDecoders(
|
void AudioDecoderG722::AppendSupportedDecoders(
|
||||||
|
@ -37,7 +37,7 @@ void AudioDecoderG722::AppendSupportedDecoders(
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> AudioDecoderG722::MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
switch (config.num_channels) {
|
switch (config.num_channels) {
|
||||||
case 1:
|
case 1:
|
||||||
return rtc::MakeUnique<AudioDecoderG722Impl>();
|
return rtc::MakeUnique<AudioDecoderG722Impl>();
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -30,11 +30,11 @@ struct AudioDecoderG722 {
|
||||||
bool IsOk() const { return num_channels == 1 || num_channels == 2; }
|
bool IsOk() const { return num_channels == 1 || num_channels == 2; }
|
||||||
int num_channels;
|
int num_channels;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -22,11 +22,11 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
|
absl::optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
if (STR_CASE_CMP(format.name.c_str(), "g722") != 0 ||
|
if (STR_CASE_CMP(format.name.c_str(), "g722") != 0 ||
|
||||||
format.clockrate_hz != 8000) {
|
format.clockrate_hz != 8000) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioEncoderG722Config config;
|
AudioEncoderG722Config config;
|
||||||
|
@ -39,8 +39,8 @@ rtc::Optional<AudioEncoderG722Config> AudioEncoderG722::SdpToConfig(
|
||||||
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 10, 60);
|
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 10, 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return config.IsOk() ? rtc::Optional<AudioEncoderG722Config>(config)
|
return config.IsOk() ? absl::optional<AudioEncoderG722Config>(config)
|
||||||
: rtc::nullopt;
|
: absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioEncoderG722::AppendSupportedEncoders(
|
void AudioEncoderG722::AppendSupportedEncoders(
|
||||||
|
@ -60,7 +60,7 @@ AudioCodecInfo AudioEncoderG722::QueryAudioEncoder(
|
||||||
std::unique_ptr<AudioEncoder> AudioEncoderG722::MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> AudioEncoderG722::MakeAudioEncoder(
|
||||||
const AudioEncoderG722Config& config,
|
const AudioEncoderG722Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
return rtc::MakeUnique<AudioEncoderG722Impl>(config, payload_type);
|
return rtc::MakeUnique<AudioEncoderG722Impl>(config, payload_type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/audio_codecs/g722/audio_encoder_g722_config.h"
|
#include "api/audio_codecs/g722/audio_encoder_g722_config.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -28,14 +28,14 @@ namespace webrtc {
|
||||||
// NOTE: This struct is still under development and may change without notice.
|
// NOTE: This struct is still under development and may change without notice.
|
||||||
struct AudioEncoderG722 {
|
struct AudioEncoderG722 {
|
||||||
using Config = AudioEncoderG722Config;
|
using Config = AudioEncoderG722Config;
|
||||||
static rtc::Optional<AudioEncoderG722Config> SdpToConfig(
|
static absl::optional<AudioEncoderG722Config> SdpToConfig(
|
||||||
const SdpAudioFormat& audio_format);
|
const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderG722Config& config);
|
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderG722Config& config);
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const AudioEncoderG722Config& config,
|
const AudioEncoderG722Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -29,11 +29,11 @@ rtc_static_library("audio_encoder_ilbc") {
|
||||||
deps = [
|
deps = [
|
||||||
":audio_encoder_ilbc_config",
|
":audio_encoder_ilbc_config",
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:ilbc",
|
"../../../modules/audio_coding:ilbc",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
"../../../rtc_base:safe_minmax",
|
"../../../rtc_base:safe_minmax",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,9 +46,9 @@ rtc_static_library("audio_decoder_ilbc") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:ilbc",
|
"../../../modules/audio_coding:ilbc",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
|
absl::optional<AudioDecoderIlbc::Config> AudioDecoderIlbc::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
return STR_CASE_CMP(format.name.c_str(), "ILBC") == 0 &&
|
return STR_CASE_CMP(format.name.c_str(), "ILBC") == 0 &&
|
||||||
format.clockrate_hz == 8000 && format.num_channels == 1
|
format.clockrate_hz == 8000 && format.num_channels == 1
|
||||||
? rtc::Optional<Config>(Config())
|
? absl::optional<Config>(Config())
|
||||||
: rtc::nullopt;
|
: absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDecoderIlbc::AppendSupportedDecoders(
|
void AudioDecoderIlbc::AppendSupportedDecoders(
|
||||||
|
@ -34,7 +34,7 @@ void AudioDecoderIlbc::AppendSupportedDecoders(
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> AudioDecoderIlbc::MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
return rtc::MakeUnique<AudioDecoderIlbcImpl>();
|
return rtc::MakeUnique<AudioDecoderIlbcImpl>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ namespace webrtc {
|
||||||
// NOTE: This struct is still under development and may change without notice.
|
// NOTE: This struct is still under development and may change without notice.
|
||||||
struct AudioDecoderIlbc {
|
struct AudioDecoderIlbc {
|
||||||
struct Config {}; // Empty---no config values needed!
|
struct Config {}; // Empty---no config values needed!
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -38,11 +38,11 @@ int GetIlbcBitrate(int ptime) {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
rtc::Optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
|
absl::optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
if (STR_CASE_CMP(format.name.c_str(), "ILBC") != 0 ||
|
if (STR_CASE_CMP(format.name.c_str(), "ILBC") != 0 ||
|
||||||
format.clockrate_hz != 8000 || format.num_channels != 1) {
|
format.clockrate_hz != 8000 || format.num_channels != 1) {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioEncoderIlbcConfig config;
|
AudioEncoderIlbcConfig config;
|
||||||
|
@ -54,8 +54,8 @@ rtc::Optional<AudioEncoderIlbcConfig> AudioEncoderIlbc::SdpToConfig(
|
||||||
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 20, 60);
|
config.frame_size_ms = rtc::SafeClamp<int>(whole_packets * 10, 20, 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return config.IsOk() ? rtc::Optional<AudioEncoderIlbcConfig>(config)
|
return config.IsOk() ? absl::optional<AudioEncoderIlbcConfig>(config)
|
||||||
: rtc::nullopt;
|
: absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioEncoderIlbc::AppendSupportedEncoders(
|
void AudioEncoderIlbc::AppendSupportedEncoders(
|
||||||
|
@ -74,7 +74,7 @@ AudioCodecInfo AudioEncoderIlbc::QueryAudioEncoder(
|
||||||
std::unique_ptr<AudioEncoder> AudioEncoderIlbc::MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> AudioEncoderIlbc::MakeAudioEncoder(
|
||||||
const AudioEncoderIlbcConfig& config,
|
const AudioEncoderIlbcConfig& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
return rtc::MakeUnique<AudioEncoderIlbcImpl>(config, payload_type);
|
return rtc::MakeUnique<AudioEncoderIlbcImpl>(config, payload_type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
|
#include "api/audio_codecs/ilbc/audio_encoder_ilbc_config.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -28,14 +28,14 @@ namespace webrtc {
|
||||||
// NOTE: This struct is still under development and may change without notice.
|
// NOTE: This struct is still under development and may change without notice.
|
||||||
struct AudioEncoderIlbc {
|
struct AudioEncoderIlbc {
|
||||||
using Config = AudioEncoderIlbcConfig;
|
using Config = AudioEncoderIlbcConfig;
|
||||||
static rtc::Optional<AudioEncoderIlbcConfig> SdpToConfig(
|
static absl::optional<AudioEncoderIlbcConfig> SdpToConfig(
|
||||||
const SdpAudioFormat& audio_format);
|
const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderIlbcConfig& config);
|
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderIlbcConfig& config);
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const AudioEncoderIlbcConfig& config,
|
const AudioEncoderIlbcConfig& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -77,10 +77,10 @@ rtc_static_library("audio_encoder_isac_fix") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:isac_fix",
|
"../../../modules/audio_coding:isac_fix",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +93,10 @@ rtc_static_library("audio_decoder_isac_fix") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:isac_fix",
|
"../../../modules/audio_coding:isac_fix",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,10 +109,10 @@ rtc_static_library("audio_encoder_isac_float") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:isac",
|
"../../../modules/audio_coding:isac",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ rtc_static_library("audio_decoder_isac_float") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:isac",
|
"../../../modules/audio_coding:isac",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioDecoderIsacFix::Config> AudioDecoderIsacFix::SdpToConfig(
|
absl::optional<AudioDecoderIsacFix::Config> AudioDecoderIsacFix::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
return STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
return STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||||
format.clockrate_hz == 16000 && format.num_channels == 1
|
format.clockrate_hz == 16000 && format.num_channels == 1
|
||||||
? rtc::Optional<Config>(Config())
|
? absl::optional<Config>(Config())
|
||||||
: rtc::nullopt;
|
: absl::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioDecoderIsacFix::AppendSupportedDecoders(
|
void AudioDecoderIsacFix::AppendSupportedDecoders(
|
||||||
|
@ -31,7 +31,7 @@ void AudioDecoderIsacFix::AppendSupportedDecoders(
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> AudioDecoderIsacFix::MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> AudioDecoderIsacFix::MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
return rtc::MakeUnique<AudioDecoderIsacFixImpl>(16000);
|
return rtc::MakeUnique<AudioDecoderIsacFixImpl>(16000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ namespace webrtc {
|
||||||
// NOTE: This struct is still under development and may change without notice.
|
// NOTE: This struct is still under development and may change without notice.
|
||||||
struct AudioDecoderIsacFix {
|
struct AudioDecoderIsacFix {
|
||||||
struct Config {}; // Empty---no config values needed!
|
struct Config {}; // Empty---no config values needed!
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioDecoderIsacFloat::Config> AudioDecoderIsacFloat::SdpToConfig(
|
absl::optional<AudioDecoderIsacFloat::Config>
|
||||||
const SdpAudioFormat& format) {
|
AudioDecoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
|
||||||
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||||
(format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
|
(format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
|
||||||
format.num_channels == 1) {
|
format.num_channels == 1) {
|
||||||
|
@ -25,7 +25,7 @@ rtc::Optional<AudioDecoderIsacFloat::Config> AudioDecoderIsacFloat::SdpToConfig(
|
||||||
config.sample_rate_hz = format.clockrate_hz;
|
config.sample_rate_hz = format.clockrate_hz;
|
||||||
return config;
|
return config;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void AudioDecoderIsacFloat::AppendSupportedDecoders(
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> AudioDecoderIsacFloat::MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> AudioDecoderIsacFloat::MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
return rtc::MakeUnique<AudioDecoderIsacFloatImpl>(config.sample_rate_hz);
|
return rtc::MakeUnique<AudioDecoderIsacFloatImpl>(config.sample_rate_hz);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -32,11 +32,11 @@ struct AudioDecoderIsacFloat {
|
||||||
}
|
}
|
||||||
int sample_rate_hz = 16000;
|
int sample_rate_hz = 16000;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
|
absl::optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||||
format.clockrate_hz == 16000 && format.num_channels == 1) {
|
format.clockrate_hz == 16000 && format.num_channels == 1) {
|
||||||
|
@ -31,7 +31,7 @@ rtc::Optional<AudioEncoderIsacFix::Config> AudioEncoderIsacFix::SdpToConfig(
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ AudioCodecInfo AudioEncoderIsacFix::QueryAudioEncoder(
|
||||||
std::unique_ptr<AudioEncoder> AudioEncoderIsacFix::MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> AudioEncoderIsacFix::MakeAudioEncoder(
|
||||||
AudioEncoderIsacFix::Config config,
|
AudioEncoderIsacFix::Config config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
AudioEncoderIsacFixImpl::Config c;
|
AudioEncoderIsacFixImpl::Config c;
|
||||||
c.frame_size_ms = config.frame_size_ms;
|
c.frame_size_ms = config.frame_size_ms;
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -30,13 +30,13 @@ struct AudioEncoderIsacFix {
|
||||||
bool IsOk() const { return frame_size_ms == 30 || frame_size_ms == 60; }
|
bool IsOk() const { return frame_size_ms == 30 || frame_size_ms == 60; }
|
||||||
int frame_size_ms = 30;
|
int frame_size_ms = 30;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static AudioCodecInfo QueryAudioEncoder(Config config);
|
static AudioCodecInfo QueryAudioEncoder(Config config);
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
Config config,
|
Config config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioEncoderIsacFloat::Config> AudioEncoderIsacFloat::SdpToConfig(
|
absl::optional<AudioEncoderIsacFloat::Config>
|
||||||
const SdpAudioFormat& format) {
|
AudioEncoderIsacFloat::SdpToConfig(const SdpAudioFormat& format) {
|
||||||
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
if (STR_CASE_CMP(format.name.c_str(), "ISAC") == 0 &&
|
||||||
(format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
|
(format.clockrate_hz == 16000 || format.clockrate_hz == 32000) &&
|
||||||
format.num_channels == 1) {
|
format.num_channels == 1) {
|
||||||
|
@ -37,7 +37,7 @@ rtc::Optional<AudioEncoderIsacFloat::Config> AudioEncoderIsacFloat::SdpToConfig(
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ AudioCodecInfo AudioEncoderIsacFloat::QueryAudioEncoder(
|
||||||
std::unique_ptr<AudioEncoder> AudioEncoderIsacFloat::MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> AudioEncoderIsacFloat::MakeAudioEncoder(
|
||||||
const AudioEncoderIsacFloat::Config& config,
|
const AudioEncoderIsacFloat::Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
RTC_DCHECK(config.IsOk());
|
RTC_DCHECK(config.IsOk());
|
||||||
AudioEncoderIsacFloatImpl::Config c;
|
AudioEncoderIsacFloatImpl::Config c;
|
||||||
c.sample_rate_hz = config.sample_rate_hz;
|
c.sample_rate_hz = config.sample_rate_hz;
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -35,13 +35,13 @@ struct AudioEncoderIsacFloat {
|
||||||
int sample_rate_hz = 16000;
|
int sample_rate_hz = 16000;
|
||||||
int frame_size_ms = 30;
|
int frame_size_ms = 30;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static AudioCodecInfo QueryAudioEncoder(const Config& config);
|
static AudioCodecInfo QueryAudioEncoder(const Config& config);
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const Config& config,
|
const Config& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -19,8 +19,8 @@ rtc_static_library("audio_encoder_opus_config") {
|
||||||
"audio_encoder_opus_config.h",
|
"audio_encoder_opus_config.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"../..:optional",
|
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
defines = []
|
defines = []
|
||||||
if (rtc_opus_variable_complexity) {
|
if (rtc_opus_variable_complexity) {
|
||||||
|
@ -42,9 +42,9 @@ rtc_source_set("audio_encoder_opus") {
|
||||||
deps = [
|
deps = [
|
||||||
":audio_encoder_opus_config",
|
":audio_encoder_opus_config",
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../../modules/audio_coding:webrtc_opus",
|
"../../../modules/audio_coding:webrtc_opus",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,9 @@ rtc_static_library("audio_decoder_opus") {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:audio_codecs_api",
|
"..:audio_codecs_api",
|
||||||
"../..:optional",
|
|
||||||
"../../..:webrtc_common",
|
"../../..:webrtc_common",
|
||||||
"../../../modules/audio_coding:webrtc_opus",
|
"../../../modules/audio_coding:webrtc_opus",
|
||||||
"../../../rtc_base:rtc_base_approved",
|
"../../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
|
absl::optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
const auto num_channels = [&]() -> rtc::Optional<int> {
|
const auto num_channels = [&]() -> absl::optional<int> {
|
||||||
auto stereo = format.parameters.find("stereo");
|
auto stereo = format.parameters.find("stereo");
|
||||||
if (stereo != format.parameters.end()) {
|
if (stereo != format.parameters.end()) {
|
||||||
if (stereo->second == "0") {
|
if (stereo->second == "0") {
|
||||||
|
@ -30,7 +30,7 @@ rtc::Optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
|
||||||
} else if (stereo->second == "1") {
|
} else if (stereo->second == "1") {
|
||||||
return 2;
|
return 2;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt; // Bad stereo parameter.
|
return absl::nullopt; // Bad stereo parameter.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 1; // Default to mono.
|
return 1; // Default to mono.
|
||||||
|
@ -40,7 +40,7 @@ rtc::Optional<AudioDecoderOpus::Config> AudioDecoderOpus::SdpToConfig(
|
||||||
num_channels) {
|
num_channels) {
|
||||||
return Config{*num_channels};
|
return Config{*num_channels};
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ void AudioDecoderOpus::AppendSupportedDecoders(
|
||||||
|
|
||||||
std::unique_ptr<AudioDecoder> AudioDecoderOpus::MakeAudioDecoder(
|
std::unique_ptr<AudioDecoder> AudioDecoderOpus::MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
return rtc::MakeUnique<AudioDecoderOpusImpl>(config.num_channels);
|
return rtc::MakeUnique<AudioDecoderOpusImpl>(config.num_channels);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_decoder.h"
|
#include "api/audio_codecs/audio_decoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ struct AudioDecoderOpus {
|
||||||
struct Config {
|
struct Config {
|
||||||
int num_channels;
|
int num_channels;
|
||||||
};
|
};
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
static absl::optional<Config> SdpToConfig(const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedDecoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
Config config,
|
Config config,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
rtc::Optional<AudioEncoderOpusConfig> AudioEncoderOpus::SdpToConfig(
|
absl::optional<AudioEncoderOpusConfig> AudioEncoderOpus::SdpToConfig(
|
||||||
const SdpAudioFormat& format) {
|
const SdpAudioFormat& format) {
|
||||||
return AudioEncoderOpusImpl::SdpToConfig(format);
|
return AudioEncoderOpusImpl::SdpToConfig(format);
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ AudioCodecInfo AudioEncoderOpus::QueryAudioEncoder(
|
||||||
std::unique_ptr<AudioEncoder> AudioEncoderOpus::MakeAudioEncoder(
|
std::unique_ptr<AudioEncoder> AudioEncoderOpus::MakeAudioEncoder(
|
||||||
const AudioEncoderOpusConfig& config,
|
const AudioEncoderOpusConfig& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/) {
|
||||||
return AudioEncoderOpusImpl::MakeAudioEncoder(config, payload_type);
|
return AudioEncoderOpusImpl::MakeAudioEncoder(config, payload_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/audio_codecs/audio_codec_pair_id.h"
|
#include "api/audio_codecs/audio_codec_pair_id.h"
|
||||||
#include "api/audio_codecs/audio_encoder.h"
|
#include "api/audio_codecs/audio_encoder.h"
|
||||||
#include "api/audio_codecs/audio_format.h"
|
#include "api/audio_codecs/audio_format.h"
|
||||||
#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
|
#include "api/audio_codecs/opus/audio_encoder_opus_config.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -28,14 +28,14 @@ namespace webrtc {
|
||||||
// NOTE: This struct is still under development and may change without notice.
|
// NOTE: This struct is still under development and may change without notice.
|
||||||
struct AudioEncoderOpus {
|
struct AudioEncoderOpus {
|
||||||
using Config = AudioEncoderOpusConfig;
|
using Config = AudioEncoderOpusConfig;
|
||||||
static rtc::Optional<AudioEncoderOpusConfig> SdpToConfig(
|
static absl::optional<AudioEncoderOpusConfig> SdpToConfig(
|
||||||
const SdpAudioFormat& audio_format);
|
const SdpAudioFormat& audio_format);
|
||||||
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
static void AppendSupportedEncoders(std::vector<AudioCodecSpec>* specs);
|
||||||
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderOpusConfig& config);
|
static AudioCodecInfo QueryAudioEncoder(const AudioEncoderOpusConfig& config);
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const AudioEncoderOpusConfig& config,
|
const AudioEncoderOpusConfig& config,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> codec_pair_id = rtc::nullopt);
|
absl::optional<AudioCodecPairId> codec_pair_id = absl::nullopt);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ struct AudioEncoderOpusConfig {
|
||||||
|
|
||||||
// NOTE: This member must always be set.
|
// NOTE: This member must always be set.
|
||||||
// TODO(kwiberg): Turn it into just an int.
|
// TODO(kwiberg): Turn it into just an int.
|
||||||
rtc::Optional<int> bitrate_bps;
|
absl::optional<int> bitrate_bps;
|
||||||
|
|
||||||
bool fec_enabled;
|
bool fec_enabled;
|
||||||
bool cbr_enabled;
|
bool cbr_enabled;
|
||||||
|
|
|
@ -43,12 +43,13 @@ struct AudioDecoderFakeApi {
|
||||||
SdpAudioFormat audio_format;
|
SdpAudioFormat audio_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
|
static absl::optional<Config> SdpToConfig(
|
||||||
|
const SdpAudioFormat& audio_format) {
|
||||||
if (Params::AudioFormat() == audio_format) {
|
if (Params::AudioFormat() == audio_format) {
|
||||||
Config config = {audio_format};
|
Config config = {audio_format};
|
||||||
return config;
|
return config;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ struct AudioDecoderFakeApi {
|
||||||
|
|
||||||
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
static std::unique_ptr<AudioDecoder> MakeAudioDecoder(
|
||||||
const Config&,
|
const Config&,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/ = rtc::nullopt) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/ = absl::nullopt) {
|
||||||
auto dec = rtc::MakeUnique<testing::StrictMock<MockAudioDecoder>>();
|
auto dec = rtc::MakeUnique<testing::StrictMock<MockAudioDecoder>>();
|
||||||
EXPECT_CALL(*dec, SampleRateHz())
|
EXPECT_CALL(*dec, SampleRateHz())
|
||||||
.WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
|
.WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
|
||||||
|
@ -80,7 +81,7 @@ TEST(AudioDecoderFactoryTemplateTest, NoDecoderTypes) {
|
||||||
EXPECT_THAT(factory->GetSupportedDecoders(), testing::IsEmpty());
|
EXPECT_THAT(factory->GetSupportedDecoders(), testing::IsEmpty());
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"bar", 16000, 1}, absl::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AudioDecoderFactoryTemplateTest, OneDecoderType) {
|
TEST(AudioDecoderFactoryTemplateTest, OneDecoderType) {
|
||||||
|
@ -91,8 +92,8 @@ TEST(AudioDecoderFactoryTemplateTest, OneDecoderType) {
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"bogus", 8000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"bogus", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"bar", 16000, 1}, absl::nullopt));
|
||||||
auto dec = factory->MakeAudioDecoder({"bogus", 8000, 1}, rtc::nullopt);
|
auto dec = factory->MakeAudioDecoder({"bogus", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec);
|
ASSERT_NE(nullptr, dec);
|
||||||
EXPECT_EQ(8000, dec->SampleRateHz());
|
EXPECT_EQ(8000, dec->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -110,14 +111,14 @@ TEST(AudioDecoderFactoryTemplateTest, TwoDecoderTypes) {
|
||||||
EXPECT_TRUE(
|
EXPECT_TRUE(
|
||||||
factory->IsSupportedDecoder({"sham", 16000, 2, {{"param", "value"}}}));
|
factory->IsSupportedDecoder({"sham", 16000, 2, {{"param", "value"}}}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"bar", 16000, 1}, absl::nullopt));
|
||||||
auto dec1 = factory->MakeAudioDecoder({"bogus", 8000, 1}, rtc::nullopt);
|
auto dec1 = factory->MakeAudioDecoder({"bogus", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec1);
|
ASSERT_NE(nullptr, dec1);
|
||||||
EXPECT_EQ(8000, dec1->SampleRateHz());
|
EXPECT_EQ(8000, dec1->SampleRateHz());
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"sham", 16000, 2}, rtc::nullopt));
|
factory->MakeAudioDecoder({"sham", 16000, 2}, absl::nullopt));
|
||||||
auto dec2 = factory->MakeAudioDecoder(
|
auto dec2 = factory->MakeAudioDecoder(
|
||||||
{"sham", 16000, 2, {{"param", "value"}}}, rtc::nullopt);
|
{"sham", 16000, 2, {{"param", "value"}}}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec2);
|
ASSERT_NE(nullptr, dec2);
|
||||||
EXPECT_EQ(16000, dec2->SampleRateHz());
|
EXPECT_EQ(16000, dec2->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -132,11 +133,11 @@ TEST(AudioDecoderFactoryTemplateTest, G711) {
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"PCMU", 8000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"PCMU", 8000, 1}));
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"pcma", 8000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"pcma", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"pcmu", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"pcmu", 16000, 1}, absl::nullopt));
|
||||||
auto dec1 = factory->MakeAudioDecoder({"pcmu", 8000, 1}, rtc::nullopt);
|
auto dec1 = factory->MakeAudioDecoder({"pcmu", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec1);
|
ASSERT_NE(nullptr, dec1);
|
||||||
EXPECT_EQ(8000, dec1->SampleRateHz());
|
EXPECT_EQ(8000, dec1->SampleRateHz());
|
||||||
auto dec2 = factory->MakeAudioDecoder({"PCMA", 8000, 1}, rtc::nullopt);
|
auto dec2 = factory->MakeAudioDecoder({"PCMA", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec2);
|
ASSERT_NE(nullptr, dec2);
|
||||||
EXPECT_EQ(8000, dec2->SampleRateHz());
|
EXPECT_EQ(8000, dec2->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -149,16 +150,16 @@ TEST(AudioDecoderFactoryTemplateTest, G722) {
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"G722", 8000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"G722", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"bar", 16000, 1}, absl::nullopt));
|
||||||
auto dec1 = factory->MakeAudioDecoder({"G722", 8000, 1}, rtc::nullopt);
|
auto dec1 = factory->MakeAudioDecoder({"G722", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec1);
|
ASSERT_NE(nullptr, dec1);
|
||||||
EXPECT_EQ(16000, dec1->SampleRateHz());
|
EXPECT_EQ(16000, dec1->SampleRateHz());
|
||||||
EXPECT_EQ(1u, dec1->Channels());
|
EXPECT_EQ(1u, dec1->Channels());
|
||||||
auto dec2 = factory->MakeAudioDecoder({"G722", 8000, 2}, rtc::nullopt);
|
auto dec2 = factory->MakeAudioDecoder({"G722", 8000, 2}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec2);
|
ASSERT_NE(nullptr, dec2);
|
||||||
EXPECT_EQ(16000, dec2->SampleRateHz());
|
EXPECT_EQ(16000, dec2->SampleRateHz());
|
||||||
EXPECT_EQ(2u, dec2->Channels());
|
EXPECT_EQ(2u, dec2->Channels());
|
||||||
auto dec3 = factory->MakeAudioDecoder({"G722", 8000, 3}, rtc::nullopt);
|
auto dec3 = factory->MakeAudioDecoder({"G722", 8000, 3}, absl::nullopt);
|
||||||
ASSERT_EQ(nullptr, dec3);
|
ASSERT_EQ(nullptr, dec3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,8 +170,9 @@ TEST(AudioDecoderFactoryTemplateTest, Ilbc) {
|
||||||
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}}));
|
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13300}}));
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"ilbc", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"bar", 8000, 1}, rtc::nullopt));
|
EXPECT_EQ(nullptr,
|
||||||
auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1}, rtc::nullopt);
|
factory->MakeAudioDecoder({"bar", 8000, 1}, absl::nullopt));
|
||||||
|
auto dec = factory->MakeAudioDecoder({"ilbc", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec);
|
ASSERT_NE(nullptr, dec);
|
||||||
EXPECT_EQ(8000, dec->SampleRateHz());
|
EXPECT_EQ(8000, dec->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -184,8 +186,8 @@ TEST(AudioDecoderFactoryTemplateTest, IsacFix) {
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 16000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 16000, 1}));
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"isac", 32000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"isac", 32000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"isac", 8000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"isac", 8000, 1}, absl::nullopt));
|
||||||
auto dec = factory->MakeAudioDecoder({"isac", 16000, 1}, rtc::nullopt);
|
auto dec = factory->MakeAudioDecoder({"isac", 16000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec);
|
ASSERT_NE(nullptr, dec);
|
||||||
EXPECT_EQ(16000, dec->SampleRateHz());
|
EXPECT_EQ(16000, dec->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -201,11 +203,11 @@ TEST(AudioDecoderFactoryTemplateTest, IsacFloat) {
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 16000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 16000, 1}));
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 32000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"isac", 32000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"isac", 8000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"isac", 8000, 1}, absl::nullopt));
|
||||||
auto dec1 = factory->MakeAudioDecoder({"isac", 16000, 1}, rtc::nullopt);
|
auto dec1 = factory->MakeAudioDecoder({"isac", 16000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec1);
|
ASSERT_NE(nullptr, dec1);
|
||||||
EXPECT_EQ(16000, dec1->SampleRateHz());
|
EXPECT_EQ(16000, dec1->SampleRateHz());
|
||||||
auto dec2 = factory->MakeAudioDecoder({"isac", 32000, 1}, rtc::nullopt);
|
auto dec2 = factory->MakeAudioDecoder({"isac", 32000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec2);
|
ASSERT_NE(nullptr, dec2);
|
||||||
EXPECT_EQ(32000, dec2->SampleRateHz());
|
EXPECT_EQ(32000, dec2->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -224,8 +226,9 @@ TEST(AudioDecoderFactoryTemplateTest, L16) {
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"foo", 8000, 1}));
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"L16", 48000, 1}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"L16", 48000, 1}));
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"L16", 96000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"L16", 96000, 1}));
|
||||||
EXPECT_EQ(nullptr, factory->MakeAudioDecoder({"L16", 8000, 0}, rtc::nullopt));
|
EXPECT_EQ(nullptr,
|
||||||
auto dec = factory->MakeAudioDecoder({"L16", 48000, 2}, rtc::nullopt);
|
factory->MakeAudioDecoder({"L16", 8000, 0}, absl::nullopt));
|
||||||
|
auto dec = factory->MakeAudioDecoder({"L16", 48000, 2}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec);
|
ASSERT_NE(nullptr, dec);
|
||||||
EXPECT_EQ(48000, dec->SampleRateHz());
|
EXPECT_EQ(48000, dec->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -242,8 +245,8 @@ TEST(AudioDecoderFactoryTemplateTest, Opus) {
|
||||||
EXPECT_FALSE(factory->IsSupportedDecoder({"opus", 48000, 1}));
|
EXPECT_FALSE(factory->IsSupportedDecoder({"opus", 48000, 1}));
|
||||||
EXPECT_TRUE(factory->IsSupportedDecoder({"opus", 48000, 2}));
|
EXPECT_TRUE(factory->IsSupportedDecoder({"opus", 48000, 2}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioDecoder({"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioDecoder({"bar", 16000, 1}, absl::nullopt));
|
||||||
auto dec = factory->MakeAudioDecoder({"opus", 48000, 2}, rtc::nullopt);
|
auto dec = factory->MakeAudioDecoder({"opus", 48000, 2}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, dec);
|
ASSERT_NE(nullptr, dec);
|
||||||
EXPECT_EQ(48000, dec->SampleRateHz());
|
EXPECT_EQ(48000, dec->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,12 +43,13 @@ struct AudioEncoderFakeApi {
|
||||||
SdpAudioFormat audio_format;
|
SdpAudioFormat audio_format;
|
||||||
};
|
};
|
||||||
|
|
||||||
static rtc::Optional<Config> SdpToConfig(const SdpAudioFormat& audio_format) {
|
static absl::optional<Config> SdpToConfig(
|
||||||
|
const SdpAudioFormat& audio_format) {
|
||||||
if (Params::AudioFormat() == audio_format) {
|
if (Params::AudioFormat() == audio_format) {
|
||||||
Config config = {audio_format};
|
Config config = {audio_format};
|
||||||
return config;
|
return config;
|
||||||
} else {
|
} else {
|
||||||
return rtc::nullopt;
|
return absl::nullopt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ struct AudioEncoderFakeApi {
|
||||||
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
static std::unique_ptr<AudioEncoder> MakeAudioEncoder(
|
||||||
const Config&,
|
const Config&,
|
||||||
int payload_type,
|
int payload_type,
|
||||||
rtc::Optional<AudioCodecPairId> /*codec_pair_id*/ = rtc::nullopt) {
|
absl::optional<AudioCodecPairId> /*codec_pair_id*/ = absl::nullopt) {
|
||||||
auto enc = rtc::MakeUnique<testing::StrictMock<MockAudioEncoder>>();
|
auto enc = rtc::MakeUnique<testing::StrictMock<MockAudioEncoder>>();
|
||||||
EXPECT_CALL(*enc, SampleRateHz())
|
EXPECT_CALL(*enc, SampleRateHz())
|
||||||
.WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
|
.WillOnce(testing::Return(Params::CodecInfo().sample_rate_hz));
|
||||||
|
@ -78,9 +79,9 @@ TEST(AudioEncoderFactoryTemplateTest, NoEncoderTypes) {
|
||||||
new rtc::RefCountedObject<
|
new rtc::RefCountedObject<
|
||||||
audio_encoder_factory_template_impl::AudioEncoderFactoryT<>>());
|
audio_encoder_factory_template_impl::AudioEncoderFactoryT<>>());
|
||||||
EXPECT_THAT(factory->GetSupportedEncoders(), testing::IsEmpty());
|
EXPECT_THAT(factory->GetSupportedEncoders(), testing::IsEmpty());
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, absl::nullopt));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AudioEncoderFactoryTemplateTest, OneEncoderType) {
|
TEST(AudioEncoderFactoryTemplateTest, OneEncoderType) {
|
||||||
|
@ -88,12 +89,12 @@ TEST(AudioEncoderFactoryTemplateTest, OneEncoderType) {
|
||||||
EXPECT_THAT(factory->GetSupportedEncoders(),
|
EXPECT_THAT(factory->GetSupportedEncoders(),
|
||||||
testing::ElementsAre(
|
testing::ElementsAre(
|
||||||
AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}}));
|
AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
||||||
EXPECT_EQ(AudioCodecInfo(8000, 1, 12345),
|
EXPECT_EQ(AudioCodecInfo(8000, 1, 12345),
|
||||||
factory->QueryAudioEncoder({"bogus", 8000, 1}));
|
factory->QueryAudioEncoder({"bogus", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, absl::nullopt));
|
||||||
auto enc = factory->MakeAudioEncoder(17, {"bogus", 8000, 1}, rtc::nullopt);
|
auto enc = factory->MakeAudioEncoder(17, {"bogus", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc);
|
ASSERT_NE(nullptr, enc);
|
||||||
EXPECT_EQ(8000, enc->SampleRateHz());
|
EXPECT_EQ(8000, enc->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -106,21 +107,21 @@ TEST(AudioEncoderFactoryTemplateTest, TwoEncoderTypes) {
|
||||||
AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}},
|
AudioCodecSpec{{"bogus", 8000, 1}, {8000, 1, 12345}},
|
||||||
AudioCodecSpec{{"sham", 16000, 2, {{"param", "value"}}},
|
AudioCodecSpec{{"sham", 16000, 2, {{"param", "value"}}},
|
||||||
{16000, 2, 23456}}));
|
{16000, 2, 23456}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
||||||
EXPECT_EQ(AudioCodecInfo(8000, 1, 12345),
|
EXPECT_EQ(AudioCodecInfo(8000, 1, 12345),
|
||||||
factory->QueryAudioEncoder({"bogus", 8000, 1}));
|
factory->QueryAudioEncoder({"bogus", 8000, 1}));
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
AudioCodecInfo(16000, 2, 23456),
|
AudioCodecInfo(16000, 2, 23456),
|
||||||
factory->QueryAudioEncoder({"sham", 16000, 2, {{"param", "value"}}}));
|
factory->QueryAudioEncoder({"sham", 16000, 2, {{"param", "value"}}}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, absl::nullopt));
|
||||||
auto enc1 = factory->MakeAudioEncoder(17, {"bogus", 8000, 1}, rtc::nullopt);
|
auto enc1 = factory->MakeAudioEncoder(17, {"bogus", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc1);
|
ASSERT_NE(nullptr, enc1);
|
||||||
EXPECT_EQ(8000, enc1->SampleRateHz());
|
EXPECT_EQ(8000, enc1->SampleRateHz());
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"sham", 16000, 2}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"sham", 16000, 2}, absl::nullopt));
|
||||||
auto enc2 = factory->MakeAudioEncoder(
|
auto enc2 = factory->MakeAudioEncoder(
|
||||||
17, {"sham", 16000, 2, {{"param", "value"}}}, rtc::nullopt);
|
17, {"sham", 16000, 2, {{"param", "value"}}}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc2);
|
ASSERT_NE(nullptr, enc2);
|
||||||
EXPECT_EQ(16000, enc2->SampleRateHz());
|
EXPECT_EQ(16000, enc2->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -131,15 +132,15 @@ TEST(AudioEncoderFactoryTemplateTest, G711) {
|
||||||
testing::ElementsAre(
|
testing::ElementsAre(
|
||||||
AudioCodecSpec{{"PCMU", 8000, 1}, {8000, 1, 64000}},
|
AudioCodecSpec{{"PCMU", 8000, 1}, {8000, 1, 64000}},
|
||||||
AudioCodecSpec{{"PCMA", 8000, 1}, {8000, 1, 64000}}));
|
AudioCodecSpec{{"PCMA", 8000, 1}, {8000, 1, 64000}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"PCMA", 16000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"PCMA", 16000, 1}));
|
||||||
EXPECT_EQ(AudioCodecInfo(8000, 1, 64000),
|
EXPECT_EQ(AudioCodecInfo(8000, 1, 64000),
|
||||||
factory->QueryAudioEncoder({"PCMA", 8000, 1}));
|
factory->QueryAudioEncoder({"PCMA", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"PCMU", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"PCMU", 16000, 1}, absl::nullopt));
|
||||||
auto enc1 = factory->MakeAudioEncoder(17, {"PCMU", 8000, 1}, rtc::nullopt);
|
auto enc1 = factory->MakeAudioEncoder(17, {"PCMU", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc1);
|
ASSERT_NE(nullptr, enc1);
|
||||||
EXPECT_EQ(8000, enc1->SampleRateHz());
|
EXPECT_EQ(8000, enc1->SampleRateHz());
|
||||||
auto enc2 = factory->MakeAudioEncoder(17, {"PCMA", 8000, 1}, rtc::nullopt);
|
auto enc2 = factory->MakeAudioEncoder(17, {"PCMA", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc2);
|
ASSERT_NE(nullptr, enc2);
|
||||||
EXPECT_EQ(8000, enc2->SampleRateHz());
|
EXPECT_EQ(8000, enc2->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -149,12 +150,12 @@ TEST(AudioEncoderFactoryTemplateTest, G722) {
|
||||||
EXPECT_THAT(factory->GetSupportedEncoders(),
|
EXPECT_THAT(factory->GetSupportedEncoders(),
|
||||||
testing::ElementsAre(
|
testing::ElementsAre(
|
||||||
AudioCodecSpec{{"G722", 8000, 1}, {16000, 1, 64000}}));
|
AudioCodecSpec{{"G722", 8000, 1}, {16000, 1, 64000}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
||||||
EXPECT_EQ(AudioCodecInfo(16000, 1, 64000),
|
EXPECT_EQ(AudioCodecInfo(16000, 1, 64000),
|
||||||
factory->QueryAudioEncoder({"G722", 8000, 1}));
|
factory->QueryAudioEncoder({"G722", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, absl::nullopt));
|
||||||
auto enc = factory->MakeAudioEncoder(17, {"G722", 8000, 1}, rtc::nullopt);
|
auto enc = factory->MakeAudioEncoder(17, {"G722", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc);
|
ASSERT_NE(nullptr, enc);
|
||||||
EXPECT_EQ(16000, enc->SampleRateHz());
|
EXPECT_EQ(16000, enc->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -164,12 +165,12 @@ TEST(AudioEncoderFactoryTemplateTest, Ilbc) {
|
||||||
EXPECT_THAT(factory->GetSupportedEncoders(),
|
EXPECT_THAT(factory->GetSupportedEncoders(),
|
||||||
testing::ElementsAre(
|
testing::ElementsAre(
|
||||||
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13333}}));
|
AudioCodecSpec{{"ILBC", 8000, 1}, {8000, 1, 13333}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
||||||
EXPECT_EQ(AudioCodecInfo(8000, 1, 13333),
|
EXPECT_EQ(AudioCodecInfo(8000, 1, 13333),
|
||||||
factory->QueryAudioEncoder({"ilbc", 8000, 1}));
|
factory->QueryAudioEncoder({"ilbc", 8000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"bar", 8000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"bar", 8000, 1}, absl::nullopt));
|
||||||
auto enc = factory->MakeAudioEncoder(17, {"ilbc", 8000, 1}, rtc::nullopt);
|
auto enc = factory->MakeAudioEncoder(17, {"ilbc", 8000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc);
|
ASSERT_NE(nullptr, enc);
|
||||||
EXPECT_EQ(8000, enc->SampleRateHz());
|
EXPECT_EQ(8000, enc->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -179,18 +180,18 @@ TEST(AudioEncoderFactoryTemplateTest, IsacFix) {
|
||||||
EXPECT_THAT(factory->GetSupportedEncoders(),
|
EXPECT_THAT(factory->GetSupportedEncoders(),
|
||||||
testing::ElementsAre(AudioCodecSpec{
|
testing::ElementsAre(AudioCodecSpec{
|
||||||
{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}}));
|
{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"isac", 16000, 2}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"isac", 16000, 2}));
|
||||||
EXPECT_EQ(AudioCodecInfo(16000, 1, 32000, 10000, 32000),
|
EXPECT_EQ(AudioCodecInfo(16000, 1, 32000, 10000, 32000),
|
||||||
factory->QueryAudioEncoder({"isac", 16000, 1}));
|
factory->QueryAudioEncoder({"isac", 16000, 1}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"isac", 32000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"isac", 32000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"isac", 8000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"isac", 8000, 1}, absl::nullopt));
|
||||||
auto enc1 = factory->MakeAudioEncoder(17, {"isac", 16000, 1}, rtc::nullopt);
|
auto enc1 = factory->MakeAudioEncoder(17, {"isac", 16000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc1);
|
ASSERT_NE(nullptr, enc1);
|
||||||
EXPECT_EQ(16000, enc1->SampleRateHz());
|
EXPECT_EQ(16000, enc1->SampleRateHz());
|
||||||
EXPECT_EQ(3u, enc1->Num10MsFramesInNextPacket());
|
EXPECT_EQ(3u, enc1->Num10MsFramesInNextPacket());
|
||||||
auto enc2 = factory->MakeAudioEncoder(
|
auto enc2 = factory->MakeAudioEncoder(
|
||||||
17, {"isac", 16000, 1, {{"ptime", "60"}}}, rtc::nullopt);
|
17, {"isac", 16000, 1, {{"ptime", "60"}}}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc2);
|
ASSERT_NE(nullptr, enc2);
|
||||||
EXPECT_EQ(6u, enc2->Num10MsFramesInNextPacket());
|
EXPECT_EQ(6u, enc2->Num10MsFramesInNextPacket());
|
||||||
}
|
}
|
||||||
|
@ -202,17 +203,17 @@ TEST(AudioEncoderFactoryTemplateTest, IsacFloat) {
|
||||||
testing::ElementsAre(
|
testing::ElementsAre(
|
||||||
AudioCodecSpec{{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}},
|
AudioCodecSpec{{"ISAC", 16000, 1}, {16000, 1, 32000, 10000, 32000}},
|
||||||
AudioCodecSpec{{"ISAC", 32000, 1}, {32000, 1, 56000, 10000, 56000}}));
|
AudioCodecSpec{{"ISAC", 32000, 1}, {32000, 1, 56000, 10000, 56000}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"isac", 16000, 2}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"isac", 16000, 2}));
|
||||||
EXPECT_EQ(AudioCodecInfo(16000, 1, 32000, 10000, 32000),
|
EXPECT_EQ(AudioCodecInfo(16000, 1, 32000, 10000, 32000),
|
||||||
factory->QueryAudioEncoder({"isac", 16000, 1}));
|
factory->QueryAudioEncoder({"isac", 16000, 1}));
|
||||||
EXPECT_EQ(AudioCodecInfo(32000, 1, 56000, 10000, 56000),
|
EXPECT_EQ(AudioCodecInfo(32000, 1, 56000, 10000, 56000),
|
||||||
factory->QueryAudioEncoder({"isac", 32000, 1}));
|
factory->QueryAudioEncoder({"isac", 32000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"isac", 8000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"isac", 8000, 1}, absl::nullopt));
|
||||||
auto enc1 = factory->MakeAudioEncoder(17, {"isac", 16000, 1}, rtc::nullopt);
|
auto enc1 = factory->MakeAudioEncoder(17, {"isac", 16000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc1);
|
ASSERT_NE(nullptr, enc1);
|
||||||
EXPECT_EQ(16000, enc1->SampleRateHz());
|
EXPECT_EQ(16000, enc1->SampleRateHz());
|
||||||
auto enc2 = factory->MakeAudioEncoder(17, {"isac", 32000, 1}, rtc::nullopt);
|
auto enc2 = factory->MakeAudioEncoder(17, {"isac", 32000, 1}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc2);
|
ASSERT_NE(nullptr, enc2);
|
||||||
EXPECT_EQ(32000, enc2->SampleRateHz());
|
EXPECT_EQ(32000, enc2->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -228,12 +229,12 @@ TEST(AudioEncoderFactoryTemplateTest, L16) {
|
||||||
AudioCodecSpec{{"L16", 8000, 2}, {8000, 2, 8000 * 16 * 2}},
|
AudioCodecSpec{{"L16", 8000, 2}, {8000, 2, 8000 * 16 * 2}},
|
||||||
AudioCodecSpec{{"L16", 16000, 2}, {16000, 2, 16000 * 16 * 2}},
|
AudioCodecSpec{{"L16", 16000, 2}, {16000, 2, 16000 * 16 * 2}},
|
||||||
AudioCodecSpec{{"L16", 32000, 2}, {32000, 2, 32000 * 16 * 2}}));
|
AudioCodecSpec{{"L16", 32000, 2}, {32000, 2, 32000 * 16 * 2}}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"L16", 8000, 0}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"L16", 8000, 0}));
|
||||||
EXPECT_EQ(AudioCodecInfo(48000, 1, 48000 * 16),
|
EXPECT_EQ(AudioCodecInfo(48000, 1, 48000 * 16),
|
||||||
factory->QueryAudioEncoder({"L16", 48000, 1}));
|
factory->QueryAudioEncoder({"L16", 48000, 1}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"L16", 8000, 0}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"L16", 8000, 0}, absl::nullopt));
|
||||||
auto enc = factory->MakeAudioEncoder(17, {"L16", 48000, 2}, rtc::nullopt);
|
auto enc = factory->MakeAudioEncoder(17, {"L16", 48000, 2}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc);
|
ASSERT_NE(nullptr, enc);
|
||||||
EXPECT_EQ(48000, enc->SampleRateHz());
|
EXPECT_EQ(48000, enc->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
@ -248,14 +249,14 @@ TEST(AudioEncoderFactoryTemplateTest, Opus) {
|
||||||
testing::ElementsAre(AudioCodecSpec{
|
testing::ElementsAre(AudioCodecSpec{
|
||||||
{"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}},
|
{"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}},
|
||||||
info}));
|
info}));
|
||||||
EXPECT_EQ(rtc::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
EXPECT_EQ(absl::nullopt, factory->QueryAudioEncoder({"foo", 8000, 1}));
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(
|
||||||
info,
|
info,
|
||||||
factory->QueryAudioEncoder(
|
factory->QueryAudioEncoder(
|
||||||
{"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}));
|
{"opus", 48000, 2, {{"minptime", "10"}, {"useinbandfec", "1"}}}));
|
||||||
EXPECT_EQ(nullptr,
|
EXPECT_EQ(nullptr,
|
||||||
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, rtc::nullopt));
|
factory->MakeAudioEncoder(17, {"bar", 16000, 1}, absl::nullopt));
|
||||||
auto enc = factory->MakeAudioEncoder(17, {"opus", 48000, 2}, rtc::nullopt);
|
auto enc = factory->MakeAudioEncoder(17, {"opus", 48000, 2}, absl::nullopt);
|
||||||
ASSERT_NE(nullptr, enc);
|
ASSERT_NE(nullptr, enc);
|
||||||
EXPECT_EQ(48000, enc->SampleRateHz());
|
EXPECT_EQ(48000, enc->SampleRateHz());
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "rtc_base/stringencode.h"
|
#include "rtc_base/stringencode.h"
|
||||||
|
|
||||||
namespace cricket {
|
namespace cricket {
|
||||||
|
@ -126,53 +126,53 @@ struct AudioOptions {
|
||||||
|
|
||||||
// Audio processing that attempts to filter away the output signal from
|
// Audio processing that attempts to filter away the output signal from
|
||||||
// later inbound pickup.
|
// later inbound pickup.
|
||||||
rtc::Optional<bool> echo_cancellation;
|
absl::optional<bool> echo_cancellation;
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS)
|
||||||
// Forces software echo cancellation on iOS. This is a temporary workaround
|
// Forces software echo cancellation on iOS. This is a temporary workaround
|
||||||
// (until Apple fixes the bug) for a device with non-functioning AEC. May
|
// (until Apple fixes the bug) for a device with non-functioning AEC. May
|
||||||
// improve performance on that particular device, but will cause unpredictable
|
// improve performance on that particular device, but will cause unpredictable
|
||||||
// behavior in all other cases. See http://bugs.webrtc.org/8682.
|
// behavior in all other cases. See http://bugs.webrtc.org/8682.
|
||||||
rtc::Optional<bool> ios_force_software_aec_HACK;
|
absl::optional<bool> ios_force_software_aec_HACK;
|
||||||
#endif
|
#endif
|
||||||
// Audio processing to adjust the sensitivity of the local mic dynamically.
|
// Audio processing to adjust the sensitivity of the local mic dynamically.
|
||||||
rtc::Optional<bool> auto_gain_control;
|
absl::optional<bool> auto_gain_control;
|
||||||
// Audio processing to filter out background noise.
|
// Audio processing to filter out background noise.
|
||||||
rtc::Optional<bool> noise_suppression;
|
absl::optional<bool> noise_suppression;
|
||||||
// Audio processing to remove background noise of lower frequencies.
|
// Audio processing to remove background noise of lower frequencies.
|
||||||
rtc::Optional<bool> highpass_filter;
|
absl::optional<bool> highpass_filter;
|
||||||
// Audio processing to swap the left and right channels.
|
// Audio processing to swap the left and right channels.
|
||||||
rtc::Optional<bool> stereo_swapping;
|
absl::optional<bool> stereo_swapping;
|
||||||
// Audio receiver jitter buffer (NetEq) max capacity in number of packets.
|
// Audio receiver jitter buffer (NetEq) max capacity in number of packets.
|
||||||
rtc::Optional<int> audio_jitter_buffer_max_packets;
|
absl::optional<int> audio_jitter_buffer_max_packets;
|
||||||
// Audio receiver jitter buffer (NetEq) fast accelerate mode.
|
// Audio receiver jitter buffer (NetEq) fast accelerate mode.
|
||||||
rtc::Optional<bool> audio_jitter_buffer_fast_accelerate;
|
absl::optional<bool> audio_jitter_buffer_fast_accelerate;
|
||||||
// Audio processing to detect typing.
|
// Audio processing to detect typing.
|
||||||
rtc::Optional<bool> typing_detection;
|
absl::optional<bool> typing_detection;
|
||||||
rtc::Optional<bool> aecm_generate_comfort_noise;
|
absl::optional<bool> aecm_generate_comfort_noise;
|
||||||
rtc::Optional<bool> experimental_agc;
|
absl::optional<bool> experimental_agc;
|
||||||
rtc::Optional<bool> extended_filter_aec;
|
absl::optional<bool> extended_filter_aec;
|
||||||
rtc::Optional<bool> delay_agnostic_aec;
|
absl::optional<bool> delay_agnostic_aec;
|
||||||
rtc::Optional<bool> experimental_ns;
|
absl::optional<bool> experimental_ns;
|
||||||
rtc::Optional<bool> intelligibility_enhancer;
|
absl::optional<bool> intelligibility_enhancer;
|
||||||
// Note that tx_agc_* only applies to non-experimental AGC.
|
// Note that tx_agc_* only applies to non-experimental AGC.
|
||||||
rtc::Optional<bool> residual_echo_detector;
|
absl::optional<bool> residual_echo_detector;
|
||||||
rtc::Optional<uint16_t> tx_agc_target_dbov;
|
absl::optional<uint16_t> tx_agc_target_dbov;
|
||||||
rtc::Optional<uint16_t> tx_agc_digital_compression_gain;
|
absl::optional<uint16_t> tx_agc_digital_compression_gain;
|
||||||
rtc::Optional<bool> tx_agc_limiter;
|
absl::optional<bool> tx_agc_limiter;
|
||||||
// Enable combined audio+bandwidth BWE.
|
// Enable combined audio+bandwidth BWE.
|
||||||
// TODO(pthatcher): This flag is set from the
|
// TODO(pthatcher): This flag is set from the
|
||||||
// "googCombinedAudioVideoBwe", but not used anywhere. So delete it,
|
// "googCombinedAudioVideoBwe", but not used anywhere. So delete it,
|
||||||
// and check if any other AudioOptions members are unused.
|
// and check if any other AudioOptions members are unused.
|
||||||
rtc::Optional<bool> combined_audio_video_bwe;
|
absl::optional<bool> combined_audio_video_bwe;
|
||||||
// Enable audio network adaptor.
|
// Enable audio network adaptor.
|
||||||
rtc::Optional<bool> audio_network_adaptor;
|
absl::optional<bool> audio_network_adaptor;
|
||||||
// Config string for audio network adaptor.
|
// Config string for audio network adaptor.
|
||||||
rtc::Optional<std::string> audio_network_adaptor_config;
|
absl::optional<std::string> audio_network_adaptor_config;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <class T>
|
template <class T>
|
||||||
static std::string ToStringIfSet(const char* key,
|
static std::string ToStringIfSet(const char* key,
|
||||||
const rtc::Optional<T>& val) {
|
const absl::optional<T>& val) {
|
||||||
std::string str;
|
std::string str;
|
||||||
if (val) {
|
if (val) {
|
||||||
str = key;
|
str = key;
|
||||||
|
@ -184,7 +184,7 @@ struct AudioOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static void SetFrom(rtc::Optional<T>* s, const rtc::Optional<T>& o) {
|
static void SetFrom(absl::optional<T>* s, const absl::optional<T>& o) {
|
||||||
if (o) {
|
if (o) {
|
||||||
*s = o;
|
*s = o;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelinit
|
// C++ version of: https://www.w3.org/TR/webrtc/#idl-def-rtcdatachannelinit
|
||||||
// TODO(deadbeef): Use rtc::Optional for the "-1 if unset" things.
|
// TODO(deadbeef): Use absl::optional for the "-1 if unset" things.
|
||||||
struct DataChannelInit {
|
struct DataChannelInit {
|
||||||
// Deprecated. Reliability is assumed, and channel will be unreliable if
|
// Deprecated. Reliability is assumed, and channel will be unreliable if
|
||||||
// maxRetransmitTime or MaxRetransmits is set.
|
// maxRetransmitTime or MaxRetransmits is set.
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/rtcerror.h"
|
#include "api/rtcerror.h"
|
||||||
#include "rtc_base/refcount.h"
|
#include "rtc_base/refcount.h"
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ const char* SdpTypeToString(SdpType type);
|
||||||
// Returns the SdpType from its string form. The string form can be one of the
|
// Returns the SdpType from its string form. The string form can be one of the
|
||||||
// constants defined in SessionDescriptionInterface. Passing in any other string
|
// constants defined in SessionDescriptionInterface. Passing in any other string
|
||||||
// results in nullopt.
|
// results in nullopt.
|
||||||
rtc::Optional<SdpType> SdpTypeFromString(const std::string& type_str);
|
absl::optional<SdpType> SdpTypeFromString(const std::string& type_str);
|
||||||
|
|
||||||
// Class representation of an SDP session description.
|
// Class representation of an SDP session description.
|
||||||
//
|
//
|
||||||
|
|
|
@ -59,11 +59,11 @@ bool FindConstraint(const webrtc::MediaConstraintsInterface* constraints,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Converts a constraint (mandatory takes precedence over optional) to an
|
// Converts a constraint (mandatory takes precedence over optional) to an
|
||||||
// rtc::Optional.
|
// absl::optional.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void ConstraintToOptional(const webrtc::MediaConstraintsInterface* constraints,
|
void ConstraintToOptional(const webrtc::MediaConstraintsInterface* constraints,
|
||||||
const std::string& key,
|
const std::string& key,
|
||||||
rtc::Optional<T>* value_out) {
|
absl::optional<T>* value_out) {
|
||||||
T value;
|
T value;
|
||||||
bool present = FindConstraint<T>(constraints, key, &value, nullptr);
|
bool present = FindConstraint<T>(constraints, key, &value, nullptr);
|
||||||
if (present) {
|
if (present) {
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/peerconnectioninterface.h"
|
#include "api/peerconnectioninterface.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
// TODO(zhihuang): Remove unrelated headers once downstream applications stop
|
// TODO(zhihuang): Remove unrelated headers once downstream applications stop
|
||||||
// relying on them; they were previously transitively included by
|
// relying on them; they were previously transitively included by
|
||||||
|
@ -132,7 +132,7 @@ class VideoTrackSourceInterface : public MediaSourceInterface,
|
||||||
// depending on video codec.
|
// depending on video codec.
|
||||||
// TODO(perkj): Remove this once denoising is done by the source, and not by
|
// TODO(perkj): Remove this once denoising is done by the source, and not by
|
||||||
// the encoder.
|
// the encoder.
|
||||||
virtual rtc::Optional<bool> needs_denoising() const = 0;
|
virtual absl::optional<bool> needs_denoising() const = 0;
|
||||||
|
|
||||||
// Returns false if no stats are available, e.g, for a remote source, or a
|
// Returns false if no stats are available, e.g, for a remote source, or a
|
||||||
// source which has not seen its first frame yet.
|
// source which has not seen its first frame yet.
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/cryptoparams.h"
|
#include "api/cryptoparams.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ class MediaDescription {
|
||||||
// The mid(media stream identification) is used for identifying media streams
|
// The mid(media stream identification) is used for identifying media streams
|
||||||
// within a session description.
|
// within a session description.
|
||||||
// https://tools.ietf.org/html/rfc5888#section-6
|
// https://tools.ietf.org/html/rfc5888#section-6
|
||||||
rtc::Optional<std::string> mid() const { return mid_; }
|
absl::optional<std::string> mid() const { return mid_; }
|
||||||
void set_mid(std::string mid) { mid_.emplace(std::move(mid)); }
|
void set_mid(std::string mid) { mid_.emplace(std::move(mid)); }
|
||||||
|
|
||||||
// Security keys and parameters for this media stream. Can be used to
|
// Security keys and parameters for this media stream. Can be used to
|
||||||
|
@ -43,7 +43,7 @@ class MediaDescription {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
rtc::Optional<std::string> mid_;
|
absl::optional<std::string> mid_;
|
||||||
|
|
||||||
std::vector<cricket::CryptoParams> sdes_params_;
|
std::vector<cricket::CryptoParams> sdes_params_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/ortc/packettransportinterface.h"
|
#include "api/ortc/packettransportinterface.h"
|
||||||
#include "api/rtcerror.h"
|
#include "api/rtcerror.h"
|
||||||
#include "api/rtp_headers.h"
|
#include "api/rtp_headers.h"
|
||||||
|
|
|
@ -361,7 +361,7 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||||
// The below fields correspond to constraints from the deprecated
|
// The below fields correspond to constraints from the deprecated
|
||||||
// constraints interface for constructing a PeerConnection.
|
// constraints interface for constructing a PeerConnection.
|
||||||
//
|
//
|
||||||
// rtc::Optional fields can be "missing", in which case the implementation
|
// absl::optional fields can be "missing", in which case the implementation
|
||||||
// default will be used.
|
// default will be used.
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
@ -396,15 +396,15 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||||
// Minimum bitrate at which screencast video tracks will be encoded at.
|
// Minimum bitrate at which screencast video tracks will be encoded at.
|
||||||
// This means adding padding bits up to this bitrate, which can help
|
// This means adding padding bits up to this bitrate, which can help
|
||||||
// when switching from a static scene to one with motion.
|
// when switching from a static scene to one with motion.
|
||||||
rtc::Optional<int> screencast_min_bitrate;
|
absl::optional<int> screencast_min_bitrate;
|
||||||
|
|
||||||
// Use new combined audio/video bandwidth estimation?
|
// Use new combined audio/video bandwidth estimation?
|
||||||
rtc::Optional<bool> combined_audio_video_bwe;
|
absl::optional<bool> combined_audio_video_bwe;
|
||||||
|
|
||||||
// Can be used to disable DTLS-SRTP. This should never be done, but can be
|
// Can be used to disable DTLS-SRTP. This should never be done, but can be
|
||||||
// useful for testing purposes, for example in setting up a loopback call
|
// useful for testing purposes, for example in setting up a loopback call
|
||||||
// with a single PeerConnection.
|
// with a single PeerConnection.
|
||||||
rtc::Optional<bool> enable_dtls_srtp;
|
absl::optional<bool> enable_dtls_srtp;
|
||||||
|
|
||||||
/////////////////////////////////////////////////
|
/////////////////////////////////////////////////
|
||||||
// The below fields are not part of the standard.
|
// The below fields are not part of the standard.
|
||||||
|
@ -504,29 +504,29 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||||
// 3) ice_check_min_interval defines the minimal interval (equivalently the
|
// 3) ice_check_min_interval defines the minimal interval (equivalently the
|
||||||
// maximum rate) that overrides the above two intervals when either of them
|
// maximum rate) that overrides the above two intervals when either of them
|
||||||
// is less.
|
// is less.
|
||||||
rtc::Optional<int> ice_check_interval_strong_connectivity;
|
absl::optional<int> ice_check_interval_strong_connectivity;
|
||||||
rtc::Optional<int> ice_check_interval_weak_connectivity;
|
absl::optional<int> ice_check_interval_weak_connectivity;
|
||||||
rtc::Optional<int> ice_check_min_interval;
|
absl::optional<int> ice_check_min_interval;
|
||||||
|
|
||||||
// The min time period for which a candidate pair must wait for response to
|
// The min time period for which a candidate pair must wait for response to
|
||||||
// connectivity checks before it becomes unwritable. This parameter
|
// connectivity checks before it becomes unwritable. This parameter
|
||||||
// overrides the default value in the ICE implementation if set.
|
// overrides the default value in the ICE implementation if set.
|
||||||
rtc::Optional<int> ice_unwritable_timeout;
|
absl::optional<int> ice_unwritable_timeout;
|
||||||
|
|
||||||
// The min number of connectivity checks that a candidate pair must sent
|
// The min number of connectivity checks that a candidate pair must sent
|
||||||
// without receiving response before it becomes unwritable. This parameter
|
// without receiving response before it becomes unwritable. This parameter
|
||||||
// overrides the default value in the ICE implementation if set.
|
// overrides the default value in the ICE implementation if set.
|
||||||
rtc::Optional<int> ice_unwritable_min_checks;
|
absl::optional<int> ice_unwritable_min_checks;
|
||||||
|
|
||||||
// The interval in milliseconds at which STUN candidates will resend STUN
|
// The interval in milliseconds at which STUN candidates will resend STUN
|
||||||
// binding requests to keep NAT bindings open.
|
// binding requests to keep NAT bindings open.
|
||||||
rtc::Optional<int> stun_candidate_keepalive_interval;
|
absl::optional<int> stun_candidate_keepalive_interval;
|
||||||
|
|
||||||
// ICE Periodic Regathering
|
// ICE Periodic Regathering
|
||||||
// If set, WebRTC will periodically create and propose candidates without
|
// If set, WebRTC will periodically create and propose candidates without
|
||||||
// starting a new ICE generation. The regathering happens continuously with
|
// starting a new ICE generation. The regathering happens continuously with
|
||||||
// interval specified in milliseconds by the uniform distribution [a, b].
|
// interval specified in milliseconds by the uniform distribution [a, b].
|
||||||
rtc::Optional<rtc::IntervalRange> ice_regather_interval_range;
|
absl::optional<rtc::IntervalRange> ice_regather_interval_range;
|
||||||
|
|
||||||
// Optional TurnCustomizer.
|
// Optional TurnCustomizer.
|
||||||
// With this class one can modify outgoing TURN messages.
|
// With this class one can modify outgoing TURN messages.
|
||||||
|
@ -538,7 +538,7 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||||
// A candidate pair on a preferred network has a higher precedence in ICE
|
// 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
|
// than one on an un-preferred network, regardless of priority or network
|
||||||
// cost.
|
// cost.
|
||||||
rtc::Optional<rtc::AdapterType> network_preference;
|
absl::optional<rtc::AdapterType> network_preference;
|
||||||
|
|
||||||
// Configure the SDP semantics used by this PeerConnection. Note that the
|
// Configure the SDP semantics used by this PeerConnection. Note that the
|
||||||
// WebRTC 1.0 specification requires kUnifiedPlan semantics. The
|
// WebRTC 1.0 specification requires kUnifiedPlan semantics. The
|
||||||
|
@ -979,9 +979,9 @@ class PeerConnectionInterface : public rtc::RefCountInterface {
|
||||||
|
|
||||||
// 0 <= min <= current <= max should hold for set parameters.
|
// 0 <= min <= current <= max should hold for set parameters.
|
||||||
struct BitrateParameters {
|
struct BitrateParameters {
|
||||||
rtc::Optional<int> min_bitrate_bps;
|
absl::optional<int> min_bitrate_bps;
|
||||||
rtc::Optional<int> current_bitrate_bps;
|
absl::optional<int> current_bitrate_bps;
|
||||||
rtc::Optional<int> max_bitrate_bps;
|
absl::optional<int> max_bitrate_bps;
|
||||||
};
|
};
|
||||||
|
|
||||||
// SetBitrate limits the bandwidth allocated for all RTP streams sent by
|
// SetBitrate limits the bandwidth allocated for all RTP streams sent by
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
#include "api/optional.h"
|
|
||||||
#include "api/video/video_content_type.h"
|
#include "api/video/video_content_type.h"
|
||||||
#include "api/video/video_rotation.h"
|
#include "api/video/video_rotation.h"
|
||||||
#include "api/video/video_timing.h"
|
#include "api/video/video_timing.h"
|
||||||
|
@ -102,7 +102,7 @@ struct RTPHeaderExtension {
|
||||||
bool hasVideoRotation;
|
bool hasVideoRotation;
|
||||||
VideoRotation videoRotation;
|
VideoRotation videoRotation;
|
||||||
|
|
||||||
// TODO(ilnik): Refactor this and one above to be rtc::Optional() and remove
|
// TODO(ilnik): Refactor this and one above to be absl::optional() and remove
|
||||||
// a corresponding bool flag.
|
// a corresponding bool flag.
|
||||||
bool hasVideoContentType;
|
bool hasVideoContentType;
|
||||||
VideoContentType videoContentType;
|
VideoContentType videoContentType;
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/mediatypes.h"
|
#include "api/mediatypes.h"
|
||||||
#include "api/optional.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ struct RtcpFeedback {
|
||||||
// 1. It's an enum instead of a string.
|
// 1. It's an enum instead of a string.
|
||||||
// 2. Generic NACK feedback is represented by a GENERIC_NACK message type,
|
// 2. Generic NACK feedback is represented by a GENERIC_NACK message type,
|
||||||
// rather than an unset "parameter" value.
|
// rather than an unset "parameter" value.
|
||||||
rtc::Optional<RtcpFeedbackMessageType> message_type;
|
absl::optional<RtcpFeedbackMessageType> message_type;
|
||||||
|
|
||||||
// Constructors for convenience.
|
// Constructors for convenience.
|
||||||
RtcpFeedback();
|
RtcpFeedback();
|
||||||
|
@ -125,23 +125,23 @@ struct RtpCodecCapability {
|
||||||
cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO;
|
cricket::MediaType kind = cricket::MEDIA_TYPE_AUDIO;
|
||||||
|
|
||||||
// Clock rate in Hertz. If unset, the codec is applicable to any clock rate.
|
// Clock rate in Hertz. If unset, the codec is applicable to any clock rate.
|
||||||
rtc::Optional<int> clock_rate;
|
absl::optional<int> clock_rate;
|
||||||
|
|
||||||
// Default payload type for this codec. Mainly needed for codecs that use
|
// Default payload type for this codec. Mainly needed for codecs that use
|
||||||
// that have statically assigned payload types.
|
// that have statically assigned payload types.
|
||||||
rtc::Optional<int> preferred_payload_type;
|
absl::optional<int> preferred_payload_type;
|
||||||
|
|
||||||
// Maximum packetization time supported by an RtpReceiver for this codec.
|
// Maximum packetization time supported by an RtpReceiver for this codec.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<int> max_ptime;
|
absl::optional<int> max_ptime;
|
||||||
|
|
||||||
// Preferred packetization time for an RtpReceiver or RtpSender of this
|
// Preferred packetization time for an RtpReceiver or RtpSender of this
|
||||||
// codec.
|
// codec.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<int> ptime;
|
absl::optional<int> ptime;
|
||||||
|
|
||||||
// The number of audio channels supported. Unused for video codecs.
|
// The number of audio channels supported. Unused for video codecs.
|
||||||
rtc::Optional<int> num_channels;
|
absl::optional<int> num_channels;
|
||||||
|
|
||||||
// Feedback mechanisms supported for this codec.
|
// Feedback mechanisms supported for this codec.
|
||||||
std::vector<RtcpFeedback> rtcp_feedback;
|
std::vector<RtcpFeedback> rtcp_feedback;
|
||||||
|
@ -204,7 +204,7 @@ struct RtpHeaderExtensionCapability {
|
||||||
std::string uri;
|
std::string uri;
|
||||||
|
|
||||||
// Preferred value of ID that goes in the packet.
|
// Preferred value of ID that goes in the packet.
|
||||||
rtc::Optional<int> preferred_id;
|
absl::optional<int> preferred_id;
|
||||||
|
|
||||||
// If true, it's preferred that the value in the header is encrypted.
|
// If true, it's preferred that the value in the header is encrypted.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
|
@ -313,7 +313,7 @@ typedef RtpExtension RtpHeaderExtensionParameters;
|
||||||
struct RtpFecParameters {
|
struct RtpFecParameters {
|
||||||
// If unset, a value is chosen by the implementation.
|
// If unset, a value is chosen by the implementation.
|
||||||
// Works just like RtpEncodingParameters::ssrc.
|
// Works just like RtpEncodingParameters::ssrc.
|
||||||
rtc::Optional<uint32_t> ssrc;
|
absl::optional<uint32_t> ssrc;
|
||||||
|
|
||||||
FecMechanism mechanism = FecMechanism::RED;
|
FecMechanism mechanism = FecMechanism::RED;
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ struct RtpFecParameters {
|
||||||
struct RtpRtxParameters {
|
struct RtpRtxParameters {
|
||||||
// If unset, a value is chosen by the implementation.
|
// If unset, a value is chosen by the implementation.
|
||||||
// Works just like RtpEncodingParameters::ssrc.
|
// Works just like RtpEncodingParameters::ssrc.
|
||||||
rtc::Optional<uint32_t> ssrc;
|
absl::optional<uint32_t> ssrc;
|
||||||
|
|
||||||
// Constructors for convenience.
|
// Constructors for convenience.
|
||||||
RtpRtxParameters();
|
RtpRtxParameters();
|
||||||
|
@ -353,7 +353,7 @@ struct RtpEncodingParameters {
|
||||||
// may change due to an SSRC conflict, in which case the conflict is handled
|
// 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
|
// internally without any event. Another way of looking at this is that an
|
||||||
// unset SSRC acts as a "wildcard" SSRC.
|
// unset SSRC acts as a "wildcard" SSRC.
|
||||||
rtc::Optional<uint32_t> ssrc;
|
absl::optional<uint32_t> ssrc;
|
||||||
|
|
||||||
// Can be used to reference a codec in the |codecs| member of the
|
// Can be used to reference a codec in the |codecs| member of the
|
||||||
// RtpParameters that contains this RtpEncodingParameters. If unset, the
|
// RtpParameters that contains this RtpEncodingParameters. If unset, the
|
||||||
|
@ -361,23 +361,23 @@ struct RtpEncodingParameters {
|
||||||
// prepare to receive any codec (for a receiver).
|
// prepare to receive any codec (for a receiver).
|
||||||
// TODO(deadbeef): Not implemented. Implementation of RtpSender will always
|
// TODO(deadbeef): Not implemented. Implementation of RtpSender will always
|
||||||
// choose the first codec from the list.
|
// choose the first codec from the list.
|
||||||
rtc::Optional<int> codec_payload_type;
|
absl::optional<int> codec_payload_type;
|
||||||
|
|
||||||
// Specifies the FEC mechanism, if set.
|
// Specifies the FEC mechanism, if set.
|
||||||
// TODO(deadbeef): Not implemented. Current implementation will use whatever
|
// TODO(deadbeef): Not implemented. Current implementation will use whatever
|
||||||
// FEC codecs are available, including red+ulpfec.
|
// FEC codecs are available, including red+ulpfec.
|
||||||
rtc::Optional<RtpFecParameters> fec;
|
absl::optional<RtpFecParameters> fec;
|
||||||
|
|
||||||
// Specifies the RTX parameters, if set.
|
// Specifies the RTX parameters, if set.
|
||||||
// TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
|
// TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
|
||||||
rtc::Optional<RtpRtxParameters> rtx;
|
absl::optional<RtpRtxParameters> rtx;
|
||||||
|
|
||||||
// Only used for audio. If set, determines whether or not discontinuous
|
// Only used for audio. If set, determines whether or not discontinuous
|
||||||
// transmission will be used, if an available codec supports it. If not
|
// transmission will be used, if an available codec supports it. If not
|
||||||
// set, the implementation default setting will be used.
|
// set, the implementation default setting will be used.
|
||||||
// TODO(deadbeef): Not implemented. Current implementation will use a CN
|
// TODO(deadbeef): Not implemented. Current implementation will use a CN
|
||||||
// codec as long as it's present.
|
// codec as long as it's present.
|
||||||
rtc::Optional<DtxStatus> dtx;
|
absl::optional<DtxStatus> dtx;
|
||||||
|
|
||||||
// The relative bitrate priority of this encoding. Currently this is
|
// The relative bitrate priority of this encoding. Currently this is
|
||||||
// implemented for the entire rtp sender by using the value of the first
|
// implemented for the entire rtp sender by using the value of the first
|
||||||
|
@ -394,7 +394,7 @@ struct RtpEncodingParameters {
|
||||||
// creates a ptime for a specific codec, which is later changed in the
|
// creates a ptime for a specific codec, which is later changed in the
|
||||||
// RtpEncodingParameters by the application.
|
// RtpEncodingParameters by the application.
|
||||||
// TODO(bugs.webrtc.org/8819): Not implemented.
|
// TODO(bugs.webrtc.org/8819): Not implemented.
|
||||||
rtc::Optional<int> ptime;
|
absl::optional<int> ptime;
|
||||||
|
|
||||||
// If set, this represents the Transport Independent Application Specific
|
// If set, this represents the Transport Independent Application Specific
|
||||||
// maximum bandwidth defined in RFC3890. If unset, there is no maximum
|
// maximum bandwidth defined in RFC3890. If unset, there is no maximum
|
||||||
|
@ -407,23 +407,23 @@ struct RtpEncodingParameters {
|
||||||
// bandwidth for the entire bandwidth estimator (audio and video). This is
|
// 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
|
// just always how "b=AS" was handled, but it's not correct and should be
|
||||||
// fixed.
|
// fixed.
|
||||||
rtc::Optional<int> max_bitrate_bps;
|
absl::optional<int> max_bitrate_bps;
|
||||||
|
|
||||||
// Specifies the minimum bitrate in bps for video.
|
// Specifies the minimum bitrate in bps for video.
|
||||||
// TODO(asapersson): Not implemented for ORTC API.
|
// TODO(asapersson): Not implemented for ORTC API.
|
||||||
// TODO(asapersson): Not implemented for single layer.
|
// TODO(asapersson): Not implemented for single layer.
|
||||||
rtc::Optional<int> min_bitrate_bps;
|
absl::optional<int> min_bitrate_bps;
|
||||||
|
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<int> max_framerate;
|
absl::optional<int> max_framerate;
|
||||||
|
|
||||||
// For video, scale the resolution down by this factor.
|
// For video, scale the resolution down by this factor.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<double> scale_resolution_down_by;
|
absl::optional<double> scale_resolution_down_by;
|
||||||
|
|
||||||
// Scale the framerate down by this factor.
|
// Scale the framerate down by this factor.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<double> scale_framerate_down_by;
|
absl::optional<double> scale_framerate_down_by;
|
||||||
|
|
||||||
// For an RtpSender, set to true to cause this encoding to be encoded and
|
// 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
|
// sent, and false for it not to be encoded and sent. This allows control
|
||||||
|
@ -478,24 +478,24 @@ struct RtpCodecParameters {
|
||||||
int payload_type = 0;
|
int payload_type = 0;
|
||||||
|
|
||||||
// If unset, the implementation default is used.
|
// If unset, the implementation default is used.
|
||||||
rtc::Optional<int> clock_rate;
|
absl::optional<int> clock_rate;
|
||||||
|
|
||||||
// The number of audio channels used. Unset for video codecs. If unset for
|
// The number of audio channels used. Unset for video codecs. If unset for
|
||||||
// audio, the implementation default is used.
|
// audio, the implementation default is used.
|
||||||
// TODO(deadbeef): The "implementation default" part isn't fully implemented.
|
// TODO(deadbeef): The "implementation default" part isn't fully implemented.
|
||||||
// Only defaults to 1, even though some codecs (such as opus) should really
|
// Only defaults to 1, even though some codecs (such as opus) should really
|
||||||
// default to 2.
|
// default to 2.
|
||||||
rtc::Optional<int> num_channels;
|
absl::optional<int> num_channels;
|
||||||
|
|
||||||
// The maximum packetization time to be used by an RtpSender.
|
// The maximum packetization time to be used by an RtpSender.
|
||||||
// If |ptime| is also set, this will be ignored.
|
// If |ptime| is also set, this will be ignored.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<int> max_ptime;
|
absl::optional<int> max_ptime;
|
||||||
|
|
||||||
// The packetization time to be used by an RtpSender.
|
// The packetization time to be used by an RtpSender.
|
||||||
// If unset, will use any time up to max_ptime.
|
// If unset, will use any time up to max_ptime.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<int> ptime;
|
absl::optional<int> ptime;
|
||||||
|
|
||||||
// Feedback mechanisms to be used for this codec.
|
// Feedback mechanisms to be used for this codec.
|
||||||
// TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
|
// TODO(deadbeef): Not implemented with PeerConnection senders/receivers.
|
||||||
|
@ -551,7 +551,7 @@ struct RtcpParameters final {
|
||||||
// The SSRC to be used in the "SSRC of packet sender" field. If not set, one
|
// The SSRC to be used in the "SSRC of packet sender" field. If not set, one
|
||||||
// will be chosen by the implementation.
|
// will be chosen by the implementation.
|
||||||
// TODO(deadbeef): Not implemented.
|
// TODO(deadbeef): Not implemented.
|
||||||
rtc::Optional<uint32_t> ssrc;
|
absl::optional<uint32_t> ssrc;
|
||||||
|
|
||||||
// The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
|
// The Canonical Name (CNAME) used by RTCP (e.g. in SDES messages).
|
||||||
//
|
//
|
||||||
|
|
|
@ -57,8 +57,8 @@ class RtpSource {
|
||||||
// The source can be either a contributing source or a synchronization source.
|
// The source can be either a contributing source or a synchronization source.
|
||||||
RtpSourceType source_type() const { return source_type_; }
|
RtpSourceType source_type() const { return source_type_; }
|
||||||
|
|
||||||
rtc::Optional<uint8_t> audio_level() const { return audio_level_; }
|
absl::optional<uint8_t> audio_level() const { return audio_level_; }
|
||||||
void set_audio_level(const rtc::Optional<uint8_t>& level) {
|
void set_audio_level(const absl::optional<uint8_t>& level) {
|
||||||
audio_level_ = level;
|
audio_level_ = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class RtpSource {
|
||||||
int64_t timestamp_ms_;
|
int64_t timestamp_ms_;
|
||||||
uint32_t source_id_;
|
uint32_t source_id_;
|
||||||
RtpSourceType source_type_;
|
RtpSourceType source_type_;
|
||||||
rtc::Optional<uint8_t> audio_level_;
|
absl::optional<uint8_t> audio_level_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RtpReceiverObserverInterface {
|
class RtpReceiverObserverInterface {
|
||||||
|
|
|
@ -38,7 +38,7 @@ class RtpSenderInterface : public rtc::RefCountInterface {
|
||||||
|
|
||||||
// Returns primary SSRC used by this sender for sending media.
|
// Returns primary SSRC used by this sender for sending media.
|
||||||
// Returns 0 if not yet determined.
|
// Returns 0 if not yet determined.
|
||||||
// TODO(deadbeef): Change to rtc::Optional.
|
// TODO(deadbeef): Change to absl::optional.
|
||||||
// TODO(deadbeef): Remove? With GetParameters this should be redundant.
|
// TODO(deadbeef): Remove? With GetParameters this should be redundant.
|
||||||
virtual uint32_t ssrc() const = 0;
|
virtual uint32_t ssrc() const = 0;
|
||||||
|
|
||||||
|
|
|
@ -14,8 +14,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "absl/types/optional.h"
|
||||||
#include "api/array_view.h"
|
#include "api/array_view.h"
|
||||||
#include "api/optional.h"
|
|
||||||
#include "api/rtpreceiverinterface.h"
|
#include "api/rtpreceiverinterface.h"
|
||||||
#include "api/rtpsenderinterface.h"
|
#include "api/rtpsenderinterface.h"
|
||||||
#include "rtc_base/refcount.h"
|
#include "rtc_base/refcount.h"
|
||||||
|
@ -68,7 +68,7 @@ class RtpTransceiverInterface : public rtc::RefCountInterface {
|
||||||
// remote descriptions. Before negotiation is complete, the mid value may be
|
// 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.
|
// null. After rollbacks, the value may change from a non-null value to null.
|
||||||
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
|
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-mid
|
||||||
virtual rtc::Optional<std::string> mid() const = 0;
|
virtual absl::optional<std::string> mid() const = 0;
|
||||||
|
|
||||||
// The sender attribute exposes the RtpSender corresponding to the RTP media
|
// 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,
|
// that may be sent with the transceiver's mid. The sender is always present,
|
||||||
|
@ -105,7 +105,7 @@ class RtpTransceiverInterface : public rtc::RefCountInterface {
|
||||||
// for this transceiver. If this transceiver has never been represented in an
|
// 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.
|
// offer/answer exchange, or if the transceiver is stopped, the value is null.
|
||||||
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
|
// https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-currentdirection
|
||||||
virtual rtc::Optional<RtpTransceiverDirection> current_direction() const = 0;
|
virtual absl::optional<RtpTransceiverDirection> current_direction() const = 0;
|
||||||
|
|
||||||
// The Stop method irreversibly stops the RtpTransceiver. The sender of this
|
// The Stop method irreversibly stops the RtpTransceiver. The sender of this
|
||||||
// transceiver will no longer send, the receiver will no longer receive.
|
// transceiver will no longer send, the receiver will no longer receive.
|
||||||
|
|
|
@ -15,7 +15,7 @@ rtc_source_set("bitrate_settings") {
|
||||||
"bitrate_settings.h",
|
"bitrate_settings.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:optional",
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,11 @@ rtc_static_library("network_control") {
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"..:optional",
|
|
||||||
"../units:data_rate",
|
"../units:data_rate",
|
||||||
"../units:data_size",
|
"../units:data_size",
|
||||||
"../units:time_delta",
|
"../units:time_delta",
|
||||||
"../units:timestamp",
|
"../units:timestamp",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +45,10 @@ if (rtc_include_tests) {
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
":network_control",
|
":network_control",
|
||||||
"../:optional",
|
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../test:test_support",
|
"../../test:test_support",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#ifndef API_TRANSPORT_BITRATE_SETTINGS_H_
|
#ifndef API_TRANSPORT_BITRATE_SETTINGS_H_
|
||||||
#define API_TRANSPORT_BITRATE_SETTINGS_H_
|
#define API_TRANSPORT_BITRATE_SETTINGS_H_
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -25,9 +25,9 @@ struct BitrateSettings {
|
||||||
~BitrateSettings();
|
~BitrateSettings();
|
||||||
BitrateSettings(const BitrateSettings&);
|
BitrateSettings(const BitrateSettings&);
|
||||||
// 0 <= min <= start <= max should hold for set parameters.
|
// 0 <= min <= start <= max should hold for set parameters.
|
||||||
rtc::Optional<int> min_bitrate_bps;
|
absl::optional<int> min_bitrate_bps;
|
||||||
rtc::Optional<int> start_bitrate_bps;
|
absl::optional<int> start_bitrate_bps;
|
||||||
rtc::Optional<int> max_bitrate_bps;
|
absl::optional<int> max_bitrate_bps;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/units/data_rate.h"
|
#include "api/units/data_rate.h"
|
||||||
#include "api/units/data_size.h"
|
#include "api/units/data_size.h"
|
||||||
#include "api/units/time_delta.h"
|
#include "api/units/time_delta.h"
|
||||||
|
@ -32,10 +32,10 @@ struct StreamsConfig {
|
||||||
~StreamsConfig();
|
~StreamsConfig();
|
||||||
Timestamp at_time = Timestamp::Infinity();
|
Timestamp at_time = Timestamp::Infinity();
|
||||||
bool requests_alr_probing = false;
|
bool requests_alr_probing = false;
|
||||||
rtc::Optional<double> pacing_factor;
|
absl::optional<double> pacing_factor;
|
||||||
rtc::Optional<DataRate> min_pacing_rate;
|
absl::optional<DataRate> min_pacing_rate;
|
||||||
rtc::Optional<DataRate> max_padding_rate;
|
absl::optional<DataRate> max_padding_rate;
|
||||||
rtc::Optional<DataRate> max_total_allocated_bitrate;
|
absl::optional<DataRate> max_total_allocated_bitrate;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TargetRateConstraints {
|
struct TargetRateConstraints {
|
||||||
|
@ -43,8 +43,8 @@ struct TargetRateConstraints {
|
||||||
TargetRateConstraints(const TargetRateConstraints&);
|
TargetRateConstraints(const TargetRateConstraints&);
|
||||||
~TargetRateConstraints();
|
~TargetRateConstraints();
|
||||||
Timestamp at_time = Timestamp::Infinity();
|
Timestamp at_time = Timestamp::Infinity();
|
||||||
rtc::Optional<DataRate> min_data_rate;
|
absl::optional<DataRate> min_data_rate;
|
||||||
rtc::Optional<DataRate> max_data_rate;
|
absl::optional<DataRate> max_data_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Send side information
|
// Send side information
|
||||||
|
@ -62,7 +62,7 @@ struct NetworkRouteChange {
|
||||||
// The TargetRateConstraints are set here so they can be changed synchronously
|
// The TargetRateConstraints are set here so they can be changed synchronously
|
||||||
// when network route changes.
|
// when network route changes.
|
||||||
TargetRateConstraints constraints;
|
TargetRateConstraints constraints;
|
||||||
rtc::Optional<DataRate> starting_rate;
|
absl::optional<DataRate> starting_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PacedPacketInfo {
|
struct PacedPacketInfo {
|
||||||
|
@ -121,7 +121,7 @@ struct PacketResult {
|
||||||
PacketResult(const PacketResult&);
|
PacketResult(const PacketResult&);
|
||||||
~PacketResult();
|
~PacketResult();
|
||||||
|
|
||||||
rtc::Optional<SentPacket> sent_packet;
|
absl::optional<SentPacket> sent_packet;
|
||||||
Timestamp receive_time = Timestamp::Infinity();
|
Timestamp receive_time = Timestamp::Infinity();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -185,10 +185,10 @@ struct NetworkControlUpdate {
|
||||||
NetworkControlUpdate();
|
NetworkControlUpdate();
|
||||||
NetworkControlUpdate(const NetworkControlUpdate&);
|
NetworkControlUpdate(const NetworkControlUpdate&);
|
||||||
~NetworkControlUpdate();
|
~NetworkControlUpdate();
|
||||||
rtc::Optional<DataSize> congestion_window;
|
absl::optional<DataSize> congestion_window;
|
||||||
rtc::Optional<PacerConfig> pacer_config;
|
absl::optional<PacerConfig> pacer_config;
|
||||||
std::vector<ProbeClusterConfig> probe_cluster_configs;
|
std::vector<ProbeClusterConfig> probe_cluster_configs;
|
||||||
rtc::Optional<TargetTransferRate> target_rate;
|
absl::optional<TargetTransferRate> target_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Process control
|
// Process control
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/transport/network_control.h"
|
#include "api/transport/network_control.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
|
@ -26,9 +26,9 @@ rtc_source_set("video_frame") {
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"..:optional",
|
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,11 +66,11 @@ rtc_source_set("video_bitrate_allocation") {
|
||||||
"video_bitrate_allocation.h",
|
"video_bitrate_allocation.h",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
"..:optional",
|
|
||||||
"../..:typedefs",
|
"../..:typedefs",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:safe_conversions",
|
"../../rtc_base:safe_conversions",
|
||||||
"../../rtc_base:stringutils",
|
"../../rtc_base:stringutils",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +83,8 @@ rtc_source_set("video_stream_decoder") {
|
||||||
deps = [
|
deps = [
|
||||||
":encoded_frame",
|
":encoded_frame",
|
||||||
":video_frame",
|
":video_frame",
|
||||||
"..:optional",
|
|
||||||
"../video_codecs:video_codecs_api",
|
"../video_codecs:video_codecs_api",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ bool VideoBitrateAllocation::SetBitrate(size_t spatial_index,
|
||||||
RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
|
RTC_CHECK_LT(spatial_index, kMaxSpatialLayers);
|
||||||
RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
|
RTC_CHECK_LT(temporal_index, kMaxTemporalStreams);
|
||||||
int64_t new_bitrate_sum_bps = sum_;
|
int64_t new_bitrate_sum_bps = sum_;
|
||||||
rtc::Optional<uint32_t>& layer_bitrate =
|
absl::optional<uint32_t>& layer_bitrate =
|
||||||
bitrates_[spatial_index][temporal_index];
|
bitrates_[spatial_index][temporal_index];
|
||||||
if (layer_bitrate) {
|
if (layer_bitrate) {
|
||||||
RTC_DCHECK_LE(*layer_bitrate, sum_);
|
RTC_DCHECK_LE(*layer_bitrate, sum_);
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "typedefs.h" // NOLINT(build/include)
|
#include "typedefs.h" // NOLINT(build/include)
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -77,7 +77,7 @@ class VideoBitrateAllocation {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint32_t sum_;
|
uint32_t sum_;
|
||||||
rtc::Optional<uint32_t> bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
|
absl::optional<uint32_t> bitrates_[kMaxSpatialLayers][kMaxTemporalStreams];
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/video/video_sink_interface.h"
|
#include "api/video/video_sink_interface.h"
|
||||||
|
|
||||||
namespace rtc {
|
namespace rtc {
|
||||||
|
@ -38,7 +38,7 @@ struct VideoSinkWants {
|
||||||
// have improved after an earlier downgrade. The source should select the
|
// have improved after an earlier downgrade. The source should select the
|
||||||
// closest resolution to this pixel count, but if max_pixel_count is set, it
|
// closest resolution to this pixel count, but if max_pixel_count is set, it
|
||||||
// still sets the absolute upper bound.
|
// still sets the absolute upper bound.
|
||||||
rtc::Optional<int> target_pixel_count;
|
absl::optional<int> target_pixel_count;
|
||||||
// Tells the source the maximum framerate the sink wants.
|
// Tells the source the maximum framerate the sink wants.
|
||||||
int max_framerate_fps = std::numeric_limits<int>::max();
|
int max_framerate_fps = std::numeric_limits<int>::max();
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,8 +37,8 @@ class VideoStreamDecoder {
|
||||||
|
|
||||||
// Called with the decoded frame.
|
// Called with the decoded frame.
|
||||||
virtual void OnDecodedFrame(VideoFrame decodedImage,
|
virtual void OnDecodedFrame(VideoFrame decodedImage,
|
||||||
rtc::Optional<int> decode_time_ms,
|
absl::optional<int> decode_time_ms,
|
||||||
rtc::Optional<int> qp) = 0;
|
absl::optional<int> qp) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual ~VideoStreamDecoder() = default;
|
virtual ~VideoStreamDecoder() = default;
|
||||||
|
|
|
@ -30,13 +30,13 @@ rtc_source_set("video_codecs_api") {
|
||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"..:optional",
|
|
||||||
"../..:webrtc_common",
|
"../..:webrtc_common",
|
||||||
"../../common_video",
|
"../../common_video",
|
||||||
"../../rtc_base:checks",
|
"../../rtc_base:checks",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../video:video_bitrate_allocation",
|
"../video:video_bitrate_allocation",
|
||||||
"../video:video_frame",
|
"../video:video_frame",
|
||||||
|
"//third_party/abseil-cpp/absl/types:optional",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,8 +178,8 @@ TEST_F(VideoDecoderSoftwareFallbackWrapperTest,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
void Decoded(webrtc::VideoFrame& decodedImage,
|
void Decoded(webrtc::VideoFrame& decodedImage,
|
||||||
rtc::Optional<int32_t> decode_time_ms,
|
absl::optional<int32_t> decode_time_ms,
|
||||||
rtc::Optional<uint8_t> qp) override {
|
absl::optional<uint8_t> qp) override {
|
||||||
RTC_NOTREACHED();
|
RTC_NOTREACHED();
|
||||||
}
|
}
|
||||||
} callback;
|
} callback;
|
||||||
|
|
|
@ -19,8 +19,8 @@ int32_t DecodedImageCallback::Decoded(VideoFrame& decodedImage,
|
||||||
}
|
}
|
||||||
|
|
||||||
void DecodedImageCallback::Decoded(VideoFrame& decodedImage,
|
void DecodedImageCallback::Decoded(VideoFrame& decodedImage,
|
||||||
rtc::Optional<int32_t> decode_time_ms,
|
absl::optional<int32_t> decode_time_ms,
|
||||||
rtc::Optional<uint8_t> qp) {
|
absl::optional<uint8_t> qp) {
|
||||||
Decoded(decodedImage, decode_time_ms.value_or(-1));
|
Decoded(decodedImage, decode_time_ms.value_or(-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@ class DecodedImageCallback {
|
||||||
// TODO(sakal): Remove other implementations when upstream projects have been
|
// TODO(sakal): Remove other implementations when upstream projects have been
|
||||||
// updated.
|
// updated.
|
||||||
virtual void Decoded(VideoFrame& decodedImage,
|
virtual void Decoded(VideoFrame& decodedImage,
|
||||||
rtc::Optional<int32_t> decode_time_ms,
|
absl::optional<int32_t> decode_time_ms,
|
||||||
rtc::Optional<uint8_t> qp);
|
absl::optional<uint8_t> qp);
|
||||||
|
|
||||||
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId);
|
virtual int32_t ReceivedDecodedReferenceFrame(const uint64_t pictureId);
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/video/video_bitrate_allocation.h"
|
#include "api/video/video_bitrate_allocation.h"
|
||||||
#include "api/video/video_frame.h"
|
#include "api/video/video_frame.h"
|
||||||
#include "api/video_codecs/video_codec.h"
|
#include "api/video_codecs/video_codec.h"
|
||||||
|
@ -90,7 +90,7 @@ class VideoEncoder {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// TODO(nisse): Would be nicer if kOff were a constant ScalingSettings
|
// TODO(nisse): Would be nicer if kOff were a constant ScalingSettings
|
||||||
// rather than a magic value. However, rtc::Optional is not trivially copy
|
// rather than a magic value. However, absl::optional is not trivially copy
|
||||||
// constructible, and hence a constant ScalingSettings needs a static
|
// constructible, and hence a constant ScalingSettings needs a static
|
||||||
// initializer, which is strongly discouraged in Chrome. We can hopefully
|
// initializer, which is strongly discouraged in Chrome. We can hopefully
|
||||||
// fix this when we switch to absl::optional or std::optional.
|
// fix this when we switch to absl::optional or std::optional.
|
||||||
|
@ -102,7 +102,7 @@ class VideoEncoder {
|
||||||
ScalingSettings(KOff); // NOLINT(runtime/explicit)
|
ScalingSettings(KOff); // NOLINT(runtime/explicit)
|
||||||
~ScalingSettings();
|
~ScalingSettings();
|
||||||
|
|
||||||
const rtc::Optional<QpThresholds> thresholds;
|
const absl::optional<QpThresholds> thresholds;
|
||||||
|
|
||||||
// We will never ask for a resolution lower than this.
|
// We will never ask for a resolution lower than this.
|
||||||
// TODO(kthelgason): Lower this limit when better testing
|
// TODO(kthelgason): Lower this limit when better testing
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "api/optional.h"
|
#include "absl/types/optional.h"
|
||||||
#include "api/video_codecs/video_codec.h"
|
|
||||||
#include "api/video_codecs/sdp_video_format.h"
|
#include "api/video_codecs/sdp_video_format.h"
|
||||||
|
#include "api/video_codecs/video_codec.h"
|
||||||
#include "rtc_base/refcount.h"
|
#include "rtc_base/refcount.h"
|
||||||
#include "rtc_base/scoped_ref_ptr.h"
|
#include "rtc_base/scoped_ref_ptr.h"
|
||||||
|
|
||||||
|
@ -37,9 +37,9 @@ struct VideoStream {
|
||||||
int max_bitrate_bps;
|
int max_bitrate_bps;
|
||||||
int max_qp;
|
int max_qp;
|
||||||
|
|
||||||
rtc::Optional<size_t> num_temporal_layers;
|
absl::optional<size_t> num_temporal_layers;
|
||||||
|
|
||||||
rtc::Optional<double> bitrate_priority;
|
absl::optional<double> bitrate_priority;
|
||||||
|
|
||||||
// TODO(bugs.webrtc.org/8653): Support active per-simulcast layer.
|
// TODO(bugs.webrtc.org/8653): Support active per-simulcast layer.
|
||||||
bool active;
|
bool active;
|
||||||
|
@ -50,7 +50,7 @@ class VideoEncoderConfig {
|
||||||
// These are reference counted to permit copying VideoEncoderConfig and be
|
// These are reference counted to permit copying VideoEncoderConfig and be
|
||||||
// kept alive until all encoder_specific_settings go out of scope.
|
// kept alive until all encoder_specific_settings go out of scope.
|
||||||
// TODO(kthelgason): Consider removing the need for copying VideoEncoderConfig
|
// TODO(kthelgason): Consider removing the need for copying VideoEncoderConfig
|
||||||
// and use rtc::Optional for encoder_specific_settings instead.
|
// and use absl::optional for encoder_specific_settings instead.
|
||||||
class EncoderSpecificSettings : public rtc::RefCountInterface {
|
class EncoderSpecificSettings : public rtc::RefCountInterface {
|
||||||
public:
|
public:
|
||||||
// TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is
|
// TODO(pbos): Remove FillEncoderSpecificSettings as soon as VideoCodec is
|
||||||
|
|
|
@ -25,7 +25,7 @@ PROXY_SIGNALING_THREAD_DESTRUCTOR()
|
||||||
PROXY_CONSTMETHOD0(SourceState, state)
|
PROXY_CONSTMETHOD0(SourceState, state)
|
||||||
PROXY_CONSTMETHOD0(bool, remote)
|
PROXY_CONSTMETHOD0(bool, remote)
|
||||||
PROXY_CONSTMETHOD0(bool, is_screencast)
|
PROXY_CONSTMETHOD0(bool, is_screencast)
|
||||||
PROXY_CONSTMETHOD0(rtc::Optional<bool>, needs_denoising)
|
PROXY_CONSTMETHOD0(absl::optional<bool>, needs_denoising)
|
||||||
PROXY_METHOD1(bool, GetStats, Stats*)
|
PROXY_METHOD1(bool, GetStats, Stats*)
|
||||||
PROXY_WORKER_METHOD2(void,
|
PROXY_WORKER_METHOD2(void,
|
||||||
AddOrUpdateSink,
|
AddOrUpdateSink,
|
||||||
|
|
Loading…
Reference in a new issue