Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1959)

Unified Diff: talk/app/webrtc/webrtcsession.cc

Issue 1430433004: Replace rtc::cricket::Settable with rtc::Maybe (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: talk/app/webrtc/webrtcsession.cc
diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc
index 95abeab77a9c9e6dc6e1a1033b083d9f41535e7a..3e62fc640d4ca3c359ef29b63d220293322ef240 100644
--- a/talk/app/webrtc/webrtcsession.cc
+++ b/talk/app/webrtc/webrtcsession.cc
@@ -441,10 +441,11 @@ static std::string MakeTdErrorString(const std::string& desc) {
// Set |option| to the highest-priority value of |key| in the optional
// constraints if the key is found and has a valid value.
-template<typename T>
+template <typename T>
static void SetOptionFromOptionalConstraint(
const MediaConstraintsInterface* constraints,
- const std::string& key, cricket::Settable<T>* option) {
+ const std::string& key,
+ rtc::Maybe<T>* option) {
if (!constraints) {
return;
}
@@ -452,7 +453,7 @@ static void SetOptionFromOptionalConstraint(
T value;
if (constraints->GetOptional().FindFirst(key, &string_value)) {
if (rtc::FromString(string_value, &value)) {
- option->Set(value);
+ *option = value;
}
}
}
@@ -644,8 +645,8 @@ bool WebRtcSession::Initialize(
constraints,
MediaConstraintsInterface::kEnableDscp,
&value, NULL)) {
- audio_options_.dscp.Set(value);
- video_options_.dscp.Set(value);
+ audio_options_.dscp = value;
+ video_options_.dscp = value;
}
// Find Suspend Below Min Bitrate constraint.
@@ -654,7 +655,7 @@ bool WebRtcSession::Initialize(
MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate,
&value,
NULL)) {
- video_options_.suspend_below_min_bitrate.Set(value);
+ video_options_.suspend_below_min_bitrate = value;
}
SetOptionFromOptionalConstraint(constraints,
@@ -684,12 +685,10 @@ bool WebRtcSession::Initialize(
SetOptionFromOptionalConstraint(constraints,
MediaConstraintsInterface::kNumUnsignalledRecvStreams,
&video_options_.unsignalled_recv_stream_limit);
- if (video_options_.unsignalled_recv_stream_limit.IsSet()) {
- int stream_limit;
- video_options_.unsignalled_recv_stream_limit.Get(&stream_limit);
- stream_limit = std::min(kMaxUnsignalledRecvStreams, stream_limit);
- stream_limit = std::max(0, stream_limit);
- video_options_.unsignalled_recv_stream_limit.Set(stream_limit);
+ if (video_options_.unsignalled_recv_stream_limit) {
+ video_options_.unsignalled_recv_stream_limit =
the sun 2015/10/28 13:18:01 The above two lines are pretty confusing. This sy
kwiberg-webrtc 2015/10/28 14:34:38 I agree that it isn't 100% obvious. But this is ho
the sun 2015/10/28 14:45:48 Option 4: Drop assignment overload and always requ
+ std::max(0, std::min(kMaxUnsignalledRecvStreams,
+ *video_options_.unsignalled_recv_stream_limit));
}
SetOptionFromOptionalConstraint(constraints,
@@ -700,11 +699,11 @@ bool WebRtcSession::Initialize(
MediaConstraintsInterface::kCombinedAudioVideoBwe,
&audio_options_.combined_audio_video_bwe);
- audio_options_.audio_jitter_buffer_max_packets.Set(
- rtc_configuration.audio_jitter_buffer_max_packets);
+ audio_options_.audio_jitter_buffer_max_packets =
+ rtc_configuration.audio_jitter_buffer_max_packets;
- audio_options_.audio_jitter_buffer_fast_accelerate.Set(
- rtc_configuration.audio_jitter_buffer_fast_accelerate);
+ audio_options_.audio_jitter_buffer_fast_accelerate =
+ rtc_configuration.audio_jitter_buffer_fast_accelerate;
const cricket::VideoCodec default_codec(
JsepSessionDescription::kDefaultVideoCodecId,

Powered by Google App Engine
This is Rietveld 408576698