Optional: Use nullopt and implicit construction in /api

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=pthatcher@webrtc.org

Bug: None
Change-Id: Icdc7e9e4395eeac053483c69e53501e5aa222107
Reviewed-on: https://webrtc-review.googlesource.com/23567
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Peter Thatcher <pthatcher@webrtc.org>
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20867}
This commit is contained in:
Oskar Sundbom
2017-11-16 10:52:42 +01:00
committed by Commit Bot
parent f9d303c042
commit 0e1d7989a5
2 changed files with 4 additions and 5 deletions

View File

@ -67,7 +67,7 @@ void ConstraintToOptional(const webrtc::MediaConstraintsInterface* constraints,
T value; T value;
bool present = FindConstraint<T>(constraints, key, &value, nullptr); bool present = FindConstraint<T>(constraints, key, &value, nullptr);
if (present) { if (present) {
*value_out = rtc::Optional<T>(value); *value_out = value;
} }
} }
} // namespace } // namespace
@ -268,7 +268,7 @@ void CopyConstraintsIntoAudioOptions(
// When |kAudioNetworkAdaptorConfig| is defined, it both means that audio // When |kAudioNetworkAdaptorConfig| is defined, it both means that audio
// network adaptor is desired, and provides the config string. // network adaptor is desired, and provides the config string.
if (options->audio_network_adaptor_config) { if (options->audio_network_adaptor_config) {
options->audio_network_adaptor = rtc::Optional<bool>(true); options->audio_network_adaptor = true;
} }
} }

View File

@ -61,15 +61,14 @@ VideoCodecH264 VideoEncoder::GetDefaultH264Settings() {
} }
VideoEncoder::ScalingSettings::ScalingSettings(bool on, int low, int high) VideoEncoder::ScalingSettings::ScalingSettings(bool on, int low, int high)
: enabled(on), : enabled(on), thresholds(QpThresholds(low, high)) {}
thresholds(rtc::Optional<QpThresholds>(QpThresholds(low, high))) {}
VideoEncoder::ScalingSettings::ScalingSettings(bool on, VideoEncoder::ScalingSettings::ScalingSettings(bool on,
int low, int low,
int high, int high,
int min_pixels) int min_pixels)
: enabled(on), : enabled(on),
thresholds(rtc::Optional<QpThresholds>(QpThresholds(low, high))), thresholds(QpThresholds(low, high)),
min_pixels_per_frame(min_pixels) {} min_pixels_per_frame(min_pixels) {}
VideoEncoder::ScalingSettings::ScalingSettings(bool on, int min_pixels) VideoEncoder::ScalingSettings::ScalingSettings(bool on, int min_pixels)