Optional: Use nullopt and implicit construction in /pc

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.

TBR=pthatcher@webrtc.org

Bug: None
Change-Id: If41c462dc3ddff664d0b70d249d760e2ca4c8ab3
Reviewed-on: https://webrtc-review.googlesource.com/23576
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20820}
diff --git a/pc/channel.cc b/pc/channel.cc
index 544ef4f..8bb37d1 100644
--- a/pc/channel.cc
+++ b/pc/channel.cc
@@ -1667,7 +1667,7 @@
   RtpSendParametersFromMediaDescription(audio, rtp_header_extensions,
       &send_params);
   if (audio->agc_minus_10db()) {
-    send_params.options.adjust_agc_delta = rtc::Optional<int>(kAgcMinus10db);
+    send_params.options.adjust_agc_delta = kAgcMinus10db;
   }
 
   bool parameters_applied = media_channel()->SetSendParameters(send_params);
diff --git a/pc/channel_unittest.cc b/pc/channel_unittest.cc
index 36a6b57..1813564 100644
--- a/pc/channel_unittest.cc
+++ b/pc/channel_unittest.cc
@@ -1866,7 +1866,7 @@
         channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL));
     EXPECT_EQ(media_channel1_->max_bps(), -1);
     VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1),
-                     rtc::Optional<int>());
+                     rtc::nullopt);
   }
 
   void CanChangeMaxBitrate() {
@@ -1875,19 +1875,16 @@
         channel1_->SetLocalContent(&local_media_content1_, CA_OFFER, NULL));
 
     EXPECT_TRUE(channel1_->SetRtpSendParameters(
-        kSsrc1, BitrateLimitedParameters(rtc::Optional<int>(1000))));
-    VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1),
-                     rtc::Optional<int>(1000));
-    VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1),
-                     rtc::Optional<int>(1000));
+        kSsrc1, BitrateLimitedParameters(1000)));
+    VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1), 1000);
+    VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1), 1000);
     EXPECT_EQ(-1, media_channel1_->max_bps());
 
     EXPECT_TRUE(channel1_->SetRtpSendParameters(
-        kSsrc1, BitrateLimitedParameters(rtc::Optional<int>())));
-    VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1),
-                     rtc::Optional<int>());
+        kSsrc1, BitrateLimitedParameters(rtc::nullopt)));
+    VerifyMaxBitrate(channel1_->GetRtpSendParameters(kSsrc1), rtc::nullopt);
     VerifyMaxBitrate(media_channel1_->GetRtpSendParameters(kSsrc1),
-                     rtc::Optional<int>());
+                     rtc::nullopt);
     EXPECT_EQ(-1, media_channel1_->max_bps());
   }
 
diff --git a/pc/localaudiosource_unittest.cc b/pc/localaudiosource_unittest.cc
index 7b74bce..bf566c6 100644
--- a/pc/localaudiosource_unittest.cc
+++ b/pc/localaudiosource_unittest.cc
@@ -38,20 +38,20 @@
   rtc::scoped_refptr<LocalAudioSource> source =
       LocalAudioSource::Create(&constraints);
 
