Optional: Use nullopt and implicit construction in /modules/audio_coding
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=kwiberg@webrtc.org
Bug: None
Change-Id: I055411a3e521964c81100869a197dd92f5608f1b
Reviewed-on: https://webrtc-review.googlesource.com/23619
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Elad Alon <eladalon@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20728}
diff --git a/modules/audio_coding/neteq/packet_buffer.cc b/modules/audio_coding/neteq/packet_buffer.cc
index 3005d43..dfffebd 100644
--- a/modules/audio_coding/neteq/packet_buffer.cc
+++ b/modules/audio_coding/neteq/packet_buffer.cc
@@ -139,12 +139,11 @@
if (*current_cng_rtp_payload_type &&
**current_cng_rtp_payload_type != packet.payload_type) {
// New CNG payload type implies new codec type.
- *current_rtp_payload_type = rtc::Optional<uint8_t>();
+ *current_rtp_payload_type = rtc::nullopt;
Flush();
flushed = true;
}
- *current_cng_rtp_payload_type =
- rtc::Optional<uint8_t>(packet.payload_type);
+ *current_cng_rtp_payload_type = packet.payload_type;
} else if (!decoder_database.IsDtmf(packet.payload_type)) {
// This must be speech.
if ((*current_rtp_payload_type &&
@@ -153,11 +152,11 @@
!EqualSampleRates(packet.payload_type,
**current_cng_rtp_payload_type,
decoder_database))) {
- *current_cng_rtp_payload_type = rtc::Optional<uint8_t>();
+ *current_cng_rtp_payload_type = rtc::nullopt;
Flush();
flushed = true;
}
- *current_rtp_payload_type = rtc::Optional<uint8_t>(packet.payload_type);
+ *current_rtp_payload_type = packet.payload_type;
}
int return_val = InsertPacket(std::move(packet), stats);
if (return_val == kFlushed) {
@@ -210,7 +209,7 @@
rtc::Optional<Packet> PacketBuffer::GetNextPacket() {
if (Empty()) {
// Buffer is empty.
- return rtc::Optional<Packet>();
+ return rtc::nullopt;
}
rtc::Optional<Packet> packet(std::move(buffer_.front()));