Optional: Use nullopt and implicit construction in /modules/rtp_rtcp
Changes places where we explicitly construct an Optional to instead use
nullopt or the requisite value type only.
This CL was uploaded by git cl split.
R=danilchap@webrtc.org
Bug: None
Change-Id: Ib4694d183f04d675f2ea66d39661fdffb2a984f1
Reviewed-on: https://webrtc-review.googlesource.com/23604
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20846}
diff --git a/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc b/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
index 291175e..066f202 100644
--- a/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
+++ b/modules/rtp_rtcp/source/rtcp_packet/extended_reports.cc
@@ -56,7 +56,7 @@
rrtr_block_.reset();
dlrr_block_.ClearItems();
voip_metric_block_.reset();
- target_bitrate_ = rtc::Optional<TargetBitrate>();
+ target_bitrate_ = rtc::nullopt;
const uint8_t* current_block = packet.payload() + kXrBaseLength;
const uint8_t* const packet_end =
@@ -118,7 +118,7 @@
if (target_bitrate_)
RTC_LOG(LS_WARNING) << "TargetBitrate already set, overwriting.";
- target_bitrate_ = rtc::Optional<TargetBitrate>(bitrate);
+ target_bitrate_ = bitrate;
}
size_t ExtendedReports::BlockLength() const {
diff --git a/modules/rtp_rtcp/source/rtp_payload_registry.cc b/modules/rtp_rtcp/source/rtp_payload_registry.cc
index 0ea9049..93e8a34 100644
--- a/modules/rtp_rtcp/source/rtp_payload_registry.cc
+++ b/modules/rtp_rtcp/source/rtp_payload_registry.cc
@@ -312,7 +312,7 @@
rtc::CritScope cs(&crit_sect_);
const auto it = payload_type_map_.find(payload_type);
return it == payload_type_map_.end()
- ? rtc::Optional<RtpUtility::Payload>()
+ ? rtc::nullopt
: rtc::Optional<RtpUtility::Payload>(it->second);
}
diff --git a/modules/rtp_rtcp/source/rtp_receiver_impl.cc b/modules/rtp_rtcp/source/rtp_receiver_impl.cc
index 64acfb5..6ed4d7c 100644
--- a/modules/rtp_rtcp/source/rtp_receiver_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_receiver_impl.cc
@@ -191,7 +191,7 @@
auto audio_level =
rtp_header.extension.hasAudioLevel
? rtc::Optional<uint8_t>(rtp_header.extension.audioLevel)
- : rtc::Optional<uint8_t>();
+ : rtc::nullopt;
UpdateSources(audio_level);
int32_t ret_val = rtp_media_receiver_->ParseRtpPacket(
diff --git a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 64b76db..d649fd6 100644
--- a/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -267,7 +267,7 @@
rtc::Optional<uint32_t> ModuleRtpRtcpImpl::FlexfecSsrc() const {
if (rtp_sender_)
return rtp_sender_->FlexfecSsrc();
- return rtc::Optional<uint32_t>();
+ return rtc::nullopt;
}
void ModuleRtpRtcpImpl::IncomingRtcpPacket(const uint8_t* rtcp_packet,
diff --git a/modules/rtp_rtcp/source/rtp_sender.cc b/modules/rtp_rtcp/source/rtp_sender.cc
index 539dda6..bc88039 100644
--- a/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/modules/rtp_rtcp/source/rtp_sender.cc
@@ -1118,7 +1118,7 @@
if (video_) {
return video_->FlexfecSsrc();
}
- return rtc::Optional<uint32_t>();
+ return rtc::nullopt;
}
void RTPSender::SetCsrcs(const std::vector<uint32_t>& csrcs) {
diff --git a/modules/rtp_rtcp/source/rtp_sender_video.cc b/modules/rtp_rtcp/source/rtp_sender_video.cc
index 8d8fbf6..cf23bd3 100644
--- a/modules/rtp_rtcp/source/rtp_sender_video.cc
+++ b/modules/rtp_rtcp/source/rtp_sender_video.cc
@@ -280,9 +280,9 @@
rtc::Optional<uint32_t> RTPSenderVideo::FlexfecSsrc() const {
if (flexfec_sender_) {
- return rtc::Optional<uint32_t>(flexfec_sender_->ssrc());
+ return flexfec_sender_->ssrc();
}
- return rtc::Optional<uint32_t>();
+ return rtc::nullopt;
}
bool RTPSenderVideo::SendVideo(RtpVideoCodecTypes video_type,