Optional: Use nullopt and implicit construction in /common_video
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. R=magjed@webrtc.org Bug: None Change-Id: I0eddc997560894dc661f521f6096e2d834216cee Reviewed-on: https://webrtc-review.googlesource.com/23608 Reviewed-by: Magnus Jedvert <magjed@webrtc.org> Commit-Queue: Oskar Sundbom <ossu@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20895}
This commit is contained in:
parent
9299642fd0
commit
92016ce5a4
@ -44,7 +44,7 @@ H264BitstreamParser::Result H264BitstreamParser::ParseNonParameterSetNalu(
|
||||
if (!sps_ || !pps_)
|
||||
return kInvalidStream;
|
||||
|
||||
last_slice_qp_delta_ = rtc::Optional<int32_t>();
|
||||
last_slice_qp_delta_ = rtc::nullopt;
|
||||
const std::vector<uint8_t> slice_rbsp =
|
||||
H264::ParseRbsp(source, source_length);
|
||||
if (slice_rbsp.size() < H264::kNaluTypeSize)
|
||||
@ -262,7 +262,7 @@ H264BitstreamParser::Result H264BitstreamParser::ParseNonParameterSetNalu(
|
||||
return kInvalidStream;
|
||||
}
|
||||
|
||||
last_slice_qp_delta_ = rtc::Optional<int32_t>(last_slice_qp_delta);
|
||||
last_slice_qp_delta_ = last_slice_qp_delta;
|
||||
return kOk;
|
||||
}
|
||||
|
||||
|
||||
@ -17,9 +17,9 @@
|
||||
#include "rtc_base/bitbuffer.h"
|
||||
#include "rtc_base/logging.h"
|
||||
|
||||
#define RETURN_EMPTY_ON_FAIL(x) \
|
||||
if (!(x)) { \
|
||||
return rtc::Optional<PpsParser::PpsState>(); \
|
||||
#define RETURN_EMPTY_ON_FAIL(x) \
|
||||
if (!(x)) { \
|
||||
return rtc::nullopt; \
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -65,15 +65,15 @@ rtc::Optional<uint32_t> PpsParser::ParsePpsIdFromSlice(const uint8_t* data,
|
||||
uint32_t golomb_tmp;
|
||||
// first_mb_in_slice: ue(v)
|
||||
if (!slice_reader.ReadExponentialGolomb(&golomb_tmp))
|
||||
return rtc::Optional<uint32_t>();
|
||||
return rtc::nullopt;
|
||||
// slice_type: ue(v)
|
||||
if (!slice_reader.ReadExponentialGolomb(&golomb_tmp))
|
||||
return rtc::Optional<uint32_t>();
|
||||
return rtc::nullopt;
|
||||
// pic_parameter_set_id: ue(v)
|
||||
uint32_t slice_pps_id;
|
||||
if (!slice_reader.ReadExponentialGolomb(&slice_pps_id))
|
||||
return rtc::Optional<uint32_t>();
|
||||
return rtc::Optional<uint32_t>(slice_pps_id);
|
||||
return rtc::nullopt;
|
||||
return slice_pps_id;
|
||||
}
|
||||
|
||||
rtc::Optional<PpsParser::PpsState> PpsParser::ParseInternal(
|
||||
@ -183,7 +183,7 @@ rtc::Optional<PpsParser::PpsState> PpsParser::ParseInternal(
|
||||
RETURN_EMPTY_ON_FAIL(
|
||||
bit_buffer->ReadBits(&pps.redundant_pic_cnt_present_flag, 1));
|
||||
|
||||
return rtc::Optional<PpsParser::PpsState>(pps);
|
||||
return pps;
|
||||
}
|
||||
|
||||
bool PpsParser::ParsePpsIdsInternal(rtc::BitBuffer* bit_buffer,
|
||||
|
||||
@ -77,8 +77,7 @@ rtc::Optional<VideoFrame> VideoRenderFrames::FrameToRender() {
|
||||
rtc::Optional<VideoFrame> render_frame;
|
||||
// Get the newest frame that can be released for rendering.
|
||||
while (!incoming_frames_.empty() && TimeToNextFrameRelease() <= 0) {
|
||||
render_frame =
|
||||
rtc::Optional<VideoFrame>(std::move(incoming_frames_.front()));
|
||||
render_frame = std::move(incoming_frames_.front());
|
||||
incoming_frames_.pop_front();
|
||||
}
|
||||
return render_frame;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user