Remove rule that discourages passing optional by const reference

include example to demonstrate:
(subjectively) increased readability
(objectively) decreased binary size

Bug: None
Change-Id: I970e668af98d98725b2d527f44169a8b7c9d2338
Reviewed-on: https://webrtc-review.googlesource.com/c/121420
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26545}
This commit is contained in:
Danil Chapovalov
2019-02-05 11:32:19 +01:00
committed by Commit Bot
parent 681de2036b
commit b769894025
14 changed files with 31 additions and 47 deletions

View File

@ -283,11 +283,12 @@ int LibvpxVp8Decoder::Decode(const EncodedImage& input_image,
return WEBRTC_VIDEO_CODEC_OK;
}
int LibvpxVp8Decoder::ReturnFrame(const vpx_image_t* img,
uint32_t timestamp,
int64_t ntp_time_ms,
int qp,
const ColorSpace* explicit_color_space) {
int LibvpxVp8Decoder::ReturnFrame(
const vpx_image_t* img,
uint32_t timestamp,
int64_t ntp_time_ms,
int qp,
const webrtc::ColorSpace* explicit_color_space) {
if (img == NULL) {
// Decoder OK and NULL image => No show frame
return WEBRTC_VIDEO_CODEC_NO_OUTPUT;

View File

@ -54,7 +54,7 @@ class LibvpxVp8Decoder : public VideoDecoder {
uint32_t timeStamp,
int64_t ntp_time_ms,
int qp,
const ColorSpace* explicit_color_space);
const webrtc::ColorSpace* explicit_color_space);
const bool use_postproc_arm_;
I420BufferPool buffer_pool_;

View File

@ -193,7 +193,7 @@ TEST_F(TestVp8Impl, EncodedColorSpaceEqualsInputColorSpace) {
VideoFrame input_frame_w_color_space =
VideoFrame::Builder()
.set_video_frame_buffer(input_frame->video_frame_buffer())
.set_color_space(&color_space)
.set_color_space(color_space)
.build();
EncodeAndWaitForFrame(input_frame_w_color_space, &encoded_frame,
@ -229,7 +229,7 @@ TEST_F(TestVp8Impl, DecodedColorSpaceEqualsEncodedColorSpace) {
// Encoded frame with explicit color space information.
ColorSpace color_space = CreateTestColorSpace(/*with_hdr_metadata=*/false);
encoded_frame.SetColorSpace(&color_space);
encoded_frame.SetColorSpace(color_space);
EXPECT_EQ(WEBRTC_VIDEO_CODEC_OK,
decoder_->Decode(encoded_frame, false, nullptr, -1));
std::unique_ptr<VideoFrame> decoded_frame;