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}
This commit is contained in:
Danil Chapovalov
2018-06-14 12:59:38 +02:00
committed by Commit Bot
parent 394b4ebe38
commit d264df587f
27 changed files with 95 additions and 95 deletions

View File

@ -88,7 +88,6 @@ rtc_source_set("rtp_rtcp_format") {
"../../:typedefs", "../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api", "../../api:libjingle_peerconnection_api",
"../../api:optional",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/video:video_frame", "../../api/video:video_frame",
"../../common_video", "../../common_video",
@ -96,6 +95,7 @@ rtc_source_set("rtp_rtcp_format") {
"../../rtc_base:deprecation", "../../rtc_base:deprecation",
"../../rtc_base:rtc_base_approved", "../../rtc_base:rtc_base_approved",
"../../system_wrappers", "../../system_wrappers",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -196,7 +196,6 @@ rtc_static_library("rtp_rtcp") {
"../../:typedefs", "../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api", "../../api:libjingle_peerconnection_api",
"../../api:optional",
"../../api:transport_api", "../../api:transport_api",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/video:video_bitrate_allocation", "../../api/video:video_bitrate_allocation",
@ -221,6 +220,7 @@ rtc_static_library("rtp_rtcp") {
"../../system_wrappers:metrics_api", "../../system_wrappers:metrics_api",
"../audio_coding:audio_format_conversion", "../audio_coding:audio_format_conversion",
"../remote_bitrate_estimator", "../remote_bitrate_estimator",
"//third_party/abseil-cpp/absl/types:optional",
] ]
# TODO(jschuh): Bug 1348: fix this warning. # TODO(jschuh): Bug 1348: fix this warning.
@ -245,7 +245,6 @@ rtc_source_set("rtcp_transceiver") {
"../../:webrtc_common", "../../:webrtc_common",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api", "../../api:libjingle_peerconnection_api",
"../../api:optional",
"../../api:transport_api", "../../api:transport_api",
"../../api/video:video_bitrate_allocation", "../../api/video:video_bitrate_allocation",
"../../rtc_base:checks", "../../rtc_base:checks",
@ -253,6 +252,7 @@ rtc_source_set("rtcp_transceiver") {
"../../rtc_base:rtc_task_queue", "../../rtc_base:rtc_task_queue",
"../../rtc_base:weak_ptr", "../../rtc_base:weak_ptr",
"../../system_wrappers", "../../system_wrappers",
"//third_party/abseil-cpp/absl/types:optional",
] ]
} }
@ -292,11 +292,11 @@ rtc_source_set("mock_rtp_rtcp") {
":rtp_rtcp", ":rtp_rtcp",
":rtp_rtcp_format", ":rtp_rtcp_format",
"..:module_api", "..:module_api",
"../../api:optional",
"../../api/video:video_bitrate_allocation", "../../api/video:video_bitrate_allocation",
"../../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",
] ]
} }
@ -410,7 +410,6 @@ if (rtc_include_tests) {
"../../:typedefs", "../../:typedefs",
"../../api:array_view", "../../api:array_view",
"../../api:libjingle_peerconnection_api", "../../api:libjingle_peerconnection_api",
"../../api:optional",
"../../api:transport_api", "../../api:transport_api",
"../../api/video:video_bitrate_allocation", "../../api/video:video_bitrate_allocation",
"../../api/video:video_frame", "../../api/video:video_frame",
@ -430,6 +429,7 @@ if (rtc_include_tests) {
"../../test:test_common", "../../test:test_common",
"../../test:test_support", "../../test:test_support",
"../audio_coding:audio_format_conversion", "../audio_coding:audio_format_conversion",
"//third_party/abseil-cpp/absl/types:optional",
] ]
# TODO(jschuh): bugs.webrtc.org/1348: fix this warning. # TODO(jschuh): bugs.webrtc.org/1348: fix this warning.

View File

@ -14,8 +14,8 @@
#include <map> #include <map>
#include <set> #include <set>
#include "absl/types/optional.h"
#include "api/audio_codecs/audio_format.h" #include "api/audio_codecs/audio_format.h"
#include "api/optional.h"
#include "api/video_codecs/video_codec.h" #include "api/video_codecs/video_codec.h"
#include "modules/rtp_rtcp/source/rtp_utility.h" #include "modules/rtp_rtcp/source/rtp_utility.h"
#include "rtc_base/criticalsection.h" #include "rtc_base/criticalsection.h"
@ -42,7 +42,7 @@ class RTPPayloadRegistry {
int GetPayloadTypeFrequency(uint8_t payload_type) const; int GetPayloadTypeFrequency(uint8_t payload_type) const;
rtc::Optional<RtpUtility::Payload> PayloadTypeToPayload( absl::optional<RtpUtility::Payload> PayloadTypeToPayload(
uint8_t payload_type) const; uint8_t payload_type) const;
void ResetLastReceivedPayloadTypes() { void ResetLastReceivedPayloadTypes() {

View File

@ -16,7 +16,7 @@
#include <utility> #include <utility>
#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 "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/include/module.h" #include "modules/include/module.h"
@ -199,7 +199,7 @@ class RtpRtcp : public Module, public RtcpFeedbackSenderInterface {
int associated_payload_type) = 0; int associated_payload_type) = 0;
// Returns the FlexFEC SSRC, if there is one. // 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. // Sets sending status. Sends kRtcpByeCode when going from true to false.
// Returns -1 on failure else 0. // Returns -1 on failure else 0.

View File

@ -91,8 +91,8 @@ class PayloadUnion {
} }
private: private:
rtc::Optional<AudioPayload> audio_payload_; absl::optional<AudioPayload> audio_payload_;
rtc::Optional<VideoPayload> video_payload_; absl::optional<VideoPayload> video_payload_;
}; };
enum RTPAliveType { kRtpDead = 0, kRtpNoRtp = 1, kRtpAlive = 2 }; enum RTPAliveType { kRtpDead = 0, kRtpNoRtp = 1, kRtpAlive = 2 };

