From 108f20fd45eab34e14435160b9fd779569ce4a10 Mon Sep 17 00:00:00 2001 From: Johannes Kron Date: Thu, 7 Feb 2019 16:42:45 +0100 Subject: [PATCH] Fix color space bug in wrapper of H264 decoder Bug: none Change-Id: I8309e5e3c177ae75712fa257e083ea2018a1f8e2 Reviewed-on: https://webrtc-review.googlesource.com/c/121760 Commit-Queue: Johannes Kron Reviewed-by: Ilya Nikolaevskiy Cr-Commit-Position: refs/heads/master@{#26597} --- modules/video_coding/BUILD.gn | 4 ++++ modules/video_coding/codecs/h264/h264_decoder_impl.cc | 4 ++-- modules/video_coding/codecs/h264/test/h264_impl_unittest.cc | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/video_coding/BUILD.gn b/modules/video_coding/BUILD.gn index 75ee497cff..aded52965e 100644 --- a/modules/video_coding/BUILD.gn +++ b/modules/video_coding/BUILD.gn @@ -760,6 +760,10 @@ if (rtc_include_tests) { rtc_source_set("video_coding_modules_tests") { testonly = true + defines = [] + if (rtc_use_h264) { + defines += [ "WEBRTC_USE_H264" ] + } sources = [ "codecs/h264/test/h264_impl_unittest.cc", diff --git a/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/modules/video_coding/codecs/h264/h264_decoder_impl.cc index 73190d1a65..e5d31ed34d 100644 --- a/modules/video_coding/codecs/h264/h264_decoder_impl.cc +++ b/modules/video_coding/codecs/h264/h264_decoder_impl.cc @@ -304,8 +304,8 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image, // Pass on color space from input frame if explicitly specified. const ColorSpace& color_space = - input_frame->color_space() ? *input_frame->color_space() - : ExtractH264ColorSpace(av_context_.get()); + input_image.ColorSpace() ? *input_image.ColorSpace() + : ExtractH264ColorSpace(av_context_.get()); VideoFrame decoded_frame = VideoFrame::Builder() .set_video_frame_buffer(input_frame->video_frame_buffer()) diff --git a/modules/video_coding/codecs/h264/test/h264_impl_unittest.cc b/modules/video_coding/codecs/h264/test/h264_impl_unittest.cc index f93c463033..e1788644bb 100644 --- a/modules/video_coding/codecs/h264/test/h264_impl_unittest.cc +++ b/modules/video_coding/codecs/h264/test/h264_impl_unittest.cc @@ -84,7 +84,7 @@ TEST_F(TestH264Impl, MAYBE_EncodeDecode) { EXPECT_EQ(ColorSpace::PrimaryID::kUnspecified, color_space.primaries()); EXPECT_EQ(ColorSpace::TransferID::kUnspecified, color_space.transfer()); EXPECT_EQ(ColorSpace::MatrixID::kUnspecified, color_space.matrix()); - EXPECT_EQ(ColorSpace::RangeID::kLimited, color_space.range()); + EXPECT_EQ(ColorSpace::RangeID::kInvalid, color_space.range()); EXPECT_EQ(ColorSpace::ChromaSiting::kUnspecified, color_space.chroma_siting_horizontal()); EXPECT_EQ(ColorSpace::ChromaSiting::kUnspecified,