Replace rtc::Optional with absl::optional in modules/audio_coding
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated by running script with parameter 'modules/audio_coding'
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: Ic980ee605148fdb160666d4aa03cc87175e48fe8
Reviewed-on: https://webrtc-review.googlesource.com/84130
Reviewed-by: Oskar Sundbom <ossu@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23659}
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index 84efc5c..b61099c 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -64,7 +64,7 @@
return neteq_->LeastRequiredDelayMs();
}
-rtc::Optional<int> AcmReceiver::last_packet_sample_rate_hz() const {
+absl::optional<int> AcmReceiver::last_packet_sample_rate_hz() const {
rtc::CritScope lock(&crit_sect_);
return last_packet_sample_rate_hz_;
}
@@ -86,7 +86,7 @@
{
rtc::CritScope lock(&crit_sect_);
- const rtc::Optional<CodecInst> ci =
+ const absl::optional<CodecInst> ci =
RtpHeaderToDecoder(*header, incoming_payload[0]);
if (!ci) {
RTC_LOG_F(LS_ERROR) << "Payload-type "
@@ -202,15 +202,15 @@
const auto neteq_decoder = [acm_codec_id, channels]() -> NetEqDecoder {
if (acm_codec_id == -1)
return NetEqDecoder::kDecoderArbitrary; // External decoder.
- const rtc::Optional<RentACodec::CodecId> cid =
+ const absl::optional<RentACodec::CodecId> cid =
RentACodec::CodecIdFromIndex(acm_codec_id);
RTC_DCHECK(cid) << "Invalid codec index: " << acm_codec_id;
- const rtc::Optional<NetEqDecoder> ned =
+ const absl::optional<NetEqDecoder> ned =
RentACodec::NetEqDecoderFromCodecId(*cid, channels);
RTC_DCHECK(ned) << "Invalid codec ID: " << static_cast<int>(*cid);
return *ned;
}();
- const rtc::Optional<SdpAudioFormat> new_format =
+ const absl::optional<SdpAudioFormat> new_format =
NetEqDecoderToSdpAudioFormat(neteq_decoder);
rtc::CritScope lock(&crit_sect_);
@@ -276,9 +276,9 @@
void AcmReceiver::RemoveAllCodecs() {
rtc::CritScope lock(&crit_sect_);
neteq_->RemoveAllPayloadTypes();
- last_audio_decoder_ = rtc::nullopt;
- last_audio_format_ = rtc::nullopt;
- last_packet_sample_rate_hz_ = rtc::nullopt;
+ last_audio_decoder_ = absl::nullopt;
+ last_audio_format_ = absl::nullopt;
+ last_packet_sample_rate_hz_ = absl::nullopt;
}
int AcmReceiver::RemoveCodec(uint8_t payload_type) {
@@ -289,14 +289,14 @@
return -1;
}
if (last_audio_decoder_ && payload_type == last_audio_decoder_->pltype) {
- last_audio_decoder_ = rtc::nullopt;
- last_audio_format_ = rtc::nullopt;
- last_packet_sample_rate_hz_ = rtc::nullopt;
+ last_audio_decoder_ = absl::nullopt;
+ last_audio_format_ = absl::nullopt;
+ last_packet_sample_rate_hz_ = absl::nullopt;
}
return 0;
}
-rtc::Optional<uint32_t> AcmReceiver::GetPlayoutTimestamp() {
+absl::optional<uint32_t> AcmReceiver::GetPlayoutTimestamp() {
return neteq_->GetPlayoutTimestamp();
}
@@ -317,7 +317,7 @@
return 0;
}
-rtc::Optional<SdpAudioFormat> AcmReceiver::LastAudioFormat() const {
+absl::optional<SdpAudioFormat> AcmReceiver::LastAudioFormat() const {
rtc::CritScope lock(&crit_sect_);
return last_audio_format_;
}
@@ -354,7 +354,7 @@
int AcmReceiver::DecoderByPayloadType(uint8_t payload_type,
CodecInst* codec) const {
rtc::CritScope lock(&crit_sect_);
- const rtc::Optional<CodecInst> ci = neteq_->GetDecoder(payload_type);
+ const absl::optional<CodecInst> ci = neteq_->GetDecoder(payload_type);
if (ci) {
*codec = *ci;
return 0;
@@ -384,10 +384,10 @@
// TODO(turajs): Should NetEq Buffer be flushed?
}
-const rtc::Optional<CodecInst> AcmReceiver::RtpHeaderToDecoder(
+const absl::optional<CodecInst> AcmReceiver::RtpHeaderToDecoder(
const RTPHeader& rtp_header,
uint8_t first_payload_byte) const {
- const rtc::Optional<CodecInst> ci =
+ const absl::optional<CodecInst> ci =
neteq_->GetDecoder(rtp_header.payloadType);
if (ci && STR_CASE_CMP(ci->plname, "red") == 0) {
// This is a RED packet. Get the payload of the audio codec.