View File

@ -16,7 +16,7 @@
#include <utility> #include <utility>
#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 "modules/include/module.h" #include "modules/include/module.h"
#include "modules/rtp_rtcp/include/rtp_rtcp.h" #include "modules/rtp_rtcp/include/rtp_rtcp.h"
@ -75,7 +75,7 @@ class MockRtpRtcp : public RtpRtcp {
MOCK_CONST_METHOD0(RtxSendStatus, int()); MOCK_CONST_METHOD0(RtxSendStatus, int());
MOCK_METHOD1(SetRtxSsrc, void(uint32_t)); MOCK_METHOD1(SetRtxSsrc, void(uint32_t));
MOCK_METHOD2(SetRtxSendPayloadType, void(int, int)); 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_CONST_METHOD0(RtxSendPayloadType, std::pair<int, int>());
MOCK_METHOD1(SetSendingStatus, int32_t(bool sending)); MOCK_METHOD1(SetSendingStatus, int32_t(bool sending));
MOCK_CONST_METHOD0(Sending, bool()); MOCK_CONST_METHOD0(Sending, bool());

View File

@ -57,7 +57,7 @@ bool ExtendedReports::Parse(const CommonHeader& packet) {
rrtr_block_.reset(); rrtr_block_.reset();
dlrr_block_.ClearItems(); dlrr_block_.ClearItems();
voip_metric_block_.reset(); voip_metric_block_.reset();
target_bitrate_ = rtc::nullopt; target_bitrate_ = absl::nullopt;
const uint8_t* current_block = packet.payload() + kXrBaseLength; const uint8_t* current_block = packet.payload() + kXrBaseLength;
const uint8_t* const packet_end = const uint8_t* const packet_end =

View File

@ -13,7 +13,7 @@
#include <vector> #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.h"
#include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h" #include "modules/rtp_rtcp/source/rtcp_packet/dlrr.h"
#include "modules/rtp_rtcp/source/rtcp_packet/rrtr.h" #include "modules/rtp_rtcp/source/rtcp_packet/rrtr.h"
@ -44,12 +44,12 @@ class ExtendedReports : public RtcpPacket {
void SetTargetBitrate(const TargetBitrate& target_bitrate); void SetTargetBitrate(const TargetBitrate& target_bitrate);
uint32_t sender_ssrc() const { return sender_ssrc_; } 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 Dlrr& dlrr() const { return dlrr_block_; }
const rtc::Optional<VoipMetric>& voip_metric() const { const absl::optional<VoipMetric>& voip_metric() const {
return voip_metric_block_; return voip_metric_block_;
} }
const rtc::Optional<TargetBitrate>& target_bitrate() const { const absl::optional<TargetBitrate>& target_bitrate() const {
return target_bitrate_; return target_bitrate_;
} }
@ -76,10 +76,10 @@ class ExtendedReports : public RtcpPacket {
void ParseTargetBitrateBlock(const uint8_t* block, uint16_t block_length); void ParseTargetBitrateBlock(const uint8_t* block, uint16_t block_length);
uint32_t sender_ssrc_; 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. Dlrr dlrr_block_; // Dlrr without items treated same as no dlrr block.
rtc::Optional<VoipMetric> voip_metric_block_; absl::optional<VoipMetric> voip_metric_block_;
rtc::Optional<TargetBitrate> target_bitrate_; absl::optional<TargetBitrate> target_bitrate_;
}; };
} // namespace rtcp } // namespace rtcp
} // namespace webrtc } // namespace webrtc

View File

@ -67,7 +67,7 @@ TEST(TargetBitrateTest, FullPacket) {
rtcp::ExtendedReports xr; rtcp::ExtendedReports xr;
EXPECT_TRUE(ParseSinglePacket(kRtcpPacket, &xr)); EXPECT_TRUE(ParseSinglePacket(kRtcpPacket, &xr));
EXPECT_EQ(kSsrc, xr.sender_ssrc()); 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)); ASSERT_TRUE(static_cast<bool>(target_bitrate));
CheckBitrateItems(target_bitrate->GetTargetBitrates()); CheckBitrateItems(target_bitrate->GetTargetBitrates());
} }

View File

@ -72,7 +72,7 @@ struct RTCPReceiver::PacketInformation {
int64_t rtt_ms = 0; int64_t rtt_ms = 0;
uint32_t receiver_estimated_max_bitrate_bps = 0; uint32_t receiver_estimated_max_bitrate_bps = 0;
std::unique_ptr<rtcp::TransportFeedback> transport_feedback; 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). // Structure for handing TMMBR and TMMBN rtcp messages (RFC5104, section 3.5.4).

View File

