summaryrefslogtreecommitdiff
path: root/chromium/media/ffmpeg
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-11-28 16:14:41 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2022-12-13 15:19:41 +0000
commit61d9742824d54be5693191fe502325a909feca59 (patch)
treecbf28e779b11338fe52eb75b915684cd8955542c /chromium/media/ffmpeg
parent45f9ded08bb7526984b24ccb5a5327aaf6821676 (diff)
downloadqtwebengine-chromium-61d9742824d54be5693191fe502325a909feca59.tar.gz
BASELINE: Update Chromium to 108.0.5359.70
Change-Id: I77334ff232b819600f275bd3cfe41fbaa3619230 Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/445904 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media/ffmpeg')
-rw-r--r--chromium/media/ffmpeg/BUILD.gn2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common.cc34
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common.h2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_common_unittest.cc2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_decoding_loop.cc2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_decoding_loop.h2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_deleters.h2
-rw-r--r--chromium/media/ffmpeg/ffmpeg_regression_tests.cc2
-rw-r--r--chromium/media/ffmpeg/scoped_av_packet.cc2
-rw-r--r--chromium/media/ffmpeg/scoped_av_packet.h2
-rw-r--r--chromium/media/ffmpeg/scoped_av_packet_unittest.cc2
11 files changed, 32 insertions, 22 deletions
diff --git a/chromium/media/ffmpeg/BUILD.gn b/chromium/media/ffmpeg/BUILD.gn
index 72a6eba4de1..1254dc85837 100644
--- a/chromium/media/ffmpeg/BUILD.gn
+++ b/chromium/media/ffmpeg/BUILD.gn
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
+# Copyright 2016 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_common.cc b/chromium/media/ffmpeg/ffmpeg_common.cc
index 9500983595f..899d7521d3a 100644
--- a/chromium/media/ffmpeg/ffmpeg_common.cc
+++ b/chromium/media/ffmpeg/ffmpeg_common.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -37,6 +37,14 @@ EncryptionScheme GetEncryptionScheme(const AVStream* stream) {
return key ? EncryptionScheme::kCenc : EncryptionScheme::kUnencrypted;
}
+VideoDecoderConfig::AlphaMode GetAlphaMode(const AVStream* stream) {
+ AVDictionaryEntry* alpha_mode =
+ av_dict_get(stream->metadata, "alpha_mode", nullptr, 0);
+ return alpha_mode && !strcmp(alpha_mode->value, "1")
+ ? VideoDecoderConfig::AlphaMode::kHasAlpha
+ : VideoDecoderConfig::AlphaMode::kIsOpaque;
+}
+
} // namespace
// Why AV_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
@@ -498,6 +506,7 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
// for now, but may not always be true forever. Fix this in the future.
gfx::Rect visible_rect(codec_context->width, codec_context->height);
gfx::Size coded_size = visible_rect.size();
+ gfx::HDRMetadata hdr_metadata;
// In some cases a container may have a DAR but no PAR, but FFmpeg translates
// everything to PAR. It is possible to get the render width and height, but I
@@ -534,6 +543,9 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
codec_context->color_range == AVCOL_RANGE_JPEG
? gfx::ColorSpace::RangeID::FULL
: gfx::ColorSpace::RangeID::LIMITED);
+
+ VideoDecoderConfig::AlphaMode alpha_mode = GetAlphaMode(stream);
+
switch (codec) {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
case VideoCodec::kH264: {
@@ -572,6 +584,8 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
// the container
color_space = hevc_config.GetColorSpace();
}
+ hdr_metadata = hevc_config.GetHDRMetadata();
+ alpha_mode = hevc_config.GetAlphaMode();
#endif // BUILDFLAG(ENABLE_HEVC_PARSER_AND_HW_DECODER)
}
}
@@ -652,9 +666,6 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
profile = ProfileIDToVideoCodecProfile(codec_context->profile);
}
- auto* alpha_mode = av_dict_get(stream->metadata, "alpha_mode", nullptr, 0);
- const bool has_alpha = alpha_mode && !strcmp(alpha_mode->value, "1");
-
void* display_matrix =
av_stream_get_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, nullptr);
@@ -707,12 +718,9 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
codec_context->extradata + codec_context->extradata_size);
}
// TODO(tmathmeyer) ffmpeg can't provide us with an actual video rotation yet.
- config->Initialize(codec, profile,
- has_alpha ? VideoDecoderConfig::AlphaMode::kHasAlpha
- : VideoDecoderConfig::AlphaMode::kIsOpaque,
- color_space, video_transformation, coded_size,
- visible_rect, natural_size, extra_data,
- GetEncryptionScheme(stream));
+ config->Initialize(codec, profile, alpha_mode, color_space,
+ video_transformation, coded_size, visible_rect,
+ natural_size, extra_data, GetEncryptionScheme(stream));
// Set the aspect ratio explicitly since our version hasn't been rounded.
config->set_aspect_ratio(aspect_ratio);
@@ -722,7 +730,6 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
if (side_data.type != AV_PKT_DATA_MASTERING_DISPLAY_METADATA)
continue;
- gfx::HDRMetadata hdr_metadata{};
AVMasteringDisplayMetadata* metadata =
reinterpret_cast<AVMasteringDisplayMetadata*>(side_data.data);
if (metadata->has_primaries) {
@@ -744,10 +751,13 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
hdr_metadata.color_volume_metadata.luminance_min =
av_q2d(metadata->min_luminance);
}
- config->set_hdr_metadata(hdr_metadata);
}
}
+ if (hdr_metadata.IsValid()) {
+ config->set_hdr_metadata(hdr_metadata);
+ }
+
return true;
}
diff --git a/chromium/media/ffmpeg/ffmpeg_common.h b/chromium/media/ffmpeg/ffmpeg_common.h
index 97d6307e284..cac69b08109 100644
--- a/chromium/media/ffmpeg/ffmpeg_common.h
+++ b/chromium/media/ffmpeg/ffmpeg_common.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_common_unittest.cc b/chromium/media/ffmpeg/ffmpeg_common_unittest.cc
index e391f55e05b..a44d7eda796 100644
--- a/chromium/media/ffmpeg/ffmpeg_common_unittest.cc
+++ b/chromium/media/ffmpeg/ffmpeg_common_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc b/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc
index a005f0197cd..63de64aeb41 100644
--- a/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc
+++ b/chromium/media/ffmpeg/ffmpeg_decoding_loop.cc
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_decoding_loop.h b/chromium/media/ffmpeg/ffmpeg_decoding_loop.h
index 99b264f7508..ab71f712e4e 100644
--- a/chromium/media/ffmpeg/ffmpeg_decoding_loop.h
+++ b/chromium/media/ffmpeg/ffmpeg_decoding_loop.h
@@ -1,4 +1,4 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
+// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_deleters.h b/chromium/media/ffmpeg/ffmpeg_deleters.h
index 346c862603a..3246f6a108a 100644
--- a/chromium/media/ffmpeg/ffmpeg_deleters.h
+++ b/chromium/media/ffmpeg/ffmpeg_deleters.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/ffmpeg_regression_tests.cc b/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
index ca8db2426f8..ba71809085b 100644
--- a/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
+++ b/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
diff --git a/chromium/media/ffmpeg/scoped_av_packet.cc b/chromium/media/ffmpeg/scoped_av_packet.cc
index bb9b7b4a968..458c3021d33 100644
--- a/chromium/media/ffmpeg/scoped_av_packet.cc
+++ b/chromium/media/ffmpeg/scoped_av_packet.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/scoped_av_packet.h b/chromium/media/ffmpeg/scoped_av_packet.h
index 17d2aabc9e3..9635f31d7df 100644
--- a/chromium/media/ffmpeg/scoped_av_packet.h
+++ b/chromium/media/ffmpeg/scoped_av_packet.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
diff --git a/chromium/media/ffmpeg/scoped_av_packet_unittest.cc b/chromium/media/ffmpeg/scoped_av_packet_unittest.cc
index ad58d265b7b..0420bb2d7c2 100644
--- a/chromium/media/ffmpeg/scoped_av_packet_unittest.cc
+++ b/chromium/media/ffmpeg/scoped_av_packet_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2022 The Chromium Authors. All rights reserved.
+// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.