Replace rtc::Optional with absl::optional in modules/rtp_rtcp
This is a no-op change because rtc::Optional is an alias to absl::optional
This CL generated using script:
#!/bin/bash
dir=modules/rtp_rtcp
find $dir -type f \( -name \*.h -o -name \*.cc \) \
-exec sed -i 's|rtc::Optional|absl::optional|' {} \+ \
-exec sed -i 's|rtc::nullopt|absl::nullopt|' {} \+ \
-exec sed -i 's|#include "api/optional.h"|#include "absl/types/optional.h"|' {} \+
find $dir -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: Ife720849709959046329c1c9faa3f31aa13274dc
Reviewed-on: https://webrtc-review.googlesource.com/83584
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23624}
diff --git a/modules/rtp_rtcp/BUILD.gn b/modules/rtp_rtcp/BUILD.gn
index 6ade021..286f1e0 100644
--- a/modules/rtp_rtcp/BUILD.gn
+++ b/modules/rtp_rtcp/BUILD.gn
@@ -88,7 +88,6 @@
"../../:typedefs",
"../../api:array_view",
"../../api:libjingle_peerconnection_api",
- "../../api:optional",
"../../api/audio_codecs:audio_codecs_api",
"../../api/video:video_frame",
"../../common_video",
@@ -96,6 +95,7 @@
"../../rtc_base:deprecation",
"../../rtc_base:rtc_base_approved",
"../../system_wrappers",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -196,7 +196,6 @@
"../../:typedefs",
"../../api:array_view",
"../../api:libjingle_peerconnection_api",
- "../../api:optional",
"../../api:transport_api",
"../../api/audio_codecs:audio_codecs_api",
"../../api/video:video_bitrate_allocation",
@@ -221,6 +220,7 @@
"../../system_wrappers:metrics_api",
"../audio_coding:audio_format_conversion",
"../remote_bitrate_estimator",
+ "//third_party/abseil-cpp/absl/types:optional",
]
# TODO(jschuh): Bug 1348: fix this warning.
@@ -245,7 +245,6 @@
"../../:webrtc_common",
"../../api:array_view",
"../../api:libjingle_peerconnection_api",
- "../../api:optional",
"../../api:transport_api",
"../../api/video:video_bitrate_allocation",
"../../rtc_base:checks",
@@ -253,6 +252,7 @@
"../../rtc_base:rtc_task_queue",
"../../rtc_base:weak_ptr",
"../../system_wrappers",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -292,11 +292,11 @@
":rtp_rtcp",
":rtp_rtcp_format",
"..:module_api",
- "../../api:optional",
"../../api/video:video_bitrate_allocation",
"../../rtc_base:checks",
"../../rtc_base:rtc_base_approved",
"../../test:test_support",
+ "//third_party/abseil-cpp/absl/types:optional",
]
}
@@ -410,7 +410,6 @@
"../../:typedefs",
"../../api:array_view",
"../../api:libjingle_peerconnection_api",
- "../../api:optional",
"../../api:transport_api",
"../../api/video:video_bitrate_allocation",
"../../api/video:video_frame",
@@ -430,6 +429,7 @@
"../../test:test_common",
"../../test:test_support",
"../audio_coding:audio_format_conversion",
+ "//third_party/abseil-cpp/absl/types:optional",
]
# TODO(jschuh): bugs.webrtc.org/1348: fix this warning.
diff --git a/modules/rtp_rtcp/include/rtp_payload_registry.h b/modules/rtp_rtcp/include/rtp_payload_registry.h
index dcaa2a2..c80f475 100644
--- a/modules/rtp_rtcp/include/rtp_payload_registry.h
+++ b/modules/rtp_rtcp/include/rtp_payload_registry.h
@@ -14,8 +14,8 @@
#include <map>
#include <set>
+#include "absl/types/optional.h"
#include "api/audio_codecs/audio_format.h"
-#include "api/optional.h"
#include "api/video_codecs/video_codec.h"
#include "modules/rtp_rtcp/source/rtp_utility.h"
#include "rtc_base/criticalsection.h"
@@ -42,7 +42,7 @@
int GetPayloadTypeFrequency(uint8_t payload_type) const;
- rtc::Optional<RtpUtility::Payload> PayloadTypeToPayload(
+ absl::optional<RtpUtility::Payload> PayloadTypeToPayload(
uint8_t payload_type) const;
void ResetLastReceivedPayloadTypes() {
diff --git a/modules/rtp_rtcp/include/rtp_rtcp.h b/modules/rtp_rtcp/include/rtp_rtcp.h
index 8ddcdb3..773075e 100644
--- a/modules/rtp_rtcp/include/rtp_rtcp.h
+++ b/modules/rtp_rtcp/include/rtp_rtcp.h
@@ -16,7 +16,7 @@
#include <utility>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/video/video_bitrate_allocation.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/include/module.h"
@@ -199,7 +199,7 @@
int associated_payload_type) = 0;
// Returns the FlexFEC SSRC, if there is one.
- virtual rtc::Optional<uint32_t> FlexfecSsrc() const = 0;
+ virtual absl::optional<uint32_t> FlexfecSsrc() const = 0;
// Sets sending status. Sends kRtcpByeCode when going from true to false.
// Returns -1 on failure else 0.
diff --git a/modules/rtp_rtcp/include/rtp_rtcp_defines.h b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
index 31b3451..2cd3c54 100644
--- a/modules/rtp_rtcp/include/rtp_rtcp_defines.h
+++ b/modules/rtp_rtcp/include/rtp_rtcp_defines.h
@@ -91,8 +91,8 @@
}
private:
- rtc::Optional<AudioPayload> audio_payload_;
- rtc::Optional<VideoPayload> video_payload_;
+ absl::optional<AudioPayload> audio_payload_;
+ absl::optional<VideoPayload> video_payload_;
};
enum RTPAliveType { kRtpDead = 0, kRtpNoRtp = 1, kRtpAlive = 2 };
diff --git a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
index db32a8c..d176930 100644
--- a/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
+++ b/modules/rtp_rtcp/mocks/mock_rtp_rtcp.h
@@ -16,7 +16,7 @@
#include <utility>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/video/video_bitrate_allocation.h"
#include "modules/include/module.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
@@ -75,7 +75,7 @@
MOCK_CONST_METHOD0(RtxSendStatus, int());
MOCK_METHOD1(SetRtxSsrc, void(uint32_t));
MOCK_METHOD2(SetRtxSendPayloadType, void(int, int));
- MOCK_CONST_METHOD0(FlexfecSsrc, rtc::Optional<uint32_t>());
+ MOCK_CONST_METHOD0(FlexfecSsrc, absl::optional<uint32_t>());
MOCK_CONST_METHOD0(RtxSendPayloadType, std::pair<int, int>());
MOCK_METHOD1(SetSendingStatus, int32_t(bool sending));
MOCK_CONST_METHOD0(Sending, bool());
diff --git a/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc b/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
index 664e02b..06472ef 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
@@ -57,7 +57,7 @@
rrtr_block_.reset();
dlrr_block_.ClearItems();
voip_metric_block_.reset();
- target_bitrate_ = rtc::nullopt;
+ target_bitrate_ = absl::nullopt;
const uint8_t* current_block = packet.payload() + kXrBaseLength;
const uint8_t* const packet_end =
diff --git a/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h b/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h
index 91794f8..7855502 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h
+++ b/modules/rtp_rtcp/source/rtcp_packet/extended_reports.h
@@ -13,7 +13,7 @@
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/rtp_rtcp/source/rtcp_packet.h"
#include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
#include "modules/rtp_rtcp/source/rtcp_packet/rrtr.h"
@@ -44,12 +44,12 @@
void SetTargetBitrate(const TargetBitrate& target_bitrate);
uint32_t sender_ssrc() const { return sender_ssrc_; }
- const rtc::Optional<Rrtr>& rrtr() const { return rrtr_block_; }
+ const absl::optional<Rrtr>& rrtr() const { return rrtr_block_; }
const Dlrr& dlrr() const { return dlrr_block_; }
- const rtc::Optional<VoipMetric>& voip_metric() const {
+ const absl::optional<VoipMetric>& voip_metric() const {
return voip_metric_block_;
}
- const rtc::Optional<TargetBitrate>& target_bitrate() const {
+ const absl::optional<TargetBitrate>& target_bitrate() const {
return target_bitrate_;
}
@@ -76,10 +76,10 @@
void ParseTargetBitrateBlock(const uint8_t* block, uint16_t block_length);
uint32_t sender_ssrc_;
- rtc::Optional<Rrtr> rrtr_block_;
+ absl::optional<Rrtr> rrtr_block_;
Dlrr dlrr_block_; // Dlrr without items treated same as no dlrr block.
- rtc::Optional<VoipMetric> voip_metric_block_;
- rtc::Optional<TargetBitrate> target_bitrate_;
+ absl::optional<VoipMetric> voip_metric_block_;
+ absl::optional<TargetBitrate> target_bitrate_;
};
} // namespace rtcp
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtcp_packet/target_bitrate_unittest.cc b/modules/rtp_rtcp/source/rtcp_packet/target_bitrate_unittest.cc
index 5fec75f..b16bb5b 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/target_bitrate_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/target_bitrate_unittest.cc
@@ -67,7 +67,7 @@
rtcp::ExtendedReports xr;
EXPECT_TRUE(ParseSinglePacket(kRtcpPacket, &xr));
EXPECT_EQ(kSsrc, xr.sender_ssrc());
- const rtc::Optional<TargetBitrate>& target_bitrate = xr.target_bitrate();
+ const absl::optional<TargetBitrate>& target_bitrate = xr.target_bitrate();
ASSERT_TRUE(static_cast<bool>(target_bitrate));
CheckBitrateItems(target_bitrate->GetTargetBitrates());
}
diff --git a/modules/rtp_rtcp/source/rtcp_receiver.cc b/modules/rtp_rtcp/source/rtcp_receiver.cc
index 618c533..af164cc 100644
--- a/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -72,7 +72,7 @@
int64_t rtt_ms = 0;
uint32_t receiver_estimated_max_bitrate_bps = 0;
std::unique_ptr<rtcp::TransportFeedback> transport_feedback;
- rtc::Optional<VideoBitrateAllocation> target_bitrate_allocation;
+ absl::optional<VideoBitrateAllocation> target_bitrate_allocation;
};
// Structure for handing TMMBR and TMMBN rtcp messages (RFC5104, section 3.5.4).
diff --git a/modules/rtp_rtcp/source/rtcp_sender.h b/modules/rtp_rtcp/source/rtcp_sender.h
index 0452ec2..e274915 100644
--- a/modules/rtp_rtcp/source/rtcp_sender.h
+++ b/modules/rtp_rtcp/source/rtcp_sender.h
@@ -17,8 +17,8 @@
#include <string>
#include <vector>
+#include "absl/types/optional.h"
#include "api/call/transport.h"
-#include "api/optional.h"
#include "api/video/video_bitrate_allocation.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
@@ -237,7 +237,7 @@
RTC_GUARDED_BY(critical_section_rtcp_sender_);
// XR VoIP metric
- rtc::Optional<RTCPVoIPMetric> xr_voip_metric_
+ absl::optional<RTCPVoIPMetric> xr_voip_metric_
RTC_GUARDED_BY(critical_section_rtcp_sender_);
RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
@@ -246,7 +246,7 @@
RtcpNackStats nack_stats_ RTC_GUARDED_BY(critical_section_rtcp_sender_);
- rtc::Optional<VideoBitrateAllocation> video_bitrate_allocation_
+ absl::optional<VideoBitrateAllocation> video_bitrate_allocation_
RTC_GUARDED_BY(critical_section_rtcp_sender_);
void SetFlag(uint32_t type, bool is_volatile)
diff --git a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
index f77c644..c7c38bf 100644
--- a/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
@@ -679,7 +679,7 @@
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport));
EXPECT_EQ(1, parser()->xr()->num_packets());
EXPECT_EQ(kSenderSsrc, parser()->xr()->sender_ssrc());
- const rtc::Optional<rtcp::TargetBitrate>& target_bitrate =
+ const absl::optional<rtcp::TargetBitrate>& target_bitrate =
parser()->xr()->target_bitrate();
ASSERT_TRUE(target_bitrate);
const std::vector<rtcp::TargetBitrate::BitrateItem>& bitrates =
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc b/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
index 9716784..5cfe019 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl.cc
@@ -46,7 +46,7 @@
struct RtcpTransceiverImpl::RemoteSenderState {
uint8_t fir_sequence_number = 0;
- rtc::Optional<SenderReportTimes> last_received_sender_report;
+ absl::optional<SenderReportTimes> last_received_sender_report;
std::vector<MediaReceiverRtcpObserver*> observers;
};
@@ -245,7 +245,7 @@
return;
RemoteSenderState& remote_sender =
remote_senders_[sender_report.sender_ssrc()];
- rtc::Optional<SenderReportTimes>& last =
+ absl::optional<SenderReportTimes>& last =
remote_sender.last_received_sender_report;
last.emplace();
last->local_received_time_us = now_us;
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl.h b/modules/rtp_rtcp/source/rtcp_transceiver_impl.h
index 05c74f2..7bcd16f 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl.h
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl.h
@@ -16,8 +16,8 @@
#include <string>
#include <vector>
+#include "absl/types/optional.h"
#include "api/array_view.h"
-#include "api/optional.h"
#include "modules/rtp_rtcp/source/rtcp_packet/common_header.h"
#include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
#include "modules/rtp_rtcp/source/rtcp_packet/remb.h"
@@ -91,7 +91,7 @@
const RtcpTransceiverConfig config_;
bool ready_to_send_;
- rtc::Optional<rtcp::Remb> remb_;
+ absl::optional<rtcp::Remb> remb_;
// TODO(danilchap): Remove entries from remote_senders_ that are no longer
// needed.
std::map<uint32_t, RemoteSenderState> remote_senders_;
diff --git a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
index df8178d..1fe5000 100644
--- a/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
+++ b/modules/rtp_rtcp/source/rtcp_transceiver_impl_unittest.cc
@@ -144,7 +144,7 @@
config.outgoing_transport = &transport;
config.initial_report_delay_ms = 10;
config.task_queue = &queue;
- rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver;
+ absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
int64_t started_ms = rtc::TimeMillis();
queue.PostTask([&] { rtcp_transceiver.emplace(config); });
@@ -169,7 +169,7 @@
config.initial_report_delay_ms = 0;
config.report_period_ms = kReportPeriodMs;
config.task_queue = &queue;
- rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver;
+ absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
int64_t time_just_before_1st_packet_ms = 0;
queue.PostTask([&] {
// Because initial_report_delay_ms is set to 0, time_just_before_the_packet
@@ -202,7 +202,7 @@
config.initial_report_delay_ms = 0;
config.report_period_ms = kReportPeriodMs;
config.task_queue = &queue;
- rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver;
+ absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
queue.PostTask([&] { rtcp_transceiver.emplace(config); });
// Wait for first packet.
@@ -288,7 +288,7 @@
config.initial_ready_to_send = false;
config.outgoing_transport = &transport;
config.task_queue = &queue;
- rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver;
+ absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
rtcp_transceiver.emplace(config);
rtcp_transceiver->SetReadyToSend(true);
diff --git a/modules/rtp_rtcp/source/rtp_format_h264.cc b/modules/rtp_rtcp/source/rtp_format_h264.cc
index 0f46f9b..633f0ae 100644
--- a/modules/rtp_rtcp/source/rtp_format_h264.cc
+++ b/modules/rtp_rtcp/source/rtp_format_h264.cc
@@ -129,7 +129,7 @@
// RtpDepacketizerH264::ParseSingleNalu (receive side, in orderer to
// protect us from unknown or legacy send clients).
- rtc::Optional<SpsParser::SpsState> sps;
+ absl::optional<SpsParser::SpsState> sps;
std::unique_ptr<rtc::Buffer> output_buffer(new rtc::Buffer());
// Add the type header to the output buffer first, so that the rewriter
@@ -514,7 +514,7 @@
if (start_offset)
output_buffer->AppendData(payload_data, start_offset);
- rtc::Optional<SpsParser::SpsState> sps;
+ absl::optional<SpsParser::SpsState> sps;
SpsVuiRewriter::ParseResult result = SpsVuiRewriter::ParseAndRewriteSps(
&payload_data[start_offset], end_offset - start_offset, &sps,
@@ -596,7 +596,7 @@
parsed_payload->frame_type = kVideoFrameKey;
RTC_FALLTHROUGH();
case H264::NaluType::kSlice: {
- rtc::Optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice(
+ absl::optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice(
&payload_data[start_offset], end_offset - start_offset);
if (pps_id) {
nalu.pps_id = *pps_id;
@@ -648,7 +648,7 @@
if (first_fragment) {
offset_ = 0;
length_ -= kNalHeaderSize;
- rtc::Optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice(
+ absl::optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice(
payload_data + 2 * kNalHeaderSize, length_ - kNalHeaderSize);
if (pps_id) {
nalu.pps_id = *pps_id;
diff --git a/modules/rtp_rtcp/source/rtp_packet_history.cc b/modules/rtp_rtcp/source/rtp_packet_history.cc
index 2bd06c4..4fd384d 100644
--- a/modules/rtp_rtcp/source/rtp_packet_history.cc
+++ b/modules/rtp_rtcp/source/rtp_packet_history.cc
@@ -84,7 +84,7 @@
void RtpPacketHistory::PutRtpPacket(std::unique_ptr<RtpPacketToSend> packet,
StorageType type,
- rtc::Optional<int64_t> send_time_ms) {
+ absl::optional<int64_t> send_time_ms) {
RTC_DCHECK(packet);
rtc::CritScope cs(&lock_);
int64_t now_ms = clock_->TimeInMilliseconds();
@@ -146,21 +146,21 @@
return rtc::MakeUnique<RtpPacketToSend>(*packet.packet);
}
-rtc::Optional<RtpPacketHistory::PacketState> RtpPacketHistory::GetPacketState(
+absl::optional<RtpPacketHistory::PacketState> RtpPacketHistory::GetPacketState(
uint16_t sequence_number,
bool verify_rtt) const {
rtc::CritScope cs(&lock_);
if (mode_ == StorageMode::kDisabled) {
- return rtc::nullopt;
+ return absl::nullopt;
}
auto rtp_it = packet_history_.find(sequence_number);
if (rtp_it == packet_history_.end()) {
- return rtc::nullopt;
+ return absl::nullopt;
}
if (verify_rtt && !VerifyRtt(rtp_it->second, clock_->TimeInMilliseconds())) {
- return rtc::nullopt;
+ return absl::nullopt;
}
return StoredPacketToPacketState(rtp_it->second);
diff --git a/modules/rtp_rtcp/source/rtp_packet_history.h b/modules/rtp_rtcp/source/rtp_packet_history.h
index bfcdcc8..03527ff 100644
--- a/modules/rtp_rtcp/source/rtp_packet_history.h
+++ b/modules/rtp_rtcp/source/rtp_packet_history.h
@@ -42,7 +42,7 @@
~PacketState();
uint16_t rtp_sequence_number = 0;
- rtc::Optional<int64_t> send_time_ms;
+ absl::optional<int64_t> send_time_ms;
int64_t capture_time_ms = 0;
uint32_t ssrc = 0;
size_t payload_size = 0;
@@ -74,7 +74,7 @@
// be set accordingly.
void PutRtpPacket(std::unique_ptr<RtpPacketToSend> packet,
StorageType type,
- rtc::Optional<int64_t> send_time_ms);
+ absl::optional<int64_t> send_time_ms);
// Gets stored RTP packet corresponding to the input |sequence number|.
// Returns nullptr if packet is not found. If |verify_rtt| is true, doesn't
@@ -85,8 +85,8 @@
// Similar to GetPacketAndSetSendTime(), but only returns a snapshot of the
// current state for packet, and never updates internal state.
- rtc::Optional<PacketState> GetPacketState(uint16_t sequence_number,
- bool verify_rtt) const;
+ absl::optional<PacketState> GetPacketState(uint16_t sequence_number,
+ bool verify_rtt) const;
// Get the packet (if any) from the history, with size closest to
// |packet_size|. The exact size of the packet is not guaranteed.
@@ -101,7 +101,7 @@
~StoredPacket();
// The time of last transmission, including retransmissions.
- rtc::Optional<int64_t> send_time_ms;
+ absl::optional<int64_t> send_time_ms;
// Number of times RE-transmitted, ie excluding the first transmission.
size_t times_retransmitted = 0;
@@ -140,7 +140,7 @@
// The earliest packet in the history. This might not be the lowest sequence
// number, in case there is a wraparound.
- rtc::Optional<uint16_t> start_seqno_ RTC_GUARDED_BY(lock_);
+ absl::optional<uint16_t> start_seqno_ RTC_GUARDED_BY(lock_);
RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPacketHistory);
};
diff --git a/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc b/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
index c7cd180..026c187 100644
--- a/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
+++ b/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
@@ -62,7 +62,7 @@
hist_.SetStorePacketsStatus(StorageMode::kStore, 10);
// Store a packet, but with send-time. It should then not be removed.
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum), kAllowRetransmission,
- rtc::nullopt);
+ absl::nullopt);
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false));
// Changing store status, even to the current one, will clear the history.
@@ -74,7 +74,7 @@
hist_.SetStorePacketsStatus(StorageMode::kStoreAndCull, 10);
// Store a packet, but with send-time. It should then not be removed.
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum), kAllowRetransmission,
- rtc::nullopt);
+ absl::nullopt);
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false));
// Changing store status, to clear the history.
@@ -83,7 +83,7 @@
// Add a new packet.
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum + 1), kAllowRetransmission,
- rtc::nullopt);
+ absl::nullopt);
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum + 1, false));
// Advance time past where packet expires.
@@ -93,7 +93,7 @@
// Add one more packet and verify no state left from packet before reset.
hist_.PutRtpPacket(CreateRtpPacket(To16u(kStartSeqNum + 2)),
- kAllowRetransmission, rtc::nullopt);
+ kAllowRetransmission, absl::nullopt);
EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false));
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum + 1, false));
EXPECT_TRUE(hist_.GetPacketState(To16u(kStartSeqNum + 2), false));
@@ -102,7 +102,7 @@
TEST_F(RtpPacketHistoryTest, NoStoreStatus) {
EXPECT_EQ(StorageMode::kDisabled, hist_.GetStorageMode());
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
- hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, rtc::nullopt);
+ hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, absl::nullopt);
// Packet should not be stored.
EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false));
}
@@ -117,7 +117,7 @@
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false));
- hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, rtc::nullopt);
+ hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, absl::nullopt);
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false));
}
@@ -127,7 +127,7 @@
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
packet->set_capture_time_ms(capture_time_ms);
rtc::CopyOnWriteBuffer buffer = packet->Buffer();
- hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, rtc::nullopt);
+ hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, absl::nullopt);
std::unique_ptr<RtpPacketToSend> packet_out =
hist_.GetPacketAndSetSendTime(kStartSeqNum, false);
@@ -143,7 +143,7 @@
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
packet->set_capture_time_ms(-1);
rtc::CopyOnWriteBuffer buffer = packet->Buffer();
- hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, rtc::nullopt);
+ hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, absl::nullopt);
std::unique_ptr<RtpPacketToSend> packet_out =
hist_.GetPacketAndSetSendTime(kStartSeqNum, false);
@@ -157,7 +157,7 @@
int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
rtc::CopyOnWriteBuffer buffer = packet->Buffer();
- hist_.PutRtpPacket(std::move(packet), kDontRetransmit, rtc::nullopt);
+ hist_.PutRtpPacket(std::move(packet), kDontRetransmit, absl::nullopt);
// Get the packet and verify data.
std::unique_ptr<RtpPacketToSend> packet_out;
@@ -182,7 +182,7 @@
hist_.PutRtpPacket(std::move(packet), StorageType::kAllowRetransmission,
fake_clock_.TimeInMilliseconds());
- rtc::Optional<RtpPacketHistory::PacketState> state =
+ absl::optional<RtpPacketHistory::PacketState> state =
hist_.GetPacketState(kStartSeqNum, false);
ASSERT_TRUE(state);
EXPECT_EQ(state->rtp_sequence_number, kStartSeqNum);
@@ -208,7 +208,7 @@
int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
size_t len = packet->size();
- hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, rtc::nullopt);
+ hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, absl::nullopt);
// First transmission: TimeToSendPacket() call from pacer.
EXPECT_TRUE(hist_.GetPacketAndSetSendTime(kStartSeqNum, false));
@@ -223,7 +223,7 @@
// 2) When the pacer determines that it is time to send the packet, it calls
// GetPacketAndSetSendTime(). This time we do not need to verify RTT as
// has that has already been done.
- rtc::Optional<RtpPacketHistory::PacketState> packet_state =
+ absl::optional<RtpPacketHistory::PacketState> packet_state =
hist_.GetPacketState(kStartSeqNum, /*verify_rtt=*/true);
EXPECT_TRUE(packet_state);
EXPECT_EQ(len, packet_state->payload_size);
@@ -313,7 +313,7 @@
for (size_t i = 0; i < kMaxNumPackets; ++i) {
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum + i);
// Don't mark packets as sent, preventing them from being removed.
- hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, rtc::nullopt);
+ hist_.PutRtpPacket(std::move(packet), kAllowRetransmission, absl::nullopt);
}
// First packet should still be there.
@@ -338,7 +338,7 @@
for (size_t i = 0; i < kMaxNumPackets; ++i) {
// Mark packets as unsent.
hist_.PutRtpPacket(CreateRtpPacket(To16u(kStartSeqNum + i)),
- kAllowRetransmission, rtc::nullopt);
+ kAllowRetransmission, absl::nullopt);
}
fake_clock_.AdvanceTimeMilliseconds(RtpPacketHistory::kMinPacketDurationMs);
diff --git a/modules/rtp_rtcp/source/rtp_payload_registry.cc b/modules/rtp_rtcp/source/rtp_payload_registry.cc
index 25abb68..c48cd6c 100644
--- a/modules/rtp_rtcp/source/rtp_payload_registry.cc
+++ b/modules/rtp_rtcp/source/rtp_payload_registry.cc
@@ -227,13 +227,13 @@
: kVideoPayloadTypeFrequency;
}
-rtc::Optional<RtpUtility::Payload> RTPPayloadRegistry::PayloadTypeToPayload(
+absl::optional<RtpUtility::Payload> RTPPayloadRegistry::PayloadTypeToPayload(
uint8_t payload_type) const {
rtc::CritScope cs(&crit_sect_);
const auto it = payload_type_map_.find(payload_type);
return it == payload_type_map_.end()
- ? rtc::nullopt
- : rtc::Optional<RtpUtility::Payload>(it->second);
+ ? absl::nullopt
+ : absl::optional<RtpUtility::Payload>(it->second);
}
} // namespace webrtc
diff --git a/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/modules/rtp_rtcp/source/rtp_receiver_impl.cc
index 5c5d68f..fb2cc66 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_receiver_impl.cc
@@ -29,7 +29,7 @@
namespace webrtc {
namespace {
-bool InOrderPacket(rtc::Optional<uint16_t> latest_sequence_number,
+bool InOrderPacket(absl::optional<uint16_t> latest_sequence_number,
uint16_t current_sequence_number) {
if (!latest_sequence_number)
return true;
@@ -174,8 +174,8 @@
auto audio_level =
rtp_header.extension.hasAudioLevel
- ? rtc::Optional<uint8_t>(rtp_header.extension.audioLevel)
- : rtc::nullopt;
+ ? absl::optional<uint8_t>(rtp_header.extension.audioLevel)
+ : absl::nullopt;
UpdateSources(audio_level);
int32_t ret_val = rtp_media_receiver_->ParseRtpPacket(
@@ -323,7 +323,7 @@
}
void RtpReceiverImpl::UpdateSources(
- const rtc::Optional<uint8_t>& ssrc_audio_level) {
+ const absl::optional<uint8_t>& ssrc_audio_level) {
rtc::CritScope lock(&critical_section_rtp_receiver_);
int64_t now_ms = clock_->TimeInMilliseconds();
diff --git a/modules/rtp_rtcp/source/rtp_receiver_impl.h b/modules/rtp_rtcp/source/rtp_receiver_impl.h
index 3e78893..70d7a2e 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_impl.h
+++ b/modules/rtp_rtcp/source/rtp_receiver_impl.h
@@ -16,7 +16,7 @@
#include <unordered_map>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "modules/rtp_rtcp/include/rtp_receiver.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtp_receiver_strategy.h"
@@ -74,7 +74,7 @@
int32_t CheckPayloadChanged(const RTPHeader& rtp_header,
PayloadUnion* payload);
- void UpdateSources(const rtc::Optional<uint8_t>& ssrc_audio_level);
+ void UpdateSources(const absl::optional<uint8_t>& ssrc_audio_level);
void RemoveOutdatedSources(int64_t now_ms);
Clock* clock_;
@@ -91,7 +91,7 @@
critical_section_rtp_receiver_);
// Sequence number and timestamps for the latest in-order packet.
- rtc::Optional<uint16_t> last_received_sequence_number_
+ absl::optional<uint16_t> last_received_sequence_number_
RTC_GUARDED_BY(critical_section_rtp_receiver_);
uint32_t last_received_timestamp_
RTC_GUARDED_BY(critical_section_rtp_receiver_);
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 07a6afb..289ef53 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -266,10 +266,10 @@
rtp_sender_->SetRtxPayloadType(payload_type, associated_payload_type);
}
-rtc::Optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const {
+absl::optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const {
if (rtp_sender_)
return rtp_sender_->FlexfecSsrc();
- return rtc::nullopt;
+ return absl::nullopt;
}
void ModuleRtpRtcpImpl::IncomingRtcpPacket(const uint8_t* rtcp_packet,
@@ -898,7 +898,7 @@
ssrcs.insert(main_ssrc);
if (RtxSendStatus() != kRtxOff)
ssrcs.insert(rtp_sender_->RtxSsrc());
- rtc::Optional<uint32_t> flexfec_ssrc = FlexfecSsrc();
+ absl::optional<uint32_t> flexfec_ssrc = FlexfecSsrc();
if (flexfec_ssrc)
ssrcs.insert(*flexfec_ssrc);
rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs);
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index c51e971..9f53416 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -17,7 +17,7 @@
#include <utility>
#include <vector>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "api/video/video_bitrate_allocation.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@@ -102,7 +102,7 @@
void SetRtxSendPayloadType(int payload_type,
int associated_payload_type) override;
- rtc::Optional<uint32_t> FlexfecSsrc() const override;
+ absl::optional<uint32_t> FlexfecSsrc() const override;
// Sends kRtcpByeCode when going from true to false.
int32_t SetSendingStatus(bool sending) override;
diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc
index bf24c7d..8e0a4e8 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -630,7 +630,7 @@
int32_t RTPSender::ReSendPacket(uint16_t packet_id) {
// Try to find packet in RTP packet history. Also verify RTT here, so that we
// don't retransmit too often.
- rtc::Optional<RtpPacketHistory::PacketState> stored_packet =
+ absl::optional<RtpPacketHistory::PacketState> stored_packet =
packet_history_.GetPacketState(packet_id, true);
if (!stored_packet) {
// Packet not found.
@@ -908,7 +908,7 @@
}
uint32_t ssrc = packet->Ssrc();
- rtc::Optional<uint32_t> flexfec_ssrc = FlexfecSsrc();
+ absl::optional<uint32_t> flexfec_ssrc = FlexfecSsrc();
if (paced_sender_) {
uint16_t seq_no = packet->SequenceNumber();
// Correct offset between implementations of millisecond time stamps in
@@ -919,9 +919,9 @@
// Store FlexFEC packets in the history here, so they can be found
// when the pacer calls TimeToSendPacket.
flexfec_packet_history_.PutRtpPacket(std::move(packet), storage,
- rtc::nullopt);
+ absl::nullopt);
} else {
- packet_history_.PutRtpPacket(std::move(packet), storage, rtc::nullopt);
+ packet_history_.PutRtpPacket(std::move(packet), storage, absl::nullopt);
}
paced_sender_->InsertPacket(priority, ssrc, seq_no, corrected_time_ms,
@@ -1155,11 +1155,11 @@
mid_ = mid;
}
-rtc::Optional<uint32_t> RTPSender::FlexfecSsrc() const {
+absl::optional<uint32_t> RTPSender::FlexfecSsrc() const {
if (video_) {
return video_->FlexfecSsrc();
}
- return rtc::nullopt;
+ return absl::nullopt;
}
void RTPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
diff --git a/modules/rtp_rtcp/source/rtp_sender.h b/modules/rtp_rtcp/source/rtp_sender.h
index 61de2f1..5ff4a0f 100644
--- a/modules/rtp_rtcp/source/rtp_sender.h
+++ b/modules/rtp_rtcp/source/rtp_sender.h
@@ -17,9 +17,9 @@
#include <utility>
#include <vector>
+#include "absl/types/optional.h"
#include "api/array_view.h"
#include "api/call/transport.h"
-#include "api/optional.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
@@ -172,7 +172,7 @@
uint32_t SSRC() const;
- rtc::Optional<uint32_t> FlexfecSsrc() const;
+ absl::optional<uint32_t> FlexfecSsrc() const;
bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet,
StorageType storage,
@@ -315,9 +315,9 @@
bool sequence_number_forced_ RTC_GUARDED_BY(send_critsect_);
uint16_t sequence_number_ RTC_GUARDED_BY(send_critsect_);
uint16_t sequence_number_rtx_ RTC_GUARDED_BY(send_critsect_);
- // Must be explicitly set by the application, use of rtc::Optional
+ // Must be explicitly set by the application, use of absl::optional
// only to keep track of correct use.
- rtc::Optional<uint32_t> ssrc_ RTC_GUARDED_BY(send_critsect_);
+ absl::optional<uint32_t> ssrc_ RTC_GUARDED_BY(send_critsect_);
// MID value to send in the MID header extension.
std::string mid_ RTC_GUARDED_BY(send_critsect_);
uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(send_critsect_);
@@ -327,7 +327,7 @@
bool last_packet_marker_bit_ RTC_GUARDED_BY(send_critsect_);
std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(send_critsect_);
int rtx_ RTC_GUARDED_BY(send_critsect_);
- rtc::Optional<uint32_t> ssrc_rtx_ RTC_GUARDED_BY(send_critsect_);
+ absl::optional<uint32_t> ssrc_rtx_ RTC_GUARDED_BY(send_critsect_);
// Mapping rtx_payload_type_map_[associated] = rtx.
std::map<int8_t, int8_t> rtx_payload_type_map_ RTC_GUARDED_BY(send_critsect_);
size_t rtp_overhead_bytes_per_packet_ RTC_GUARDED_BY(send_critsect_);
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index b5515c5..efac87c 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -264,11 +264,11 @@
key_fec_params_ = key_params;
}
-rtc::Optional<uint32_t> RTPSenderVideo::FlexfecSsrc() const {
+absl::optional<uint32_t> RTPSenderVideo::FlexfecSsrc() const {
if (flexfec_sender_) {
return flexfec_sender_->ssrc();
}
- return rtc::nullopt;
+ return absl::nullopt;
}
bool RTPSenderVideo::SendVideo(enum VideoCodecType video_type,
@@ -503,7 +503,7 @@
int64_t expected_next_frame_time = kUndefined;
for (int i = temporal_id - 1; i >= 0; --i) {
TemporalLayerStats* stats = &frame_stats_by_temporal_layer_[i];
- rtc::Optional<uint32_t> rate = stats->frame_rate_fp1000s.Rate(now_ms);
+ absl::optional<uint32_t> rate = stats->frame_rate_fp1000s.Rate(now_ms);
if (rate) {
int64_t tl_next = stats->last_frame_time_ms + 1000000 / *rate;
if (tl_next - now_ms > -expected_retransmission_time_ms &&
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.h b/modules/rtp_rtcp/source/rtp_sender_video.h
index 13ed4c4..08724c7 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.h
+++ b/modules/rtp_rtcp/source/rtp_sender_video.h
@@ -14,7 +14,7 @@
#include <map>
#include <memory>
-#include "api/optional.h"
+#include "absl/types/optional.h"
#include "common_types.h" // NOLINT(build/include)
#include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@@ -70,7 +70,7 @@
const FecProtectionParams& key_params);
// FlexFEC.
- rtc::Optional<uint32_t> FlexfecSsrc() const;
+ absl::optional<uint32_t> FlexfecSsrc() const;
uint32_t VideoBitrateSent() const;
uint32_t FecOverheadRate() const;