Optional: Use nullopt and implicit construction in /modules/video_coding

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: Iedebf4dc56a973306e7d7e7649525879808dc72b
Reviewed-on: https://webrtc-review.googlesource.com/23578
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20878}
This commit is contained in:
Oskar Sundbom
2017-11-16 10:54:49 +01:00
committed by Commit Bot
parent 56d460902e
commit 6bd39025ec
9 changed files with 17 additions and 20 deletions

View File

@ -47,7 +47,7 @@ std::unique_ptr<VideoBitrateAllocator> CreateBitrateAllocator(
rtc::Optional<size_t> GetMaxNaluLength(const EncodedImage& encoded_frame,
const TestConfig& config) {
if (config.codec_settings.codecType != kVideoCodecH264)
return rtc::Optional<size_t>();
return rtc::nullopt;
std::vector<webrtc::H264::NaluIndex> nalu_indices =
webrtc::H264::FindNaluIndices(encoded_frame._buffer,
@ -59,7 +59,7 @@ rtc::Optional<size_t> GetMaxNaluLength(const EncodedImage& encoded_frame,
for (const webrtc::H264::NaluIndex& index : nalu_indices)
max_length = std::max(max_length, index.payload_size);
return rtc::Optional<size_t>(max_length);
return max_length;
}
int GetElapsedTimeMicroseconds(int64_t start_ns, int64_t stop_ns) {

View File

@ -132,7 +132,7 @@ class ScreenshareLayerTest : public ::testing::Test {
// FrameEncoded() call will be omitted and needs to be done by the caller.
// Returns the flags for the last frame.
int SkipUntilTl(int layer) {
return SkipUntilTlAndSync(layer, rtc::Optional<bool>());
return SkipUntilTlAndSync(layer, rtc::nullopt);
}
// Same as SkipUntilTl, but also waits until the sync bit condition is met.
@ -583,7 +583,7 @@ TEST_F(ScreenshareLayerTest, 2LayersSyncAtOvershootDrop) {
EXPECT_TRUE(RunGracePeriod());
// Move ahead until we have a sync frame in TL1.
EXPECT_EQ(kTl1SyncFlags, SkipUntilTlAndSync(1, rtc::Optional<bool>(true)));
EXPECT_EQ(kTl1SyncFlags, SkipUntilTlAndSync(1, true));
ASSERT_TRUE(vp8_info_.layerSync);
// Simulate overshoot of this frame.

View File

@ -108,7 +108,7 @@ class DecodedImageCallbackTestImpl : public webrtc::DecodedImageCallback {
EXPECT_GT(frame.width(), 0);
EXPECT_GT(frame.height(), 0);
EXPECT_TRUE(qp);
frame_ = rtc::Optional<VideoFrame>(frame);
frame_ = frame;
qp_ = qp;
complete_ = true;
}

View File

@ -1234,8 +1234,7 @@ int VP8DecoderImpl::ReturnFrame(const vpx_image_t* img,
VideoFrame decoded_image(buffer, timestamp, 0, kVideoRotation_0);
decoded_image.set_ntp_time_ms(ntp_time_ms);
decode_complete_callback_->Decoded(decoded_image, rtc::Optional<int32_t>(),
rtc::Optional<uint8_t>(qp));
decode_complete_callback_->Decoded(decoded_image, rtc::nullopt, qp);
return WEBRTC_VIDEO_CODEC_OK;
}

View File

@ -983,8 +983,7 @@ int VP9DecoderImpl::ReturnFrame(const vpx_image_t* img,
0 /* render_time_ms */, webrtc::kVideoRotation_0);
decoded_image.set_ntp_time_ms(ntp_time_ms);
decode_complete_callback_->Decoded(decoded_image, rtc::Optional<int32_t>(),
rtc::Optional<uint8_t>(qp));
decode_complete_callback_->Decoded(decoded_image, rtc::nullopt, qp);
return WEBRTC_VIDEO_CODEC_OK;
}