-  EXPECT_EQ(rtc::Optional<bool>(false), source->options().echo_cancellation);
-  EXPECT_EQ(rtc::Optional<bool>(true), source->options().extended_filter_aec);
-  EXPECT_EQ(rtc::Optional<bool>(true), source->options().delay_agnostic_aec);
-  EXPECT_EQ(rtc::Optional<bool>(true), source->options().auto_gain_control);
-  EXPECT_EQ(rtc::Optional<bool>(true), source->options().experimental_agc);
-  EXPECT_EQ(rtc::Optional<bool>(false), source->options().noise_suppression);
-  EXPECT_EQ(rtc::Optional<bool>(true), source->options().highpass_filter);
+  EXPECT_EQ(false, source->options().echo_cancellation);
+  EXPECT_EQ(true, source->options().extended_filter_aec);
+  EXPECT_EQ(true, source->options().delay_agnostic_aec);
+  EXPECT_EQ(true, source->options().auto_gain_control);
+  EXPECT_EQ(true, source->options().experimental_agc);
+  EXPECT_EQ(false, source->options().noise_suppression);
+  EXPECT_EQ(true, source->options().highpass_filter);
 }
 
 TEST(LocalAudioSourceTest, OptionNotSet) {
   webrtc::FakeConstraints constraints;
   rtc::scoped_refptr<LocalAudioSource> source =
       LocalAudioSource::Create(&constraints);
-  EXPECT_EQ(rtc::Optional<bool>(), source->options().highpass_filter);
+  EXPECT_EQ(rtc::nullopt, source->options().highpass_filter);
 }
 
 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) {
@@ -64,7 +64,7 @@
   rtc::scoped_refptr<LocalAudioSource> source =
       LocalAudioSource::Create(&constraints);
 
-  EXPECT_EQ(rtc::Optional<bool>(false), source->options().echo_cancellation);
+  EXPECT_EQ(false, source->options().echo_cancellation);
 }
 
 TEST(LocalAudioSourceTest, InvalidOptional) {
@@ -76,7 +76,7 @@
       LocalAudioSource::Create(&constraints);
 
   EXPECT_EQ(MediaSourceInterface::kLive, source->state());
-  EXPECT_EQ(rtc::Optional<bool>(false), source->options().highpass_filter);
+  EXPECT_EQ(false, source->options().highpass_filter);
 }
 
 TEST(LocalAudioSourceTest, InvalidMandatory) {
@@ -88,19 +88,19 @@
       LocalAudioSource::Create(&constraints);
 
   EXPECT_EQ(MediaSourceInterface::kLive, source->state());
-  EXPECT_EQ(rtc::Optional<bool>(false), source->options().highpass_filter);
+  EXPECT_EQ(false, source->options().highpass_filter);
 }
 
 TEST(LocalAudioSourceTest, InitWithAudioOptions) {
   cricket::AudioOptions audio_options;
-  audio_options.highpass_filter = rtc::Optional<bool>(true);
+  audio_options.highpass_filter = true;
   rtc::scoped_refptr<LocalAudioSource> source =
       LocalAudioSource::Create(&audio_options);
-  EXPECT_EQ(rtc::Optional<bool>(true), source->options().highpass_filter);
+  EXPECT_EQ(true, source->options().highpass_filter);
 }
 
 TEST(LocalAudioSourceTest, InitWithNoOptions) {
   rtc::scoped_refptr<LocalAudioSource> source =
       LocalAudioSource::Create((cricket::AudioOptions*)nullptr);
-  EXPECT_EQ(rtc::Optional<bool>(), source->options().highpass_filter);
+  EXPECT_EQ(rtc::nullopt, source->options().highpass_filter);
 }
diff --git a/pc/mediaconstraintsinterface_unittest.cc b/pc/mediaconstraintsinterface_unittest.cc
index 21c547a..882d097 100644
--- a/pc/mediaconstraintsinterface_unittest.cc
+++ b/pc/mediaconstraintsinterface_unittest.cc
@@ -62,7 +62,7 @@
   // values that are already present.
   constraints = FakeConstraints();
   configuration = old_configuration;
-  configuration.enable_dtls_srtp = rtc::Optional<bool>(true);
+  configuration.enable_dtls_srtp = true;
   configuration.audio_jitter_buffer_max_packets = 34;
   CopyConstraintsIntoRtcConfiguration(&constraints, &configuration);
   EXPECT_EQ(34, configuration.audio_jitter_buffer_max_packets);
