Optional: Use nullopt and implicit construction in /test
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 Bug: None Change-Id: Ifca0183c2675a8d4e74c21b86f1724d9b2c01f5d Reviewed-on: https://webrtc-review.googlesource.com/23579 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Oskar Sundbom <ossu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21580}
This commit is contained in:
parent
1db508352c
commit
3f6804d140
@ -218,9 +218,8 @@ void CallTest::CreateAudioAndFecSendConfigs(size_t num_audio_streams,
|
|||||||
if (num_audio_streams > 0) {
|
if (num_audio_streams > 0) {
|
||||||
audio_send_config_ = AudioSendStream::Config(send_transport);
|
audio_send_config_ = AudioSendStream::Config(send_transport);
|
||||||
audio_send_config_.rtp.ssrc = kAudioSendSsrc;
|
audio_send_config_.rtp.ssrc = kAudioSendSsrc;
|
||||||
audio_send_config_.send_codec_spec =
|
audio_send_config_.send_codec_spec = AudioSendStream::Config::SendCodecSpec(
|
||||||
rtc::Optional<AudioSendStream::Config::SendCodecSpec>(
|
kAudioSendPayloadType, {"opus", 48000, 2, {{"stereo", "1"}}});
|
||||||
{kAudioSendPayloadType, {"opus", 48000, 2, {{"stereo", "1"}}}});
|
|
||||||
audio_send_config_.encoder_factory = encoder_factory_;
|
audio_send_config_.encoder_factory = encoder_factory_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -336,13 +336,13 @@ class ScrollingImageFrameGenerator : public FrameGenerator {
|
|||||||
int offset_v = (i420_buffer->StrideV() * (pixels_scrolled_y / 2)) +
|
int offset_v = (i420_buffer->StrideV() * (pixels_scrolled_y / 2)) +
|
||||||
(pixels_scrolled_x / 2);
|
(pixels_scrolled_x / 2);
|
||||||
|
|
||||||
current_frame_ = rtc::Optional<webrtc::VideoFrame>(webrtc::VideoFrame(
|
current_frame_ = webrtc::VideoFrame(
|
||||||
new rtc::RefCountedObject<webrtc::WrappedI420Buffer>(
|
new rtc::RefCountedObject<webrtc::WrappedI420Buffer>(
|
||||||
target_width_, target_height_, &i420_buffer->DataY()[offset_y],
|
target_width_, target_height_, &i420_buffer->DataY()[offset_y],
|
||||||
i420_buffer->StrideY(), &i420_buffer->DataU()[offset_u],
|
i420_buffer->StrideY(), &i420_buffer->DataU()[offset_u],
|
||||||
i420_buffer->StrideU(), &i420_buffer->DataV()[offset_v],
|
i420_buffer->StrideU(), &i420_buffer->DataV()[offset_v],
|
||||||
i420_buffer->StrideV(), KeepRefUntilDone(i420_buffer)),
|
i420_buffer->StrideV(), KeepRefUntilDone(i420_buffer)),
|
||||||
kVideoRotation_0, 0));
|
kVideoRotation_0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Clock* const clock_;
|
Clock* const clock_;
|
||||||
|
|||||||
@ -51,7 +51,7 @@ class MockAudioEncoderFactory : public AudioEncoderFactory {
|
|||||||
ON_CALL(*factory.get(), GetSupportedEncoders())
|
ON_CALL(*factory.get(), GetSupportedEncoders())
|
||||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||||
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
||||||
.WillByDefault(Return(rtc::Optional<AudioCodecInfo>()));
|
.WillByDefault(Return(rtc::nullopt));
|
||||||
|
|
||||||
EXPECT_CALL(*factory.get(), GetSupportedEncoders()).Times(AnyNumber());
|
EXPECT_CALL(*factory.get(), GetSupportedEncoders()).Times(AnyNumber());
|
||||||
EXPECT_CALL(*factory.get(), QueryAudioEncoder(_)).Times(AnyNumber());
|
EXPECT_CALL(*factory.get(), QueryAudioEncoder(_)).Times(AnyNumber());
|
||||||
@ -74,7 +74,7 @@ class MockAudioEncoderFactory : public AudioEncoderFactory {
|
|||||||
ON_CALL(*factory.get(), GetSupportedEncoders())
|
ON_CALL(*factory.get(), GetSupportedEncoders())
|
||||||
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
.WillByDefault(Return(std::vector<webrtc::AudioCodecSpec>()));
|
||||||
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
ON_CALL(*factory.get(), QueryAudioEncoder(_))
|
||||||
.WillByDefault(Return(rtc::Optional<AudioCodecInfo>()));
|
.WillByDefault(Return(rtc::nullopt));
|
||||||
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _))
|
ON_CALL(*factory.get(), MakeAudioEncoderMock(_, _, _))
|
||||||
.WillByDefault(SetArgPointee<2>(nullptr));
|
.WillByDefault(SetArgPointee<2>(nullptr));
|
||||||
|
|
||||||
|
|||||||
@ -28,7 +28,7 @@ rtc::Optional<VideoFrame> VideoCapturer::AdaptFrame(const VideoFrame& frame) {
|
|||||||
frame.width(), frame.height(), frame.timestamp_us() * 1000,
|
frame.width(), frame.height(), frame.timestamp_us() * 1000,
|
||||||
&cropped_width, &cropped_height, &out_width, &out_height)) {
|
&cropped_width, &cropped_height, &out_width, &out_height)) {
|
||||||
// Drop frame in order to respect frame rate constraint.
|
// Drop frame in order to respect frame rate constraint.
|
||||||
return rtc::Optional<VideoFrame>();
|
return rtc::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtc::Optional<VideoFrame> out_frame;
|
rtc::Optional<VideoFrame> out_frame;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user