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}
This commit is contained in:
Danil Chapovalov
2018-06-19 13:26:36 +02:00
committed by Commit Bot
parent bbfcc703ad
commit b602123a5a
82 changed files with 452 additions and 459 deletions

View File

@ -176,21 +176,21 @@ TEST(PacketBuffer, InsertPacketList) {
MockDecoderDatabase decoder_database;
auto factory = CreateBuiltinAudioDecoderFactory();
const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu,
rtc::nullopt, factory);
absl::nullopt, factory);
EXPECT_CALL(decoder_database, GetDecoderInfo(0))
.WillRepeatedly(Return(&info));
StrictMock<MockStatisticsCalculator> mock_stats;
rtc::Optional<uint8_t> current_pt;
rtc::Optional<uint8_t> current_cng_pt;
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
EXPECT_EQ(PacketBuffer::kOK,
buffer.InsertPacketList(&list, decoder_database, &current_pt,
&current_cng_pt, &mock_stats));
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
EXPECT_EQ(10u, buffer.NumPacketsInBuffer());
EXPECT_EQ(0, current_pt); // Current payload type changed to 0.
EXPECT_EQ(rtc::nullopt, current_cng_pt); // CNG payload type not changed.
EXPECT_EQ(absl::nullopt, current_cng_pt); // CNG payload type not changed.
buffer.Flush(); // Clean up.
@ -221,25 +221,25 @@ TEST(PacketBuffer, InsertPacketListChangePayloadType) {
MockDecoderDatabase decoder_database;
auto factory = CreateBuiltinAudioDecoderFactory();
const DecoderDatabase::DecoderInfo info0(NetEqDecoder::kDecoderPCMu,
rtc::nullopt, factory);
absl::nullopt, factory);
EXPECT_CALL(decoder_database, GetDecoderInfo(0))
.WillRepeatedly(Return(&info0));
const DecoderDatabase::DecoderInfo info1(NetEqDecoder::kDecoderPCMa,
rtc::nullopt, factory);
absl::nullopt, factory);
EXPECT_CALL(decoder_database, GetDecoderInfo(1))
.WillRepeatedly(Return(&info1));
StrictMock<MockStatisticsCalculator> mock_stats;
rtc::Optional<uint8_t> current_pt;
rtc::Optional<uint8_t> current_cng_pt;
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
EXPECT_EQ(PacketBuffer::kFlushed,
buffer.InsertPacketList(&list, decoder_database, &current_pt,
&current_cng_pt, &mock_stats));
EXPECT_TRUE(list.empty()); // The PacketBuffer should have depleted the list.
EXPECT_EQ(1u, buffer.NumPacketsInBuffer()); // Only the last packet.
EXPECT_EQ(1, current_pt); // Current payload type changed to 1.
EXPECT_EQ(rtc::nullopt, current_cng_pt); // CNG payload type not changed.
EXPECT_EQ(absl::nullopt, current_cng_pt); // CNG payload type not changed.
buffer.Flush(); // Clean up.
@ -313,7 +313,7 @@ TEST(PacketBuffer, ExtractOrderRedundancy) {
EXPECT_EQ(kExpectPacketsInBuffer, buffer.NumPacketsInBuffer());
for (size_t i = 0; i < kExpectPacketsInBuffer; ++i) {
const rtc::Optional<Packet> packet = buffer.GetNextPacket();
const absl::optional<Packet> packet = buffer.GetNextPacket();
EXPECT_EQ(packet, expect_order[i]); // Compare contents.
}
EXPECT_TRUE(buffer.Empty());
@ -408,11 +408,11 @@ TEST(PacketBuffer, Reordering) {
MockDecoderDatabase decoder_database;
auto factory = CreateBuiltinAudioDecoderFactory();
const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu,
rtc::nullopt, factory);
absl::nullopt, factory);
EXPECT_CALL(decoder_database, GetDecoderInfo(0))
.WillRepeatedly(Return(&info));
rtc::Optional<uint8_t> current_pt;
rtc::Optional<uint8_t> current_cng_pt;
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
StrictMock<MockStatisticsCalculator> mock_stats;
@ -424,7 +424,7 @@ TEST(PacketBuffer, Reordering) {
// Extract them and make sure that come out in the right order.
uint32_t current_ts = start_ts;
for (int i = 0; i < 10; ++i) {
const rtc::Optional<Packet> packet = buffer.GetNextPacket();
const absl::optional<Packet> packet = buffer.GetNextPacket();
ASSERT_TRUE(packet);
EXPECT_EQ(current_ts, packet->timestamp);
current_ts += ts_increment;
@ -448,11 +448,11 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
MockDecoderDatabase decoder_database;
auto factory = CreateBuiltinAudioDecoderFactory();
const DecoderDatabase::DecoderInfo info_cng(NetEqDecoder::kDecoderCNGnb,
rtc::nullopt, factory);
absl::nullopt, factory);
EXPECT_CALL(decoder_database, GetDecoderInfo(kCngPt))
.WillRepeatedly(Return(&info_cng));
const DecoderDatabase::DecoderInfo info_speech(NetEqDecoder::kDecoderPCM16Bwb,
rtc::nullopt, factory);
absl::nullopt, factory);
EXPECT_CALL(decoder_database, GetDecoderInfo(kSpeechPt))
.WillRepeatedly(Return(&info_speech));
@ -460,8 +460,8 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
PacketGenerator gen(0, 0, kCngPt, 10);
PacketList list;
list.push_back(gen.NextPacket(kPayloadLen));
rtc::Optional<uint8_t> current_pt;
rtc::Optional<uint8_t> current_cng_pt;
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
StrictMock<MockStatisticsCalculator> mock_stats;
@ -472,7 +472,7 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
EXPECT_EQ(1u, buffer.NumPacketsInBuffer());
ASSERT_TRUE(buffer.PeekNextPacket());
EXPECT_EQ(kCngPt, buffer.PeekNextPacket()->payload_type);
EXPECT_EQ(current_pt, rtc::nullopt); // Current payload type not set.
EXPECT_EQ(current_pt, absl::nullopt); // Current payload type not set.
EXPECT_EQ(kCngPt, current_cng_pt); // CNG payload type set.
// Insert second packet, which is wide-band speech.
@ -492,7 +492,7 @@ TEST(PacketBuffer, CngFirstThenSpeechWithNewSampleRate) {
EXPECT_EQ(kSpeechPt, buffer.PeekNextPacket()->payload_type);
EXPECT_EQ(kSpeechPt, current_pt); // Current payload type set.
EXPECT_EQ(rtc::nullopt, current_cng_pt); // CNG payload type reset.
EXPECT_EQ(absl::nullopt, current_cng_pt); // CNG payload type reset.
buffer.Flush(); // Clean up.
EXPECT_CALL(decoder_database, Die()); // Called when object is deleted.
@ -550,11 +550,11 @@ TEST(PacketBuffer, Failures) {
MockDecoderDatabase decoder_database;
auto factory = CreateBuiltinAudioDecoderFactory();
const DecoderDatabase::DecoderInfo info(NetEqDecoder::kDecoderPCMu,
rtc::nullopt, factory);
absl::nullopt, factory);
EXPECT_CALL(decoder_database, GetDecoderInfo(0))
.WillRepeatedly(Return(&info));
rtc::Optional<uint8_t> current_pt;
rtc::Optional<uint8_t> current_cng_pt;
absl::optional<uint8_t> current_pt;
absl::optional<uint8_t> current_cng_pt;
EXPECT_EQ(PacketBuffer::kInvalidPacket,
buffer->InsertPacketList(&list, decoder_database, &current_pt,
&current_cng_pt, &mock_stats));