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}
This commit is contained in:
parent
10dd7ed81a
commit
36f8f3eaab
@ -1667,7 +1667,7 @@ bool VoiceChannel::SetRemoteContent_w(const MediaContentDescription* content,
|
||||
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);
|
||||
|
||||
@ -1866,7 +1866,7 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
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 @@ class ChannelTest : public testing::Test, public sigslot::has_slots<> {
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
@ -38,20 +38,20 @@ TEST(LocalAudioSourceTest, SetValidOptions) {
|
||||
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 @@ TEST(LocalAudioSourceTest, MandatoryOverridesOptional) {
|
||||
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 @@ TEST(LocalAudioSourceTest, InvalidOptional) {
|
||||
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 @@ TEST(LocalAudioSourceTest, InvalidMandatory) {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ TEST(MediaConstraintsInterface, CopyConstraintsIntoRtcConfiguration) {
|
||||
// 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);
|
||||
|
||||
@ -452,17 +452,17 @@ void VideoRtpSender::SetVideoSend() {
|
||||
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_)) {
|
||||
|
||||
@ -295,12 +295,11 @@ TEST_F(RtpSenderReceiverTest, AddAndDestroyVideoRtpReceiver) {
|
||||
// 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 @@ TEST_F(RtpSenderReceiverTest, SetAudioMaxSendBitrate) {
|
||||
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 @@ TEST_F(RtpSenderReceiverTest, SetVideoMaxSendBitrate) {
|
||||
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 @@ TEST_F(RtpSenderReceiverTest, PropagatesVideoTrackContentHint) {
|
||||
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 @@ TEST_F(RtpSenderReceiverTest,
|
||||
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 @@ TEST_F(RtpSenderReceiverTest,
|
||||
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();
|
||||
}
|
||||
|
||||
@ -164,8 +164,8 @@ bool SrtpFilter::ResetParams() {
|
||||
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 @@ bool SrtpFilter::ApplySendParams(const CryptoParams& send_params) {
|
||||
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 @@ bool SrtpFilter::ApplyRecvParams(const CryptoParams& recv_params) {
|
||||
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;
|
||||
|
||||
@ -512,20 +512,13 @@ void InitVoiceSenderInfo(cricket::VoiceSenderInfo* voice_sender_info) {
|
||||
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 @@ TEST_F(StatsCollectorTest, VerifyVideoSendSsrcStats) {
|
||||
// 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 @@ TEST_F(StatsCollectorTest, VerifyVideoReceiveSsrcStats) {
|
||||
// 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));
|
||||
|
||||
@ -35,7 +35,7 @@ RtpParameters CreateRtpParametersWithSsrcs(
|
||||
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;
|
||||
|
||||
@ -246,7 +246,7 @@ bool ExtractOption(const MediaConstraintsInterface* all_constraints,
|
||||
size_t mandatory = 0;
|
||||
bool value;
|
||||
if (FindConstraint(all_constraints, key, &value, &mandatory)) {
|
||||
*option = rtc::Optional<bool>(value);
|
||||
*option = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -312,13 +312,13 @@ TEST_F(VideoCapturerTrackSourceTest, SetValidDenoisingConstraint) {
|
||||
|
||||
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 @@ TEST_F(VideoCapturerTrackSourceTest,
|
||||
|
||||
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 @@ TEST_F(VideoCapturerTrackSourceTest, NoiseReductionAndInvalidKeyOptional) {
|
||||
|
||||
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 @@ TEST_F(VideoCapturerTrackSourceTest, NoiseReductionAndInvalidKeyMandatory) {
|
||||
|
||||
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 @@ TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueOptional) {
|
||||
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 @@ TEST_F(VideoCapturerTrackSourceTest, InvalidDenoisingValueMandatory) {
|
||||
|
||||
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 @@ TEST_F(VideoCapturerTrackSourceTest, MixedOptionsAndConstraints) {
|
||||
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
|
||||
|
||||
@ -33,8 +33,7 @@ class VideoTrackSource : public Notifier<VideoTrackSourceInterface> {
|
||||
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; }
|
||||
|
||||
|
||||
@ -175,8 +175,8 @@ WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory(
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user