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}
diff --git a/api/mediaconstraintsinterface.cc b/api/mediaconstraintsinterface.cc
index 2894f5b..90a957c 100644
--- a/api/mediaconstraintsinterface.cc
+++ b/api/mediaconstraintsinterface.cc
@@ -67,7 +67,7 @@
T value;
bool present = FindConstraint<T>(constraints, key, &value, nullptr);
if (present) {
- *value_out = rtc::Optional<T>(value);
+ *value_out = value;
}
}
} // namespace
@@ -268,7 +268,7 @@
// When |kAudioNetworkAdaptorConfig| is defined, it both means that audio
// network adaptor is desired, and provides the config string.
if (options->audio_network_adaptor_config) {
- options->audio_network_adaptor = rtc::Optional<bool>(true);
+ options->audio_network_adaptor = true;
}
}
diff --git a/api/video_codecs/video_encoder.cc b/api/video_codecs/video_encoder.cc
index e3cc516..e1cc0cf 100644
--- a/api/video_codecs/video_encoder.cc
+++ b/api/video_codecs/video_encoder.cc
@@ -61,15 +61,14 @@
}
VideoEncoder::ScalingSettings::ScalingSettings(bool on, int low, int high)
- : enabled(on),
- thresholds(rtc::Optional<QpThresholds>(QpThresholds(low, high))) {}
+ : enabled(on), thresholds(QpThresholds(low, high)) {}
VideoEncoder::ScalingSettings::ScalingSettings(bool on,
int low,
int high,
int min_pixels)
: enabled(on),
- thresholds(rtc::Optional<QpThresholds>(QpThresholds(low, high))),
+ thresholds(QpThresholds(low, high)),
min_pixels_per_frame(min_pixels) {}
VideoEncoder::ScalingSettings::ScalingSettings(bool on, int min_pixels)