Commit 7daf8c22 authored by Robert Sesek's avatar Robert Sesek Committed by Chromium LUCI CQ

mac: Remove code to support OS X 10.10 in //media

Bug: 1153883
Change-Id: I64fda2befe0c943ba5c955ae6eb8bc81f9c659c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2572257
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833428}
parent 56f5b884
...@@ -19,7 +19,7 @@ MEDIA_EXPORT gfx::ColorSpace GetImageBufferColorSpace( ...@@ -19,7 +19,7 @@ MEDIA_EXPORT gfx::ColorSpace GetImageBufferColorSpace(
CVImageBufferRef image_buffer); CVImageBufferRef image_buffer);
MEDIA_EXPORT gfx::ColorSpace GetFormatDescriptionColorSpace( MEDIA_EXPORT gfx::ColorSpace GetFormatDescriptionColorSpace(
CMFormatDescriptionRef format_description) API_AVAILABLE(macos(10.11)); CMFormatDescriptionRef format_description);
MEDIA_EXPORT CFDataRef MEDIA_EXPORT CFDataRef
GenerateContentLightLevelInfo(const gfx::HDRMetadata& hdr_metadata); GenerateContentLightLevelInfo(const gfx::HDRMetadata& hdr_metadata);
......
...@@ -57,14 +57,11 @@ gfx::ColorSpace::PrimaryID GetCoreVideoPrimary(CFTypeRef primaries_untyped) { ...@@ -57,14 +57,11 @@ gfx::ColorSpace::PrimaryID GetCoreVideoPrimary(CFTypeRef primaries_untyped) {
supported_primaries.push_back( supported_primaries.push_back(
{kCVImageBufferColorPrimaries_SMPTE_C, {kCVImageBufferColorPrimaries_SMPTE_C,
kCMFormatDescriptionColorPrimaries_SMPTE_C, kCMFormatDescriptionColorPrimaries_SMPTE_C,
gfx::ColorSpace::PrimaryID::SMPTE240M}); gfx::ColorSpace::PrimaryID::SMPTE240M});
if (@available(macos 10.11, *)) {
supported_primaries.push_back( supported_primaries.push_back(
{kCVImageBufferColorPrimaries_ITU_R_2020, {kCVImageBufferColorPrimaries_ITU_R_2020,
kCMFormatDescriptionColorPrimaries_ITU_R_2020, kCMFormatDescriptionColorPrimaries_ITU_R_2020,
gfx::ColorSpace::PrimaryID::BT2020}); gfx::ColorSpace::PrimaryID::BT2020});
}
return supported_primaries; return supported_primaries;
}()); }());
...@@ -88,10 +85,6 @@ gfx::ColorSpace::TransferID GetCoreVideoTransferFn(CFTypeRef transfer_untyped, ...@@ -88,10 +85,6 @@ gfx::ColorSpace::TransferID GetCoreVideoTransferFn(CFTypeRef transfer_untyped,
static const base::NoDestructor<std::vector<CVImageTransferFn>> static const base::NoDestructor<std::vector<CVImageTransferFn>>
kSupportedTransferFuncs([] { kSupportedTransferFuncs([] {
std::vector<CVImageTransferFn> supported_transfer_funcs; std::vector<CVImageTransferFn> supported_transfer_funcs;
// The constants kCMFormatDescriptionTransferFunction_ITU_R_709_2,
// SMPTE_240M_1995, and UseGamma will compile against macOS 10.10
// because they are #defined to their kCVImageBufferTransferFunction
// equivalents. They are technically not present until macOS 10.11.
supported_transfer_funcs.push_back( supported_transfer_funcs.push_back(
{kCVImageBufferTransferFunction_ITU_R_709_2, {kCVImageBufferTransferFunction_ITU_R_709_2,
kCMFormatDescriptionTransferFunction_ITU_R_709_2, kCMFormatDescriptionTransferFunction_ITU_R_709_2,
...@@ -104,12 +97,10 @@ gfx::ColorSpace::TransferID GetCoreVideoTransferFn(CFTypeRef transfer_untyped, ...@@ -104,12 +97,10 @@ gfx::ColorSpace::TransferID GetCoreVideoTransferFn(CFTypeRef transfer_untyped,
{kCVImageBufferTransferFunction_UseGamma, {kCVImageBufferTransferFunction_UseGamma,
kCMFormatDescriptionTransferFunction_UseGamma, kCMFormatDescriptionTransferFunction_UseGamma,
gfx::ColorSpace::TransferID::CUSTOM}); gfx::ColorSpace::TransferID::CUSTOM});
if (@available(macos 10.11, *)) {
supported_transfer_funcs.push_back( supported_transfer_funcs.push_back(
{kCVImageBufferTransferFunction_ITU_R_2020, {kCVImageBufferTransferFunction_ITU_R_2020,
kCMFormatDescriptionTransferFunction_ITU_R_2020, kCMFormatDescriptionTransferFunction_ITU_R_2020,
gfx::ColorSpace::TransferID::BT2020_10}); gfx::ColorSpace::TransferID::BT2020_10});
}
if (@available(macos 10.12, *)) { if (@available(macos 10.12, *)) {
supported_transfer_funcs.push_back( supported_transfer_funcs.push_back(
{kCVImageBufferTransferFunction_SMPTE_ST_428_1, {kCVImageBufferTransferFunction_SMPTE_ST_428_1,
...@@ -200,12 +191,10 @@ gfx::ColorSpace::MatrixID GetCoreVideoMatrix(CFTypeRef matrix_untyped) { ...@@ -200,12 +191,10 @@ gfx::ColorSpace::MatrixID GetCoreVideoMatrix(CFTypeRef matrix_untyped) {
{kCVImageBufferYCbCrMatrix_SMPTE_240M_1995, {kCVImageBufferYCbCrMatrix_SMPTE_240M_1995,
kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995, kCMFormatDescriptionYCbCrMatrix_SMPTE_240M_1995,
gfx::ColorSpace::MatrixID::SMPTE240M}); gfx::ColorSpace::MatrixID::SMPTE240M});
if (@available(macos 10.11, *)) {
supported_matrices.push_back( supported_matrices.push_back(
{kCVImageBufferYCbCrMatrix_ITU_R_2020, {kCVImageBufferYCbCrMatrix_ITU_R_2020,
kCMFormatDescriptionYCbCrMatrix_ITU_R_2020, kCMFormatDescriptionYCbCrMatrix_ITU_R_2020,
gfx::ColorSpace::MatrixID::BT2020_NCL}); gfx::ColorSpace::MatrixID::BT2020_NCL});
}
return supported_matrices; return supported_matrices;
}()); }());
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "base/location.h" #include "base/location.h"
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
#include "base/mac/mac_util.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -782,9 +781,8 @@ AVCaptureDeviceFormat* FindBestCaptureFormat( ...@@ -782,9 +781,8 @@ AVCaptureDeviceFormat* FindBestCaptureFormat(
} }
// Last preference is to read the CMSampleBuffer. // Last preference is to read the CMSampleBuffer.
gfx::ColorSpace colorSpace; gfx::ColorSpace colorSpace =
if (@available(macOS 10.11, *)) media::GetFormatDescriptionColorSpace(formatDescription);
colorSpace = media::GetFormatDescriptionColorSpace(formatDescription);
[self processSample:sampleBuffer [self processSample:sampleBuffer
captureFormat:captureFormat captureFormat:captureFormat
colorSpace:colorSpace colorSpace:colorSpace
......
...@@ -42,11 +42,7 @@ CFStringRef GetPrimaries(media::VideoColorSpace::PrimaryID primary_id) { ...@@ -42,11 +42,7 @@ CFStringRef GetPrimaries(media::VideoColorSpace::PrimaryID primary_id) {
return kCMFormatDescriptionColorPrimaries_ITU_R_709_2; return kCMFormatDescriptionColorPrimaries_ITU_R_709_2;
case media::VideoColorSpace::PrimaryID::BT2020: case media::VideoColorSpace::PrimaryID::BT2020:
if (@available(macos 10.11, *))
return kCMFormatDescriptionColorPrimaries_ITU_R_2020; return kCMFormatDescriptionColorPrimaries_ITU_R_2020;
DLOG(WARNING) << "kCMFormatDescriptionColorPrimaries_ITU_R_2020 "
"unsupported prior to 10.11";
return nil;
case media::VideoColorSpace::PrimaryID::SMPTE170M: case media::VideoColorSpace::PrimaryID::SMPTE170M:
case media::VideoColorSpace::PrimaryID::SMPTE240M: case media::VideoColorSpace::PrimaryID::SMPTE240M:
...@@ -56,18 +52,10 @@ CFStringRef GetPrimaries(media::VideoColorSpace::PrimaryID primary_id) { ...@@ -56,18 +52,10 @@ CFStringRef GetPrimaries(media::VideoColorSpace::PrimaryID primary_id) {
return kCMFormatDescriptionColorPrimaries_EBU_3213; return kCMFormatDescriptionColorPrimaries_EBU_3213;
case media::VideoColorSpace::PrimaryID::SMPTEST431_2: case media::VideoColorSpace::PrimaryID::SMPTEST431_2:
if (@available(macos 10.11, *))
return kCMFormatDescriptionColorPrimaries_DCI_P3; return kCMFormatDescriptionColorPrimaries_DCI_P3;
DLOG(WARNING) << "kCMFormatDescriptionColorPrimaries_DCI_P3 unsupported "
"prior to 10.11";
return nil;
case media::VideoColorSpace::PrimaryID::SMPTEST432_1: case media::VideoColorSpace::PrimaryID::SMPTEST432_1:
if (@available(macos 10.11, *))
return kCMFormatDescriptionColorPrimaries_P3_D65; return kCMFormatDescriptionColorPrimaries_P3_D65;
DLOG(WARNING) << "kCMFormatDescriptionColorPrimaries_P3_D65 unsupported "
"prior to 10.11";
return nil;
default: default:
DLOG(ERROR) << "Unsupported primary id: " << static_cast<int>(primary_id); DLOG(ERROR) << "Unsupported primary id: " << static_cast<int>(primary_id);
...@@ -104,11 +92,7 @@ CFStringRef GetTransferFunction( ...@@ -104,11 +92,7 @@ CFStringRef GetTransferFunction(
case media::VideoColorSpace::TransferID::BT2020_10: case media::VideoColorSpace::TransferID::BT2020_10:
case media::VideoColorSpace::TransferID::BT2020_12: case media::VideoColorSpace::TransferID::BT2020_12:
if (@available(macos 10.11, *))
return kCMFormatDescriptionTransferFunction_ITU_R_2020; return kCMFormatDescriptionTransferFunction_ITU_R_2020;
DLOG(WARNING) << "kCMFormatDescriptionTransferFunction_ITU_R_2020 "
"unsupported prior to 10.11";
return nil;
case media::VideoColorSpace::TransferID::SMPTEST2084: case media::VideoColorSpace::TransferID::SMPTEST2084:
if (@available(macos 10.13, *)) if (@available(macos 10.13, *))
...@@ -149,11 +133,7 @@ CFStringRef GetMatrix(media::VideoColorSpace::MatrixID matrix_id) { ...@@ -149,11 +133,7 @@ CFStringRef GetMatrix(media::VideoColorSpace::MatrixID matrix_id) {
return kCMFormatDescriptionYCbCrMatrix_ITU_R_709_2; return kCMFormatDescriptionYCbCrMatrix_ITU_R_709_2;
case media::VideoColorSpace::MatrixID::BT2020_NCL: case media::VideoColorSpace::MatrixID::BT2020_NCL:
if (@available(macos 10.11, *))
return kCMFormatDescriptionYCbCrMatrix_ITU_R_2020; return kCMFormatDescriptionYCbCrMatrix_ITU_R_2020;
DLOG(WARNING) << "kCVImageBufferYCbCrMatrix_ITU_R_2020 "
"unsupported prior to 10.11";
return nil;
case media::VideoColorSpace::MatrixID::FCC: case media::VideoColorSpace::MatrixID::FCC:
case media::VideoColorSpace::MatrixID::SMPTE170M: case media::VideoColorSpace::MatrixID::SMPTE170M:
......
...@@ -363,12 +363,10 @@ TEST(VTConfigUtil, GetImageBufferColorSpace_BT2020_PQ) { ...@@ -363,12 +363,10 @@ TEST(VTConfigUtil, GetImageBufferColorSpace_BT2020_PQ) {
// When BT.2020 is unavailable the default should be BT.709. // When BT.2020 is unavailable the default should be BT.709.
if (base::mac::IsAtLeastOS10_13()) { if (base::mac::IsAtLeastOS10_13()) {
EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs); EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs);
} else if (base::mac::IsAtLeastOS10_11()) { } else {
// 10.11 and 10.12 don't have HDR transfer functions. // 10.12 doesn't have HDR transfer functions.
cs.transfer = VideoColorSpace::TransferID::BT709; cs.transfer = VideoColorSpace::TransferID::BT709;
EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs); EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs);
} else {
EXPECT_EQ(gfx::ColorSpace::CreateREC709(), image_buffer_cs);
} }
} }
...@@ -384,35 +382,29 @@ TEST(VTConfigUtil, GetImageBufferColorSpace_BT2020_HLG) { ...@@ -384,35 +382,29 @@ TEST(VTConfigUtil, GetImageBufferColorSpace_BT2020_HLG) {
// When BT.2020 is unavailable the default should be BT.709. // When BT.2020 is unavailable the default should be BT.709.
if (base::mac::IsAtLeastOS10_13()) { if (base::mac::IsAtLeastOS10_13()) {
EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs); EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs);
} else if (base::mac::IsAtLeastOS10_11()) { } else {
// 10.11 and 10.12 don't have HDR transfer functions. // 10.12 doesn't have HDR transfer functions.
cs.transfer = VideoColorSpace::TransferID::BT709; cs.transfer = VideoColorSpace::TransferID::BT709;
EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs); EXPECT_EQ(cs.ToGfxColorSpace(), image_buffer_cs);
} else {
EXPECT_EQ(gfx::ColorSpace::CreateREC709(), image_buffer_cs);
} }
} }
TEST(VTConfigUtil, FormatDescriptionInvalid) { TEST(VTConfigUtil, FormatDescriptionInvalid) {
if (__builtin_available(macos 10.11, *)) {
auto format_descriptor = auto format_descriptor =
CreateFormatDescription(CFSTR("Cows"), CFSTR("Go"), CFSTR("Moo")); CreateFormatDescription(CFSTR("Cows"), CFSTR("Go"), CFSTR("Moo"));
ASSERT_TRUE(format_descriptor); ASSERT_TRUE(format_descriptor);
auto cs = GetFormatDescriptionColorSpace(format_descriptor); auto cs = GetFormatDescriptionColorSpace(format_descriptor);
EXPECT_EQ(gfx::ColorSpace::CreateREC709(), cs); EXPECT_EQ(gfx::ColorSpace::CreateREC709(), cs);
}
} }
TEST(VTConfigUtil, FormatDescriptionBT709) { TEST(VTConfigUtil, FormatDescriptionBT709) {
if (__builtin_available(macos 10.11, *)) { auto format_descriptor =
auto format_descriptor = CreateFormatDescription( CreateFormatDescription(kCMFormatDescriptionColorPrimaries_ITU_R_709_2,
kCMFormatDescriptionColorPrimaries_ITU_R_709_2,
kCMFormatDescriptionTransferFunction_ITU_R_709_2, kCMFormatDescriptionTransferFunction_ITU_R_709_2,
kCMFormatDescriptionYCbCrMatrix_ITU_R_709_2); kCMFormatDescriptionYCbCrMatrix_ITU_R_709_2);
ASSERT_TRUE(format_descriptor); ASSERT_TRUE(format_descriptor);
auto cs = GetFormatDescriptionColorSpace(format_descriptor); auto cs = GetFormatDescriptionColorSpace(format_descriptor);
EXPECT_EQ(ToBT709_APPLE(gfx::ColorSpace::CreateREC709()), cs); EXPECT_EQ(ToBT709_APPLE(gfx::ColorSpace::CreateREC709()), cs);
}
} }
} // namespace media } // namespace media
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment