diff --git a/modules/video_coding/codecs/test/videoprocessor.cc b/modules/video_coding/codecs/test/videoprocessor.cc index 5e20615b5d..20cb0cffbd 100644 --- a/modules/video_coding/codecs/test/videoprocessor.cc +++ b/modules/video_coding/codecs/test/videoprocessor.cc @@ -47,7 +47,7 @@ std::unique_ptr CreateBitrateAllocator( rtc::Optional GetMaxNaluLength(const EncodedImage& encoded_frame, const TestConfig& config) { if (config.codec_settings.codecType != kVideoCodecH264) - return rtc::Optional(); + return rtc::nullopt; std::vector nalu_indices = webrtc::H264::FindNaluIndices(encoded_frame._buffer, @@ -59,7 +59,7 @@ rtc::Optional 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(max_length); + return max_length; } int GetElapsedTimeMicroseconds(int64_t start_ns, int64_t stop_ns) { diff --git a/modules/video_coding/codecs/vp8/screenshare_layers_unittest.cc b/modules/video_coding/codecs/vp8/screenshare_layers_unittest.cc index 988c1b3a95..754235ab0b 100644 --- a/modules/video_coding/codecs/vp8/screenshare_layers_unittest.cc +++ b/modules/video_coding/codecs/vp8/screenshare_layers_unittest.cc @@ -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()); + 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(true))); + EXPECT_EQ(kTl1SyncFlags, SkipUntilTlAndSync(1, true)); ASSERT_TRUE(vp8_info_.layerSync); // Simulate overshoot of this frame. diff --git a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc index 015485f23e..5d6abec76d 100644 --- a/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc +++ b/modules/video_coding/codecs/vp8/test/vp8_impl_unittest.cc @@ -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(frame); + frame_ = frame; qp_ = qp; complete_ = true; } diff --git a/modules/video_coding/codecs/vp8/vp8_impl.cc b/modules/video_coding/codecs/vp8/vp8_impl.cc index 107618fc66..9e89696d46 100644 --- a/modules/video_coding/codecs/vp8/vp8_impl.cc +++ b/modules/video_coding/codecs/vp8/vp8_impl.cc @@ -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(), - rtc::Optional(qp)); + decode_complete_callback_->Decoded(decoded_image, rtc::nullopt, qp); return WEBRTC_VIDEO_CODEC_OK; } diff --git a/modules/video_coding/codecs/vp9/vp9_impl.cc b/modules/video_coding/codecs/vp9/vp9_impl.cc index 7c69dfd619..5fa45370a5 100644 --- a/modules/video_coding/codecs/vp9/vp9_impl.cc +++ b/modules/video_coding/codecs/vp9/vp9_impl.cc @@ -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(), - rtc::Optional(qp)); + decode_complete_callback_->Decoded(decoded_image, rtc::nullopt, qp); return WEBRTC_VIDEO_CODEC_OK; } diff --git a/modules/video_coding/frame_object.cc b/modules/video_coding/frame_object.cc index 72dd70e5e6..6a31cfd9b6 100644 --- a/modules/video_coding/frame_object.cc +++ b/modules/video_coding/frame_object.cc @@ -167,8 +167,8 @@ rtc::Optional RtpFrameObject::GetCodecHeader() const { rtc::CritScope lock(&packet_buffer_->crit_); VCMPacket* packet = packet_buffer_->GetPacket(first_seq_num_); if (!packet) - return rtc::Optional(); - return rtc::Optional(packet->video_header.codecHeader); + return rtc::nullopt; + return packet->video_header.codecHeader; } } // namespace video_coding diff --git a/modules/video_coding/generic_decoder.cc b/modules/video_coding/generic_decoder.cc index f3af20c19b..a7d6a85b90 100644 --- a/modules/video_coding/generic_decoder.cc +++ b/modules/video_coding/generic_decoder.cc @@ -58,8 +58,8 @@ int32_t VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, int64_t decode_time_ms) { Decoded(decodedImage, decode_time_ms >= 0 ? rtc::Optional(decode_time_ms) - : rtc::Optional(), - rtc::Optional()); + : rtc::nullopt, + rtc::nullopt); return WEBRTC_VIDEO_CODEC_OK; } @@ -85,8 +85,7 @@ void VCMDecodedFrameCallback::Decoded(VideoFrame& decodedImage, const int64_t now_ms = _clock->TimeInMilliseconds(); if (!decode_time_ms) { - decode_time_ms = - rtc::Optional(now_ms - frameInfo->decodeStartTimeMs); + decode_time_ms = now_ms - frameInfo->decodeStartTimeMs; } _timing->StopDecodeTimer(decodedImage.timestamp(), *decode_time_ms, now_ms, frameInfo->renderTimeMs); diff --git a/modules/video_coding/packet_buffer.cc b/modules/video_coding/packet_buffer.cc index bf830833ed..9b3d93e658 100644 --- a/modules/video_coding/packet_buffer.cc +++ b/modules/video_coding/packet_buffer.cc @@ -116,9 +116,9 @@ bool PacketBuffer::InsertPacket(VCMPacket* packet) { UpdateMissingPackets(packet->seqNum); int64_t now_ms = clock_->TimeInMilliseconds(); - last_received_packet_ms_ = rtc::Optional(now_ms); + last_received_packet_ms_ = now_ms; if (packet->frameType == kVideoFrameKey) - last_received_keyframe_packet_ms_ = rtc::Optional(now_ms); + last_received_keyframe_packet_ms_ = now_ms; found_frames = FindFrames(seq_num); } @@ -458,7 +458,7 @@ int PacketBuffer::Release() const { void PacketBuffer::UpdateMissingPackets(uint16_t seq_num) { if (!newest_inserted_seq_num_) - newest_inserted_seq_num_ = rtc::Optional(seq_num); + newest_inserted_seq_num_ = seq_num; const int kMaxPaddingAge = 1000; if (AheadOf(seq_num, *newest_inserted_seq_num_)) { diff --git a/modules/video_coding/utility/moving_average.cc b/modules/video_coding/utility/moving_average.cc index d72c465a0d..8076f93476 100644 --- a/modules/video_coding/utility/moving_average.cc +++ b/modules/video_coding/utility/moving_average.cc @@ -28,9 +28,9 @@ rtc::Optional MovingAverage::GetAverage() const { rtc::Optional MovingAverage::GetAverage(size_t num_samples) const { if (num_samples > size() || num_samples == 0) - return rtc::Optional(); + return rtc::nullopt; int sum = sum_ - sum_history_[(count_ - num_samples) % sum_history_.size()]; - return rtc::Optional(sum / static_cast(num_samples)); + return sum / static_cast(num_samples); } void MovingAverage::Reset() {