diff --git a/pc/rtpsender.cc b/pc/rtpsender.cc
index 2f9bf0c..f5f8a71 100644
--- a/pc/rtpsender.cc
+++ b/pc/rtpsender.cc
@@ -452,17 +452,17 @@
   cricket::VideoOptions options;
   VideoTrackSourceInterface* source = track_->GetSource();
   if (source) {
-    options.is_screencast = rtc::Optional<bool>(source->is_screencast());
+    options.is_screencast = source->is_screencast();
     options.video_noise_reduction = source->needs_denoising();
   }
   switch (cached_track_content_hint_) {
     case VideoTrackInterface::ContentHint::kNone:
       break;
     case VideoTrackInterface::ContentHint::kFluid:
-      options.is_screencast = rtc::Optional<bool>(false);
+      options.is_screencast = false;
       break;
     case VideoTrackInterface::ContentHint::kDetailed:
-      options.is_screencast = rtc::Optional<bool>(true);
+      options.is_screencast = true;
       break;
   }
   if (!channel_->SetVideoSend(ssrc_, track_->enabled(), &options, track_)) {
diff --git a/pc/rtpsenderreceiver_unittest.cc b/pc/rtpsenderreceiver_unittest.cc
index 7ea4d4c..f5b06d1 100644
--- a/pc/rtpsenderreceiver_unittest.cc
+++ b/pc/rtpsenderreceiver_unittest.cc
@@ -295,12 +295,11 @@
 // Test that the AudioRtpSender applies options from the local audio source.
 TEST_F(RtpSenderReceiverTest, LocalAudioSourceOptionsApplied) {
   cricket::AudioOptions options;
-  options.echo_cancellation = rtc::Optional<bool>(true);
+  options.echo_cancellation = true;
   auto source = LocalAudioSource::Create(&options);
   CreateAudioRtpSender(source.get());
 
-  EXPECT_EQ(rtc::Optional<bool>(true),
-            voice_media_channel_->options().echo_cancellation);
+  EXPECT_EQ(true, voice_media_channel_->options().echo_cancellation);
 
   DestroyAudioRtpSender();
 }
@@ -569,18 +568,18 @@
   webrtc::RtpParameters params = audio_rtp_sender_->GetParameters();
   EXPECT_EQ(1, params.encodings.size());
   EXPECT_FALSE(params.encodings[0].max_bitrate_bps);
-  params.encodings[0].max_bitrate_bps = rtc::Optional<int>(1000);
+  params.encodings[0].max_bitrate_bps = 1000;
   EXPECT_TRUE(audio_rtp_sender_->SetParameters(params));
 
   // Read back the parameters and verify they have been changed.
   params = audio_rtp_sender_->GetParameters();
   EXPECT_EQ(1, params.encodings.size());
-  EXPECT_EQ(rtc::Optional<int>(1000), params.encodings[0].max_bitrate_bps);
+  EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
 
   // Verify that the audio channel received the new parameters.
   params = voice_media_channel_->GetRtpSendParameters(kAudioSsrc);
   EXPECT_EQ(1, params.encodings.size());
-  EXPECT_EQ(rtc::Optional<int>(1000), params.encodings[0].max_bitrate_bps);
+  EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
 
   // Verify that the global bitrate limit has not been changed.
   EXPECT_EQ(-1, voice_media_channel_->max_bps());
@@ -605,18 +604,18 @@
   webrtc::RtpParameters params = video_rtp_sender_->GetParameters();
   EXPECT_EQ(1, params.encodings.size());
   EXPECT_FALSE(params.encodings[0].max_bitrate_bps);
-  params.encodings[0].max_bitrate_bps = rtc::Optional<int>(1000);
+  params.encodings[0].max_bitrate_bps = 1000;
   EXPECT_TRUE(video_rtp_sender_->SetParameters(params));
 
   // Read back the parameters and verify they have been changed.
   params = video_rtp_sender_->GetParameters();
   EXPECT_EQ(1, params.encodings.size());
-  EXPECT_EQ(rtc::Optional<int>(1000), params.encodings[0].max_bitrate_bps);
+  EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
 
   // Verify that the video channel received the new parameters.
   params = video_media_channel_->GetRtpSendParameters(kVideoSsrc);
   EXPECT_EQ(1, params.encodings.size());
-  EXPECT_EQ(rtc::Optional<int>(1000), params.encodings[0].max_bitrate_bps);
+  EXPECT_EQ(1000, params.encodings[0].max_bitrate_bps);
 
   // Verify that the global bitrate limit has not been changed.
   EXPECT_EQ(-1, video_media_channel_->max_bps());
@@ -652,24 +651,20 @@
   video_track_->set_enabled(true);
 
   // |video_track_| is not screencast by default.
-  EXPECT_EQ(rtc::Optional<bool>(false),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(false, video_media_channel_->options().is_screencast);
   // No content hint should be set by default.
   EXPECT_EQ(VideoTrackInterface::ContentHint::kNone,
             video_track_->content_hint());
   // Setting detailed should turn a non-screencast source into screencast mode.
   video_track_->set_content_hint(VideoTrackInterface::ContentHint::kDetailed);
-  EXPECT_EQ(rtc::Optional<bool>(true),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(true, video_media_channel_->options().is_screencast);
   // Removing the content hint should turn the track back into non-screencast
   // mode.
   video_track_->set_content_hint(VideoTrackInterface::ContentHint::kNone);
-  EXPECT_EQ(rtc::Optional<bool>(false),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(false, video_media_channel_->options().is_screencast);
   // Setting fluid should remain in non-screencast mode (its default).
   video_track_->set_content_hint(VideoTrackInterface::ContentHint::kFluid);
-  EXPECT_EQ(rtc::Optional<bool>(false),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(false, video_media_channel_->options().is_screencast);
 
   DestroyVideoRtpSender();
 }
@@ -683,23 +678,19 @@
   video_track_->set_enabled(true);
 
   // |video_track_| with a screencast source should be screencast by default.
-  EXPECT_EQ(rtc::Optional<bool>(true),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(true, video_media_channel_->options().is_screencast);
   // No content hint should be set by default.
   EXPECT_EQ(VideoTrackInterface::ContentHint::kNone,
             video_track_->content_hint());
   // Setting fluid should turn a screencast source into non-screencast mode.
   video_track_->set_content_hint(VideoTrackInterface::ContentHint::kFluid);
-  EXPECT_EQ(rtc::Optional<bool>(false),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(false, video_media_channel_->options().is_screencast);
   // Removing the content hint should turn the track back into screencast mode.
   video_track_->set_content_hint(VideoTrackInterface::ContentHint::kNone);
-  EXPECT_EQ(rtc::Optional<bool>(true),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(true, video_media_channel_->options().is_screencast);
   // Setting detailed should still remain in screencast mode (its default).
   video_track_->set_content_hint(VideoTrackInterface::ContentHint::kDetailed);
-  EXPECT_EQ(rtc::Optional<bool>(true),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(true, video_media_channel_->options().is_screencast);
 
   DestroyVideoRtpSender();
 }
@@ -718,20 +709,17 @@
   video_track_->set_enabled(true);
 
   // Sender is not ready to send (no SSRC) so no option should have been set.
-  EXPECT_EQ(rtc::Optional<bool>(),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(rtc::nullopt, video_media_channel_->options().is_screencast);
 
   // Verify that the content hint is accounted for when video_rtp_sender_ does
   // get enabled.
   video_rtp_sender_->SetSsrc(kVideoSsrc);
-  EXPECT_EQ(rtc::Optional<bool>(true),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(true, video_media_channel_->options().is_screencast);
 
   // And removing the hint should go back to false (to verify that false was
   // default correctly).
   video_track_->set_content_hint(VideoTrackInterface::ContentHint::kNone);
-  EXPECT_EQ(rtc::Optional<bool>(false),
-            video_media_channel_->options().is_screencast);
+  EXPECT_EQ(false, video_media_channel_->options().is_screencast);
 
   DestroyVideoRtpSender();
 }
diff --git a/pc/srtpfilter.cc b/pc/srtpfilter.cc
index a0dee64..157fdeb 100644
--- a/pc/srtpfilter.cc
+++ b/pc/srtpfilter.cc
@@ -164,8 +164,8 @@
   offer_params_.clear();
   applied_send_params_ = CryptoParams();
   applied_recv_params_ = CryptoParams();
-  send_cipher_suite_ = rtc::Optional<int>();
-  recv_cipher_suite_ = rtc::Optional<int>();
+  send_cipher_suite_ = rtc::nullopt;
+  recv_cipher_suite_ = rtc::nullopt;
   send_key_.Clear();
   recv_key_.Clear();
   state_ = ST_INIT;
@@ -181,8 +181,7 @@
     return true;
   }
 
-  send_cipher_suite_ = rtc::Optional<int>(
-      rtc::SrtpCryptoSuiteFromName(send_params.cipher_suite));
+  send_cipher_suite_ = rtc::SrtpCryptoSuiteFromName(send_params.cipher_suite);
   if (send_cipher_suite_ == rtc::SRTP_INVALID_CRYPTO_SUITE) {
     RTC_LOG(LS_WARNING) << "Unknown crypto suite(s) received:"
                         << " send cipher_suite " << send_params.cipher_suite;
@@ -211,8 +210,7 @@
     return true;
   }
 
-  recv_cipher_suite_ = rtc::Optional<int>(
-      rtc::SrtpCryptoSuiteFromName(recv_params.cipher_suite));
+  recv_cipher_suite_ = rtc::SrtpCryptoSuiteFromName(recv_params.cipher_suite);
   if (recv_cipher_suite_ == rtc::SRTP_INVALID_CRYPTO_SUITE) {
     RTC_LOG(LS_WARNING) << "Unknown crypto suite(s) received:"
                         << " recv cipher_suite " << recv_params.cipher_suite;
diff --git a/pc/statscollector_unittest.cc b/pc/statscollector_unittest.cc
index d5bc0ff..d65e3a6 100644
--- a/pc/statscollector_unittest.cc
+++ b/pc/statscollector_unittest.cc
@@ -512,20 +512,13 @@
   voice_sender_info->echo_delay_std_ms = 111;
   voice_sender_info->aec_quality_min = 112.0f;
   voice_sender_info->typing_noise_detected = false;
-  voice_sender_info->ana_statistics.bitrate_action_counter =
-      rtc::Optional<uint32_t>(113);
-  voice_sender_info->ana_statistics.channel_action_counter =
-      rtc::Optional<uint32_t>(114);
-  voice_sender_info->ana_statistics.dtx_action_counter =
-      rtc::Optional<uint32_t>(115);
-  voice_sender_info->ana_statistics.fec_action_counter =
-      rtc::Optional<uint32_t>(116);
-  voice_sender_info->ana_statistics.frame_length_increase_counter =
-      rtc::Optional<uint32_t>(117);
-  voice_sender_info->ana_statistics.frame_length_decrease_counter =
-      rtc::Optional<uint32_t>(118);
-  voice_sender_info->ana_statistics.uplink_packet_loss_fraction =
-      rtc::Optional<float>(119.0);
+  voice_sender_info->ana_statistics.bitrate_action_counter = 113;
+  voice_sender_info->ana_statistics.channel_action_counter = 114;
+  voice_sender_info->ana_statistics.dtx_action_counter = 115;
+  voice_sender_info->ana_statistics.fec_action_counter = 116;
+  voice_sender_info->ana_statistics.frame_length_increase_counter = 117;
+  voice_sender_info->ana_statistics.frame_length_decrease_counter = 118;
+  voice_sender_info->ana_statistics.uplink_packet_loss_fraction = 119.0;
 }
 
 void UpdateVoiceSenderInfoFromAudioTrack(
@@ -2112,7 +2105,7 @@
   // Construct a stats value to read.
   video_sender_info.add_ssrc(1234);
   video_sender_info.frames_encoded = 10;
-  video_sender_info.qp_sum = rtc::Optional<uint64_t>(11);
+  video_sender_info.qp_sum = 11;
   stats_read.senders.push_back(video_sender_info);
 
   EXPECT_CALL(pc_, video_channel()).WillRepeatedly(Return(&video_channel));
@@ -2159,7 +2152,7 @@
   // Construct a stats value to read.
   video_receiver_info.add_ssrc(1234);
   video_receiver_info.frames_decoded = 10;
-  video_receiver_info.qp_sum = rtc::Optional<uint64_t>(11);
+  video_receiver_info.qp_sum = 11;
   stats_read.receivers.push_back(video_receiver_info);
 
   EXPECT_CALL(pc_, video_channel()).WillRepeatedly(Return(&video_channel));
diff --git a/pc/trackmediainfomap_unittest.cc b/pc/trackmediainfomap_unittest.cc
index 9f25646..65e75c4 100644
--- a/pc/trackmediainfomap_unittest.cc
+++ b/pc/trackmediainfomap_unittest.cc
@@ -35,7 +35,7 @@
   RtpParameters params;
   for (uint32_t ssrc : ssrcs) {
     RtpEncodingParameters encoding_params;
-    encoding_params.ssrc = rtc::Optional<uint32_t>(ssrc);
+    encoding_params.ssrc = ssrc;
     params.encodings.push_back(encoding_params);
   }
   return params;
diff --git a/pc/videocapturertracksource.cc b/pc/videocapturertracksource.cc
index 93654e8..bbfb334 100644
--- a/pc/videocapturertracksource.cc
+++ b/pc/videocapturertracksource.cc
@@ -246,7 +246,7 @@
   size_t mandatory = 0;
   bool value;
   if (FindConstraint(all_constraints, key, &value, &mandatory)) {
-    *option = rtc::Optional<bool>(value);
+    *option = value;
     return true;
   }
 
diff --git a/pc/videocapturertracksource_unittest.cc b/pc/videocapturertracksource_unittest.cc
index a492643..819a722 100644
--- a/pc/videocapturertracksource_unittest.cc
+++ b/pc/videocapturertracksource_unittest.cc
@@ -312,13 +312,13 @@
 
   CreateVideoCapturerSource(&constraints);
 
-  EXPECT_EQ(rtc::Optional<bool>(false), source_->needs_denoising());
+  EXPECT_EQ(false, source_->needs_denoising());
 }
 
 TEST_F(VideoCapturerTrackSourceTest, NoiseReductionConstraintNotSet) {
   FakeConstraints constraints;
   CreateVideoCapturerSource(&constraints);
-  EXPECT_EQ(rtc::Optional<bool>(), source_->needs_denoising());
+  EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
 }
 
 TEST_F(VideoCapturerTrackSourceTest,
@@ -329,7 +329,7 @@
 
   CreateVideoCapturerSource(&constraints);
 
-  EXPECT_EQ(rtc::Optional<bool>(false), source_->needs_denoising());
+  EXPECT_EQ(false, source_->needs_denoising());
 }
 
 TEST_F(VideoCapturerTrackSourceTest, NoiseReductionAndInvalidKeyOptional) {
@@ -341,7 +341,7 @@
 
   EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
                  kMaxWaitMs);
-  EXPECT_EQ(rtc::Optional<bool>(true), source_->needs_denoising());
+  EXPECT_EQ(true, source_->needs_denoising());
 }
 
 TEST_F(VideoCapturerTrackSourceTest, NoiseReductionAndInvalidKeyMandatory) {
@@ -353,7 +353,7 @@
 
   EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
                  kMaxWaitMs);
-  EXPECT_EQ(rtc::Optional<bool>(), source_->needs_denoising());
+  EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
 }
 
 TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueOptional) {
@@ -366,7 +366,7 @@
   EXPECT_EQ_WAIT(MediaSourceInterface::kLive, state_observer_->state(),
                  kMaxWaitMs);
 
-  EXPECT_EQ(rtc::Optional<bool>(), source_->needs_denoising());
+  EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
 }
 
 TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueMandatory) {
@@ -380,7 +380,7 @@
 
   EXPECT_EQ_WAIT(MediaSourceInterface::kEnded, state_observer_->state(),
                  kMaxWaitMs);
-  EXPECT_EQ(rtc::Optional<bool>(), source_->needs_denoising());
+  EXPECT_EQ(rtc::nullopt, source_->needs_denoising());
 }
 
 TEST_F(VideoCapturerTrackSourceTest, MixedOptionsAndConstraints) {
@@ -401,7 +401,7 @@
   EXPECT_EQ(288, format->height);
   EXPECT_EQ(5, format->framerate());
 
-  EXPECT_EQ(rtc::Optional<bool>(false), source_->needs_denoising());
+  EXPECT_EQ(false, source_->needs_denoising());
 }
 
 // Tests that the source starts video with the default resolution for
diff --git a/pc/videotracksource.h b/pc/videotracksource.h
index 3ab5909..6dacf37 100644
--- a/pc/videotracksource.h
+++ b/pc/videotracksource.h
@@ -33,8 +33,7 @@
   bool remote() const override { return remote_; }
 
   bool is_screencast() const override { return false; }
-  rtc::Optional<bool> needs_denoising() const override {
-    return rtc::Optional<bool>(); }
+  rtc::Optional<bool> needs_denoising() const override { return rtc::nullopt; }
 
   bool GetStats(Stats* stats) override { return false; }
 
diff --git a/pc/webrtcsessiondescriptionfactory.cc b/pc/webrtcsessiondescriptionfactory.cc
index 8154c89..18e9ba0 100644
--- a/pc/webrtcsessiondescriptionfactory.cc
+++ b/pc/webrtcsessiondescriptionfactory.cc
@@ -175,8 +175,8 @@
 
     // Request certificate. This happens asynchronously, so that the caller gets
     // a chance to connect to |SignalCertificateReady|.
-    cert_generator_->GenerateCertificateAsync(
-        key_params, rtc::Optional<uint64_t>(), callback);
+    cert_generator_->GenerateCertificateAsync(key_params, rtc::nullopt,
+                                              callback);
   }
 }