@ -17,8 +17,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "absl/types/optional.h"
#include "api/call/transport.h" #include "api/call/transport.h"
#include "api/optional.h"
#include "api/video/video_bitrate_allocation.h" #include "api/video/video_bitrate_allocation.h"
#include "modules/remote_bitrate_estimator/include/bwe_defines.h" #include "modules/remote_bitrate_estimator/include/bwe_defines.h"
#include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h" #include "modules/remote_bitrate_estimator/include/remote_bitrate_estimator.h"
@ -237,7 +237,7 @@ class RTCPSender {
RTC_GUARDED_BY(critical_section_rtcp_sender_); RTC_GUARDED_BY(critical_section_rtcp_sender_);
// XR VoIP metric // XR VoIP metric
rtc::Optional<RTCPVoIPMetric> xr_voip_metric_ absl::optional<RTCPVoIPMetric> xr_voip_metric_
RTC_GUARDED_BY(critical_section_rtcp_sender_); RTC_GUARDED_BY(critical_section_rtcp_sender_);
RtcpPacketTypeCounterObserver* const packet_type_counter_observer_; RtcpPacketTypeCounterObserver* const packet_type_counter_observer_;
@ -246,7 +246,7 @@ class RTCPSender {
RtcpNackStats nack_stats_ RTC_GUARDED_BY(critical_section_rtcp_sender_); 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_); RTC_GUARDED_BY(critical_section_rtcp_sender_);
void SetFlag(uint32_t type, bool is_volatile) void SetFlag(uint32_t type, bool is_volatile)

View File

@ -679,7 +679,7 @@ TEST_F(RtcpSenderTest, SendXrWithTargetBitrate) {
EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport)); EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpReport));
EXPECT_EQ(1, parser()->xr()->num_packets()); EXPECT_EQ(1, parser()->xr()->num_packets());
EXPECT_EQ(kSenderSsrc, parser()->xr()->sender_ssrc()); 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(); parser()->xr()->target_bitrate();
ASSERT_TRUE(target_bitrate); ASSERT_TRUE(target_bitrate);
const std::vector<rtcp::TargetBitrate::BitrateItem>& bitrates = const std::vector<rtcp::TargetBitrate::BitrateItem>& bitrates =

View File

