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}
This commit is contained in:
Oskar Sundbom
2017-11-16 15:31:38 +01:00
committed by Commit Bot
parent f715c53bca
commit 12ab00b4d8
49 changed files with 435 additions and 570 deletions

View File

@ -606,21 +606,20 @@ rtc::Optional<CodecInst> AudioCodingModuleImpl::SendCodec() const {
if (encoder_factory_) {
auto* ci = encoder_factory_->codec_manager.GetCodecInst();
if (ci) {
return rtc::Optional<CodecInst>(*ci);
return *ci;
}
CreateSpeechEncoderIfNecessary(encoder_factory_.get());
const std::unique_ptr<AudioEncoder>& enc =
encoder_factory_->codec_manager.GetStackParams()->speech_encoder;
if (enc) {
return rtc::Optional<CodecInst>(
acm2::CodecManager::ForgeCodecInst(enc.get()));
return acm2::CodecManager::ForgeCodecInst(enc.get());
}
return rtc::Optional<CodecInst>();
return rtc::nullopt;
} else {
return encoder_stack_
? rtc::Optional<CodecInst>(
acm2::CodecManager::ForgeCodecInst(encoder_stack_.get()))
: rtc::Optional<CodecInst>();
: rtc::nullopt;
}
}
@ -639,8 +638,7 @@ int AudioCodingModuleImpl::SendFrequency() const {
void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) {
rtc::CritScope lock(&acm_crit_sect_);
if (encoder_stack_) {
encoder_stack_->OnReceivedUplinkBandwidth(bitrate_bps,
rtc::Optional<int64_t>());
encoder_stack_->OnReceivedUplinkBandwidth(bitrate_bps, rtc::nullopt);
}
}