@ -46,7 +46,7 @@ struct SenderReportTimes {
struct RtcpTransceiverImpl::RemoteSenderState { struct RtcpTransceiverImpl::RemoteSenderState {
uint8_t fir_sequence_number = 0; uint8_t fir_sequence_number = 0;
rtc::Optional<SenderReportTimes> last_received_sender_report; absl::optional<SenderReportTimes> last_received_sender_report;
std::vector<MediaReceiverRtcpObserver*> observers; std::vector<MediaReceiverRtcpObserver*> observers;
}; };
@ -245,7 +245,7 @@ void RtcpTransceiverImpl::HandleSenderReport(
return; return;
RemoteSenderState& remote_sender = RemoteSenderState& remote_sender =
remote_senders_[sender_report.sender_ssrc()]; remote_senders_[sender_report.sender_ssrc()];
rtc::Optional<SenderReportTimes>& last = absl::optional<SenderReportTimes>& last =
remote_sender.last_received_sender_report; remote_sender.last_received_sender_report;
last.emplace(); last.emplace();
last->local_received_time_us = now_us; last->local_received_time_us = now_us;

View File

@ -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 "modules/rtp_rtcp/source/rtcp_packet/common_header.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/dlrr.h"
#include "modules/rtp_rtcp/source/rtcp_packet/remb.h" #include "modules/rtp_rtcp/source/rtcp_packet/remb.h"
@ -91,7 +91,7 @@ class RtcpTransceiverImpl {
const RtcpTransceiverConfig config_; const RtcpTransceiverConfig config_;
bool ready_to_send_; 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 // TODO(danilchap): Remove entries from remote_senders_ that are no longer
// needed. // needed.
std::map<uint32_t, RemoteSenderState> remote_senders_; std::map<uint32_t, RemoteSenderState> remote_senders_;

View File

@ -144,7 +144,7 @@ TEST(RtcpTransceiverImplTest, DelaysSendingFirstCompondPacket) {
config.outgoing_transport = &transport; config.outgoing_transport = &transport;
config.initial_report_delay_ms = 10; config.initial_report_delay_ms = 10;
config.task_queue = &queue; config.task_queue = &queue;
rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver; absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
int64_t started_ms = rtc::TimeMillis(); int64_t started_ms = rtc::TimeMillis();
queue.PostTask([&] { rtcp_transceiver.emplace(config); }); queue.PostTask([&] { rtcp_transceiver.emplace(config); });
@ -169,7 +169,7 @@ TEST(RtcpTransceiverImplTest, PeriodicallySendsPackets) {
config.initial_report_delay_ms = 0; config.initial_report_delay_ms = 0;
config.report_period_ms = kReportPeriodMs; config.report_period_ms = kReportPeriodMs;
config.task_queue = &queue; config.task_queue = &queue;
rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver; absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
int64_t time_just_before_1st_packet_ms = 0; int64_t time_just_before_1st_packet_ms = 0;
queue.PostTask([&] { queue.PostTask([&] {
// Because initial_report_delay_ms is set to 0, time_just_before_the_packet // Because initial_report_delay_ms is set to 0, time_just_before_the_packet
@ -202,7 +202,7 @@ TEST(RtcpTransceiverImplTest, SendCompoundPacketDelaysPeriodicSendPackets) {
config.initial_report_delay_ms = 0; config.initial_report_delay_ms = 0;
config.report_period_ms = kReportPeriodMs; config.report_period_ms = kReportPeriodMs;
config.task_queue = &queue; config.task_queue = &queue;
rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver; absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
queue.PostTask([&] { rtcp_transceiver.emplace(config); }); queue.PostTask([&] { rtcp_transceiver.emplace(config); });
// Wait for first packet. // Wait for first packet.
@ -288,7 +288,7 @@ TEST(RtcpTransceiverImplTest, SendsPeriodicRtcpWhenNetworkStateIsUp) {
config.initial_ready_to_send = false; config.initial_ready_to_send = false;
config.outgoing_transport = &transport; config.outgoing_transport = &transport;
config.task_queue = &queue; config.task_queue = &queue;
rtc::Optional<RtcpTransceiverImpl> rtcp_transceiver; absl::optional<RtcpTransceiverImpl> rtcp_transceiver;
rtcp_transceiver.emplace(config); rtcp_transceiver.emplace(config);
rtcp_transceiver->SetReadyToSend(true); rtcp_transceiver->SetReadyToSend(true);

View File

@ -129,7 +129,7 @@ size_t RtpPacketizerH264::SetPayloadData(
// RtpDepacketizerH264::ParseSingleNalu (receive side, in orderer to // RtpDepacketizerH264::ParseSingleNalu (receive side, in orderer to
// protect us from unknown or legacy send clients). // 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()); std::unique_ptr<rtc::Buffer> output_buffer(new rtc::Buffer());
// Add the type header to the output buffer first, so that the rewriter // Add the type header to the output buffer first, so that the rewriter
@ -514,7 +514,7 @@ bool RtpDepacketizerH264::ProcessStapAOrSingleNalu(
if (start_offset) if (start_offset)
output_buffer->AppendData(payload_data, start_offset); output_buffer->AppendData(payload_data, start_offset);
rtc::Optional<SpsParser::SpsState> sps; absl::optional<SpsParser::SpsState> sps;
SpsVuiRewriter::ParseResult result = SpsVuiRewriter::ParseAndRewriteSps( SpsVuiRewriter::ParseResult result = SpsVuiRewriter::ParseAndRewriteSps(
&payload_data[start_offset], end_offset - start_offset, &sps, &payload_data[start_offset], end_offset - start_offset, &sps,
@ -596,7 +596,7 @@ bool RtpDepacketizerH264::ProcessStapAOrSingleNalu(
parsed_payload->frame_type = kVideoFrameKey; parsed_payload->frame_type = kVideoFrameKey;
RTC_FALLTHROUGH(); RTC_FALLTHROUGH();
case H264::NaluType::kSlice: { 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); &payload_data[start_offset], end_offset - start_offset);
if (pps_id) { if (pps_id) {
nalu.pps_id = *pps_id; nalu.pps_id = *pps_id;
@ -648,7 +648,7 @@ bool RtpDepacketizerH264::ParseFuaNalu(
if (first_fragment) { if (first_fragment) {
offset_ = 0; offset_ = 0;
length_ -= kNalHeaderSize; length_ -= kNalHeaderSize;
rtc::Optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice( absl::optional<uint32_t> pps_id = PpsParser::ParsePpsIdFromSlice(
payload_data + 2 * kNalHeaderSize, length_ - kNalHeaderSize); payload_data + 2 * kNalHeaderSize, length_ - kNalHeaderSize);
if (pps_id) { if (pps_id) {
nalu.pps_id = *pps_id; nalu.pps_id = *pps_id;

View File

@ -84,7 +84,7 @@ void RtpPacketHistory::SetRtt(int64_t rtt_ms) {
void RtpPacketHistory::PutRtpPacket(std::unique_ptr<RtpPacketToSend> packet, void RtpPacketHistory::PutRtpPacket(std::unique_ptr<RtpPacketToSend> packet,
StorageType type, StorageType type,
rtc::Optional<int64_t> send_time_ms) { absl::optional<int64_t> send_time_ms) {
RTC_DCHECK(packet); RTC_DCHECK(packet);
rtc::CritScope cs(&lock_); rtc::CritScope cs(&lock_);
int64_t now_ms = clock_->TimeInMilliseconds(); int64_t now_ms = clock_->TimeInMilliseconds();
@ -146,21 +146,21 @@ std::unique_ptr<RtpPacketToSend> RtpPacketHistory::GetPacketAndSetSendTime(
return rtc::MakeUnique<RtpPacketToSend>(*packet.packet); return rtc::MakeUnique<RtpPacketToSend>(*packet.packet);
} }
rtc::Optional<RtpPacketHistory::PacketState> RtpPacketHistory::GetPacketState( absl::optional<RtpPacketHistory::PacketState> RtpPacketHistory::GetPacketState(
uint16_t sequence_number, uint16_t sequence_number,
bool verify_rtt) const { bool verify_rtt) const {
rtc::CritScope cs(&lock_); rtc::CritScope cs(&lock_);
if (mode_ == StorageMode::kDisabled) { if (mode_ == StorageMode::kDisabled) {
return rtc::nullopt; return absl::nullopt;
} }
auto rtp_it = packet_history_.find(sequence_number); auto rtp_it = packet_history_.find(sequence_number);
if (rtp_it == packet_history_.end()) { if (rtp_it == packet_history_.end()) {
return rtc::nullopt; return absl::nullopt;
} }
if (verify_rtt && !VerifyRtt(rtp_it->second, clock_->TimeInMilliseconds())) { if (verify_rtt && !VerifyRtt(rtp_it->second, clock_->TimeInMilliseconds())) {
return rtc::nullopt; return absl::nullopt;
} }
return StoredPacketToPacketState(rtp_it->second); return StoredPacketToPacketState(rtp_it->second);

View File

@ -42,7 +42,7 @@ class RtpPacketHistory {
~PacketState(); ~PacketState();
uint16_t rtp_sequence_number = 0; 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; int64_t capture_time_ms = 0;
uint32_t ssrc = 0; uint32_t ssrc = 0;
size_t payload_size = 0; size_t payload_size = 0;
@ -74,7 +74,7 @@ class RtpPacketHistory {
// be set accordingly. // be set accordingly.
void PutRtpPacket(std::unique_ptr<RtpPacketToSend> packet, void PutRtpPacket(std::unique_ptr<RtpPacketToSend> packet,
StorageType type, 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|. // Gets stored RTP packet corresponding to the input |sequence number|.
// Returns nullptr if packet is not found. If |verify_rtt| is true, doesn't // Returns nullptr if packet is not found. If |verify_rtt| is true, doesn't
@ -85,7 +85,7 @@ class RtpPacketHistory {
// Similar to GetPacketAndSetSendTime(), but only returns a snapshot of the // Similar to GetPacketAndSetSendTime(), but only returns a snapshot of the
// current state for packet, and never updates internal state. // current state for packet, and never updates internal state.
rtc::Optional<PacketState> GetPacketState(uint16_t sequence_number, absl::optional<PacketState> GetPacketState(uint16_t sequence_number,
bool verify_rtt) const; bool verify_rtt) const;
// Get the packet (if any) from the history, with size closest to // Get the packet (if any) from the history, with size closest to
@ -101,7 +101,7 @@ class RtpPacketHistory {
~StoredPacket(); ~StoredPacket();
// The time of last transmission, including retransmissions. // 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. // Number of times RE-transmitted, ie excluding the first transmission.
size_t times_retransmitted = 0; size_t times_retransmitted = 0;
@ -140,7 +140,7 @@ class RtpPacketHistory {
// The earliest packet in the history. This might not be the lowest sequence // The earliest packet in the history. This might not be the lowest sequence
// number, in case there is a wraparound. // 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); RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(RtpPacketHistory);
}; };

View File

@ -62,7 +62,7 @@ TEST_F(RtpPacketHistoryTest, ClearsHistoryAfterSetStoreStatus) {
hist_.SetStorePacketsStatus(StorageMode::kStore, 10); hist_.SetStorePacketsStatus(StorageMode::kStore, 10);
// Store a packet, but with send-time. It should then not be removed. // Store a packet, but with send-time. It should then not be removed.
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum), kAllowRetransmission, hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum), kAllowRetransmission,
rtc::nullopt); absl::nullopt);
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false)); EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false));
// Changing store status, even to the current one, will clear the history. // Changing store status, even to the current one, will clear the history.
@ -74,7 +74,7 @@ TEST_F(RtpPacketHistoryTest, StartSeqResetAfterReset) {
hist_.SetStorePacketsStatus(StorageMode::kStoreAndCull, 10); hist_.SetStorePacketsStatus(StorageMode::kStoreAndCull, 10);
// Store a packet, but with send-time. It should then not be removed. // Store a packet, but with send-time. It should then not be removed.
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum), kAllowRetransmission, hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum), kAllowRetransmission,
rtc::nullopt); absl::nullopt);
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false)); EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false));
// Changing store status, to clear the history. // Changing store status, to clear the history.
@ -83,7 +83,7 @@ TEST_F(RtpPacketHistoryTest, StartSeqResetAfterReset) {
// Add a new packet. // Add a new packet.
hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum + 1), kAllowRetransmission, hist_.PutRtpPacket(CreateRtpPacket(kStartSeqNum + 1), kAllowRetransmission,
rtc::nullopt); absl::nullopt);
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum + 1, false)); EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum + 1, false));
// Advance time past where packet expires. // Advance time past where packet expires.
@ -93,7 +93,7 @@ TEST_F(RtpPacketHistoryTest, StartSeqResetAfterReset) {
// Add one more packet and verify no state left from packet before reset. // Add one more packet and verify no state left from packet before reset.
hist_.PutRtpPacket(CreateRtpPacket(To16u(kStartSeqNum + 2)), hist_.PutRtpPacket(CreateRtpPacket(To16u(kStartSeqNum + 2)),
kAllowRetransmission, rtc::nullopt); kAllowRetransmission, absl::nullopt);
EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false)); EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false));
EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum + 1, false)); EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum + 1, false));
EXPECT_TRUE(hist_.GetPacketState(To16u(kStartSeqNum + 2), false)); EXPECT_TRUE(hist_.GetPacketState(To16u(kStartSeqNum + 2), false));
@ -102,7 +102,7 @@ TEST_F(RtpPacketHistoryTest, StartSeqResetAfterReset) {
TEST_F(RtpPacketHistoryTest, NoStoreStatus) { TEST_F(RtpPacketHistoryTest, NoStoreStatus) {
EXPECT_EQ(StorageMode::kDisabled, hist_.GetStorageMode()); EXPECT_EQ(StorageMode::kDisabled, hist_.GetStorageMode());
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum); 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. // Packet should not be stored.
EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false)); EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false));
} }
@ -117,7 +117,7 @@ TEST_F(RtpPacketHistoryTest, PutRtpPacket) {
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum); std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
EXPECT_FALSE(hist_.GetPacketState(kStartSeqNum, false)); 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)); EXPECT_TRUE(hist_.GetPacketState(kStartSeqNum, false));
} }
@ -127,7 +127,7 @@ TEST_F(RtpPacketHistoryTest, GetRtpPacket) {
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum); std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
packet->set_capture_time_ms(capture_time_ms); packet->set_capture_time_ms(capture_time_ms);
rtc::CopyOnWriteBuffer buffer = packet->Buffer(); 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 = std::unique_ptr<RtpPacketToSend> packet_out =
hist_.GetPacketAndSetSendTime(kStartSeqNum, false); hist_.GetPacketAndSetSendTime(kStartSeqNum, false);
@ -143,7 +143,7 @@ TEST_F(RtpPacketHistoryTest, NoCaptureTime) {
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum); std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
packet->set_capture_time_ms(-1); packet->set_capture_time_ms(-1);
rtc::CopyOnWriteBuffer buffer = packet->Buffer(); 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 = std::unique_ptr<RtpPacketToSend> packet_out =
hist_.GetPacketAndSetSendTime(kStartSeqNum, false); hist_.GetPacketAndSetSendTime(kStartSeqNum, false);
@ -157,7 +157,7 @@ TEST_F(RtpPacketHistoryTest, DontRetransmit) {
int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum); std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
rtc::CopyOnWriteBuffer buffer = packet->Buffer(); 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. // Get the packet and verify data.
std::unique_ptr<RtpPacketToSend> packet_out; std::unique_ptr<RtpPacketToSend> packet_out;
@ -182,7 +182,7 @@ TEST_F(RtpPacketHistoryTest, PacketStateIsCorrect) {
hist_.PutRtpPacket(std::move(packet), StorageType::kAllowRetransmission, hist_.PutRtpPacket(std::move(packet), StorageType::kAllowRetransmission,
fake_clock_.TimeInMilliseconds()); fake_clock_.TimeInMilliseconds());
rtc::Optional<RtpPacketHistory::PacketState> state = absl::optional<RtpPacketHistory::PacketState> state =
hist_.GetPacketState(kStartSeqNum, false); hist_.GetPacketState(kStartSeqNum, false);
ASSERT_TRUE(state); ASSERT_TRUE(state);
EXPECT_EQ(state->rtp_sequence_number, kStartSeqNum); EXPECT_EQ(state->rtp_sequence_number, kStartSeqNum);
@ -208,7 +208,7 @@ TEST_F(RtpPacketHistoryTest, MinResendTimeWithPacer) {
int64_t capture_time_ms = fake_clock_.TimeInMilliseconds(); int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum); std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum);
size_t len = packet->size(); 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. // First transmission: TimeToSendPacket() call from pacer.
EXPECT_TRUE(hist_.GetPacketAndSetSendTime(kStartSeqNum, false)); EXPECT_TRUE(hist_.GetPacketAndSetSendTime(kStartSeqNum, false));
@ -223,7 +223,7 @@ TEST_F(RtpPacketHistoryTest, MinResendTimeWithPacer) {
// 2) When the pacer determines that it is time to send the packet, it calls // 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 // GetPacketAndSetSendTime(). This time we do not need to verify RTT as
// has that has already been done. // has that has already been done.
rtc::Optional<RtpPacketHistory::PacketState> packet_state = absl::optional<RtpPacketHistory::PacketState> packet_state =
hist_.GetPacketState(kStartSeqNum, /*verify_rtt=*/true); hist_.GetPacketState(kStartSeqNum, /*verify_rtt=*/true);
EXPECT_TRUE(packet_state); EXPECT_TRUE(packet_state);
EXPECT_EQ(len, packet_state->payload_size); EXPECT_EQ(len, packet_state->payload_size);
@ -313,7 +313,7 @@ TEST_F(RtpPacketHistoryTest, RemovesOldestPacketWhenAtMaxCapacity) {
for (size_t i = 0; i < kMaxNumPackets; ++i) { for (size_t i = 0; i < kMaxNumPackets; ++i) {
std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum + i); std::unique_ptr<RtpPacketToSend> packet = CreateRtpPacket(kStartSeqNum + i);
// Don't mark packets as sent, preventing them from being removed. // 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. // First packet should still be there.
@ -338,7 +338,7 @@ TEST_F(RtpPacketHistoryTest, DontRemoveUnsentPackets) {
for (size_t i = 0; i < kMaxNumPackets; ++i) { for (size_t i = 0; i < kMaxNumPackets; ++i) {
// Mark packets as unsent. // Mark packets as unsent.
hist_.PutRtpPacket(CreateRtpPacket(To16u(kStartSeqNum + i)), hist_.PutRtpPacket(CreateRtpPacket(To16u(kStartSeqNum + i)),
kAllowRetransmission, rtc::nullopt); kAllowRetransmission, absl::nullopt);
} }
fake_clock_.AdvanceTimeMilliseconds(RtpPacketHistory::kMinPacketDurationMs); fake_clock_.AdvanceTimeMilliseconds(RtpPacketHistory::kMinPacketDurationMs);

View File

@ -227,13 +227,13 @@ int RTPPayloadRegistry::GetPayloadTypeFrequency(
: kVideoPayloadTypeFrequency; : kVideoPayloadTypeFrequency;
} }
rtc::Optional<RtpUtility::Payload> RTPPayloadRegistry::PayloadTypeToPayload( absl::optional<RtpUtility::Payload> RTPPayloadRegistry::PayloadTypeToPayload(
uint8_t payload_type) const { uint8_t payload_type) const {
rtc::CritScope cs(&crit_sect_); rtc::CritScope cs(&crit_sect_);
const auto it = payload_type_map_.find(payload_type); const auto it = payload_type_map_.find(payload_type);
return it == payload_type_map_.end() return it == payload_type_map_.end()
? rtc::nullopt ? absl::nullopt
: rtc::Optional<RtpUtility::Payload>(it->second); : absl::optional<RtpUtility::Payload>(it->second);
} }
} // namespace webrtc } // namespace webrtc

View File

@ -29,7 +29,7 @@
namespace webrtc { namespace webrtc {
namespace { namespace {
bool InOrderPacket(rtc::Optional<uint16_t> latest_sequence_number, bool InOrderPacket(absl::optional<uint16_t> latest_sequence_number,
uint16_t current_sequence_number) { uint16_t current_sequence_number) {
if (!latest_sequence_number) if (!latest_sequence_number)
return true; return true;
@ -174,8 +174,8 @@ bool RtpReceiverImpl::IncomingRtpPacket(const RTPHeader& rtp_header,
auto audio_level = auto audio_level =
rtp_header.extension.hasAudioLevel rtp_header.extension.hasAudioLevel
? rtc::Optional<uint8_t>(rtp_header.extension.audioLevel) ? absl::optional<uint8_t>(rtp_header.extension.audioLevel)
: rtc::nullopt; : absl::nullopt;
UpdateSources(audio_level); UpdateSources(audio_level);
int32_t ret_val = rtp_media_receiver_->ParseRtpPacket( int32_t ret_val = rtp_media_receiver_->ParseRtpPacket(
@ -323,7 +323,7 @@ void RtpReceiverImpl::CheckCSRC(const WebRtcRTPHeader& rtp_header) {
} }
void RtpReceiverImpl::UpdateSources( 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_); rtc::CritScope lock(&critical_section_rtp_receiver_);
int64_t now_ms = clock_->TimeInMilliseconds(); int64_t now_ms = clock_->TimeInMilliseconds();

View File

@ -16,7 +16,7 @@
#include <unordered_map> #include <unordered_map>
#include <vector> #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_receiver.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
#include "modules/rtp_rtcp/source/rtp_receiver_strategy.h" #include "modules/rtp_rtcp/source/rtp_receiver_strategy.h"
@ -74,7 +74,7 @@ class RtpReceiverImpl : public RtpReceiver {
int32_t CheckPayloadChanged(const RTPHeader& rtp_header, int32_t CheckPayloadChanged(const RTPHeader& rtp_header,
PayloadUnion* payload); 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); void RemoveOutdatedSources(int64_t now_ms);
Clock* clock_; Clock* clock_;
@ -91,7 +91,7 @@ class RtpReceiverImpl : public RtpReceiver {
critical_section_rtp_receiver_); critical_section_rtp_receiver_);
// Sequence number and timestamps for the latest in-order packet. // 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_); RTC_GUARDED_BY(critical_section_rtp_receiver_);
uint32_t last_received_timestamp_ uint32_t last_received_timestamp_
RTC_GUARDED_BY(critical_section_rtp_receiver_); RTC_GUARDED_BY(critical_section_rtp_receiver_);

View File

@ -266,10 +266,10 @@ void ModuleRtpRtcpImpl::SetRtxSendPayloadType(int payload_type,
rtp_sender_->SetRtxPayloadType(payload_type, associated_payload_type); 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_) if (rtp_sender_)
return rtp_sender_->FlexfecSsrc(); return rtp_sender_->FlexfecSsrc();
return rtc::nullopt; return absl::nullopt;
} }
void ModuleRtpRtcpImpl::IncomingRtcpPacket(const uint8_t* rtcp_packet, void ModuleRtpRtcpImpl::IncomingRtcpPacket(const uint8_t* rtcp_packet,
@ -898,7 +898,7 @@ void ModuleRtpRtcpImpl::SetRtcpReceiverSsrcs(uint32_t main_ssrc) {
ssrcs.insert(main_ssrc); ssrcs.insert(main_ssrc);
if (RtxSendStatus() != kRtxOff) if (RtxSendStatus() != kRtxOff)
ssrcs.insert(rtp_sender_->RtxSsrc()); ssrcs.insert(rtp_sender_->RtxSsrc());
rtc::Optional<uint32_t> flexfec_ssrc = FlexfecSsrc(); absl::optional<uint32_t> flexfec_ssrc = FlexfecSsrc();
if (flexfec_ssrc) if (flexfec_ssrc)
ssrcs.insert(*flexfec_ssrc); ssrcs.insert(*flexfec_ssrc);
rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs); rtcp_receiver_.SetSsrcs(main_ssrc, ssrcs);

View File

@ -17,7 +17,7 @@
#include <utility> #include <utility>
#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 "modules/rtp_rtcp/include/rtp_rtcp.h" #include "modules/rtp_rtcp/include/rtp_rtcp.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@ -102,7 +102,7 @@ class ModuleRtpRtcpImpl : public RtpRtcp, public RTCPReceiver::ModuleRtpRtcp {
void SetRtxSendPayloadType(int payload_type, void SetRtxSendPayloadType(int payload_type,
int associated_payload_type) override; 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. // Sends kRtcpByeCode when going from true to false.
int32_t SetSendingStatus(bool sending) override; int32_t SetSendingStatus(bool sending) override;

View File

@ -630,7 +630,7 @@ bool RTPSender::StorePackets() const {
int32_t RTPSender::ReSendPacket(uint16_t packet_id) { int32_t RTPSender::ReSendPacket(uint16_t packet_id) {
// Try to find packet in RTP packet history. Also verify RTT here, so that we // Try to find packet in RTP packet history. Also verify RTT here, so that we
// don't retransmit too often. // don't retransmit too often.
rtc::Optional<RtpPacketHistory::PacketState> stored_packet = absl::optional<RtpPacketHistory::PacketState> stored_packet =
packet_history_.GetPacketState(packet_id, true); packet_history_.GetPacketState(packet_id, true);
if (!stored_packet) { if (!stored_packet) {
// Packet not found. // Packet not found.
@ -908,7 +908,7 @@ bool RTPSender::SendToNetwork(std::unique_ptr<RtpPacketToSend> packet,
} }
uint32_t ssrc = packet->Ssrc(); uint32_t ssrc = packet->Ssrc();
rtc::Optional<uint32_t> flexfec_ssrc = FlexfecSsrc(); absl::optional<uint32_t> flexfec_ssrc = FlexfecSsrc();
if (paced_sender_) { if (paced_sender_) {
uint16_t seq_no = packet->SequenceNumber(); uint16_t seq_no = packet->SequenceNumber();
// Correct offset between implementations of millisecond time stamps in // Correct offset between implementations of millisecond time stamps in
@ -919,9 +919,9 @@ bool RTPSender::SendToNetwork(std::unique_ptr<RtpPacketToSend> packet,
// Store FlexFEC packets in the history here, so they can be found // Store FlexFEC packets in the history here, so they can be found
// when the pacer calls TimeToSendPacket. // when the pacer calls TimeToSendPacket.
flexfec_packet_history_.PutRtpPacket(std::move(packet), storage, flexfec_packet_history_.PutRtpPacket(std::move(packet), storage,
rtc::nullopt); absl::nullopt);
} else { } 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, paced_sender_->InsertPacket(priority, ssrc, seq_no, corrected_time_ms,
@ -1155,11 +1155,11 @@ void RTPSender::SetMid(const std::string& mid) {
mid_ = mid; mid_ = mid;
} }
rtc::Optional<uint32_t> RTPSender::FlexfecSsrc() const { absl::optional<uint32_t> RTPSender::FlexfecSsrc() const {
if (video_) { if (video_) {
return video_->FlexfecSsrc(); return video_->FlexfecSsrc();
} }
return rtc::nullopt; return absl::nullopt;
} }
void RTPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) { void RTPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {

View File

@ -17,9 +17,9 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "absl/types/optional.h"
#include "api/array_view.h" #include "api/array_view.h"
#include "api/call/transport.h" #include "api/call/transport.h"
#include "api/optional.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/rtp_rtcp/include/flexfec_sender.h" #include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/rtp_header_extension_map.h" #include "modules/rtp_rtcp/include/rtp_header_extension_map.h"
@ -172,7 +172,7 @@ class RTPSender {
uint32_t SSRC() const; uint32_t SSRC() const;
rtc::Optional<uint32_t> FlexfecSsrc() const; absl::optional<uint32_t> FlexfecSsrc() const;
bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet, bool SendToNetwork(std::unique_ptr<RtpPacketToSend> packet,
StorageType storage, StorageType storage,
@ -315,9 +315,9 @@ class RTPSender {
bool sequence_number_forced_ RTC_GUARDED_BY(send_critsect_); bool sequence_number_forced_ RTC_GUARDED_BY(send_critsect_);
uint16_t sequence_number_ RTC_GUARDED_BY(send_critsect_); uint16_t sequence_number_ RTC_GUARDED_BY(send_critsect_);
uint16_t sequence_number_rtx_ 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. // 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. // MID value to send in the MID header extension.
std::string mid_ RTC_GUARDED_BY(send_critsect_); std::string mid_ RTC_GUARDED_BY(send_critsect_);
uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(send_critsect_); uint32_t last_rtp_timestamp_ RTC_GUARDED_BY(send_critsect_);
@ -327,7 +327,7 @@ class RTPSender {
bool last_packet_marker_bit_ RTC_GUARDED_BY(send_critsect_); bool last_packet_marker_bit_ RTC_GUARDED_BY(send_critsect_);
std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(send_critsect_); std::vector<uint32_t> csrcs_ RTC_GUARDED_BY(send_critsect_);
int rtx_ 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. // Mapping rtx_payload_type_map_[associated] = rtx.
std::map<int8_t, int8_t> rtx_payload_type_map_ RTC_GUARDED_BY(send_critsect_); 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_); size_t rtp_overhead_bytes_per_packet_ RTC_GUARDED_BY(send_critsect_);

View File

@ -264,11 +264,11 @@ void RTPSenderVideo::SetFecParameters(const FecProtectionParams& delta_params,
key_fec_params_ = key_params; key_fec_params_ = key_params;
} }
rtc::Optional<uint32_t> RTPSenderVideo::FlexfecSsrc() const { absl::optional<uint32_t> RTPSenderVideo::FlexfecSsrc() const {
if (flexfec_sender_) { if (flexfec_sender_) {
return flexfec_sender_->ssrc(); return flexfec_sender_->ssrc();
} }
return rtc::nullopt; return absl::nullopt;
} }
bool RTPSenderVideo::SendVideo(enum VideoCodecType video_type, bool RTPSenderVideo::SendVideo(enum VideoCodecType video_type,
@ -503,7 +503,7 @@ bool RTPSenderVideo::UpdateConditionalRetransmit(
int64_t expected_next_frame_time = kUndefined; int64_t expected_next_frame_time = kUndefined;
for (int i = temporal_id - 1; i >= 0; --i) { for (int i = temporal_id - 1; i >= 0; --i) {
TemporalLayerStats* stats = &frame_stats_by_temporal_layer_[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) { if (rate) {
int64_t tl_next = stats->last_frame_time_ms + 1000000 / *rate; int64_t tl_next = stats->last_frame_time_ms + 1000000 / *rate;
if (tl_next - now_ms > -expected_retransmission_time_ms && if (tl_next - now_ms > -expected_retransmission_time_ms &&

View File

@ -14,7 +14,7 @@
#include <map> #include <map>
#include <memory> #include <memory>
#include "api/optional.h" #include "absl/types/optional.h"
#include "common_types.h" // NOLINT(build/include) #include "common_types.h" // NOLINT(build/include)
#include "modules/rtp_rtcp/include/flexfec_sender.h" #include "modules/rtp_rtcp/include/flexfec_sender.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h" #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@ -70,7 +70,7 @@ class RTPSenderVideo {
const FecProtectionParams& key_params); const FecProtectionParams& key_params);
// FlexFEC. // FlexFEC.
rtc::Optional<uint32_t> FlexfecSsrc() const; absl::optional<uint32_t> FlexfecSsrc() const;
uint32_t VideoBitrateSent() const; uint32_t VideoBitrateSent() const;
uint32_t FecOverheadRate() const; uint32_t FecOverheadRate() const;