diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-11-28 16:14:41 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-12-13 15:19:41 +0000 |
commit | 61d9742824d54be5693191fe502325a909feca59 (patch) | |
tree | cbf28e779b11338fe52eb75b915684cd8955542c /chromium/media/base | |
parent | 45f9ded08bb7526984b24ccb5a5327aaf6821676 (diff) | |
download | qtwebengine-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/base')
564 files changed, 2841 insertions, 1806 deletions
diff --git a/chromium/media/base/BUILD.gn b/chromium/media/base/BUILD.gn index ac8d570e1a2..fe3054a0ec0 100644 --- a/chromium/media/base/BUILD.gn +++ b/chromium/media/base/BUILD.gn @@ -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. @@ -175,10 +175,10 @@ source_set("base") { "format_utils.h", "frame_rate_estimator.cc", "frame_rate_estimator.h", + "key_system_info.cc", + "key_system_info.h", "key_system_names.cc", "key_system_names.h", - "key_system_properties.cc", - "key_system_properties.h", "key_systems.cc", "key_systems.h", "localized_strings.cc", @@ -208,6 +208,8 @@ source_set("base") { "media_observer.h", "media_permission.cc", "media_permission.h", + "media_player_logging_id.cc", + "media_player_logging_id.h", "media_resource.cc", "media_resource.h", "media_serializers.h", diff --git a/chromium/media/base/android/BUILD.gn b/chromium/media/base/android/BUILD.gn index 7d45fe6f05e..b4b17de4ba0 100644 --- a/chromium/media/base/android/BUILD.gn +++ b/chromium/media/base/android/BUILD.gn @@ -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/base/android/android_cdm_factory.cc b/chromium/media/base/android/android_cdm_factory.cc index 15084f3ed7c..a6346151f6c 100644 --- a/chromium/media/base/android/android_cdm_factory.cc +++ b/chromium/media/base/android/android_cdm_factory.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/android_cdm_factory.h b/chromium/media/base/android/android_cdm_factory.h index 1aa9f68dcd5..20d4f66bb09 100644 --- a/chromium/media/base/android/android_cdm_factory.h +++ b/chromium/media/base/android/android_cdm_factory.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/android_overlay.cc b/chromium/media/base/android/android_overlay.cc index 22a02a23f97..c034210618c 100644 --- a/chromium/media/base/android/android_overlay.cc +++ b/chromium/media/base/android/android_overlay.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/base/android/android_overlay.h b/chromium/media/base/android/android_overlay.h index 1c37622c97c..67c77534771 100644 --- a/chromium/media/base/android/android_overlay.h +++ b/chromium/media/base/android/android_overlay.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/base/android/android_util.cc b/chromium/media/base/android/android_util.cc index ca627d9b006..29a86c0f2c1 100644 --- a/chromium/media/base/android/android_util.cc +++ b/chromium/media/base/android/android_util.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/base/android/android_util.h b/chromium/media/base/android/android_util.h index b70b6495d57..9098e2ef549 100644 --- a/chromium/media/base/android/android_util.h +++ b/chromium/media/base/android/android_util.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/base/android/extract_sps_and_pps.cc b/chromium/media/base/android/extract_sps_and_pps.cc index 213b419d43b..b96f3f9e49e 100644 --- a/chromium/media/base/android/extract_sps_and_pps.cc +++ b/chromium/media/base/android/extract_sps_and_pps.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/base/android/extract_sps_and_pps.h b/chromium/media/base/android/extract_sps_and_pps.h index d3310a6c4d6..3a11d54e1c6 100644 --- a/chromium/media/base/android/extract_sps_and_pps.h +++ b/chromium/media/base/android/extract_sps_and_pps.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/base/android/jni_hdr_metadata.cc b/chromium/media/base/android/jni_hdr_metadata.cc index eebeb4d5282..f004b0171b2 100644 --- a/chromium/media/base/android/jni_hdr_metadata.cc +++ b/chromium/media/base/android/jni_hdr_metadata.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/base/android/jni_hdr_metadata.h b/chromium/media/base/android/jni_hdr_metadata.h index 38d1a0efe36..009297d7278 100644 --- a/chromium/media/base/android/jni_hdr_metadata.h +++ b/chromium/media/base/android/jni_hdr_metadata.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/base/android/media_codec_bridge.h b/chromium/media/base/android/media_codec_bridge.h index 1a58bbd7563..2b0ac8e924a 100644 --- a/chromium/media/base/android/media_codec_bridge.h +++ b/chromium/media/base/android/media_codec_bridge.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/android/media_codec_bridge_impl.cc b/chromium/media/base/android/media_codec_bridge_impl.cc index aac199d9b32..347cbba1fc4 100644 --- a/chromium/media/base/android/media_codec_bridge_impl.cc +++ b/chromium/media/base/android/media_codec_bridge_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/android/media_codec_bridge_impl.h b/chromium/media/base/android/media_codec_bridge_impl.h index 5e64ddd20ff..96b6b8d961c 100644 --- a/chromium/media/base/android/media_codec_bridge_impl.h +++ b/chromium/media/base/android/media_codec_bridge_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/android/media_codec_bridge_impl_unittest.cc b/chromium/media/base/android/media_codec_bridge_impl_unittest.cc index d1010650e7e..43eecb6dc9d 100644 --- a/chromium/media/base/android/media_codec_bridge_impl_unittest.cc +++ b/chromium/media/base/android/media_codec_bridge_impl_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/media_codec_direction.h b/chromium/media/base/android/media_codec_direction.h index 3e972c2802d..b71abb97a03 100644 --- a/chromium/media/base/android/media_codec_direction.h +++ b/chromium/media/base/android/media_codec_direction.h @@ -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/base/android/media_codec_loop.cc b/chromium/media/base/android/media_codec_loop.cc index ba2feac5134..010c5056a04 100644 --- a/chromium/media/base/android/media_codec_loop.cc +++ b/chromium/media/base/android/media_codec_loop.cc @@ -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/base/android/media_codec_loop.h b/chromium/media/base/android/media_codec_loop.h index 7427df5a019..f8632c726a0 100644 --- a/chromium/media/base/android/media_codec_loop.h +++ b/chromium/media/base/android/media_codec_loop.h @@ -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/base/android/media_codec_loop_unittest.cc b/chromium/media/base/android/media_codec_loop_unittest.cc index 5613ea9098b..559cb8c8229 100644 --- a/chromium/media/base/android/media_codec_loop_unittest.cc +++ b/chromium/media/base/android/media_codec_loop_unittest.cc @@ -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. @@ -91,7 +91,7 @@ class MediaCodecLoopTest : public testing::Test { } void ConstructCodecLoop() { - int sdk_int = base::android::SDK_VERSION_MARSHMALLOW; + int sdk_int = base::android::SDK_VERSION_NOUGAT; auto codec = std::make_unique<MockMediaCodecBridge>(); // Since we're providing a codec, we do not expect an error. EXPECT_CALL(*client_, OnCodecLoopError()).Times(0); @@ -199,7 +199,7 @@ class MediaCodecLoopTest : public testing::Test { TEST_F(MediaCodecLoopTest, TestConstructionWithNullCodec) { std::unique_ptr<MediaCodecBridge> codec; EXPECT_CALL(*client_, OnCodecLoopError()).Times(1); - const int sdk_int = base::android::SDK_VERSION_MARSHMALLOW; + const int sdk_int = base::android::SDK_VERSION_NOUGAT; codec_loop_ = std::make_unique<MediaCodecLoop>( sdk_int, client_.get(), std::move(codec), scoped_refptr<base::SingleThreadTaskRunner>()); diff --git a/chromium/media/base/android/media_codec_util.cc b/chromium/media/base/android/media_codec_util.cc index fe96d28fc6b..9c14831d39b 100644 --- a/chromium/media/base/android/media_codec_util.cc +++ b/chromium/media/base/android/media_codec_util.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,13 +6,13 @@ #include <stddef.h> -#include <algorithm> #include <vector> #include "base/android/build_info.h" #include "base/android/jni_android.h" #include "base/android/jni_array.h" #include "base/android/jni_string.h" +#include "base/containers/contains.h" #include "base/logging.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" @@ -68,19 +68,7 @@ static bool IsSupportedAndroidMimeType(const std::string& mime_type) { kMp3MimeType, kAacMimeType, kOpusMimeType, kVorbisMimeType, kAvcMimeType, kDolbyVisionMimeType, kHevcMimeType, kVp8MimeType, kVp9MimeType, kAv1MimeType}; - return std::find(supported.begin(), supported.end(), mime_type) != - supported.end(); -} - -static std::string GetDefaultCodecName(const std::string& mime_type, - MediaCodecDirection direction, - bool requires_software_codec) { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jstring> j_mime = ConvertUTF8ToJavaString(env, mime_type); - ScopedJavaLocalRef<jstring> j_codec_name = - Java_MediaCodecUtil_getDefaultCodecName( - env, j_mime, static_cast<int>(direction), requires_software_codec); - return ConvertJavaStringToUTF8(env, j_codec_name.obj()); + return base::Contains(supported, mime_type); } static bool IsDecoderSupportedByDevice(const std::string& android_mime_type) { @@ -203,13 +191,6 @@ std::set<int> MediaCodecUtil::GetEncoderColorFormats( return color_formats; } -#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) -// static -bool MediaCodecUtil::IsDolbyVisionDecoderAvailable() { - return IsDecoderSupportedByDevice(kDolbyVisionMimeType); -} -#endif - // static bool MediaCodecUtil::IsVp8DecoderAvailable() { return IsDecoderSupportedByDevice(kVp8MimeType); @@ -330,33 +311,28 @@ void MediaCodecUtil::AddSupportedCodecProfileLevels( // static bool MediaCodecUtil::IsKnownUnaccelerated(VideoCodec codec, MediaCodecDirection direction) { - std::string codec_name = - GetDefaultCodecName(CodecToAndroidMimeType(codec), direction, false); - DVLOG(1) << __func__ << "Default codec for " << GetCodecName(codec) << " : " - << codec_name << ", direction: " << static_cast<int>(direction); + auto* env = AttachCurrentThread(); + auto j_mime = ConvertUTF8ToJavaString(env, CodecToAndroidMimeType(codec)); + auto j_codec_name = Java_MediaCodecUtil_getDefaultCodecName( + env, j_mime, static_cast<int>(direction), /*requireSoftwareCodec=*/false, + /*requireHardwareCodec=*/true); + + auto codec_name = ConvertJavaStringToUTF8(env, j_codec_name.obj()); + DVLOG(1) << __func__ << "Default hardware codec for " << GetCodecName(codec) + << " : " << codec_name + << ", direction: " << static_cast<int>(direction); if (codec_name.empty()) return true; // MediaTek hardware vp8 is known slower than the software implementation. - if (base::StartsWith(codec_name, "OMX.MTK.", base::CompareCase::SENSITIVE)) { - if (codec == VideoCodec::kVP8) { - // We may still reject VP8 hardware decoding later on certain chipsets, - // see isDecoderSupportedForDevice(). We don't have the the chipset ID - // here to check now though. - return base::android::BuildInfo::GetInstance()->sdk_int() < SDK_VERSION_P; - } - - return false; + if (base::StartsWith(codec_name, "OMX.MTK.") && codec == VideoCodec::kVP8) { + // We may still reject VP8 hardware decoding later on certain chipsets, + // see isDecoderSupportedForDevice(). We don't have the the chipset ID + // here to check now though. + return base::android::BuildInfo::GetInstance()->sdk_int() < SDK_VERSION_P; } - // It would be nice if MediaCodecInfo externalized some notion of - // HW-acceleration but it doesn't. Android Media guidance is that the - // "OMX.google" prefix is always used for SW decoders, so that's what we - // use. "OMX.SEC.*" codec is Samsung software implementation - report it - // as unaccelerated as well. - return base::StartsWith(codec_name, "OMX.google.", - base::CompareCase::SENSITIVE) || - base::StartsWith(codec_name, "OMX.SEC.", base::CompareCase::SENSITIVE); + return false; } } // namespace media diff --git a/chromium/media/base/android/media_codec_util.h b/chromium/media/base/android/media_codec_util.h index 4afc89f0019..15e49568a47 100644 --- a/chromium/media/base/android/media_codec_util.h +++ b/chromium/media/base/android/media_codec_util.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -34,11 +34,6 @@ class MEDIA_EXPORT MediaCodecUtil { // Returns true if MediaCodec supports CBCS Encryption. static bool PlatformSupportsCbcsEncryption(int sdk); -#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) - // Indicates if Dolby Vision decoder is available on this device. - static bool IsDolbyVisionDecoderAvailable(); -#endif - // Indicates if the vp8 decoder or encoder is available on this device. static bool IsVp8DecoderAvailable(); static bool IsVp8EncoderAvailable(); diff --git a/chromium/media/base/android/media_codec_util_unittest.cc b/chromium/media/base/android/media_codec_util_unittest.cc index 91e18618df2..ed999a4a5e5 100644 --- a/chromium/media/base/android/media_codec_util_unittest.cc +++ b/chromium/media/base/android/media_codec_util_unittest.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. @@ -9,7 +9,6 @@ namespace media { // These will come from mockable BuildInfo, once it exists. -using base::android::SDK_VERSION_MARSHMALLOW; using base::android::SDK_VERSION_NOUGAT; using base::android::SDK_VERSION_NOUGAT_MR1; @@ -27,8 +26,6 @@ class MediaCodecUtilTest : public testing::Test { TEST_F(MediaCodecUtilTest, TestCbcsAvailableIfNewerVersion) { EXPECT_FALSE( - MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_MARSHMALLOW)); - EXPECT_FALSE( MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_NOUGAT)); EXPECT_TRUE( MediaCodecUtil::PlatformSupportsCbcsEncryption(SDK_VERSION_NOUGAT_MR1)); diff --git a/chromium/media/base/android/media_common_android.h b/chromium/media/base/android/media_common_android.h index c86f21fc8e6..8ddff37cac5 100644 --- a/chromium/media/base/android/media_common_android.h +++ b/chromium/media/base/android/media_common_android.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/base/android/media_crypto_context.h b/chromium/media/base/android/media_crypto_context.h index a1a079258ec..de88108507d 100644 --- a/chromium/media/base/android/media_crypto_context.h +++ b/chromium/media/base/android/media_crypto_context.h @@ -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/base/android/media_crypto_context_impl.cc b/chromium/media/base/android/media_crypto_context_impl.cc index 5fbc550441f..35a8cf8844a 100644 --- a/chromium/media/base/android/media_crypto_context_impl.cc +++ b/chromium/media/base/android/media_crypto_context_impl.cc @@ -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/base/android/media_crypto_context_impl.h b/chromium/media/base/android/media_crypto_context_impl.h index 1985a36e771..8258385e563 100644 --- a/chromium/media/base/android/media_crypto_context_impl.h +++ b/chromium/media/base/android/media_crypto_context_impl.h @@ -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/base/android/media_drm_bridge.cc b/chromium/media/base/android/media_drm_bridge.cc index 0c38fc73c66..4460bad02cf 100644 --- a/chromium/media/base/android/media_drm_bridge.cc +++ b/chromium/media/base/android/media_drm_bridge.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/android/media_drm_bridge.h b/chromium/media/base/android/media_drm_bridge.h index f46afa4588f..1f138040d8f 100644 --- a/chromium/media/base/android/media_drm_bridge.h +++ b/chromium/media/base/android/media_drm_bridge.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/android/media_drm_bridge_client.cc b/chromium/media/base/android/media_drm_bridge_client.cc index 182e43e5dc6..0b85c86d7d1 100644 --- a/chromium/media/base/android/media_drm_bridge_client.cc +++ b/chromium/media/base/android/media_drm_bridge_client.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/media_drm_bridge_client.h b/chromium/media/base/android/media_drm_bridge_client.h index 59d907e4507..46f26916e07 100644 --- a/chromium/media/base/android/media_drm_bridge_client.h +++ b/chromium/media/base/android/media_drm_bridge_client.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/media_drm_bridge_delegate.cc b/chromium/media/base/android/media_drm_bridge_delegate.cc index 8bd43ca1120..711146e8846 100644 --- a/chromium/media/base/android/media_drm_bridge_delegate.cc +++ b/chromium/media/base/android/media_drm_bridge_delegate.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/media_drm_bridge_delegate.h b/chromium/media/base/android/media_drm_bridge_delegate.h index 79bcf9f5a2c..2abb7cdb2bc 100644 --- a/chromium/media/base/android/media_drm_bridge_delegate.h +++ b/chromium/media/base/android/media_drm_bridge_delegate.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/media_drm_bridge_factory.cc b/chromium/media/base/android/media_drm_bridge_factory.cc index 613e45bbaaf..c67d69c9b88 100644 --- a/chromium/media/base/android/media_drm_bridge_factory.cc +++ b/chromium/media/base/android/media_drm_bridge_factory.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/android/media_drm_bridge_factory.h b/chromium/media/base/android/media_drm_bridge_factory.h index 236edeaa1f2..03abfe54531 100644 --- a/chromium/media/base/android/media_drm_bridge_factory.h +++ b/chromium/media/base/android/media_drm_bridge_factory.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/android/media_drm_bridge_unittest.cc b/chromium/media/base/android/media_drm_bridge_unittest.cc index dca6d3e747b..180523094c4 100644 --- a/chromium/media/base/android/media_drm_bridge_unittest.cc +++ b/chromium/media/base/android/media_drm_bridge_unittest.cc @@ -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. @@ -23,14 +23,14 @@ using ::testing::StrictMock; namespace media { -#define EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(a) \ - do { \ - if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) { \ - VLOG(0) << "Widevine not supported on device."; \ - EXPECT_FALSE(a); \ - } else { \ - EXPECT_TRUE(a); \ - } \ +#define EXPECT_TRUE_IF_WIDEVINE_AVAILABLE(a) \ + do { \ + if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) { \ + VLOG(0) << "Widevine not supported on device."; \ + EXPECT_FALSE(a); \ + } else { \ + EXPECT_TRUE(a); \ + } \ } while (0) const char kAudioMp4[] = "audio/mp4"; @@ -128,11 +128,10 @@ TEST_F(MediaDrmBridgeTest, IsKeySystemSupported_Widevine) { EXPECT_TRUE_IF_WIDEVINE_AVAILABLE( IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoMp4)); - EXPECT_TRUE_IF_WIDEVINE_AVAILABLE( - IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM)); + IsKeySystemSupportedWithType(kWidevineKeySystem, kAudioWebM)); EXPECT_TRUE_IF_WIDEVINE_AVAILABLE( - IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM)); + IsKeySystemSupportedWithType(kWidevineKeySystem, kVideoWebM)); EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "unknown")); EXPECT_FALSE(IsKeySystemSupportedWithType(kWidevineKeySystem, "video/avi")); @@ -171,7 +170,8 @@ TEST_F(MediaDrmBridgeTest, CreateWithSecurityLevel_Widevine) { CreateWithoutSessionSupport(kWidevineKeySystem, kTestOrigin, kL1); } -TEST_F(MediaDrmBridgeTest, Provision_Widevine) { +// See https://crbug.com/1370782. +TEST_F(MediaDrmBridgeTest, DISABLED_Provision_Widevine) { // Only test this if Widevine is supported. Otherwise // CreateWithoutSessionSupport() will return null and it can't be tested. if (!MediaDrmBridge::IsKeySystemSupported(kWidevineKeySystem)) { @@ -186,16 +186,6 @@ TEST_F(MediaDrmBridgeTest, Provision_Widevine) { return; } - // On Android M occasionally MediaDrm.getProvisionRequest() throws and thus a - // request can not be generated. This has been fixed in Android N. As Android - // M is unlikely to be fixed, disabling this test if running on Android M. - // http://crbug.com/973096#c21 - if (base::android::BuildInfo::GetInstance()->sdk_int() == - base::android::SDK_VERSION_MARSHMALLOW) { - VLOG(0) << "Disabled for Android M."; - return; - } - // Calling Provision() later should trigger a provisioning request. As we // can't pass the request to a license server, // MockProvisionFetcher::Retrieve() simply drops the request and never diff --git a/chromium/media/base/android/media_drm_storage_bridge.cc b/chromium/media/base/android/media_drm_storage_bridge.cc index 803d8407d8e..a9f7df570c8 100644 --- a/chromium/media/base/android/media_drm_storage_bridge.cc +++ b/chromium/media/base/android/media_drm_storage_bridge.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/base/android/media_drm_storage_bridge.h b/chromium/media/base/android/media_drm_storage_bridge.h index 8787f9f6d97..5ccef3885b6 100644 --- a/chromium/media/base/android/media_drm_storage_bridge.h +++ b/chromium/media/base/android/media_drm_storage_bridge.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/base/android/media_player_bridge.cc b/chromium/media/base/android/media_player_bridge.cc index 9ed5a3f9d37..36a58acfcd2 100644 --- a/chromium/media/base/android/media_player_bridge.cc +++ b/chromium/media/base/android/media_player_bridge.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/base/android/media_player_bridge.h b/chromium/media/base/android/media_player_bridge.h index 98b88b97105..a6426d49a33 100644 --- a/chromium/media/base/android/media_player_bridge.h +++ b/chromium/media/base/android/media_player_bridge.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/base/android/media_player_bridge_unittest.cc b/chromium/media/base/android/media_player_bridge_unittest.cc index 13b651f9943..fdd01711e68 100644 --- a/chromium/media/base/android/media_player_bridge_unittest.cc +++ b/chromium/media/base/android/media_player_bridge_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/android/media_player_listener.cc b/chromium/media/base/android/media_player_listener.cc index 9720a3f0ac4..249a3298189 100644 --- a/chromium/media/base/android/media_player_listener.cc +++ b/chromium/media/base/android/media_player_listener.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/base/android/media_player_listener.h b/chromium/media/base/android/media_player_listener.h index 166afc4bd0f..54c99f5f80f 100644 --- a/chromium/media/base/android/media_player_listener.h +++ b/chromium/media/base/android/media_player_listener.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/base/android/media_resource_getter.cc b/chromium/media/base/android/media_resource_getter.cc index 5fdff06b946..5340054ae3d 100644 --- a/chromium/media/base/android/media_resource_getter.cc +++ b/chromium/media/base/android/media_resource_getter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/android/media_resource_getter.h b/chromium/media/base/android/media_resource_getter.h index b0b822261fa..32712c2fd11 100644 --- a/chromium/media/base/android/media_resource_getter.h +++ b/chromium/media/base/android/media_resource_getter.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/android/media_server_crash_listener.cc b/chromium/media/base/android/media_server_crash_listener.cc index 958df440d1f..ed37491eb0d 100644 --- a/chromium/media/base/android/media_server_crash_listener.cc +++ b/chromium/media/base/android/media_server_crash_listener.cc @@ -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/base/android/media_server_crash_listener.h b/chromium/media/base/android/media_server_crash_listener.h index b66e222aef5..9bdb8471156 100644 --- a/chromium/media/base/android/media_server_crash_listener.h +++ b/chromium/media/base/android/media_server_crash_listener.h @@ -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/base/android/media_service_throttler.cc b/chromium/media/base/android/media_service_throttler.cc index 603e5543365..5ea844d27d7 100644 --- a/chromium/media/base/android/media_service_throttler.cc +++ b/chromium/media/base/android/media_service_throttler.cc @@ -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/base/android/media_service_throttler.h b/chromium/media/base/android/media_service_throttler.h index e3057efd59a..1bae14a7c47 100644 --- a/chromium/media/base/android/media_service_throttler.h +++ b/chromium/media/base/android/media_service_throttler.h @@ -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/base/android/media_service_throttler_unittest.cc b/chromium/media/base/android/media_service_throttler_unittest.cc index 7b12f8aef9b..af2eefdd1d7 100644 --- a/chromium/media/base/android/media_service_throttler_unittest.cc +++ b/chromium/media/base/android/media_service_throttler_unittest.cc @@ -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/base/android/media_url_interceptor.h b/chromium/media/base/android/media_url_interceptor.h index d099ee0d260..ff53cb06da5 100644 --- a/chromium/media/base/android/media_url_interceptor.h +++ b/chromium/media/base/android/media_url_interceptor.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/base/android/mock_android_overlay.cc b/chromium/media/base/android/mock_android_overlay.cc index e16d68116f2..b2155f46f7a 100644 --- a/chromium/media/base/android/mock_android_overlay.cc +++ b/chromium/media/base/android/mock_android_overlay.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/base/android/mock_android_overlay.h b/chromium/media/base/android/mock_android_overlay.h index 52d1cdf934e..cbfbf2d92c4 100644 --- a/chromium/media/base/android/mock_android_overlay.h +++ b/chromium/media/base/android/mock_android_overlay.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/base/android/mock_media_codec_bridge.cc b/chromium/media/base/android/mock_media_codec_bridge.cc index 3799d0c172e..4be6f9fa4eb 100644 --- a/chromium/media/base/android/mock_media_codec_bridge.cc +++ b/chromium/media/base/android/mock_media_codec_bridge.cc @@ -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/base/android/mock_media_codec_bridge.h b/chromium/media/base/android/mock_media_codec_bridge.h index 3bbc17ff1a2..874d78652f9 100644 --- a/chromium/media/base/android/mock_media_codec_bridge.h +++ b/chromium/media/base/android/mock_media_codec_bridge.h @@ -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/base/android/mock_media_crypto_context.cc b/chromium/media/base/android/mock_media_crypto_context.cc index 8276c9897e6..d09fdb264f9 100644 --- a/chromium/media/base/android/mock_media_crypto_context.cc +++ b/chromium/media/base/android/mock_media_crypto_context.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/base/android/mock_media_crypto_context.h b/chromium/media/base/android/mock_media_crypto_context.h index 24061c01020..ecde6f81488 100644 --- a/chromium/media/base/android/mock_media_crypto_context.h +++ b/chromium/media/base/android/mock_media_crypto_context.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/base/android/stream_texture_wrapper.h b/chromium/media/base/android/stream_texture_wrapper.h index 2e4275ac985..b0a4dd5ef45 100644 --- a/chromium/media/base/android/stream_texture_wrapper.h +++ b/chromium/media/base/android/stream_texture_wrapper.h @@ -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/base/android/test_destruction_observable.cc b/chromium/media/base/android/test_destruction_observable.cc index eb8c226323a..035e4412634 100644 --- a/chromium/media/base/android/test_destruction_observable.cc +++ b/chromium/media/base/android/test_destruction_observable.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/base/android/test_destruction_observable.h b/chromium/media/base/android/test_destruction_observable.h index c4b77bbe3b4..5993bf84f7e 100644 --- a/chromium/media/base/android/test_destruction_observable.h +++ b/chromium/media/base/android/test_destruction_observable.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/base/android_overlay_config.cc b/chromium/media/base/android_overlay_config.cc index 41e4aa09675..64b619be3be 100644 --- a/chromium/media/base/android_overlay_config.cc +++ b/chromium/media/base/android_overlay_config.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/base/android_overlay_config.h b/chromium/media/base/android_overlay_config.h index bed54bed35e..a9c401d43c9 100644 --- a/chromium/media/base/android_overlay_config.h +++ b/chromium/media/base/android_overlay_config.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/base/android_overlay_mojo_factory.h b/chromium/media/base/android_overlay_mojo_factory.h index 87034657333..ecfd70b190c 100644 --- a/chromium/media/base/android_overlay_mojo_factory.h +++ b/chromium/media/base/android_overlay_mojo_factory.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/base/async_destroy_video_decoder.h b/chromium/media/base/async_destroy_video_decoder.h index e0f9f9352d7..93456f19f52 100644 --- a/chromium/media/base/async_destroy_video_decoder.h +++ b/chromium/media/base/async_destroy_video_decoder.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/async_destroy_video_encoder.h b/chromium/media/base/async_destroy_video_encoder.h index 6debc10fee7..d6ab76221a3 100644 --- a/chromium/media/base/async_destroy_video_encoder.h +++ b/chromium/media/base/async_destroy_video_encoder.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/audio_block_fifo.cc b/chromium/media/base/audio_block_fifo.cc index ad49cff0637..41c1f1a5b66 100644 --- a/chromium/media/base/audio_block_fifo.cc +++ b/chromium/media/base/audio_block_fifo.cc @@ -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/base/audio_block_fifo.h b/chromium/media/base/audio_block_fifo.h index a3abd8b2bc2..b2778d708bc 100644 --- a/chromium/media/base/audio_block_fifo.h +++ b/chromium/media/base/audio_block_fifo.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/base/audio_block_fifo_unittest.cc b/chromium/media/base/audio_block_fifo_unittest.cc index fd443e69a10..82095509b6d 100644 --- a/chromium/media/base/audio_block_fifo_unittest.cc +++ b/chromium/media/base/audio_block_fifo_unittest.cc @@ -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/base/audio_buffer.cc b/chromium/media/base/audio_buffer.cc index 93f3e33612e..d5fa4722d61 100644 --- a/chromium/media/base/audio_buffer.cc +++ b/chromium/media/base/audio_buffer.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -100,6 +100,7 @@ AudioBuffer::AudioBuffer(SampleFormat sample_format, CHECK_GE(channel_count_, 0); CHECK_LE(channel_count_, limits::kMaxChannels); CHECK_GE(frame_count, 0); + DCHECK(channel_layout == CHANNEL_LAYOUT_DISCRETE || ChannelLayoutToChannelCount(channel_layout) == channel_count); @@ -112,6 +113,25 @@ AudioBuffer::AudioBuffer(SampleFormat sample_format, CHECK_NE(sample_format, kUnknownSampleFormat); + if (sample_format == kSampleFormatIECDts) { + // Allocate a contiguous buffer for IEC61937 encapsulated Bitstream. + data_size_ = frame_count * bytes_per_channel * channel_count_; + if (pool_) { + data_ = pool_->CreateBuffer(data_size_); + } else { + // Aligned buffer ensures compatibility with AudioBus + // and audio sink which have been optimized for SSE + data_.reset(static_cast<uint8_t*>( + base::AlignedAlloc(data_size, kChannelAlignment))); + } + channel_data_.reserve(1); + channel_data_.push_back(data_.get()); + + // Copy data + if (data) + memcpy(channel_data_[0], data[0], data_size); + return; + } int data_size_per_channel = frame_count * bytes_per_channel; if (IsPlanar(sample_format)) { DCHECK(!IsBitstreamFormat()) << sample_format_; @@ -510,6 +530,7 @@ void AudioBuffer::TrimRange(int start, int end) { case kSampleFormatMpegHAudio: case kSampleFormatDts: case kSampleFormatDtsxP2: + case kSampleFormatIECDts: NOTREACHED() << "Invalid sample format!"; } } else { diff --git a/chromium/media/base/audio_buffer.h b/chromium/media/base/audio_buffer.h index 5c1de98422b..0518da9977b 100644 --- a/chromium/media/base/audio_buffer.h +++ b/chromium/media/base/audio_buffer.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_buffer_converter.cc b/chromium/media/base/audio_buffer_converter.cc index a62b6113bdb..c8655f3d412 100644 --- a/chromium/media/base/audio_buffer_converter.cc +++ b/chromium/media/base/audio_buffer_converter.cc @@ -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. @@ -140,14 +140,14 @@ void AudioBufferConverter::ResetConverter(const AudioBuffer& buffer) { Flush(); audio_converter_.reset(); input_params_.Reset( - input_params_.format(), buffer.channel_layout(), buffer.sample_rate(), + input_params_.format(), {buffer.channel_layout(), buffer.channel_count()}, + buffer.sample_rate(), // If resampling is needed and the FIFO disabled, the AudioConverter will // always request SincResampler::kDefaultRequestSize frames. Otherwise it // will use the output frame size. buffer.sample_rate() == output_params_.sample_rate() ? output_params_.frames_per_buffer() : SincResampler::kDefaultRequestSize); - input_params_.set_channels_for_discrete(buffer.channel_count()); io_sample_rate_ratio_ = static_cast<double>(input_params_.sample_rate()) / output_params_.sample_rate(); diff --git a/chromium/media/base/audio_buffer_converter.h b/chromium/media/base/audio_buffer_converter.h index f59e8f23354..511cb3f51e5 100644 --- a/chromium/media/base/audio_buffer_converter.h +++ b/chromium/media/base/audio_buffer_converter.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/base/audio_buffer_converter_unittest.cc b/chromium/media/base/audio_buffer_converter_unittest.cc index a72a1703ff3..beec133aad4 100644 --- a/chromium/media/base/audio_buffer_converter_unittest.cc +++ b/chromium/media/base/audio_buffer_converter_unittest.cc @@ -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. @@ -19,7 +19,7 @@ namespace media { // Important: Use an odd buffer size here so SIMD issues are caught. const int kOutFrameSize = 441; const int kOutSampleRate = 44100; -const ChannelLayout kOutChannelLayout = CHANNEL_LAYOUT_STEREO; +constexpr ChannelLayout kOutChannelLayout = CHANNEL_LAYOUT_STEREO; const int kOutChannelCount = 2; static scoped_refptr<AudioBuffer> MakeTestBuffer(int sample_rate, @@ -38,7 +38,7 @@ class AudioBufferConverterTest : public ::testing::Test { expected_output_frames_(0.0), output_frames_(0), output_params_(AudioParameters::AUDIO_PCM_LOW_LATENCY, - kOutChannelLayout, + ChannelLayoutConfig::FromLayout<kOutChannelLayout>(), kOutSampleRate, kOutFrameSize) { audio_buffer_converter_ = @@ -208,8 +208,7 @@ TEST_F(AudioBufferConverterTest, ResetThenConvert) { TEST_F(AudioBufferConverterTest, DiscreteChannelLayout) { output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_DISCRETE, kOutSampleRate, 512); - output_params_.set_channels_for_discrete(2); + {CHANNEL_LAYOUT_DISCRETE, 2}, kOutSampleRate, 512); audio_buffer_converter_ = std::make_unique<AudioBufferConverter>(output_params_); AddInput(MakeTestBuffer(kOutSampleRate, CHANNEL_LAYOUT_STEREO, 2, 512)); @@ -217,10 +216,10 @@ TEST_F(AudioBufferConverterTest, DiscreteChannelLayout) { } TEST_F(AudioBufferConverterTest, LargeBuffersResampling) { - output_params_ = AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - kOutChannelLayout, - kOutSampleRate, - 2048); + output_params_ = + AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, + ChannelLayoutConfig::FromLayout<kOutChannelLayout>(), + kOutSampleRate, 2048); audio_buffer_converter_ = std::make_unique<AudioBufferConverter>(output_params_); diff --git a/chromium/media/base/audio_buffer_queue.cc b/chromium/media/base/audio_buffer_queue.cc index ca5be72da5c..a8cdc8e2e84 100644 --- a/chromium/media/base/audio_buffer_queue.cc +++ b/chromium/media/base/audio_buffer_queue.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_buffer_queue.h b/chromium/media/base/audio_buffer_queue.h index c6d1d990797..098c509c32b 100644 --- a/chromium/media/base/audio_buffer_queue.h +++ b/chromium/media/base/audio_buffer_queue.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_buffer_queue_unittest.cc b/chromium/media/base/audio_buffer_queue_unittest.cc index f7760654537..ad12a991884 100644 --- a/chromium/media/base/audio_buffer_queue_unittest.cc +++ b/chromium/media/base/audio_buffer_queue_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_buffer_unittest.cc b/chromium/media/base/audio_buffer_unittest.cc index e20fff84008..4b6b9b39076 100644 --- a/chromium/media/base/audio_buffer_unittest.cc +++ b/chromium/media/base/audio_buffer_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -255,6 +255,48 @@ TEST(AudioBufferTest, CreateBitstreamBuffer) { EXPECT_FALSE(buffer->end_of_stream()); } +TEST(AudioBufferTest, CopyBitstreamFromIECDts) { + const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; + const int kChannelCount = ChannelLayoutToChannelCount(kChannelLayout); + constexpr int kFrameCount = 512; + constexpr uint8_t kTestData[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; + const base::TimeDelta kTimestamp = base::Microseconds(1337); + const uint8_t* const data[] = {kTestData}; + + scoped_refptr<AudioBuffer> buffer = AudioBuffer::CopyBitstreamFrom( + kSampleFormatIECDts, kChannelLayout, kChannelCount, kSampleRate, + kFrameCount, data, sizeof(kTestData), kTimestamp); + + EXPECT_EQ(kChannelLayout, buffer->channel_layout()); + EXPECT_EQ(kFrameCount, buffer->frame_count()); + EXPECT_EQ(kSampleRate, buffer->sample_rate()); + EXPECT_EQ(kFrameCount, buffer->frame_count()); + EXPECT_EQ(kTimestamp, buffer->timestamp()); + EXPECT_TRUE(buffer->IsBitstreamFormat()); + EXPECT_FALSE(buffer->end_of_stream()); +} + +TEST(AudioBufferTest, CreateBitstreamBufferIECDts) { + const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_MONO; + const int kChannelCount = ChannelLayoutToChannelCount(kChannelLayout); + const int kFrameCount = 512; + const int kDataSize = 2048; + + scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateBitstreamBuffer( + kSampleFormatIECDts, kChannelLayout, kChannelCount, kSampleRate, + kFrameCount, kDataSize); + + EXPECT_EQ(kChannelLayout, buffer->channel_layout()); + EXPECT_EQ(kFrameCount, buffer->frame_count()); + EXPECT_EQ(kSampleRate, buffer->sample_rate()); + EXPECT_EQ(kFrameCount, buffer->frame_count()); + EXPECT_EQ(kNoTimestamp, buffer->timestamp()); + EXPECT_TRUE(buffer->IsBitstreamFormat()); + EXPECT_FALSE(buffer->end_of_stream()); +} + TEST(AudioBufferTest, CreateEOSBuffer) { scoped_refptr<AudioBuffer> buffer = AudioBuffer::CreateEOSBuffer(); EXPECT_TRUE(buffer->end_of_stream()); @@ -303,6 +345,27 @@ TEST(AudioBufferTest, ReadBitstream) { VerifyBitstreamAudioBus(bus.get(), data_size, 1, 1); } +TEST(AudioBufferTest, ReadBitstreamIECDts) { + const ChannelLayout channel_layout = CHANNEL_LAYOUT_MONO; + const int channels = ChannelLayoutToChannelCount(channel_layout); + const int frames = 512; + const size_t data_size = frames * 2 * 2; + const base::TimeDelta start_time; + + scoped_refptr<AudioBuffer> buffer = MakeBitstreamAudioBuffer( + kSampleFormatIECDts, channel_layout, channels, kSampleRate, 1, 1, frames, + data_size, start_time); + EXPECT_TRUE(buffer->IsBitstreamFormat()); + + std::unique_ptr<AudioBus> bus = AudioBus::Create(channels, frames); + buffer->ReadFrames(frames, 0, 0, bus.get()); + + EXPECT_TRUE(bus->is_bitstream_format()); + EXPECT_EQ(frames, bus->GetBitstreamFrames()); + EXPECT_EQ(data_size, bus->GetBitstreamDataSize()); + VerifyBitstreamAudioBus(bus.get(), data_size, 1, 1); +} + TEST(AudioBufferTest, ReadU8) { const ChannelLayout channel_layout = CHANNEL_LAYOUT_4_0; const int channels = ChannelLayoutToChannelCount(channel_layout); diff --git a/chromium/media/base/audio_bus.cc b/chromium/media/base/audio_bus.cc index 3115558f367..5213c5db0dd 100644 --- a/chromium/media/base/audio_bus.cc +++ b/chromium/media/base/audio_bus.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. @@ -7,7 +7,6 @@ #include <stddef.h> #include <stdint.h> -#include <cstring> #include <limits> #include <utility> diff --git a/chromium/media/base/audio_bus.h b/chromium/media/base/audio_bus.h index 5278bbfa5f1..62ab56d6afd 100644 --- a/chromium/media/base/audio_bus.h +++ b/chromium/media/base/audio_bus.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/base/audio_bus_perftest.cc b/chromium/media/base/audio_bus_perftest.cc index 45d1fdc2a9c..e0b6f43459e 100644 --- a/chromium/media/base/audio_bus_perftest.cc +++ b/chromium/media/base/audio_bus_perftest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_bus_unittest.cc b/chromium/media/base/audio_bus_unittest.cc index 753b407d92f..387cf96daf7 100644 --- a/chromium/media/base/audio_bus_unittest.cc +++ b/chromium/media/base/audio_bus_unittest.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. @@ -24,7 +24,7 @@ namespace media { static const int kChannels = 6; -static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_5_1; +static constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_5_1; // Use a buffer size which is intentionally not a multiple of kChannelAlignment. static const int kFrameCount = media::AudioBus::kChannelAlignment * 32 - 1; static const int kSampleRate = 48000; @@ -141,7 +141,8 @@ TEST_F(AudioBusTest, Create) { // Verify Create(...) using AudioParameters works as advertised. TEST_F(AudioBusTest, CreateUsingAudioParameters) { std::unique_ptr<AudioBus> bus = AudioBus::Create( - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::FromLayout<kChannelLayout>(), kSampleRate, kFrameCount)); VerifyChannelAndFrameCount(bus.get()); VerifyReadWriteAndAlignment(bus.get()); @@ -187,7 +188,8 @@ TEST_F(AudioBusTest, WrapVector) { // Verify an AudioBus created via wrapping a memory block works as advertised. TEST_F(AudioBusTest, WrapMemory) { - AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, + AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::FromLayout<kChannelLayout>(), kSampleRate, kFrameCount); int data_size = AudioBus::CalculateMemorySize(params); std::unique_ptr<float, base::AlignedFreeDeleter> data(static_cast<float*>( @@ -215,7 +217,8 @@ TEST_F(AudioBusTest, WrapMemory) { TEST_F(AudioBusTest, CopyTo) { // Create one bus with AudioParameters and the other through direct values to // test for parity between the Create() functions. - AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, + AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::FromLayout<kChannelLayout>(), kSampleRate, kFrameCount); std::unique_ptr<AudioBus> bus1 = AudioBus::Create(kChannels, kFrameCount); std::unique_ptr<AudioBus> bus2 = AudioBus::Create(params); diff --git a/chromium/media/base/audio_capturer_source.h b/chromium/media/base/audio_capturer_source.h index 14664c21927..3745397bb7c 100644 --- a/chromium/media/base/audio_capturer_source.h +++ b/chromium/media/base/audio_capturer_source.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/base/audio_codecs.cc b/chromium/media/base/audio_codecs.cc index 7f5b6e0e80b..5ce194a4c13 100644 --- a/chromium/media/base/audio_codecs.cc +++ b/chromium/media/base/audio_codecs.cc @@ -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/base/audio_codecs.h b/chromium/media/base/audio_codecs.h index 168ef272374..f4dfece0113 100644 --- a/chromium/media/base/audio_codecs.h +++ b/chromium/media/base/audio_codecs.h @@ -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/base/audio_converter.cc b/chromium/media/base/audio_converter.cc index ac54e86ed35..a9d261b9b91 100644 --- a/chromium/media/base/audio_converter.cc +++ b/chromium/media/base/audio_converter.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. // @@ -10,11 +10,11 @@ #include "media/base/audio_converter.h" -#include <algorithm> #include <memory> #include "base/bind.h" #include "base/callback_helpers.h" +#include "base/containers/contains.h" #include "base/logging.h" #include "base/trace_event/trace_event.h" #include "media/base/audio_bus.h" @@ -88,14 +88,12 @@ AudioConverter::AudioConverter(const AudioParameters& input_params, AudioConverter::~AudioConverter() = default; void AudioConverter::AddInput(InputCallback* input) { - DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) == - transform_inputs_.end()); + DCHECK(!base::Contains(transform_inputs_, input)); transform_inputs_.push_back(input); } void AudioConverter::RemoveInput(InputCallback* input) { - DCHECK(std::find(transform_inputs_.begin(), transform_inputs_.end(), input) != - transform_inputs_.end()); + DCHECK(base::Contains(transform_inputs_, input)); transform_inputs_.remove(input); if (transform_inputs_.empty()) diff --git a/chromium/media/base/audio_converter.h b/chromium/media/base/audio_converter.h index c48a59c8892..bf557c8e294 100644 --- a/chromium/media/base/audio_converter.h +++ b/chromium/media/base/audio_converter.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/base/audio_converter_perftest.cc b/chromium/media/base/audio_converter_perftest.cc index 75f02888503..44519176155 100644 --- a/chromium/media/base/audio_converter_perftest.cc +++ b/chromium/media/base/audio_converter_perftest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -55,9 +55,10 @@ TEST(AudioConverterPerfTest, ConvertBenchmark) { // Create input and output parameters to convert between the two most common // sets of parameters (as indicated via UMA data). AudioParameters input_params(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_MONO, 48000, 2048); + media::ChannelLayoutConfig::Mono(), 48000, 2048); AudioParameters output_params(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_STEREO, 44100, 440); + media::ChannelLayoutConfig::Stereo(), 44100, + 440); RunConvertBenchmark(input_params, output_params, false, "convert"); } @@ -66,11 +67,11 @@ TEST(AudioConverterPerfTest, ConvertBenchmarkFIFO) { // Create input and output parameters to convert between common buffer sizes // without any resampling for the FIFO vs no FIFO benchmarks. AudioParameters input_params(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_STEREO, - 44100, + media::ChannelLayoutConfig::Stereo(), 44100, 2048); AudioParameters output_params(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_STEREO, 44100, 440); + media::ChannelLayoutConfig::Stereo(), 44100, + 440); RunConvertBenchmark(input_params, output_params, true, "convert_fifo_only"); RunConvertBenchmark(input_params, output_params, false, diff --git a/chromium/media/base/audio_converter_unittest.cc b/chromium/media/base/audio_converter_unittest.cc index b7a8240f1f1..730af83fb36 100644 --- a/chromium/media/base/audio_converter_unittest.cc +++ b/chromium/media/base/audio_converter_unittest.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. @@ -22,7 +22,7 @@ static const int kConvertInputs = 8; static const int kConvertCycles = 3; // Parameters used for testing. -static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; +static constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; static const int kHighLatencyBufferSize = 2048; static const int kLowLatencyBufferSize = 256; static const int kSampleRate = 48000; @@ -30,15 +30,17 @@ static const int kSampleRate = 48000; // Number of full sine wave cycles for each Render() call. static const int kSineCycles = 4; -// Tuple of <input rate, output rate, output channel layout, epsilon>. -typedef std::tuple<int, int, ChannelLayout, double> AudioConverterTestData; +// Tuple of <input rate, output rate, output channel layout config, epsilon>. +typedef std::tuple<int, int, ChannelLayoutConfig, double> + AudioConverterTestData; class AudioConverterTest : public testing::TestWithParam<AudioConverterTestData> { public: AudioConverterTest() : epsilon_(std::get<3>(GetParam())) { // Create input and output parameters based on test parameters. input_parameters_ = - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::FromLayout<kChannelLayout>(), std::get<0>(GetParam()), kHighLatencyBufferSize); output_parameters_ = AudioParameters( AudioParameters::AUDIO_PCM_LOW_LATENCY, std::get<2>(GetParam()), @@ -200,13 +202,11 @@ TEST(AudioConverterTest, AudioDelayAndDiscreteChannelCount) { // Choose input and output parameters such that the transform must make // multiple calls to fill the buffer. AudioParameters input_parameters(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_DISCRETE, kSampleRate, + {CHANNEL_LAYOUT_DISCRETE, 10}, kSampleRate, kLowLatencyBufferSize); - input_parameters.set_channels_for_discrete(10); AudioParameters output_parameters(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_DISCRETE, kSampleRate * 2, - kHighLatencyBufferSize); - output_parameters.set_channels_for_discrete(5); + {CHANNEL_LAYOUT_DISCRETE, 5}, + kSampleRate * 2, kHighLatencyBufferSize); AudioConverter converter(input_parameters, output_parameters, false); FakeAudioRenderCallback callback(0.2, kSampleRate); @@ -257,12 +257,18 @@ INSTANTIATE_TEST_SUITE_P( AudioConverterTest, testing::Values( // No resampling. No channel mixing. - std::make_tuple(44100, 44100, CHANNEL_LAYOUT_STEREO, 0.00000048), + std::make_tuple(44100, + 44100, + ChannelLayoutConfig::Stereo(), + 0.00000048), // Upsampling. Channel upmixing. - std::make_tuple(44100, 48000, CHANNEL_LAYOUT_QUAD, 0.033), + std::make_tuple(44100, + 48000, + ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_QUAD>(), + 0.033), // Downsampling. Channel downmixing. - std::make_tuple(48000, 41000, CHANNEL_LAYOUT_MONO, 0.042))); + std::make_tuple(48000, 41000, ChannelLayoutConfig::Mono(), 0.042))); } // namespace media diff --git a/chromium/media/base/audio_decoder.cc b/chromium/media/base/audio_decoder.cc index 4ff425e9dfd..8b53ad699fb 100644 --- a/chromium/media/base/audio_decoder.cc +++ b/chromium/media/base/audio_decoder.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/base/audio_decoder.h b/chromium/media/base/audio_decoder.h index fea0a1394e0..9a1d5bb04fb 100644 --- a/chromium/media/base/audio_decoder.h +++ b/chromium/media/base/audio_decoder.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/base/audio_decoder_config.cc b/chromium/media/base/audio_decoder_config.cc index 1285f096f83..f49f19d87da 100644 --- a/chromium/media/base/audio_decoder_config.cc +++ b/chromium/media/base/audio_decoder_config.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/base/audio_decoder_config.h b/chromium/media/base/audio_decoder_config.h index 63379a2c1e1..2f53e231bdc 100644 --- a/chromium/media/base/audio_decoder_config.h +++ b/chromium/media/base/audio_decoder_config.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/base/audio_discard_helper.cc b/chromium/media/base/audio_discard_helper.cc index 2a59daa7bc9..1e706faba4e 100644 --- a/chromium/media/base/audio_discard_helper.cc +++ b/chromium/media/base/audio_discard_helper.cc @@ -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/base/audio_discard_helper.h b/chromium/media/base/audio_discard_helper.h index 20e8d54ec81..f4bc886a292 100644 --- a/chromium/media/base/audio_discard_helper.h +++ b/chromium/media/base/audio_discard_helper.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/base/audio_discard_helper_unittest.cc b/chromium/media/base/audio_discard_helper_unittest.cc index 0b892c96401..c13409b2ea1 100644 --- a/chromium/media/base/audio_discard_helper_unittest.cc +++ b/chromium/media/base/audio_discard_helper_unittest.cc @@ -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/base/audio_encoder.cc b/chromium/media/base/audio_encoder.cc index bb19db69df8..af4b72c4b6c 100644 --- a/chromium/media/base/audio_encoder.cc +++ b/chromium/media/base/audio_encoder.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/audio_encoder.h b/chromium/media/base/audio_encoder.h index c94c137e049..50dfaf95495 100644 --- a/chromium/media/base/audio_encoder.h +++ b/chromium/media/base/audio_encoder.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/audio_fifo.cc b/chromium/media/base/audio_fifo.cc index e1307316b98..1f8aa15c853 100644 --- a/chromium/media/base/audio_fifo.cc +++ b/chromium/media/base/audio_fifo.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/base/audio_fifo.h b/chromium/media/base/audio_fifo.h index 019c846be51..9810db4b318 100644 --- a/chromium/media/base/audio_fifo.h +++ b/chromium/media/base/audio_fifo.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/base/audio_fifo_unittest.cc b/chromium/media/base/audio_fifo_unittest.cc index 2d76c2a5d97..bacccae18fd 100644 --- a/chromium/media/base/audio_fifo_unittest.cc +++ b/chromium/media/base/audio_fifo_unittest.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/base/audio_hash.cc b/chromium/media/base/audio_hash.cc index 236d92d8920..24908d316d7 100644 --- a/chromium/media/base/audio_hash.cc +++ b/chromium/media/base/audio_hash.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_hash.h b/chromium/media/base/audio_hash.h index 758198591ac..f0df5a81ff9 100644 --- a/chromium/media/base/audio_hash.h +++ b/chromium/media/base/audio_hash.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_hash_unittest.cc b/chromium/media/base/audio_hash_unittest.cc index 60b4982a92d..60a64803f4c 100644 --- a/chromium/media/base/audio_hash_unittest.cc +++ b/chromium/media/base/audio_hash_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_latency.cc b/chromium/media/base/audio_latency.cc index f102f238116..ced5873f122 100644 --- a/chromium/media/base/audio_latency.cc +++ b/chromium/media/base/audio_latency.cc @@ -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. @@ -24,11 +24,15 @@ #include "media/base/mac/audio_latency_mac.h" #endif +#if BUILDFLAG(IS_FUCHSIA) +#include "base/fuchsia/scheduler.h" +#endif + namespace media { namespace { -#if !BUILDFLAG(IS_WIN) +#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_FUCHSIA) // Taken from "Bit Twiddling Hacks" // http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2 uint32_t RoundUpToPowerOfTwo(uint32_t v) { @@ -67,6 +71,8 @@ int LCM(int a, int b) { bool AudioLatency::IsResamplingPassthroughSupported(LatencyType type) { #if BUILDFLAG(IS_CHROMEOS_ASH) return true; +#elif BUILDFLAG(IS_FUCHSIA) + return true; #elif BUILDFLAG(IS_ANDROID) // Only N MR1+ has support for OpenSLES performance modes which allow for // power efficient playback. Per the Android audio team, we shouldn't waste @@ -83,12 +89,20 @@ bool AudioLatency::IsResamplingPassthroughSupported(LatencyType type) { // static int AudioLatency::GetHighLatencyBufferSize(int sample_rate, int preferred_buffer_size) { - // Empirically, we consider 20ms of samples to be high latency. -#if !defined(USE_CRAS) +#if defined(USE_CRAS) + // Use 80ms rounded to a power of 2. + const double eighty_ms_size = 8.0 * sample_rate / 100; + const int high_latency_buffer_size = RoundUpToPowerOfTwo(eighty_ms_size); +#elif BUILDFLAG(IS_FUCHSIA) + // Use 80ms buffers. Doesn't need to be aligned to power of 2, but it should + // be a multiple of the scheduling period used for audio threads. + constexpr base::TimeDelta period = base::Milliseconds(80); + static_assert(static_cast<int>(period / base::kAudioSchedulingPeriod) == + period / base::kAudioSchedulingPeriod); + const int high_latency_buffer_size = period.InMilliseconds() * sample_rate / + base::Time::kMillisecondsPerSecond; +#elif BUILDFLAG(IS_WIN) const double twenty_ms_size = 2.0 * sample_rate / 100; -#endif - -#if BUILDFLAG(IS_WIN) preferred_buffer_size = std::max(preferred_buffer_size, 1); // Windows doesn't use power of two buffer sizes, so we should always round up @@ -109,13 +123,9 @@ int AudioLatency::GetHighLatencyBufferSize(int sample_rate, // // On Linux, the minimum hardware buffer size is 512, so the lower calculated // values are unused. OSX may have a value as low as 128. -#if defined(USE_CRAS) - const double eighty_ms_size = 8.0 * sample_rate / 100; - const int high_latency_buffer_size = RoundUpToPowerOfTwo(eighty_ms_size); -#else + const double twenty_ms_size = 2.0 * sample_rate / 100; const int high_latency_buffer_size = RoundUpToPowerOfTwo(twenty_ms_size); -#endif // defined(USE_CRAS) -#endif // BUILDFLAG(IS_WIN) +#endif return std::max(preferred_buffer_size, high_latency_buffer_size); } diff --git a/chromium/media/base/audio_latency.h b/chromium/media/base/audio_latency.h index 5e024f315ae..2b000bc37ac 100644 --- a/chromium/media/base/audio_latency.h +++ b/chromium/media/base/audio_latency.h @@ -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/base/audio_latency_unittest.cc b/chromium/media/base/audio_latency_unittest.cc index d3c75657326..6b5145cfaed 100644 --- a/chromium/media/base/audio_latency_unittest.cc +++ b/chromium/media/base/audio_latency_unittest.cc @@ -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. @@ -122,19 +122,15 @@ class AudioLatencyTest : public testing::TestWithParam<AudioLatencyTestData> { // TODO(olka): extend unit tests, use real-world sample rates. TEST(AudioLatency, HighLatencyBufferSizes) { + for (int i = 6400; i <= 204800; i *= 2) #if BUILDFLAG(IS_WIN) - for (int i = 6400; i <= 204800; i *= 2) { EXPECT_EQ(2 * (i / 100), AudioLatency::GetHighLatencyBufferSize(i, i / 100)); - } -#else - for (int i = 6400; i <= 204800; i *= 2) -#if defined(USE_CRAS) +#elif defined(USE_CRAS) || BUILDFLAG(IS_FUCHSIA) EXPECT_EQ(8 * (i / 100), AudioLatency::GetHighLatencyBufferSize(i, 32)); #else EXPECT_EQ(2 * (i / 100), AudioLatency::GetHighLatencyBufferSize(i, 32)); #endif // defined(USE_CRAS) -#endif // BUILDFLAG(IS_WIN) } TEST(AudioLatency, InteractiveBufferSizes) { diff --git a/chromium/media/base/audio_parameters.cc b/chromium/media/base/audio_parameters.cc index a06134c67a7..d9c200ee667 100644 --- a/chromium/media/base/audio_parameters.cc +++ b/chromium/media/base/audio_parameters.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. @@ -6,11 +6,32 @@ #include <sstream> +#include "base/check_op.h" #include "media/base/audio_bus.h" +#include "media/base/channel_layout.h" #include "media/base/limits.h" namespace media { +namespace { + +int ComputeChannelCount(ChannelLayout channel_layout, int channels) { + if (channel_layout == CHANNEL_LAYOUT_DISCRETE) { + CHECK_NE(0, channels); + return channels; + } else if (channel_layout == CHANNEL_LAYOUT_5_1_4_DOWNMIX && channels != 0) { + // For CHANNEL_LAYOUT_5_1_4_DOWNMIX we can set a custom number of channels, + // but we are not forced to. + return channels; + } + const int calculated_channel_count = + ChannelLayoutToChannelCount(channel_layout); + DCHECK_EQ(calculated_channel_count, channels); + return calculated_channel_count; +} + +} // namespace + static_assert(AudioBus::kChannelAlignment == kParametersAlignment, "Audio buffer parameters struct alignment not same as AudioBus"); static_assert(sizeof(AudioInputBufferParameters) % @@ -40,6 +61,8 @@ const char* FormatToString(AudioParameters::Format format) { return "BITSTREAM_DTSX_P2"; case AudioParameters::AUDIO_BITSTREAM_IEC61937: return "BITSTREAM_IEC61937"; + case AudioParameters::AUDIO_BITSTREAM_DTS_HD_MA: + return "BITSTREAM_DTS_HD_MA"; case AudioParameters::AUDIO_FAKE: return "FAKE"; } @@ -91,26 +114,56 @@ uint32_t ComputeAudioOutputBufferSize(int channels, int frames) { return result.ValueOrDie(); } +ChannelLayoutConfig::ChannelLayoutConfig(const ChannelLayoutConfig& other) = + default; +ChannelLayoutConfig& ChannelLayoutConfig::operator=( + const ChannelLayoutConfig& other) = default; +ChannelLayoutConfig::~ChannelLayoutConfig() = default; + +ChannelLayoutConfig::ChannelLayoutConfig() + : ChannelLayoutConfig( + ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_NONE>()) {} + +ChannelLayoutConfig::ChannelLayoutConfig(ChannelLayout channel_layout, + int channels) + : channel_layout_(channel_layout), + channels_(ComputeChannelCount(channel_layout, channels)) {} + +ChannelLayoutConfig ChannelLayoutConfig::Mono() { + return FromLayout<CHANNEL_LAYOUT_MONO>(); +} + +ChannelLayoutConfig ChannelLayoutConfig::Stereo() { + return FromLayout<CHANNEL_LAYOUT_STEREO>(); +} + +ChannelLayoutConfig ChannelLayoutConfig::Guess(int channels) { + return ChannelLayoutConfig(GuessChannelLayout(channels), channels); +} + AudioParameters::AudioParameters() - : AudioParameters(AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_NONE, 0, 0) {} + : AudioParameters(AUDIO_PCM_LINEAR, + ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_NONE>(), + 0, + 0) {} AudioParameters::AudioParameters(Format format, - ChannelLayout channel_layout, + ChannelLayoutConfig channel_layout_config, int sample_rate, int frames_per_buffer) : latency_tag_(AudioLatency::LATENCY_COUNT) { - Reset(format, channel_layout, sample_rate, frames_per_buffer); + Reset(format, channel_layout_config, sample_rate, frames_per_buffer); } AudioParameters::AudioParameters( Format format, - ChannelLayout channel_layout, + ChannelLayoutConfig channel_layout_config, int sample_rate, int frames_per_buffer, const HardwareCapabilities& hardware_capabilities) : latency_tag_(AudioLatency::LATENCY_COUNT), hardware_capabilities_(hardware_capabilities) { - Reset(format, channel_layout, sample_rate, frames_per_buffer); + Reset(format, channel_layout_config, sample_rate, frames_per_buffer); } AudioParameters::~AudioParameters() = default; @@ -119,12 +172,11 @@ AudioParameters::AudioParameters(const AudioParameters&) = default; AudioParameters& AudioParameters::operator=(const AudioParameters&) = default; void AudioParameters::Reset(Format format, - ChannelLayout channel_layout, + ChannelLayoutConfig channel_layout_config, int sample_rate, int frames_per_buffer) { format_ = format; - channel_layout_ = channel_layout; - channels_ = ChannelLayoutToChannelCount(channel_layout); + channel_layout_config_ = channel_layout_config; sample_rate_ = sample_rate; frames_per_buffer_ = frames_per_buffer; effects_ = NO_EFFECTS; @@ -132,8 +184,8 @@ void AudioParameters::Reset(Format format, } bool AudioParameters::IsValid() const { - return (channels_ > 0) && (channels_ <= media::limits::kMaxChannels) && - (channel_layout_ > CHANNEL_LAYOUT_UNSUPPORTED) && + return (channels() > 0) && (channels() <= media::limits::kMaxChannels) && + (channel_layout() > CHANNEL_LAYOUT_UNSUPPORTED) && (sample_rate_ >= media::limits::kMinSampleRate) && (sample_rate_ <= media::limits::kMaxSampleRate) && (frames_per_buffer_ > 0) && @@ -147,9 +199,9 @@ bool AudioParameters::IsValid() const { media::limits::kMaxSamplesPerPacket) && (hardware_capabilities_->max_frames_per_buffer >= hardware_capabilities_->min_frames_per_buffer))) && - (channel_layout_ == CHANNEL_LAYOUT_DISCRETE || - channel_layout_ == CHANNEL_LAYOUT_5_1_4_DOWNMIX || - channels_ == ChannelLayoutToChannelCount(channel_layout_)); + (channel_layout() == CHANNEL_LAYOUT_DISCRETE || + channel_layout() == CHANNEL_LAYOUT_5_1_4_DOWNMIX || + channels() == ChannelLayoutToChannelCount(channel_layout())); } std::string AudioParameters::AsHumanReadableString() const { @@ -165,7 +217,9 @@ std::string AudioParameters::AsHumanReadableString() const { << hardware_capabilities_->min_frames_per_buffer << ", max_frames_per_buffer: " << hardware_capabilities_->max_frames_per_buffer - << ", bitstream_formats:" << hardware_capabilities_->bitstream_formats; + << ", bitstream_formats:" << hardware_capabilities_->bitstream_formats + << ", require_encapsulation:" + << hardware_capabilities_->require_encapsulation; } return s.str(); } @@ -175,7 +229,7 @@ int AudioParameters::GetBytesPerBuffer(SampleFormat fmt) const { } int AudioParameters::GetBytesPerFrame(SampleFormat fmt) const { - return channels_ * SampleFormatToBytesPerChannel(fmt); + return channels() * SampleFormatToBytesPerChannel(fmt); } double AudioParameters::GetMicrosecondsPerFrame() const { @@ -190,8 +244,8 @@ base::TimeDelta AudioParameters::GetBufferDuration() const { bool AudioParameters::Equals(const AudioParameters& other) const { return format_ == other.format() && sample_rate_ == other.sample_rate() && - channel_layout_ == other.channel_layout() && - channels_ == other.channels() && + channel_layout() == other.channel_layout() && + channels() == other.channels() && frames_per_buffer_ == other.frames_per_buffer() && effects_ == other.effects() && mic_positions_ == other.mic_positions_; } @@ -215,13 +269,23 @@ bool AudioParameters::IsFormatSupportedByHardware(Format format) const { (hardware_capabilities_->bitstream_formats & format); } +void AudioParameters::SetChannelLayoutConfig(ChannelLayout layout, + int channels) { + channel_layout_config_ = {layout, channels}; +} + +bool AudioParameters::RequireEncapsulation() const { + return hardware_capabilities_.has_value() && + hardware_capabilities_->require_encapsulation; +} + // static AudioParameters AudioParameters::UnavailableDeviceParams() { // Using 10 ms buffer since WebAudioMediaStreamSource::DeliverRebufferedAudio // deals incorrectly with reference time calculation if output buffer size // significantly differs from 10 ms used there, see http://crbug/701000. return media::AudioParameters( - media::AudioParameters::AUDIO_FAKE, media::CHANNEL_LAYOUT_STEREO, + media::AudioParameters::AUDIO_FAKE, ChannelLayoutConfig::Stereo(), media::AudioParameters::kAudioCDSampleRate, media::AudioParameters::kAudioCDSampleRate / 100); } diff --git a/chromium/media/base/audio_parameters.h b/chromium/media/base/audio_parameters.h index dccb01bfe1a..6ba5066b0d1 100644 --- a/chromium/media/base/audio_parameters.h +++ b/chromium/media/base/audio_parameters.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. @@ -112,23 +112,61 @@ ComputeAudioOutputBufferSize(const AudioParameters& parameters); MEDIA_SHMEM_EXPORT uint32_t ComputeAudioOutputBufferSize(int channels, int frames); +// Channel count and ChannelLayout pair, with helper methods to enforce safe +// construction. +class MEDIA_SHMEM_EXPORT ChannelLayoutConfig { + public: + ChannelLayoutConfig(const ChannelLayoutConfig& other); + ChannelLayoutConfig& operator=(const ChannelLayoutConfig& other); + ChannelLayoutConfig(); + ChannelLayoutConfig(ChannelLayout channel_layout, int channels); + ~ChannelLayoutConfig(); + + template <ChannelLayout layout> + static ChannelLayoutConfig FromLayout() { + return ChannelLayoutConfig(layout, ChannelLayoutToChannelCount(layout)); + } + + static ChannelLayoutConfig Mono(); + + static ChannelLayoutConfig Stereo(); + + static ChannelLayoutConfig Guess(int channels); + + ChannelLayout channel_layout() const { return channel_layout_; } + + int channels() const { return channels_; } + + private: + ChannelLayout channel_layout_; // Order of surround sound channels. + int channels_; // Number of channels. +}; + +// For |CHANNEL_LAYOUT_DISCRETE|, we have to explicitly set the number of +// channels, so we need to use the normal constructor. +template <> +ChannelLayoutConfig ChannelLayoutConfig::FromLayout<CHANNEL_LAYOUT_DISCRETE>() = + delete; + class MEDIA_SHMEM_EXPORT AudioParameters { public: // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media // GENERATED_JAVA_CLASS_NAME_OVERRIDE: AudioEncodingFormat // GENERATED_JAVA_PREFIX_TO_STRIP: AUDIO_ enum Format { - AUDIO_FAKE = 0x00, // Creates a fake AudioOutputStream object - AUDIO_PCM_LINEAR = 0x01, // PCM is 'raw' amplitude samples. - AUDIO_PCM_LOW_LATENCY = 0x02, // Linear PCM, low latency requested. - AUDIO_BITSTREAM_AC3 = 0x04, // Compressed AC3 bitstream. - AUDIO_BITSTREAM_EAC3 = 0x08, // Compressed E-AC3 bitstream. - AUDIO_BITSTREAM_DTS = 0x10, // Compressed DTS bitstream. - AUDIO_BITSTREAM_DTS_HD = 0x20, // Compressed DTS-HD bitstream. - AUDIO_BITSTREAM_DTSX_P2 = 0x40, // Compressed DTS-HD bitstream. - AUDIO_BITSTREAM_IEC61937 = 0x80, // Compressed IEC61937 bitstream. + AUDIO_FAKE = 0x000, // Creates a fake AudioOutputStream object + AUDIO_PCM_LINEAR = 0x001, // PCM is 'raw' amplitude samples. + AUDIO_PCM_LOW_LATENCY = 0x002, // Linear PCM, low latency requested. + AUDIO_BITSTREAM_AC3 = 0x004, // Compressed AC3 bitstream. + AUDIO_BITSTREAM_EAC3 = 0x008, // Compressed E-AC3 bitstream. + AUDIO_BITSTREAM_DTS = 0x010, // Compressed DTS bitstream. + AUDIO_BITSTREAM_DTS_HD = 0x020, // Compressed DTS-HD bitstream. + AUDIO_BITSTREAM_DTSX_P2 = 0x040, // Compressed DTSX Profile 2 bitstream. + AUDIO_BITSTREAM_IEC61937 = 0x080, // Compressed IEC61937 bitstream. + AUDIO_BITSTREAM_DTS_HD_MA = + 0x100, // Compressed DTS-HD Master Audio bitstream. AUDIO_FORMAT_LAST = - AUDIO_BITSTREAM_IEC61937, // Only used for validation of format. + AUDIO_BITSTREAM_DTS_HD_MA, // Only used for validation of format. }; enum { @@ -162,21 +200,30 @@ class MEDIA_SHMEM_EXPORT AudioParameters { ALLOW_DSP_ECHO_CANCELLER = 1 << 9, ALLOW_DSP_NOISE_SUPPRESSION = 1 << 10, ALLOW_DSP_AUTOMATIC_GAIN_CONTROL = 1 << 11, + + FUCHSIA_RENDER_USAGE_BACKGROUND = 1 << 12, + FUCHSIA_RENDER_USAGE_MEDIA = 1 << 13, + FUCHSIA_RENDER_USAGE_INTERRUPTION = 1 << 14, + FUCHSIA_RENDER_USAGE_SYSTEM_AGENT = 1 << 15, + FUCHSIA_RENDER_USAGE_COMMUNICATION = 1 << 16, }; struct HardwareCapabilities { HardwareCapabilities(int min_frames_per_buffer, int max_frames_per_buffer) : min_frames_per_buffer(min_frames_per_buffer), max_frames_per_buffer(max_frames_per_buffer), - bitstream_formats(0) {} - explicit HardwareCapabilities(int bitstream_formats) + bitstream_formats(0), + require_encapsulation(false) {} + HardwareCapabilities(int bitstream_formats, bool require_encapsulation) : min_frames_per_buffer(0), max_frames_per_buffer(0), - bitstream_formats(bitstream_formats) {} + bitstream_formats(bitstream_formats), + require_encapsulation(require_encapsulation) {} HardwareCapabilities() : min_frames_per_buffer(0), max_frames_per_buffer(0), - bitstream_formats(0) {} + bitstream_formats(0), + require_encapsulation(false) {} // Minimum and maximum buffer sizes supported by the audio hardware. Opening // a device with frames_per_buffer set to a value between min and max should @@ -185,16 +232,22 @@ class MEDIA_SHMEM_EXPORT AudioParameters { // Either value can be 0 and means that the min or max is not known. int min_frames_per_buffer; int max_frames_per_buffer; + // Bitstream formats (OR'ed) supported by audio hardware. int bitstream_formats; + // Bitstream will need to be encapsulated in IEC61937 to be + // passed through to the audio hardware. + bool require_encapsulation; }; AudioParameters(); + AudioParameters(Format format, - ChannelLayout channel_layout, + ChannelLayoutConfig channel_layout_config, int sample_rate, int frames_per_buffer); + AudioParameters(Format format, - ChannelLayout channel_layout, + ChannelLayoutConfig channel_layout_config, int sample_rate, int frames_per_buffer, const HardwareCapabilities& hardware_capabilities); @@ -203,7 +256,7 @@ class MEDIA_SHMEM_EXPORT AudioParameters { // Re-initializes all members except for |hardware_capabilities_|. void Reset(Format format, - ChannelLayout channel_layout, + ChannelLayoutConfig channel_layout_config, int sample_rate, int frames_per_buffer); @@ -240,21 +293,22 @@ class MEDIA_SHMEM_EXPORT AudioParameters { bool IsFormatSupportedByHardware(Format format) const; + bool RequireEncapsulation() const; + void set_format(Format format) { format_ = format; } Format format() const { return format_; } - // A setter for channel_layout_ is intentionally excluded. - ChannelLayout channel_layout() const { return channel_layout_; } + void SetChannelLayoutConfig(ChannelLayout layout, int channels); - // The number of channels is usually computed from channel_layout_. Setting - // this explicitly is only required with CHANNEL_LAYOUT_DISCRETE. - void set_channels_for_discrete(int channels) { - DCHECK(channel_layout_ == CHANNEL_LAYOUT_DISCRETE || - channel_layout_ == CHANNEL_LAYOUT_5_1_4_DOWNMIX || - channels == ChannelLayoutToChannelCount(channel_layout_)); - channels_ = channels; + const ChannelLayoutConfig& channel_layout_config() const { + return channel_layout_config_; } - int channels() const { return channels_; } + + ChannelLayout channel_layout() const { + return channel_layout_config_.channel_layout(); + } + + int channels() const { return channel_layout_config_.channels(); } void set_sample_rate(int sample_rate) { sample_rate_ = sample_rate; } int sample_rate() const { return sample_rate_; } @@ -294,9 +348,8 @@ class MEDIA_SHMEM_EXPORT AudioParameters { private: Format format_; // Format of the stream. - ChannelLayout channel_layout_; // Order of surround sound channels. - int channels_; // Number of channels. Value set based on - // |channel_layout|. + ChannelLayoutConfig channel_layout_config_; // The channel layout and the + // number of channels. int sample_rate_; // Sampling frequency/rate. int frames_per_buffer_; // Number of frames in a buffer. int effects_; // Bitmask using PlatformEffectsMask. diff --git a/chromium/media/base/audio_parameters_unittest.cc b/chromium/media/base/audio_parameters_unittest.cc index 021f044991e..7ed6f52d5ff 100644 --- a/chromium/media/base/audio_parameters_unittest.cc +++ b/chromium/media/base/audio_parameters_unittest.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. @@ -7,6 +7,7 @@ #include <stddef.h> #include "base/strings/string_number_conversions.h" +#include "media/base/channel_layout.h" #include "testing/gtest/include/gtest/gtest.h" namespace media { @@ -36,75 +37,100 @@ TEST(AudioParameters, Constructor_ParameterValues) { AudioParameters::Format expected_format = AudioParameters::AUDIO_PCM_LOW_LATENCY; int expected_channels = 6; - ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1; + constexpr ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1; int expected_rate = 44100; int expected_samples = 880; - AudioParameters params(expected_format, expected_channel_layout, - expected_rate, expected_samples); + AudioParameters params( + expected_format, + ChannelLayoutConfig::FromLayout<expected_channel_layout>(), expected_rate, + expected_samples); EXPECT_EQ(expected_format, params.format()); EXPECT_EQ(expected_channels, params.channels()); EXPECT_EQ(expected_channel_layout, params.channel_layout()); EXPECT_EQ(expected_rate, params.sample_rate()); EXPECT_EQ(expected_samples, params.frames_per_buffer()); + EXPECT_FALSE(params.RequireEncapsulation()); +} + +TEST(AudioParameters, Constructor_ParameterValuesPlusHardwareCapabilities) { + AudioParameters::Format expected_format = + AudioParameters::AUDIO_PCM_LOW_LATENCY; + int expected_channels = 6; + constexpr ChannelLayout expected_channel_layout = CHANNEL_LAYOUT_5_1; + int expected_rate = 44100; + int expected_samples = 880; + + AudioParameters::HardwareCapabilities hardware_capabilities(0, true); + AudioParameters params( + expected_format, + ChannelLayoutConfig::FromLayout<expected_channel_layout>(), expected_rate, + expected_samples, hardware_capabilities); + + EXPECT_EQ(expected_format, params.format()); + EXPECT_EQ(expected_channels, params.channels()); + EXPECT_EQ(expected_channel_layout, params.channel_layout()); + EXPECT_EQ(expected_rate, params.sample_rate()); + EXPECT_EQ(expected_samples, params.frames_per_buffer()); + EXPECT_TRUE(params.RequireEncapsulation()); } TEST(AudioParameters, GetBytesPerBuffer) { EXPECT_EQ(100, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_MONO, 1000, 100) + ChannelLayoutConfig::Mono(), 1000, 100) .GetBytesPerBuffer(kSampleFormatU8)); EXPECT_EQ(200, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_MONO, 1000, 100) + ChannelLayoutConfig::Mono(), 1000, 100) .GetBytesPerBuffer(kSampleFormatS16)); EXPECT_EQ(200, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_STEREO, 1000, 100) + ChannelLayoutConfig::Stereo(), 1000, 100) .GetBytesPerBuffer(kSampleFormatU8)); EXPECT_EQ(200, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_MONO, 1000, 200) + ChannelLayoutConfig::Mono(), 1000, 200) .GetBytesPerBuffer(kSampleFormatU8)); EXPECT_EQ(800, AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, - CHANNEL_LAYOUT_STEREO, 1000, 200) + ChannelLayoutConfig::Stereo(), 1000, 200) .GetBytesPerBuffer(kSampleFormatS16)); } TEST(AudioParameters, Compare) { AudioParameters values[] = { - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, - 1000, 100), - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, - 1000, 200), - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, - 2000, 100), - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_MONO, - 2000, 200), - - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, - 1000, 100), - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, - 1000, 200), - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, - 2000, 100), - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, CHANNEL_LAYOUT_STEREO, - 2000, 200), + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Mono(), 1000, 100), + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Mono(), 1000, 200), + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Mono(), 2000, 100), + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Mono(), 2000, 200), + + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Stereo(), 1000, 100), + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Stereo(), 1000, 200), + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Stereo(), 2000, 100), + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::Stereo(), 2000, 200), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_MONO, 1000, 100), + ChannelLayoutConfig::Mono(), 1000, 100), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_MONO, 1000, 200), + ChannelLayoutConfig::Mono(), 1000, 200), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_MONO, 2000, 100), + ChannelLayoutConfig::Mono(), 2000, 100), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_MONO, 2000, 200), + ChannelLayoutConfig::Mono(), 2000, 200), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_STEREO, 1000, 100), + ChannelLayoutConfig::Stereo(), 1000, 100), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_STEREO, 1000, 200), + ChannelLayoutConfig::Stereo(), 1000, 200), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_STEREO, 2000, 100), + ChannelLayoutConfig::Stereo(), 2000, 100), AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_STEREO, 2000, 200), + ChannelLayoutConfig::Stereo(), 2000, 200), }; for (size_t i = 0; i < std::size(values); ++i) { @@ -122,13 +148,63 @@ TEST(AudioParameters, Compare) { TEST(AudioParameters, Constructor_ValidChannelCounts) { int expected_channels = 8; ChannelLayout expected_layout = CHANNEL_LAYOUT_DISCRETE; + ChannelLayoutConfig channel_layout_config(CHANNEL_LAYOUT_DISCRETE, + expected_channels); + + AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, + channel_layout_config, 44100, 880); + EXPECT_EQ(expected_channels, params.channels()); + EXPECT_EQ(expected_layout, params.channel_layout()); + EXPECT_TRUE(params.IsValid()); +} + +TEST(AudioParameters, Constructor_ValidChannelCountsFor514Downmix) { + int expected_channels = 7; + constexpr ChannelLayout expected_layout = CHANNEL_LAYOUT_5_1_4_DOWNMIX; + ChannelLayoutConfig channel_layout_config(expected_layout, expected_channels); AudioParameters params(AudioParameters::AUDIO_PCM_LOW_LATENCY, - expected_layout, 44100, 880); - params.set_channels_for_discrete(expected_channels); + channel_layout_config, 44100, 880); EXPECT_EQ(expected_channels, params.channels()); EXPECT_EQ(expected_layout, params.channel_layout()); EXPECT_TRUE(params.IsValid()); + + // We do not have to explicitly set the channels for this layout. + params.Reset(AudioParameters::AUDIO_PCM_LOW_LATENCY, + ChannelLayoutConfig::FromLayout<expected_layout>(), 44100, 880); + EXPECT_EQ(6, params.channels()); + EXPECT_EQ(expected_layout, params.channel_layout()); + EXPECT_TRUE(params.IsValid()); +} + +TEST(AudioParameters, Constructor_CopyChannelLayoutConfig) { + int expected_channels = 8; + ChannelLayout expected_layout = CHANNEL_LAYOUT_DISCRETE; + ChannelLayoutConfig channel_layout_config(CHANNEL_LAYOUT_DISCRETE, + expected_channels); + + AudioParameters params1(AudioParameters::AUDIO_PCM_LOW_LATENCY, + channel_layout_config, 44100, 880); + AudioParameters params2(AudioParameters::AUDIO_PCM_LOW_LATENCY, + params1.channel_layout_config(), 44100, 880); + + EXPECT_EQ(expected_channels, params2.channels()); + EXPECT_EQ(expected_layout, params2.channel_layout()); + EXPECT_TRUE(params2.IsValid()); +} + +TEST(AudioParameters, ShouldCheckDiscreteWithNoChannels) { + ASSERT_DEATH( + { + ChannelLayoutConfig channel_layout_config(CHANNEL_LAYOUT_DISCRETE, 0); + }, + ""); +} + +TEST(AudioParameters, ChannelLayoutConfig_Guess) { + ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Guess(2); + EXPECT_EQ(CHANNEL_LAYOUT_STEREO, channel_layout_config.channel_layout()); + EXPECT_EQ(2, channel_layout_config.channels()); } } // namespace media diff --git a/chromium/media/base/audio_point.cc b/chromium/media/base/audio_point.cc index fd1ee46261d..5177b88a6e8 100644 --- a/chromium/media/base/audio_point.cc +++ b/chromium/media/base/audio_point.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/audio_point.h b/chromium/media/base/audio_point.h index 3b5632868e4..30c81958d39 100644 --- a/chromium/media/base/audio_point.h +++ b/chromium/media/base/audio_point.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/audio_point_unittest.cc b/chromium/media/base/audio_point_unittest.cc index bd91e447203..635f8e0b826 100644 --- a/chromium/media/base/audio_point_unittest.cc +++ b/chromium/media/base/audio_point_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/audio_power_monitor.cc b/chromium/media/base/audio_power_monitor.cc index 84d157a6cda..8a1616f99a6 100644 --- a/chromium/media/base/audio_power_monitor.cc +++ b/chromium/media/base/audio_power_monitor.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_power_monitor.h b/chromium/media/base/audio_power_monitor.h index b78531279ab..4ca6358edc4 100644 --- a/chromium/media/base/audio_power_monitor.h +++ b/chromium/media/base/audio_power_monitor.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_power_monitor_unittest.cc b/chromium/media/base/audio_power_monitor_unittest.cc index eae79205eac..7525bde6179 100644 --- a/chromium/media/base/audio_power_monitor_unittest.cc +++ b/chromium/media/base/audio_power_monitor_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/audio_processing.cc b/chromium/media/base/audio_processing.cc index 710c5aea61c..1f38697c6b1 100644 --- a/chromium/media/base/audio_processing.cc +++ b/chromium/media/base/audio_processing.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/audio_processing.h b/chromium/media/base/audio_processing.h index ca80199673e..a5fbf0dd623 100644 --- a/chromium/media/base/audio_processing.h +++ b/chromium/media/base/audio_processing.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/audio_processor_controls.h b/chromium/media/base/audio_processor_controls.h index b429f8035a6..b7c870a85c7 100644 --- a/chromium/media/base/audio_processor_controls.h +++ b/chromium/media/base/audio_processor_controls.h @@ -1,4 +1,4 @@ -// Copyright 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/base/audio_pull_fifo.cc b/chromium/media/base/audio_pull_fifo.cc index ed9e9efcc17..7dcaf1c06cd 100644 --- a/chromium/media/base/audio_pull_fifo.cc +++ b/chromium/media/base/audio_pull_fifo.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/base/audio_pull_fifo.h b/chromium/media/base/audio_pull_fifo.h index 420a230f45c..d46cb70973c 100644 --- a/chromium/media/base/audio_pull_fifo.h +++ b/chromium/media/base/audio_pull_fifo.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/base/audio_pull_fifo_unittest.cc b/chromium/media/base/audio_pull_fifo_unittest.cc index 37982d4c6f5..382161c5aeb 100644 --- a/chromium/media/base/audio_pull_fifo_unittest.cc +++ b/chromium/media/base/audio_pull_fifo_unittest.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/base/audio_push_fifo.cc b/chromium/media/base/audio_push_fifo.cc index afb2b0fbeba..7a5bf7c5b24 100644 --- a/chromium/media/base/audio_push_fifo.cc +++ b/chromium/media/base/audio_push_fifo.cc @@ -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/base/audio_push_fifo.h b/chromium/media/base/audio_push_fifo.h index c4f617694d0..f0c56af74bf 100644 --- a/chromium/media/base/audio_push_fifo.h +++ b/chromium/media/base/audio_push_fifo.h @@ -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/base/audio_push_fifo_unittest.cc b/chromium/media/base/audio_push_fifo_unittest.cc index aa9f42fb6db..4fd4a861d4d 100644 --- a/chromium/media/base/audio_push_fifo_unittest.cc +++ b/chromium/media/base/audio_push_fifo_unittest.cc @@ -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/base/audio_renderer.cc b/chromium/media/base/audio_renderer.cc index e3f63ac281b..c02e432de56 100644 --- a/chromium/media/base/audio_renderer.cc +++ b/chromium/media/base/audio_renderer.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/base/audio_renderer.h b/chromium/media/base/audio_renderer.h index e327f275862..173380d3550 100644 --- a/chromium/media/base/audio_renderer.h +++ b/chromium/media/base/audio_renderer.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/base/audio_renderer_mixer.cc b/chromium/media/base/audio_renderer_mixer.cc index 91ba595752d..3b13af58002 100644 --- a/chromium/media/base/audio_renderer_mixer.cc +++ b/chromium/media/base/audio_renderer_mixer.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/base/audio_renderer_mixer.h b/chromium/media/base/audio_renderer_mixer.h index cbdc0f7dfbe..622a11db152 100644 --- a/chromium/media/base/audio_renderer_mixer.h +++ b/chromium/media/base/audio_renderer_mixer.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/base/audio_renderer_mixer_input.cc b/chromium/media/base/audio_renderer_mixer_input.cc index 578cdcaa85f..42f963c4daf 100644 --- a/chromium/media/base/audio_renderer_mixer_input.cc +++ b/chromium/media/base/audio_renderer_mixer_input.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/base/audio_renderer_mixer_input.h b/chromium/media/base/audio_renderer_mixer_input.h index c4d598c11ed..37fd393d019 100644 --- a/chromium/media/base/audio_renderer_mixer_input.h +++ b/chromium/media/base/audio_renderer_mixer_input.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/base/audio_renderer_mixer_input_unittest.cc b/chromium/media/base/audio_renderer_mixer_input_unittest.cc index 5884bb7353f..ee3b3fea1da 100644 --- a/chromium/media/base/audio_renderer_mixer_input_unittest.cc +++ b/chromium/media/base/audio_renderer_mixer_input_unittest.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. @@ -26,7 +26,7 @@ static const int kSampleRate = 48000; static const int kBufferSize = 8192; static const base::UnguessableToken kFrameToken = base::UnguessableToken::Create(); -static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; +static constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; static const char kDefaultDeviceId[] = "default"; static const char kAnotherDeviceId[] = "another"; static const char kUnauthorizedDeviceId[] = "unauthorized"; @@ -37,7 +37,8 @@ class AudioRendererMixerInputTest : public testing::Test, public: AudioRendererMixerInputTest() { audio_parameters_ = - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, + AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::FromLayout<kChannelLayout>(), kSampleRate, kBufferSize); CreateMixerInput(kDefaultDeviceId); diff --git a/chromium/media/base/audio_renderer_mixer_pool.h b/chromium/media/base/audio_renderer_mixer_pool.h index 9071f1ff8e3..5dbeac71b15 100644 --- a/chromium/media/base/audio_renderer_mixer_pool.h +++ b/chromium/media/base/audio_renderer_mixer_pool.h @@ -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/base/audio_renderer_mixer_unittest.cc b/chromium/media/base/audio_renderer_mixer_unittest.cc index d094586e7ab..64ba7ad52e0 100644 --- a/chromium/media/base/audio_renderer_mixer_unittest.cc +++ b/chromium/media/base/audio_renderer_mixer_unittest.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. @@ -34,7 +34,7 @@ const int kOddMixerInputs = 7; const int kMixerCycles = 3; // Parameters used for testing. -const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; +constexpr ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; const int kHighLatencyBufferSize = 8192; const int kLowLatencyBufferSize = 256; @@ -61,13 +61,15 @@ class AudioRendererMixerTest const int* const sample_rates = std::get<0>(GetParam()); size_t sample_rates_count = std::get<1>(GetParam()); for (size_t i = 0; i < sample_rates_count; ++i) - input_parameters_.push_back( - AudioParameters(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout, - sample_rates[i], kHighLatencyBufferSize)); + input_parameters_.emplace_back( + AudioParameters::AUDIO_PCM_LINEAR, + ChannelLayoutConfig::FromLayout<kChannelLayout>(), sample_rates[i], + kHighLatencyBufferSize); // Create output parameters based on test parameters. output_parameters_ = - AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, kChannelLayout, + AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, + ChannelLayoutConfig::FromLayout<kChannelLayout>(), std::get<2>(GetParam()), kLowLatencyBufferSize); sink_ = new MockAudioRendererSink(); diff --git a/chromium/media/base/audio_renderer_sink.h b/chromium/media/base/audio_renderer_sink.h index e04bcd0aef0..38e883cb94c 100644 --- a/chromium/media/base/audio_renderer_sink.h +++ b/chromium/media/base/audio_renderer_sink.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/base/audio_sample_types.h b/chromium/media/base/audio_sample_types.h index af734ec68a6..6081f9537ad 100644 --- a/chromium/media/base/audio_sample_types.h +++ b/chromium/media/base/audio_sample_types.h @@ -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/base/audio_sample_types_unittest.cc b/chromium/media/base/audio_sample_types_unittest.cc index 1aa9953f0dd..54f9671b8f7 100644 --- a/chromium/media/base/audio_sample_types_unittest.cc +++ b/chromium/media/base/audio_sample_types_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 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/base/audio_shifter.cc b/chromium/media/base/audio_shifter.cc index e6e0e6de959..bbb2785e799 100644 --- a/chromium/media/base/audio_shifter.cc +++ b/chromium/media/base/audio_shifter.cc @@ -1,4 +1,4 @@ -// Copyright (c) 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/base/audio_shifter.h b/chromium/media/base/audio_shifter.h index 36e6e2b4d60..7c09be418b2 100644 --- a/chromium/media/base/audio_shifter.h +++ b/chromium/media/base/audio_shifter.h @@ -1,4 +1,4 @@ -// Copyright (c) 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/base/audio_shifter_unittest.cc b/chromium/media/base/audio_shifter_unittest.cc index 4d99ceac4f7..a3ec81a5966 100644 --- a/chromium/media/base/audio_shifter_unittest.cc +++ b/chromium/media/base/audio_shifter_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 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/base/audio_timestamp_helper.cc b/chromium/media/base/audio_timestamp_helper.cc index 240467b4da9..32d4b2adcce 100644 --- a/chromium/media/base/audio_timestamp_helper.cc +++ b/chromium/media/base/audio_timestamp_helper.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/base/audio_timestamp_helper.h b/chromium/media/base/audio_timestamp_helper.h index 116826d800e..92111d5893c 100644 --- a/chromium/media/base/audio_timestamp_helper.h +++ b/chromium/media/base/audio_timestamp_helper.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/base/audio_timestamp_helper_unittest.cc b/chromium/media/base/audio_timestamp_helper_unittest.cc index 2beb9414f11..3b74280426f 100644 --- a/chromium/media/base/audio_timestamp_helper_unittest.cc +++ b/chromium/media/base/audio_timestamp_helper_unittest.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/base/bind_to_current_loop.h b/chromium/media/base/bind_to_current_loop.h index d57fb6446a8..956a4412e24 100644 --- a/chromium/media/base/bind_to_current_loop.h +++ b/chromium/media/base/bind_to_current_loop.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/bit_reader.cc b/chromium/media/base/bit_reader.cc index a956e976583..fc5b9d7573a 100644 --- a/chromium/media/base/bit_reader.cc +++ b/chromium/media/base/bit_reader.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/base/bit_reader.h b/chromium/media/base/bit_reader.h index aceb75def80..0be3c24b5a6 100644 --- a/chromium/media/base/bit_reader.h +++ b/chromium/media/base/bit_reader.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/base/bit_reader_core.cc b/chromium/media/base/bit_reader_core.cc index 715a25b3e36..580ded8d28a 100644 --- a/chromium/media/base/bit_reader_core.cc +++ b/chromium/media/base/bit_reader_core.cc @@ -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/base/bit_reader_core.h b/chromium/media/base/bit_reader_core.h index 361b28d6990..d91b474a289 100644 --- a/chromium/media/base/bit_reader_core.h +++ b/chromium/media/base/bit_reader_core.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/base/bit_reader_fuzzertest.cc b/chromium/media/base/bit_reader_fuzzertest.cc index 9b91f1317c3..17c20989f2e 100644 --- a/chromium/media/base/bit_reader_fuzzertest.cc +++ b/chromium/media/base/bit_reader_fuzzertest.cc @@ -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/base/bit_reader_unittest.cc b/chromium/media/base/bit_reader_unittest.cc index e8ba51c12f7..1d74e146f89 100644 --- a/chromium/media/base/bit_reader_unittest.cc +++ b/chromium/media/base/bit_reader_unittest.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/base/bitrate.cc b/chromium/media/base/bitrate.cc index b265cc90d1e..d2ae94baae9 100644 --- a/chromium/media/base/bitrate.cc +++ b/chromium/media/base/bitrate.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/bitrate.h b/chromium/media/base/bitrate.h index f72692b5b8f..a99075afe06 100644 --- a/chromium/media/base/bitrate.h +++ b/chromium/media/base/bitrate.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/bitrate_unittest.cc b/chromium/media/base/bitrate_unittest.cc index 0e385b2c3b7..9f270119180 100644 --- a/chromium/media/base/bitrate_unittest.cc +++ b/chromium/media/base/bitrate_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 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/base/bitstream_buffer.cc b/chromium/media/base/bitstream_buffer.cc index 202e974601f..f4548494e11 100644 --- a/chromium/media/base/bitstream_buffer.cc +++ b/chromium/media/base/bitstream_buffer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/bitstream_buffer.h b/chromium/media/base/bitstream_buffer.h index 52dadb02495..8e00154e8f5 100644 --- a/chromium/media/base/bitstream_buffer.h +++ b/chromium/media/base/bitstream_buffer.h @@ -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/base/buffering_state.cc b/chromium/media/base/buffering_state.cc index eabc940bf52..1407a48e3b9 100644 --- a/chromium/media/base/buffering_state.cc +++ b/chromium/media/base/buffering_state.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/buffering_state.h b/chromium/media/base/buffering_state.h index 3bae42ec3f8..134d6852b50 100644 --- a/chromium/media/base/buffering_state.h +++ b/chromium/media/base/buffering_state.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/base/byte_queue.cc b/chromium/media/base/byte_queue.cc index 79cd83e7ef4..53ed0775b05 100644 --- a/chromium/media/base/byte_queue.cc +++ b/chromium/media/base/byte_queue.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/base/byte_queue.h b/chromium/media/base/byte_queue.h index ebc1f9e8fed..18b425f41b4 100644 --- a/chromium/media/base/byte_queue.h +++ b/chromium/media/base/byte_queue.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/base/callback_holder.h b/chromium/media/base/callback_holder.h index ee2da8cef9a..3144f1de642 100644 --- a/chromium/media/base/callback_holder.h +++ b/chromium/media/base/callback_holder.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/callback_holder_unittest.cc b/chromium/media/base/callback_holder_unittest.cc index 79830971fdb..c9f13bcf848 100644 --- a/chromium/media/base/callback_holder_unittest.cc +++ b/chromium/media/base/callback_holder_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/callback_registry.h b/chromium/media/base/callback_registry.h index faf55049cd6..85252739941 100644 --- a/chromium/media/base/callback_registry.h +++ b/chromium/media/base/callback_registry.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/callback_registry_unittest.cc b/chromium/media/base/callback_registry_unittest.cc index 69a382a3d5b..bbeb084c19c 100644 --- a/chromium/media/base/callback_registry_unittest.cc +++ b/chromium/media/base/callback_registry_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/cdm_callback_promise.cc b/chromium/media/base/cdm_callback_promise.cc index 26d6f7aa839..243cfa881a0 100644 --- a/chromium/media/base/cdm_callback_promise.cc +++ b/chromium/media/base/cdm_callback_promise.cc @@ -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/base/cdm_callback_promise.h b/chromium/media/base/cdm_callback_promise.h index e10adfa2682..cee0a357bd1 100644 --- a/chromium/media/base/cdm_callback_promise.h +++ b/chromium/media/base/cdm_callback_promise.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/base/cdm_config.cc b/chromium/media/base/cdm_config.cc index fa8ce23eb88..a08da7d8c01 100644 --- a/chromium/media/base/cdm_config.cc +++ b/chromium/media/base/cdm_config.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/cdm_config.h b/chromium/media/base/cdm_config.h index d00e1cf68b8..658fc53ad6b 100644 --- a/chromium/media/base/cdm_config.h +++ b/chromium/media/base/cdm_config.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/cdm_context.cc b/chromium/media/base/cdm_context.cc index 0a3ee1a1414..50d95a78575 100644 --- a/chromium/media/base/cdm_context.cc +++ b/chromium/media/base/cdm_context.cc @@ -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/base/cdm_context.h b/chromium/media/base/cdm_context.h index 2e206d2c022..94df106f894 100644 --- a/chromium/media/base/cdm_context.h +++ b/chromium/media/base/cdm_context.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/base/cdm_factory.cc b/chromium/media/base/cdm_factory.cc index 7de8570c5de..89c3aa031cd 100644 --- a/chromium/media/base/cdm_factory.cc +++ b/chromium/media/base/cdm_factory.cc @@ -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/base/cdm_factory.h b/chromium/media/base/cdm_factory.h index 4a6e0ccb786..e098bbb5d20 100644 --- a/chromium/media/base/cdm_factory.h +++ b/chromium/media/base/cdm_factory.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/base/cdm_initialized_promise.cc b/chromium/media/base/cdm_initialized_promise.cc index 8c36e0b1747..1b8cbc0695e 100644 --- a/chromium/media/base/cdm_initialized_promise.cc +++ b/chromium/media/base/cdm_initialized_promise.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/cdm_initialized_promise.h b/chromium/media/base/cdm_initialized_promise.h index 3e28a7eabc3..fbc3e4ca974 100644 --- a/chromium/media/base/cdm_initialized_promise.h +++ b/chromium/media/base/cdm_initialized_promise.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/cdm_key_information.cc b/chromium/media/base/cdm_key_information.cc index 38aed14c87f..bcf74f60c5f 100644 --- a/chromium/media/base/cdm_key_information.cc +++ b/chromium/media/base/cdm_key_information.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/cdm_key_information.h b/chromium/media/base/cdm_key_information.h index 7e2cc57c45e..7d743a6e22c 100644 --- a/chromium/media/base/cdm_key_information.h +++ b/chromium/media/base/cdm_key_information.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/cdm_promise.cc b/chromium/media/base/cdm_promise.cc index d1cb7ade052..45200679cf8 100644 --- a/chromium/media/base/cdm_promise.cc +++ b/chromium/media/base/cdm_promise.cc @@ -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/base/cdm_promise.h b/chromium/media/base/cdm_promise.h index fec3a705cb2..9de5113c481 100644 --- a/chromium/media/base/cdm_promise.h +++ b/chromium/media/base/cdm_promise.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/base/cdm_promise_adapter.cc b/chromium/media/base/cdm_promise_adapter.cc index da0ae36e712..9285d961bac 100644 --- a/chromium/media/base/cdm_promise_adapter.cc +++ b/chromium/media/base/cdm_promise_adapter.cc @@ -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/base/cdm_promise_adapter.h b/chromium/media/base/cdm_promise_adapter.h index 10d3d66174f..286b32ff1e0 100644 --- a/chromium/media/base/cdm_promise_adapter.h +++ b/chromium/media/base/cdm_promise_adapter.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/base/cdm_session_tracker.cc b/chromium/media/base/cdm_session_tracker.cc index be2a63850cd..a21dc78dfe3 100644 --- a/chromium/media/base/cdm_session_tracker.cc +++ b/chromium/media/base/cdm_session_tracker.cc @@ -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/base/cdm_session_tracker.h b/chromium/media/base/cdm_session_tracker.h index f88ab6c5a1a..8132e784e7d 100644 --- a/chromium/media/base/cdm_session_tracker.h +++ b/chromium/media/base/cdm_session_tracker.h @@ -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/base/channel_layout.cc b/chromium/media/base/channel_layout.cc index b1be4cb5162..f4836f8ee80 100644 --- a/chromium/media/base/channel_layout.cc +++ b/chromium/media/base/channel_layout.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/base/channel_layout.h b/chromium/media/base/channel_layout.h index 2bf24ef8b1f..45936f2a7ca 100644 --- a/chromium/media/base/channel_layout.h +++ b/chromium/media/base/channel_layout.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/base/channel_mixer.cc b/chromium/media/base/channel_mixer.cc index 87e6c4590db..1092c290593 100644 --- a/chromium/media/base/channel_mixer.cc +++ b/chromium/media/base/channel_mixer.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/base/channel_mixer.h b/chromium/media/base/channel_mixer.h index 12a2759cf48..c4e1756cdcd 100644 --- a/chromium/media/base/channel_mixer.h +++ b/chromium/media/base/channel_mixer.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/base/channel_mixer_unittest.cc b/chromium/media/base/channel_mixer_unittest.cc index 56facff6325..3af82e80718 100644 --- a/chromium/media/base/channel_mixer_unittest.cc +++ b/chromium/media/base/channel_mixer_unittest.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. @@ -105,19 +105,17 @@ TEST_P(ChannelMixerTest, Mixing) { int input_channels = GetParam().input_channels; std::unique_ptr<AudioBus> input_bus = AudioBus::Create(input_channels, kFrames); - AudioParameters input_audio(AudioParameters::AUDIO_PCM_LINEAR, input_layout, + AudioParameters input_audio(AudioParameters::AUDIO_PCM_LINEAR, + {input_layout, input_channels}, AudioParameters::kAudioCDSampleRate, kFrames); - if (input_layout == CHANNEL_LAYOUT_DISCRETE) - input_audio.set_channels_for_discrete(input_channels); ChannelLayout output_layout = GetParam().output_layout; int output_channels = GetParam().output_channels; std::unique_ptr<AudioBus> output_bus = AudioBus::Create(output_channels, kFrames); - AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR, output_layout, + AudioParameters output_audio(AudioParameters::AUDIO_PCM_LINEAR, + {output_layout, output_channels}, AudioParameters::kAudioCDSampleRate, kFrames); - if (output_layout == CHANNEL_LAYOUT_DISCRETE) - output_audio.set_channels_for_discrete(output_channels); const float* channel_values = GetParam().channel_values; ASSERT_EQ(input_bus->channels(), GetParam().num_channel_values); diff --git a/chromium/media/base/channel_mixing_matrix.cc b/chromium/media/base/channel_mixing_matrix.cc index a8dd62dd4f3..1b0b3bd874c 100644 --- a/chromium/media/base/channel_mixing_matrix.cc +++ b/chromium/media/base/channel_mixing_matrix.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. @@ -6,9 +6,9 @@ #include <stddef.h> -#include <algorithm> - #include "base/check_op.h" +#include "base/containers/contains.h" +#include "base/ranges/algorithm.h" #include "media/base/channel_mixer.h" namespace media { @@ -260,13 +260,11 @@ bool ChannelMixingMatrix::CreateTransformationMatrix( } void ChannelMixingMatrix::AccountFor(Channels ch) { - unaccounted_inputs_.erase(std::find( - unaccounted_inputs_.begin(), unaccounted_inputs_.end(), ch)); + unaccounted_inputs_.erase(base::ranges::find(unaccounted_inputs_, ch)); } bool ChannelMixingMatrix::IsUnaccounted(Channels ch) const { - return std::find(unaccounted_inputs_.begin(), unaccounted_inputs_.end(), - ch) != unaccounted_inputs_.end(); + return base::Contains(unaccounted_inputs_, ch); } bool ChannelMixingMatrix::HasInputChannel(Channels ch) const { diff --git a/chromium/media/base/channel_mixing_matrix.h b/chromium/media/base/channel_mixing_matrix.h index a1a5f82ef55..05886bd57a3 100644 --- a/chromium/media/base/channel_mixing_matrix.h +++ b/chromium/media/base/channel_mixing_matrix.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/base/channel_mixing_matrix_unittest.cc b/chromium/media/base/channel_mixing_matrix_unittest.cc index 3bee28210a7..f7c1cfaf50e 100644 --- a/chromium/media/base/channel_mixing_matrix_unittest.cc +++ b/chromium/media/base/channel_mixing_matrix_unittest.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/base/color_plane_layout.cc b/chromium/media/base/color_plane_layout.cc index da4fbdc55ce..1d258be8288 100644 --- a/chromium/media/base/color_plane_layout.cc +++ b/chromium/media/base/color_plane_layout.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/color_plane_layout.h b/chromium/media/base/color_plane_layout.h index 922cc1b0786..30406f7c3a5 100644 --- a/chromium/media/base/color_plane_layout.h +++ b/chromium/media/base/color_plane_layout.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/container_names.cc b/chromium/media/base/container_names.cc index 08315dcdb55..63bc689aff6 100644 --- a/chromium/media/base/container_names.cc +++ b/chromium/media/base/container_names.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/container_names.h b/chromium/media/base/container_names.h index 99cb7bf7ccd..8fb1cffbfb3 100644 --- a/chromium/media/base/container_names.h +++ b/chromium/media/base/container_names.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/container_names_fuzzertest.cc b/chromium/media/base/container_names_fuzzertest.cc index 281fcc4b792..5f304911926 100644 --- a/chromium/media/base/container_names_fuzzertest.cc +++ b/chromium/media/base/container_names_fuzzertest.cc @@ -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/base/container_names_unittest.cc b/chromium/media/base/container_names_unittest.cc index 3b0d883dba1..e914a8015fb 100644 --- a/chromium/media/base/container_names_unittest.cc +++ b/chromium/media/base/container_names_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/content_decryption_module.cc b/chromium/media/base/content_decryption_module.cc index b76374459e6..6e711293866 100644 --- a/chromium/media/base/content_decryption_module.cc +++ b/chromium/media/base/content_decryption_module.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/content_decryption_module.h b/chromium/media/base/content_decryption_module.h index f352dda1345..531b065738d 100644 --- a/chromium/media/base/content_decryption_module.h +++ b/chromium/media/base/content_decryption_module.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/converting_audio_fifo.cc b/chromium/media/base/converting_audio_fifo.cc index e74b5a7d42c..77633d692ec 100644 --- a/chromium/media/base/converting_audio_fifo.cc +++ b/chromium/media/base/converting_audio_fifo.cc @@ -1,4 +1,4 @@ -// Copyright 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. @@ -134,7 +134,7 @@ std::unique_ptr<AudioBus> ConvertingAudioFifo::EnsureExpectedChannelCount( // Both the format and the sample rate are unused for mixing, but we still // need to pass a value below. mixer_input_params_.Reset(input_params_.format(), - GuessChannelLayout(incoming_channels), + ChannelLayoutConfig::Guess(incoming_channels), incoming_channels, input_params_.sample_rate()); mixer_ = std::make_unique<ChannelMixer>(mixer_input_params_, input_params_); diff --git a/chromium/media/base/converting_audio_fifo.h b/chromium/media/base/converting_audio_fifo.h index 4350f6b4a53..617ca1fda03 100644 --- a/chromium/media/base/converting_audio_fifo.h +++ b/chromium/media/base/converting_audio_fifo.h @@ -1,4 +1,4 @@ -// Copyright 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/base/converting_audio_fifo_unittest.cc b/chromium/media/base/converting_audio_fifo_unittest.cc index 1efff7c8f99..04643aa3d48 100644 --- a/chromium/media/base/converting_audio_fifo_unittest.cc +++ b/chromium/media/base/converting_audio_fifo_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 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. @@ -14,6 +14,7 @@ #include "base/test/bind.h" #include "base/time/time.h" #include "media/base/audio_bus.h" +#include "media/base/audio_parameters.h" #include "testing/gtest/include/gtest/gtest.h" namespace media { @@ -29,7 +30,7 @@ struct TestAudioParams { const AudioParameters kDefaultParams = AudioParameters(AudioParameters::Format::AUDIO_PCM_LINEAR, - GuessChannelLayout(kDefaultChannels), + ChannelLayoutConfig::Guess(kDefaultChannels), kInputSampleRate, kDefaultFrames); @@ -52,7 +53,7 @@ class ConvertingAudioFifoTest AudioParameters TestOutputParams() { return AudioParameters(AudioParameters::Format::AUDIO_PCM_LINEAR, - GuessChannelLayout(output_channels()), + ChannelLayoutConfig::Guess(output_channels()), output_sample_rate(), output_frames()); } diff --git a/chromium/media/base/crc_16.h b/chromium/media/base/crc_16.h index 773bbacdcf7..d6c539b9072 100644 --- a/chromium/media/base/crc_16.h +++ b/chromium/media/base/crc_16.h @@ -1,4 +1,4 @@ -// Copyright 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/base/crc_16_unittest.cc b/chromium/media/base/crc_16_unittest.cc index 1149ff98001..a0d6f06ba5a 100644 --- a/chromium/media/base/crc_16_unittest.cc +++ b/chromium/media/base/crc_16_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 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/base/data_buffer.cc b/chromium/media/base/data_buffer.cc index 97e90f276af..5114345b2ae 100644 --- a/chromium/media/base/data_buffer.cc +++ b/chromium/media/base/data_buffer.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/base/data_buffer.h b/chromium/media/base/data_buffer.h index 3d5a3ffd80a..64086ed6d9b 100644 --- a/chromium/media/base/data_buffer.h +++ b/chromium/media/base/data_buffer.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/base/data_buffer_unittest.cc b/chromium/media/base/data_buffer_unittest.cc index 0faaecd8b48..ca1a97b4bc5 100644 --- a/chromium/media/base/data_buffer_unittest.cc +++ b/chromium/media/base/data_buffer_unittest.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/base/data_source.cc b/chromium/media/base/data_source.cc index 48f76091f31..90aef55e647 100644 --- a/chromium/media/base/data_source.cc +++ b/chromium/media/base/data_source.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/base/data_source.h b/chromium/media/base/data_source.h index 882ef1ca4c8..96301279fca 100644 --- a/chromium/media/base/data_source.h +++ b/chromium/media/base/data_source.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/base/decoder.cc b/chromium/media/base/decoder.cc index 5b3e69f57b0..8bd5d6afb01 100644 --- a/chromium/media/base/decoder.cc +++ b/chromium/media/base/decoder.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -71,6 +71,8 @@ std::string GetDecoderName(AudioDecoderType type) { return "MediaCodecAudioDecoder"; case AudioDecoderType::kBroker: return "AudioDecoderBroker"; + case AudioDecoderType::kPassthroughDTS: + return "PassthroughDTSAudioDecoder"; case AudioDecoderType::kTesting: return "Testing or Mock Audio decoder"; case AudioDecoderType::kAudioToolbox: diff --git a/chromium/media/base/decoder.h b/chromium/media/base/decoder.h index dcf860045d7..40e919468bc 100644 --- a/chromium/media/base/decoder.h +++ b/chromium/media/base/decoder.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,9 +25,10 @@ enum class AudioDecoderType : int { kTesting = 6, // Never send this to UKM, for tests only. kAudioToolbox = 7, // AudioToolbox (macOS) kMediaFoundation = 8, // MediaFoundationAudioDecoder + kPassthroughDTS = 9, // Passthrough DTS audio // Keep this at the end and equal to the last entry. - kMaxValue = kMediaFoundation, + kMaxValue = kPassthroughDTS, }; // List of known VideoDecoder implementations; recorded to UKM, always add new diff --git a/chromium/media/base/decoder_buffer.cc b/chromium/media/base/decoder_buffer.cc index 620fc447c10..57acc5e9401 100644 --- a/chromium/media/base/decoder_buffer.cc +++ b/chromium/media/base/decoder_buffer.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/base/decoder_buffer.h b/chromium/media/base/decoder_buffer.h index 28befa6c9aa..b5a1489a6bf 100644 --- a/chromium/media/base/decoder_buffer.h +++ b/chromium/media/base/decoder_buffer.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/base/decoder_buffer_queue.cc b/chromium/media/base/decoder_buffer_queue.cc index 9b1f70cdd3a..411dc719cb5 100644 --- a/chromium/media/base/decoder_buffer_queue.cc +++ b/chromium/media/base/decoder_buffer_queue.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/base/decoder_buffer_queue.h b/chromium/media/base/decoder_buffer_queue.h index 781e8a7cd98..8c5aa7294e5 100644 --- a/chromium/media/base/decoder_buffer_queue.h +++ b/chromium/media/base/decoder_buffer_queue.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/base/decoder_buffer_queue_unittest.cc b/chromium/media/base/decoder_buffer_queue_unittest.cc index ce233a15dc7..4272b142b6f 100644 --- a/chromium/media/base/decoder_buffer_queue_unittest.cc +++ b/chromium/media/base/decoder_buffer_queue_unittest.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/base/decoder_buffer_unittest.cc b/chromium/media/base/decoder_buffer_unittest.cc index ac3c736a3ea..4d4d982b0bf 100644 --- a/chromium/media/base/decoder_buffer_unittest.cc +++ b/chromium/media/base/decoder_buffer_unittest.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/base/decoder_factory.cc b/chromium/media/base/decoder_factory.cc index 458e0fa6ca8..acc29c364da 100644 --- a/chromium/media/base/decoder_factory.cc +++ b/chromium/media/base/decoder_factory.cc @@ -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. @@ -17,11 +17,6 @@ void DecoderFactory::CreateAudioDecoders( MediaLog* media_log, std::vector<std::unique_ptr<AudioDecoder>>* audio_decoders) {} -SupportedVideoDecoderConfigs -DecoderFactory::GetSupportedVideoDecoderConfigsForWebRTC() { - return {}; -} - void DecoderFactory::CreateVideoDecoders( scoped_refptr<base::SequencedTaskRunner> task_runner, GpuVideoAcceleratorFactories* gpu_factories, diff --git a/chromium/media/base/decoder_factory.h b/chromium/media/base/decoder_factory.h index 3f65c663bb4..3f91a33b8d2 100644 --- a/chromium/media/base/decoder_factory.h +++ b/chromium/media/base/decoder_factory.h @@ -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. @@ -45,13 +45,6 @@ class MEDIA_EXPORT DecoderFactory { MediaLog* media_log, std::vector<std::unique_ptr<AudioDecoder>>* audio_decoders); - // Returns the union of all decoder configs supported by the decoders created - // when CreateVideoDecoders is called. - // TODO(crbug.com/1173503): Rename to GetSupportedVideoDecoderConfigs after - // being properly implemented for all factories. - virtual SupportedVideoDecoderConfigs - GetSupportedVideoDecoderConfigsForWebRTC(); - // Creates video decoders and append them to the end of |video_decoders|. // Decoders are single-threaded, each decoder should run on |task_runner|. virtual void CreateVideoDecoders( diff --git a/chromium/media/base/decoder_status.cc b/chromium/media/base/decoder_status.cc index caba2464b35..09ef67bda5b 100644 --- a/chromium/media/base/decoder_status.cc +++ b/chromium/media/base/decoder_status.cc @@ -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/base/decoder_status.h b/chromium/media/base/decoder_status.h index 1142cb61d2d..c87582a3fb3 100644 --- a/chromium/media/base/decoder_status.h +++ b/chromium/media/base/decoder_status.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/decrypt_config.cc b/chromium/media/base/decrypt_config.cc index b874b34c373..7c348c621e3 100644 --- a/chromium/media/base/decrypt_config.cc +++ b/chromium/media/base/decrypt_config.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/base/decrypt_config.h b/chromium/media/base/decrypt_config.h index 7bbde2d63dd..109f31c133d 100644 --- a/chromium/media/base/decrypt_config.h +++ b/chromium/media/base/decrypt_config.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/base/decrypt_config_unittest.cc b/chromium/media/base/decrypt_config_unittest.cc index 014ee6a4d23..b6eb25fe3ee 100644 --- a/chromium/media/base/decrypt_config_unittest.cc +++ b/chromium/media/base/decrypt_config_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/decryptor.cc b/chromium/media/base/decryptor.cc index 8d24de8d34d..fe5fcb3aa2d 100644 --- a/chromium/media/base/decryptor.cc +++ b/chromium/media/base/decryptor.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/base/decryptor.h b/chromium/media/base/decryptor.h index 2a84abeb038..97dec7aaf61 100644 --- a/chromium/media/base/decryptor.h +++ b/chromium/media/base/decryptor.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/base/demuxer.cc b/chromium/media/base/demuxer.cc index 46d2e709ba3..c78afd57782 100644 --- a/chromium/media/base/demuxer.cc +++ b/chromium/media/base/demuxer.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/base/demuxer.h b/chromium/media/base/demuxer.h index 8a5241cec01..87bf6841c6d 100644 --- a/chromium/media/base/demuxer.h +++ b/chromium/media/base/demuxer.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/base/demuxer_memory_limit.h b/chromium/media/base/demuxer_memory_limit.h index 4a492d7771e..10f6740075a 100644 --- a/chromium/media/base/demuxer_memory_limit.h +++ b/chromium/media/base/demuxer_memory_limit.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/base/demuxer_memory_limit_android.cc b/chromium/media/base/demuxer_memory_limit_android.cc index 3ea849942e2..269856362b7 100644 --- a/chromium/media/base/demuxer_memory_limit_android.cc +++ b/chromium/media/base/demuxer_memory_limit_android.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/demuxer_memory_limit_cast.cc b/chromium/media/base/demuxer_memory_limit_cast.cc index addbf15ec03..8459d74ddb2 100644 --- a/chromium/media/base/demuxer_memory_limit_cast.cc +++ b/chromium/media/base/demuxer_memory_limit_cast.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/demuxer_memory_limit_cast_unittest.cc b/chromium/media/base/demuxer_memory_limit_cast_unittest.cc index 76444445254..2e92b2812aa 100644 --- a/chromium/media/base/demuxer_memory_limit_cast_unittest.cc +++ b/chromium/media/base/demuxer_memory_limit_cast_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/demuxer_memory_limit_default.cc b/chromium/media/base/demuxer_memory_limit_default.cc index 896d534098a..8dcf763a0bb 100644 --- a/chromium/media/base/demuxer_memory_limit_default.cc +++ b/chromium/media/base/demuxer_memory_limit_default.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/demuxer_memory_limit_low.cc b/chromium/media/base/demuxer_memory_limit_low.cc index 71dc442d42a..7dea8bd0a45 100644 --- a/chromium/media/base/demuxer_memory_limit_low.cc +++ b/chromium/media/base/demuxer_memory_limit_low.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/demuxer_stream.cc b/chromium/media/base/demuxer_stream.cc index ccc922440e5..7addad4152a 100644 --- a/chromium/media/base/demuxer_stream.cc +++ b/chromium/media/base/demuxer_stream.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/base/demuxer_stream.h b/chromium/media/base/demuxer_stream.h index f866d62c0cb..2a5bda07e7d 100644 --- a/chromium/media/base/demuxer_stream.h +++ b/chromium/media/base/demuxer_stream.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/base/djb2.cc b/chromium/media/base/djb2.cc index b4b440e6791..c525d83cb80 100644 --- a/chromium/media/base/djb2.cc +++ b/chromium/media/base/djb2.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/base/djb2.h b/chromium/media/base/djb2.h index cb592b71b7d..3b2c1886e3a 100644 --- a/chromium/media/base/djb2.h +++ b/chromium/media/base/djb2.h @@ -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/base/djb2_unittest.cc b/chromium/media/base/djb2_unittest.cc index e4450893120..3abb6b9ca09 100644 --- a/chromium/media/base/djb2_unittest.cc +++ b/chromium/media/base/djb2_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Copyright 2008 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/base/eme_constants.h b/chromium/media/base/eme_constants.h index 4d4dcd74437..72772a76f3d 100644 --- a/chromium/media/base/eme_constants.h +++ b/chromium/media/base/eme_constants.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/base/encoder_status.h b/chromium/media/base/encoder_status.h index 36cb0390cc7..342e181a8a5 100644 --- a/chromium/media/base/encoder_status.h +++ b/chromium/media/base/encoder_status.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/encryption_pattern.cc b/chromium/media/base/encryption_pattern.cc index ea07abb380d..515b4493f4f 100644 --- a/chromium/media/base/encryption_pattern.cc +++ b/chromium/media/base/encryption_pattern.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/encryption_pattern.h b/chromium/media/base/encryption_pattern.h index 89c3e28b115..6a2c3e94090 100644 --- a/chromium/media/base/encryption_pattern.h +++ b/chromium/media/base/encryption_pattern.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/encryption_scheme.cc b/chromium/media/base/encryption_scheme.cc index 12728f71c89..0f05f860e31 100644 --- a/chromium/media/base/encryption_scheme.cc +++ b/chromium/media/base/encryption_scheme.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/encryption_scheme.h b/chromium/media/base/encryption_scheme.h index 24a7141f9e0..1fe09feaada 100644 --- a/chromium/media/base/encryption_scheme.h +++ b/chromium/media/base/encryption_scheme.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/fake_audio_render_callback.cc b/chromium/media/base/fake_audio_render_callback.cc index d31303a345c..9a03df6e53b 100644 --- a/chromium/media/base/fake_audio_render_callback.cc +++ b/chromium/media/base/fake_audio_render_callback.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/base/fake_audio_render_callback.h b/chromium/media/base/fake_audio_render_callback.h index 1f5e39bf7e0..a0bddb24a07 100644 --- a/chromium/media/base/fake_audio_render_callback.h +++ b/chromium/media/base/fake_audio_render_callback.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/base/fake_audio_renderer_sink.cc b/chromium/media/base/fake_audio_renderer_sink.cc index ff9af5bfd54..8c9a772f7f0 100644 --- a/chromium/media/base/fake_audio_renderer_sink.cc +++ b/chromium/media/base/fake_audio_renderer_sink.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,7 +14,7 @@ namespace media { FakeAudioRendererSink::FakeAudioRendererSink() : FakeAudioRendererSink( AudioParameters(AudioParameters::AUDIO_FAKE, - CHANNEL_LAYOUT_STEREO, + ChannelLayoutConfig::Stereo(), AudioParameters::kTelephoneSampleRate, 1)) {} diff --git a/chromium/media/base/fake_audio_renderer_sink.h b/chromium/media/base/fake_audio_renderer_sink.h index 681b0d59fe3..0325da3eb92 100644 --- a/chromium/media/base/fake_audio_renderer_sink.h +++ b/chromium/media/base/fake_audio_renderer_sink.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/fake_audio_worker.cc b/chromium/media/base/fake_audio_worker.cc index 505ea02323c..291c2f82e28 100644 --- a/chromium/media/base/fake_audio_worker.cc +++ b/chromium/media/base/fake_audio_worker.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/fake_audio_worker.h b/chromium/media/base/fake_audio_worker.h index 524829d9038..097bc0b28ac 100644 --- a/chromium/media/base/fake_audio_worker.h +++ b/chromium/media/base/fake_audio_worker.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/fake_audio_worker_unittest.cc b/chromium/media/base/fake_audio_worker_unittest.cc index 355fed2145d..f46bdeb1874 100644 --- a/chromium/media/base/fake_audio_worker_unittest.cc +++ b/chromium/media/base/fake_audio_worker_unittest.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. @@ -32,7 +32,10 @@ using testing::SizeIs; class FakeAudioWorkerTest : public testing::Test { public: FakeAudioWorkerTest() - : params_(AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_STEREO, 44100, 128), + : params_(AudioParameters::AUDIO_FAKE, + ChannelLayoutConfig::Stereo(), + 44100, + 128), fake_worker_(task_environment_.GetMainThreadTaskRunner(), params_) { time_between_callbacks_ = base::Microseconds( params_.frames_per_buffer() * base::Time::kMicrosecondsPerSecond / @@ -176,7 +179,10 @@ TEST_F(FakeAudioWorkerTest, StartStopClearsCallbacks) { class FakeAudioWorkerMockTaskTest : public testing::Test { public: FakeAudioWorkerMockTaskTest() - : params_(AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_STEREO, 44100, 128), + : params_(AudioParameters::AUDIO_FAKE, + ChannelLayoutConfig::Stereo(), + 44100, + 128), fake_worker_(task_runner_, params_) { DCHECK(!global_clock_); global_clock_ = task_runner_->GetMockTickClock(); diff --git a/chromium/media/base/fake_demuxer_stream.cc b/chromium/media/base/fake_demuxer_stream.cc index d6020caddc1..0f0c2a31ae2 100644 --- a/chromium/media/base/fake_demuxer_stream.cc +++ b/chromium/media/base/fake_demuxer_stream.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/fake_demuxer_stream.h b/chromium/media/base/fake_demuxer_stream.h index 1a2251e0515..f7ad006342b 100644 --- a/chromium/media/base/fake_demuxer_stream.h +++ b/chromium/media/base/fake_demuxer_stream.h @@ -1,4 +1,4 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/fake_demuxer_stream_unittest.cc b/chromium/media/base/fake_demuxer_stream_unittest.cc index 04437210db9..4be65e3409d 100644 --- a/chromium/media/base/fake_demuxer_stream_unittest.cc +++ b/chromium/media/base/fake_demuxer_stream_unittest.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/base/fake_localized_strings.cc b/chromium/media/base/fake_localized_strings.cc index 888821fa361..9c1663221b1 100644 --- a/chromium/media/base/fake_localized_strings.cc +++ b/chromium/media/base/fake_localized_strings.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/fake_localized_strings.h b/chromium/media/base/fake_localized_strings.h index 29e8f2e36f3..e3cb0a86ac8 100644 --- a/chromium/media/base/fake_localized_strings.h +++ b/chromium/media/base/fake_localized_strings.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/fake_single_thread_task_runner.cc b/chromium/media/base/fake_single_thread_task_runner.cc index daf7f9c5778..cd058e31716 100644 --- a/chromium/media/base/fake_single_thread_task_runner.cc +++ b/chromium/media/base/fake_single_thread_task_runner.cc @@ -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/base/fake_single_thread_task_runner.h b/chromium/media/base/fake_single_thread_task_runner.h index fd61d665b0b..275bcbaa227 100644 --- a/chromium/media/base/fake_single_thread_task_runner.h +++ b/chromium/media/base/fake_single_thread_task_runner.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/base/fake_text_track_stream.cc b/chromium/media/base/fake_text_track_stream.cc index 7807c9c251d..f5075dc4e1b 100644 --- a/chromium/media/base/fake_text_track_stream.cc +++ b/chromium/media/base/fake_text_track_stream.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/fake_text_track_stream.h b/chromium/media/base/fake_text_track_stream.h index 0364b6389c9..ff819442d8e 100644 --- a/chromium/media/base/fake_text_track_stream.h +++ b/chromium/media/base/fake_text_track_stream.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/feedback_signal_accumulator.h b/chromium/media/base/feedback_signal_accumulator.h index 02617275be5..df73c7bb8aa 100644 --- a/chromium/media/base/feedback_signal_accumulator.h +++ b/chromium/media/base/feedback_signal_accumulator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/feedback_signal_accumulator_unittest.cc b/chromium/media/base/feedback_signal_accumulator_unittest.cc index f1d09baa765..93bd68d0ac3 100644 --- a/chromium/media/base/feedback_signal_accumulator_unittest.cc +++ b/chromium/media/base/feedback_signal_accumulator_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/flinging_controller.h b/chromium/media/base/flinging_controller.h index 1bf26345445..0883dc6a0ed 100644 --- a/chromium/media/base/flinging_controller.h +++ b/chromium/media/base/flinging_controller.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/format_utils.cc b/chromium/media/base/format_utils.cc index b9fc8143bd6..2fed1c2cd1a 100644 --- a/chromium/media/base/format_utils.cc +++ b/chromium/media/base/format_utils.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/base/format_utils.h b/chromium/media/base/format_utils.h index eed468b553f..137e527c77e 100644 --- a/chromium/media/base/format_utils.h +++ b/chromium/media/base/format_utils.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/base/frame_rate_estimator.cc b/chromium/media/base/frame_rate_estimator.cc index 48cf9f9a56d..246d7b0482a 100644 --- a/chromium/media/base/frame_rate_estimator.cc +++ b/chromium/media/base/frame_rate_estimator.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/frame_rate_estimator.h b/chromium/media/base/frame_rate_estimator.h index f35b2f45833..1449191af35 100644 --- a/chromium/media/base/frame_rate_estimator.h +++ b/chromium/media/base/frame_rate_estimator.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/frame_rate_estimator_unittest.cc b/chromium/media/base/frame_rate_estimator_unittest.cc index 2ba25e6ab5d..87e231b247f 100644 --- a/chromium/media/base/frame_rate_estimator_unittest.cc +++ b/chromium/media/base/frame_rate_estimator_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/ipc/BUILD.gn b/chromium/media/base/ipc/BUILD.gn index c1112cbb9bf..6217873522c 100644 --- a/chromium/media/base/ipc/BUILD.gn +++ b/chromium/media/base/ipc/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/base/ipc/media_param_traits.cc b/chromium/media/base/ipc/media_param_traits.cc index 0bb2011c22e..e0b8f50fb3f 100644 --- a/chromium/media/base/ipc/media_param_traits.cc +++ b/chromium/media/base/ipc/media_param_traits.cc @@ -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. @@ -55,14 +55,13 @@ bool ParamTraits<AudioParameters>::Read(const base::Pickle* m, } if (hardware_capabilities) { - *r = AudioParameters(format, channel_layout, sample_rate, frames_per_buffer, - *hardware_capabilities); + *r = AudioParameters(format, {channel_layout, channels}, sample_rate, + frames_per_buffer, *hardware_capabilities); } else { - *r = - AudioParameters(format, channel_layout, sample_rate, frames_per_buffer); + *r = AudioParameters(format, {channel_layout, channels}, sample_rate, + frames_per_buffer); } - r->set_channels_for_discrete(channels); r->set_effects(effects); r->set_mic_positions(mic_positions); r->set_latency_tag(latency_tag); @@ -81,6 +80,7 @@ void ParamTraits<AudioParameters::HardwareCapabilities>::Write( WriteParam(m, p.min_frames_per_buffer); WriteParam(m, p.max_frames_per_buffer); WriteParam(m, p.bitstream_formats); + WriteParam(m, p.require_encapsulation); } bool ParamTraits<AudioParameters::HardwareCapabilities>::Read( @@ -88,16 +88,19 @@ bool ParamTraits<AudioParameters::HardwareCapabilities>::Read( base::PickleIterator* iter, param_type* r) { int bitstream_formats; + bool require_encapsulation; int max_frames_per_buffer; int min_frames_per_buffer; if (!ReadParam(m, iter, &min_frames_per_buffer) || !ReadParam(m, iter, &max_frames_per_buffer) || - !ReadParam(m, iter, &bitstream_formats)) { + !ReadParam(m, iter, &bitstream_formats) || + !ReadParam(m, iter, &require_encapsulation)) { return false; } r->min_frames_per_buffer = min_frames_per_buffer; r->max_frames_per_buffer = max_frames_per_buffer; r->bitstream_formats = bitstream_formats; + r->require_encapsulation = require_encapsulation; return true; } diff --git a/chromium/media/base/ipc/media_param_traits.h b/chromium/media/base/ipc/media_param_traits.h index 4771d463930..edc38ed5fe7 100644 --- a/chromium/media/base/ipc/media_param_traits.h +++ b/chromium/media/base/ipc/media_param_traits.h @@ -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/base/ipc/media_param_traits_macros.h b/chromium/media/base/ipc/media_param_traits_macros.h index aa5e11a7d0a..2596e244c0f 100644 --- a/chromium/media/base/ipc/media_param_traits_macros.h +++ b/chromium/media/base/ipc/media_param_traits_macros.h @@ -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/base/key_system_info.cc b/chromium/media/base/key_system_info.cc new file mode 100644 index 00000000000..b8add8a5783 --- /dev/null +++ b/chromium/media/base/key_system_info.cc @@ -0,0 +1,27 @@ +// Copyright 2013 The Chromium Authors +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "media/base/key_system_info.h" + +namespace media { + +bool KeySystemInfo::IsSupportedKeySystem(const std::string& key_system) const { + // By default, only support the base key system. + return key_system == GetBaseKeySystemName(); +} + +bool KeySystemInfo::ShouldUseBaseKeySystemName() const { + // By default, use the sub key system names for creating CDMs. + return false; +} + +SupportedCodecs KeySystemInfo::GetSupportedHwSecureCodecs() const { + return EME_CODEC_NONE; +} + +bool KeySystemInfo::UseAesDecryptor() const { + return false; +} + +} // namespace media diff --git a/chromium/media/base/key_system_properties.h b/chromium/media/base/key_system_info.h index 4500f4eace3..4df1a786af9 100644 --- a/chromium/media/base/key_system_properties.h +++ b/chromium/media/base/key_system_info.h @@ -1,9 +1,9 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef MEDIA_BASE_KEY_SYSTEM_PROPERTIES_H_ -#define MEDIA_BASE_KEY_SYSTEM_PROPERTIES_H_ +#ifndef MEDIA_BASE_KEY_SYSTEM_INFO_H_ +#define MEDIA_BASE_KEY_SYSTEM_INFO_H_ #include <string> @@ -17,9 +17,9 @@ namespace media { // Provides an interface for querying the properties of a registered key system. -class MEDIA_EXPORT KeySystemProperties { +class MEDIA_EXPORT KeySystemInfo { public: - virtual ~KeySystemProperties() {} + virtual ~KeySystemInfo() {} // Gets the base key system name, e.g. "org.chromium.foo". virtual std::string GetBaseKeySystemName() const = 0; @@ -84,12 +84,11 @@ class MEDIA_EXPORT KeySystemProperties { virtual bool UseAesDecryptor() const; }; -using KeySystemPropertiesVector = - std::vector<std::unique_ptr<KeySystemProperties>>; +using KeySystemInfoVector = std::vector<std::unique_ptr<KeySystemInfo>>; using GetSupportedKeySystemsCB = - base::RepeatingCallback<void(KeySystemPropertiesVector)>; + base::RepeatingCallback<void(KeySystemInfoVector)>; } // namespace media -#endif // MEDIA_BASE_KEY_SYSTEM_PROPERTIES_H_ +#endif // MEDIA_BASE_KEY_SYSTEM_INFO_H_ diff --git a/chromium/media/base/key_system_names.cc b/chromium/media/base/key_system_names.cc index 6a8bc0a9f42..3ecdc56c5e3 100644 --- a/chromium/media/base/key_system_names.cc +++ b/chromium/media/base/key_system_names.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/key_system_names.h b/chromium/media/base/key_system_names.h index e7ed8840b1e..aacbd278463 100644 --- a/chromium/media/base/key_system_names.h +++ b/chromium/media/base/key_system_names.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/key_system_properties.cc b/chromium/media/base/key_system_properties.cc deleted file mode 100644 index 0a52ade933d..00000000000 --- a/chromium/media/base/key_system_properties.cc +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "media/base/key_system_properties.h" - -namespace media { - -bool KeySystemProperties::IsSupportedKeySystem( - const std::string& key_system) const { - // By default, only support the base key system. - return key_system == GetBaseKeySystemName(); -} - -bool KeySystemProperties::ShouldUseBaseKeySystemName() const { - // By default, use the sub key system names for creating CDMs. - return false; -} - -SupportedCodecs KeySystemProperties::GetSupportedHwSecureCodecs() const { - return EME_CODEC_NONE; -} - -bool KeySystemProperties::UseAesDecryptor() const { - return false; -} - -} // namespace media diff --git a/chromium/media/base/key_systems.cc b/chromium/media/base/key_systems.cc index 0b27e769ef5..40fdc0e159d 100644 --- a/chromium/media/base/key_systems.cc +++ b/chromium/media/base/key_systems.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,8 +20,8 @@ #include "base/threading/thread_checker.h" #include "build/build_config.h" #include "media/base/eme_constants.h" +#include "media/base/key_system_info.h" #include "media/base/key_system_names.h" -#include "media/base/key_system_properties.h" #include "media/base/media.h" #include "media/base/media_client.h" #include "media/base/media_switches.h" @@ -31,6 +31,8 @@ namespace media { +namespace { + const char kClearKeyKeySystem[] = "org.w3.clearkey"; // These names are used by UMA. Do not change them! @@ -142,7 +144,7 @@ EmeCodec ToVideoEmeCodec(VideoCodec codec, VideoCodecProfile profile) { } } -class ClearKeyProperties : public KeySystemProperties { +class ClearKeyProperties : public KeySystemInfo { public: std::string GetBaseKeySystemName() const final { return kClearKeyKeySystem; } @@ -250,7 +252,7 @@ static bool IsPotentiallySupportedKeySystem(const std::string& key_system) { // Returns whether distinctive identifiers and persistent state can be reliably // blocked for |properties| (and therefore be safely configurable). -static bool CanBlock(const KeySystemProperties& properties) { +static bool CanBlock(const KeySystemInfo& properties) { // When AesDecryptor is used, we are sure we can block. if (properties.UseAesDecryptor()) return true; @@ -310,18 +312,17 @@ class KeySystemsImpl : public KeySystems { EmeFeatureSupport GetDistinctiveIdentifierSupport( const std::string& key_system) const override; - // These two functions are for testing purpose only. + // These functions are for testing purpose only. void AddCodecMaskForTesting(EmeMediaType media_type, const std::string& codec, uint32_t mask); void AddMimeTypeCodecMaskForTesting(const std::string& mime_type, uint32_t mask); + void ResetForTesting(); private: friend class base::NoDestructor<KeySystemsImpl>; - using KeySystemPropertiesMap = - std::unordered_map<std::string, std::unique_ptr<KeySystemProperties>>; using MimeTypeToCodecsMap = std::unordered_map<std::string, SupportedCodecs>; using CodecMap = std::unordered_map<std::string, EmeCodec>; using InitDataTypesMap = std::unordered_map<std::string, EmeInitDataType>; @@ -329,12 +330,13 @@ class KeySystemsImpl : public KeySystems { KeySystemsImpl(); ~KeySystemsImpl() override; + void Initialize(); + void UpdateSupportedKeySystems(); - void OnSupportedKeySystemsUpdated(KeySystemPropertiesVector key_systems); - void ProcessSupportedKeySystems(KeySystemPropertiesVector key_systems); + void OnSupportedKeySystemsUpdated(KeySystemInfoVector key_systems); + void ProcessSupportedKeySystems(KeySystemInfoVector key_systems); - const KeySystemProperties* GetKeySystemProperties( - const std::string& key_system) const; + const KeySystemInfo* GetKeySystemInfo(const std::string& key_system) const; void RegisterMimeType(const std::string& mime_type, SupportedCodecs codecs); bool IsValidMimeTypeCodecsCombination(const std::string& mime_type, @@ -357,8 +359,8 @@ class KeySystemsImpl : public KeySystems { // Pending callbacks for UpdateIfNeeded() calls. base::OnceClosureList update_callbacks_; - // Map from key system string to KeySystemProperties instance. - KeySystemPropertiesMap key_system_properties_map_; + // Vector of KeySystemInfo . + KeySystemInfoVector key_system_properties_vector_; // This member should only be modified by RegisterMimeType(). MimeTypeToCodecsMap mime_type_to_codecs_map_; @@ -381,10 +383,7 @@ KeySystemsImpl* KeySystemsImpl::GetInstance() { } KeySystemsImpl::KeySystemsImpl() { - for (const auto& [mime_type, codecs] : kMimeTypeToCodecsMap) - RegisterMimeType(mime_type, codecs); - - UpdateSupportedKeySystems(); + Initialize(); } KeySystemsImpl::~KeySystemsImpl() { @@ -392,6 +391,13 @@ KeySystemsImpl::~KeySystemsImpl() { update_callbacks_.Notify(); } +void KeySystemsImpl::Initialize() { + for (const auto& [mime_type, codecs] : kMimeTypeToCodecsMap) + RegisterMimeType(mime_type, codecs); + + UpdateSupportedKeySystems(); +} + void KeySystemsImpl::UpdateSupportedKeySystems() { DCHECK(!is_updating_); is_updating_ = true; @@ -471,7 +477,7 @@ EmeCodec KeySystemsImpl::GetEmeCodecForString( } void KeySystemsImpl::OnSupportedKeySystemsUpdated( - KeySystemPropertiesVector key_systems) { + KeySystemInfoVector key_systems) { DVLOG(1) << __func__; is_updating_ = false; @@ -485,11 +491,11 @@ void KeySystemsImpl::OnSupportedKeySystemsUpdated( } void KeySystemsImpl::ProcessSupportedKeySystems( - KeySystemPropertiesVector key_systems) { + KeySystemInfoVector key_systems) { DCHECK(thread_checker_.CalledOnValidThread()); - // Clear `key_system_properties_map_` before we repopulating it. - key_system_properties_map_.clear(); + // Clear `key_system_properties_vector_` before repopulating it. + key_system_properties_vector_.clear(); for (auto& properties : key_systems) { DCHECK(!properties->GetBaseKeySystemName().empty()); @@ -520,23 +526,20 @@ void KeySystemsImpl::ProcessSupportedKeySystems( } const auto base_key_system_name = properties->GetBaseKeySystemName(); - DCHECK(!key_system_properties_map_.count(base_key_system_name)) - << "Key system '" << base_key_system_name << "' already registered"; DVLOG(1) << __func__ << ": Adding key system " << base_key_system_name; - key_system_properties_map_[base_key_system_name] = std::move(properties); + key_system_properties_vector_.push_back(std::move(properties)); } } -const KeySystemProperties* KeySystemsImpl::GetKeySystemProperties( +const KeySystemInfo* KeySystemsImpl::GetKeySystemInfo( const std::string& key_system) const { DCHECK(!is_updating_); - for (const auto& entry : key_system_properties_map_) { - const auto& base_key_system = entry.first; - const auto* properties = entry.second.get(); + for (const auto& key_system_properties : key_system_properties_vector_) { + const auto& base_key_system = key_system_properties->GetBaseKeySystemName(); if ((key_system == base_key_system || IsSubKeySystemOf(key_system, base_key_system)) && - properties->IsSupportedKeySystem(key_system)) { - return properties; + key_system_properties->IsSupportedKeySystem(key_system)) { + return key_system_properties.get(); } } @@ -578,7 +581,7 @@ bool KeySystemsImpl::IsSupportedInitDataType( EmeInitDataType init_data_type) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED(); return false; @@ -592,7 +595,7 @@ EmeConfig::Rule KeySystemsImpl::GetEncryptionSchemeConfigRule( EncryptionScheme encryption_scheme) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED(); return EmeConfig::UnsupportedRule(); @@ -620,11 +623,25 @@ void KeySystemsImpl::AddMimeTypeCodecMaskForTesting( RegisterMimeType(mime_type, static_cast<EmeCodec>(codecs_mask)); } +void KeySystemsImpl::ResetForTesting() { + weak_factory_.InvalidateWeakPtrs(); + is_updating_ = false; + DCHECK(update_callbacks_.empty()) + << "Should have no update callbacks for a clean test."; + key_system_properties_vector_.clear(); + mime_type_to_codecs_map_.clear(); + codec_map_for_testing_.clear(); + audio_codec_mask_ = EME_CODEC_AUDIO_ALL; + video_codec_mask_ = EME_CODEC_VIDEO_ALL; + + Initialize(); +} + std::string KeySystemsImpl::GetBaseKeySystemName( const std::string& key_system) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED() << "Key system support should have been checked"; return key_system; @@ -636,14 +653,14 @@ std::string KeySystemsImpl::GetBaseKeySystemName( bool KeySystemsImpl::IsSupportedKeySystem(const std::string& key_system) const { DCHECK(thread_checker_.CalledOnValidThread()); - return GetKeySystemProperties(key_system); + return GetKeySystemInfo(key_system); } bool KeySystemsImpl::ShouldUseBaseKeySystemName( const std::string& key_system) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED() << "Key system support should have been checked"; return false; @@ -655,7 +672,7 @@ bool KeySystemsImpl::ShouldUseBaseKeySystemName( bool KeySystemsImpl::CanUseAesDecryptor(const std::string& key_system) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { DLOG(ERROR) << key_system << " is not a known supported key system"; return false; @@ -688,7 +705,7 @@ EmeConfig::Rule KeySystemsImpl::GetContentTypeConfigRule( } // Double check whether the key system is supported. - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED() << "Key system support should have been checked"; return EmeConfig::UnsupportedRule(); @@ -768,7 +785,7 @@ EmeConfig::Rule KeySystemsImpl::GetRobustnessConfigRule( const bool* hw_secure_requirement) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED(); return EmeConfig::UnsupportedRule(); @@ -782,7 +799,7 @@ EmeConfig::Rule KeySystemsImpl::GetPersistentLicenseSessionSupport( const std::string& key_system) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED(); return EmeConfig::UnsupportedRule(); @@ -795,7 +812,7 @@ EmeFeatureSupport KeySystemsImpl::GetPersistentStateSupport( const std::string& key_system) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED(); return EmeFeatureSupport::INVALID; @@ -808,7 +825,7 @@ EmeFeatureSupport KeySystemsImpl::GetDistinctiveIdentifierSupport( const std::string& key_system) const { DCHECK(thread_checker_.CalledOnValidThread()); - const auto* properties = GetKeySystemProperties(key_system); + const auto* properties = GetKeySystemInfo(key_system); if (!properties) { NOTREACHED(); return EmeFeatureSupport::INVALID; @@ -817,12 +834,12 @@ EmeFeatureSupport KeySystemsImpl::GetDistinctiveIdentifierSupport( return properties->GetDistinctiveIdentifierSupport(); } +} // namespace + KeySystems* KeySystems::GetInstance() { return KeySystemsImpl::GetInstance(); } -//------------------------------------------------------------------------------ - bool IsSupportedKeySystemWithInitDataType(const std::string& key_system, EmeInitDataType init_data_type) { return KeySystemsImpl::GetInstance()->IsSupportedInitDataType(key_system, @@ -868,7 +885,7 @@ bool CanUseAesDecryptor(const std::string& key_system) { return KeySystemsImpl::GetInstance()->CanUseAesDecryptor(key_system); } -// These two functions are for testing purpose only. The declaration in the +// These three functions are for testing purpose only. The declaration in the // header file is guarded by "#if defined(UNIT_TEST)" so that they can be used // by tests but not non-test code. However, this .cc file is compiled as part of // "media" where "UNIT_TEST" is not defined. So we need to specify @@ -887,4 +904,8 @@ MEDIA_EXPORT void AddMimeTypeCodecMaskForTesting(const std::string& mime_type, mask); } +MEDIA_EXPORT void ResetKeySystemsForTesting() { + KeySystemsImpl::GetInstance()->ResetForTesting(); +} + } // namespace media diff --git a/chromium/media/base/key_systems.h b/chromium/media/base/key_systems.h index 4a24550ed7d..2edc4d20ee1 100644 --- a/chromium/media/base/key_systems.h +++ b/chromium/media/base/key_systems.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -127,6 +127,8 @@ MEDIA_EXPORT void AddCodecMaskForTesting(EmeMediaType media_type, uint32_t mask); MEDIA_EXPORT void AddMimeTypeCodecMaskForTesting(const std::string& mime_type, uint32_t mask); +// Resets and reinitializes the KeySystems for testing. +MEDIA_EXPORT void ResetKeySystemsForTesting(); #endif // defined(UNIT_TEST) } // namespace media diff --git a/chromium/media/base/key_systems_unittest.cc b/chromium/media/base/key_systems_unittest.cc index 771cf263868..075232ee82b 100644 --- a/chromium/media/base/key_systems_unittest.cc +++ b/chromium/media/base/key_systems_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -66,7 +66,7 @@ static_assert((TEST_CODEC_FOO_ALL & EME_CODEC_ALL) == EME_CODEC_NONE, "test codec masks should only use invalid codec masks"); // Base class to provide default implementations. -class TestKeySystemPropertiesBase : public KeySystemProperties { +class TestKeySystemInfoBase : public KeySystemInfo { public: bool IsSupportedInitDataType(EmeInitDataType init_data_type) const override { return init_data_type == EmeInitDataType::WEBM; @@ -89,9 +89,9 @@ class TestKeySystemPropertiesBase : public KeySystemProperties { } }; -class AesKeySystemProperties : public TestKeySystemPropertiesBase { +class AesKeySystemInfo : public TestKeySystemInfoBase { public: - AesKeySystemProperties(const std::string& name) : name_(name) {} + explicit AesKeySystemInfo(const std::string& name) : name_(name) {} std::string GetBaseKeySystemName() const override { return name_; } @@ -122,7 +122,7 @@ class AesKeySystemProperties : public TestKeySystemPropertiesBase { std::string name_; }; -class ExternalKeySystemProperties : public TestKeySystemPropertiesBase { +class ExternalKeySystemInfo : public TestKeySystemInfoBase { public: std::string GetBaseKeySystemName() const override { return kExternal; } @@ -231,21 +231,12 @@ EmeConfig::Rule GetRobustnessConfigRule( // Therefore, SetMediaClient() must be called before this function to make sure // MediaClient in effect when constructing KeySystems. void AddContainerAndCodecMasksForTest() { - // Since KeySystems is a singleton. Make sure we only add test container and - // codec masks once per process. - static bool is_test_masks_added = false; - - if (is_test_masks_added) - return; - AddCodecMaskForTesting(EmeMediaType::AUDIO, "fooaudio", TEST_CODEC_FOO_AUDIO); AddCodecMaskForTesting(EmeMediaType::VIDEO, "foovideo", TEST_CODEC_FOO_VIDEO); AddCodecMaskForTesting(EmeMediaType::VIDEO, "securefoovideo", TEST_CODEC_FOO_SECURE_VIDEO); AddMimeTypeCodecMaskForTesting("audio/foo", TEST_CODEC_FOO_AUDIO_ALL); AddMimeTypeCodecMaskForTesting("video/foo", TEST_CODEC_FOO_VIDEO_ALL); - - is_test_masks_added = true; } class TestMediaClient : public MediaClient { @@ -267,7 +258,7 @@ class TestMediaClient : public MediaClient { GetAudioRendererAlgorithmParameters(AudioParameters audio_parameters) final; private: - KeySystemPropertiesVector GetSupportedKeySystemsInternal(); + KeySystemInfoVector GetSupportedKeySystemsInternal(); GetSupportedKeySystemsCB get_supported_key_systems_cb_; bool supports_external_key_system_ = true; @@ -278,7 +269,6 @@ TestMediaClient::~TestMediaClient() = default; void TestMediaClient::GetSupportedKeySystems(GetSupportedKeySystemsCB cb) { // Save the callback for future updates. - DCHECK(!get_supported_key_systems_cb_); get_supported_key_systems_cb_ = cb; get_supported_key_systems_cb_.Run(GetSupportedKeySystemsInternal()); @@ -307,13 +297,13 @@ TestMediaClient::GetAudioRendererAlgorithmParameters( return absl::nullopt; } -KeySystemPropertiesVector TestMediaClient::GetSupportedKeySystemsInternal() { - KeySystemPropertiesVector key_systems; +KeySystemInfoVector TestMediaClient::GetSupportedKeySystemsInternal() { + KeySystemInfoVector key_systems; - key_systems.emplace_back(std::make_unique<AesKeySystemProperties>(kUsesAes)); + key_systems.emplace_back(std::make_unique<AesKeySystemInfo>(kUsesAes)); if (supports_external_key_system_) - key_systems.emplace_back(std::make_unique<ExternalKeySystemProperties>()); + key_systems.emplace_back(std::make_unique<ExternalKeySystemInfo>()); return key_systems; } @@ -360,6 +350,9 @@ class KeySystemsTest : public testing::Test { mixed_codecs_.push_back("foovideo"); SetMediaClient(&test_media_client_); + + // Reset KeySystems since it's a singleton. + ResetKeySystemsForTesting(); } void SetUp() override { @@ -372,7 +365,7 @@ class KeySystemsTest : public testing::Test { ~KeySystemsTest() override { // Clear the use of |test_media_client_|, which was set in SetUp(). - // NOTE: This does not clear any cached KeySystemProperties in the global + // NOTE: This does not clear any cached KeySystemInfo in the global // KeySystems instance. SetMediaClient(nullptr); } diff --git a/chromium/media/base/limits.h b/chromium/media/base/limits.h index c5cb20e36ee..817077f1d83 100644 --- a/chromium/media/base/limits.h +++ b/chromium/media/base/limits.h @@ -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/base/localized_strings.cc b/chromium/media/base/localized_strings.cc index ae3217e5b1e..c3e36729f05 100644 --- a/chromium/media/base/localized_strings.cc +++ b/chromium/media/base/localized_strings.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/localized_strings.h b/chromium/media/base/localized_strings.h index f8bfbf04f1e..3535b0d43aa 100644 --- a/chromium/media/base/localized_strings.h +++ b/chromium/media/base/localized_strings.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/logging_override_if_enabled.h b/chromium/media/base/logging_override_if_enabled.h index 4ab438c0398..2e4515c1565 100644 --- a/chromium/media/base/logging_override_if_enabled.h +++ b/chromium/media/base/logging_override_if_enabled.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/loopback_audio_converter.cc b/chromium/media/base/loopback_audio_converter.cc index 715675d28b8..d22e23d2620 100644 --- a/chromium/media/base/loopback_audio_converter.cc +++ b/chromium/media/base/loopback_audio_converter.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/base/loopback_audio_converter.h b/chromium/media/base/loopback_audio_converter.h index 705ad353ae6..e3a9189466e 100644 --- a/chromium/media/base/loopback_audio_converter.h +++ b/chromium/media/base/loopback_audio_converter.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/base/mac/BUILD.gn b/chromium/media/base/mac/BUILD.gn index 9dd95bbc171..0c770ef02ae 100644 --- a/chromium/media/base/mac/BUILD.gn +++ b/chromium/media/base/mac/BUILD.gn @@ -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/base/mac/audio_latency_mac.cc b/chromium/media/base/mac/audio_latency_mac.cc index 3d1aa2fd638..a7d7b1bcccf 100644 --- a/chromium/media/base/mac/audio_latency_mac.cc +++ b/chromium/media/base/mac/audio_latency_mac.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/base/mac/audio_latency_mac.h b/chromium/media/base/mac/audio_latency_mac.h index 23fd37954b8..7955485618d 100644 --- a/chromium/media/base/mac/audio_latency_mac.h +++ b/chromium/media/base/mac/audio_latency_mac.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/base/mac/color_space_util_mac.h b/chromium/media/base/mac/color_space_util_mac.h index ab2a4459aad..321747964da 100644 --- a/chromium/media/base/mac/color_space_util_mac.h +++ b/chromium/media/base/mac/color_space_util_mac.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,12 +21,6 @@ MEDIA_EXPORT gfx::ColorSpace GetImageBufferColorSpace( MEDIA_EXPORT gfx::ColorSpace GetFormatDescriptionColorSpace( CMFormatDescriptionRef format_description); -MEDIA_EXPORT CFDataRef -GenerateContentLightLevelInfo(const gfx::HDRMetadata& hdr_metadata); - -MEDIA_EXPORT CFDataRef -GenerateMasteringDisplayColorVolume(const gfx::HDRMetadata& hdr_metadata); - } // namespace media #endif // MEDIA_BASE_MAC_COLOR_SPACE_UTIL_MAC_H_ diff --git a/chromium/media/base/mac/color_space_util_mac.mm b/chromium/media/base/mac/color_space_util_mac.mm index 9110f1a19f7..5074bb05f2a 100644 --- a/chromium/media/base/mac/color_space_util_mac.mm +++ b/chromium/media/base/mac/color_space_util_mac.mm @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -269,65 +269,4 @@ gfx::ColorSpace GetFormatDescriptionColorSpace( format_description, kCMFormatDescriptionExtension_YCbCrMatrix)); } -CFDataRef GenerateContentLightLevelInfo(const gfx::HDRMetadata& hdr_metadata) { - // This is a SMPTEST2086 Content Light Level Information box. - struct ContentLightLevelInfoSEI { - uint16_t max_content_light_level; - uint16_t max_frame_average_light_level; - } __attribute__((packed, aligned(2))); - static_assert(sizeof(ContentLightLevelInfoSEI) == 4, "Must be 4 bytes"); - - // Values are stored in big-endian... - ContentLightLevelInfoSEI sei; - sei.max_content_light_level = - __builtin_bswap16(hdr_metadata.max_content_light_level); - sei.max_frame_average_light_level = - __builtin_bswap16(hdr_metadata.max_frame_average_light_level); - - NSData* nsdata_sei = [NSData dataWithBytes:&sei length:4]; - return base::mac::NSToCFCast(nsdata_sei); -} - -CFDataRef GenerateMasteringDisplayColorVolume( - const gfx::HDRMetadata& hdr_metadata) { - // This is a SMPTEST2086 Mastering Display Color Volume box. - struct MasteringDisplayColorVolumeSEI { - vector_ushort2 primaries[3]; // GBR - vector_ushort2 white_point; - uint32_t luminance_max; - uint32_t luminance_min; - } __attribute__((packed, aligned(4))); - static_assert(sizeof(MasteringDisplayColorVolumeSEI) == 24, - "Must be 24 bytes"); - - // Make a copy which we can manipulate. - auto md = hdr_metadata.color_volume_metadata; - - constexpr float kColorCoordinateUpperBound = 50000.0f; - md.primary_r.Scale(kColorCoordinateUpperBound); - md.primary_g.Scale(kColorCoordinateUpperBound); - md.primary_b.Scale(kColorCoordinateUpperBound); - md.white_point.Scale(kColorCoordinateUpperBound); - - constexpr float kUnitOfMasteringLuminance = 10000.0f; - md.luminance_max *= kUnitOfMasteringLuminance; - md.luminance_min *= kUnitOfMasteringLuminance; - - // Values are stored in big-endian... - MasteringDisplayColorVolumeSEI sei; - sei.primaries[0].x = __builtin_bswap16(md.primary_g.x() + 0.5f); - sei.primaries[0].y = __builtin_bswap16(md.primary_g.y() + 0.5f); - sei.primaries[1].x = __builtin_bswap16(md.primary_b.x() + 0.5f); - sei.primaries[1].y = __builtin_bswap16(md.primary_b.y() + 0.5f); - sei.primaries[2].x = __builtin_bswap16(md.primary_r.x() + 0.5f); - sei.primaries[2].y = __builtin_bswap16(md.primary_r.y() + 0.5f); - sei.white_point.x = __builtin_bswap16(md.white_point.x() + 0.5f); - sei.white_point.y = __builtin_bswap16(md.white_point.y() + 0.5f); - sei.luminance_max = __builtin_bswap32(md.luminance_max + 0.5f); - sei.luminance_min = __builtin_bswap32(md.luminance_min + 0.5f); - - NSData* nsdata_sei = [NSData dataWithBytes:&sei length:24]; - return base::mac::NSToCFCast(nsdata_sei); -} - } // namespace media diff --git a/chromium/media/base/mac/video_frame_mac.cc b/chromium/media/base/mac/video_frame_mac.cc index ced632c600e..a0adb8e9527 100644 --- a/chromium/media/base/mac/video_frame_mac.cc +++ b/chromium/media/base/mac/video_frame_mac.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. @@ -11,6 +11,7 @@ #include "base/logging.h" #include "media/base/video_frame.h" +#include "media/base/video_util.h" #include "ui/gfx/gpu_memory_buffer.h" #include "ui/gfx/mac/io_surface.h" @@ -34,33 +35,44 @@ void CvPixelBufferReleaseCallback(void* frame_ref, } // namespace MEDIA_EXPORT base::ScopedCFTypeRef<CVPixelBufferRef> -WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { +WrapVideoFrameInCVPixelBuffer(scoped_refptr<VideoFrame> frame) { base::ScopedCFTypeRef<CVPixelBufferRef> pixel_buffer; - - // If the frame is backed by a pixel buffer, just return that buffer. - if (frame.CvPixelBuffer()) { - pixel_buffer.reset(frame.CvPixelBuffer(), base::scoped_policy::RETAIN); + if (!frame) return pixel_buffer; - } + const gfx::Rect& visible_rect = frame->visible_rect(); + bool crop_needed = visible_rect != gfx::Rect(frame->coded_size()); + + if (!crop_needed) { + // If the frame is backed by a pixel buffer, just return that buffer. + if (frame->CvPixelBuffer()) { + pixel_buffer.reset(frame->CvPixelBuffer(), base::scoped_policy::RETAIN); + return pixel_buffer; + } - // If the frame has a GMB, yank out its IOSurface if possible. - if (frame.GetGpuMemoryBuffer()) { - gfx::GpuMemoryBufferHandle handle = - frame.GetGpuMemoryBuffer()->CloneHandle(); - if (handle.type == gfx::GpuMemoryBufferType::IO_SURFACE_BUFFER) { - gfx::ScopedIOSurface io_surface = handle.io_surface; - if (io_surface) { - const CVReturn cv_return = CVPixelBufferCreateWithIOSurface( - nullptr, io_surface, nullptr, pixel_buffer.InitializeInto()); - if (cv_return == kCVReturnSuccess) { - VLOG(3) << "Returning IOSurface-based CVPixelBuffer."; + // If the frame has a GMB, yank out its IOSurface if possible. + if (frame->HasGpuMemoryBuffer()) { + auto handle = frame->GetGpuMemoryBuffer()->CloneHandle(); + if (handle.type == gfx::GpuMemoryBufferType::IO_SURFACE_BUFFER) { + gfx::ScopedIOSurface io_surface = handle.io_surface; + if (io_surface) { + CVReturn cv_return = CVPixelBufferCreateWithIOSurface( + nullptr, io_surface, nullptr, pixel_buffer.InitializeInto()); + if (cv_return != kCVReturnSuccess) { + DLOG(ERROR) << "CVPixelBufferCreateWithIOSurface failed: " + << cv_return; + pixel_buffer.reset(); + } return pixel_buffer; } - pixel_buffer.reset(); } } } + // If the frame is backed by a GPU buffer, but needs cropping, map it and + // and handle like a software frame. There is no memcpy here. + if (frame->HasGpuMemoryBuffer()) + frame = ConvertToMemoryMappedFrame(std::move(frame)); + VLOG(3) << "Returning RAM based CVPixelBuffer."; // VideoFrame only supports YUV formats and most of them are 'YVU' ordered, @@ -68,7 +80,7 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { // represent I420 and NV12 frames. In addition, VideoFrame does not carry // colorimetric information, so this function assumes standard video range // and ITU Rec 709 primaries. - const VideoPixelFormat video_frame_format = frame.format(); + const VideoPixelFormat video_frame_format = frame->format(); OSType cv_format; if (video_frame_format == PIXEL_FORMAT_I420) { cv_format = kCVPixelFormatType_420YpCbCr8Planar; @@ -81,7 +93,6 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { int num_planes = VideoFrame::NumPlanes(video_frame_format); DCHECK_LE(num_planes, kMaxPlanes); - const gfx::Rect& visible_rect = frame.visible_rect(); // Build arrays for each plane's data pointer, dimensions and byte alignment. void* plane_ptrs[kMaxPlanes]; @@ -89,12 +100,12 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { size_t plane_heights[kMaxPlanes]; size_t plane_bytes_per_row[kMaxPlanes]; for (int plane_i = 0; plane_i < num_planes; ++plane_i) { - plane_ptrs[plane_i] = const_cast<uint8_t*>(frame.visible_data(plane_i)); + plane_ptrs[plane_i] = const_cast<uint8_t*>(frame->visible_data(plane_i)); gfx::Size plane_size = VideoFrame::PlaneSize(video_frame_format, plane_i, visible_rect.size()); plane_widths[plane_i] = plane_size.width(); plane_heights[plane_i] = plane_size.height(); - plane_bytes_per_row[plane_i] = frame.stride(plane_i); + plane_bytes_per_row[plane_i] = frame->stride(plane_i); } // CVPixelBufferCreateWithPlanarBytes needs a dummy plane descriptor or the @@ -110,7 +121,7 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { kCFAllocatorDefault, visible_rect.width(), visible_rect.height(), cv_format, descriptor, 0, num_planes, plane_ptrs, plane_widths, plane_heights, plane_bytes_per_row, &CvPixelBufferReleaseCallback, - const_cast<VideoFrame*>(&frame), nullptr, pixel_buffer.InitializeInto()); + frame.get(), nullptr, pixel_buffer.InitializeInto()); if (result != kCVReturnSuccess) { DLOG(ERROR) << " CVPixelBufferCreateWithPlanarBytes failed: " << result; return base::ScopedCFTypeRef<CVPixelBufferRef>(nullptr); @@ -119,7 +130,7 @@ WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame) { // The CVPixelBuffer now references the data of the frame, so increment its // reference count manually. The release callback set on the pixel buffer will // release the frame. - frame.AddRef(); + frame->AddRef(); // Apply required colorimetric attachments. CVBufferSetAttachment(pixel_buffer, kCVImageBufferColorPrimariesKey, diff --git a/chromium/media/base/mac/video_frame_mac.h b/chromium/media/base/mac/video_frame_mac.h index 93bcb77b362..2d316e27177 100644 --- a/chromium/media/base/mac/video_frame_mac.h +++ b/chromium/media/base/mac/video_frame_mac.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. @@ -8,6 +8,7 @@ #include <CoreVideo/CVPixelBuffer.h> #include "base/mac/scoped_cftyperef.h" +#include "base/memory/ref_counted.h" #include "media/base/media_export.h" namespace media { @@ -23,7 +24,7 @@ class VideoFrame; // (the visible rect's size does not match the coded size) are not supported. // If an unsupported frame is specified, null is returned. MEDIA_EXPORT base::ScopedCFTypeRef<CVPixelBufferRef> -WrapVideoFrameInCVPixelBuffer(const VideoFrame& frame); +WrapVideoFrameInCVPixelBuffer(scoped_refptr<VideoFrame> frame); } // namespace media diff --git a/chromium/media/base/mac/video_frame_mac_unittests.cc b/chromium/media/base/mac/video_frame_mac_unittests.cc index 1122f447615..8ccb45e14d4 100644 --- a/chromium/media/base/mac/video_frame_mac_unittests.cc +++ b/chromium/media/base/mac/video_frame_mac_unittests.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. @@ -40,7 +40,7 @@ TEST(VideoFrameMac, CheckBasicAttributes) { size, kTimestamp); ASSERT_TRUE(frame.get()); - auto pb = WrapVideoFrameInCVPixelBuffer(*frame); + auto pb = WrapVideoFrameInCVPixelBuffer(frame); ASSERT_TRUE(pb.get()); const gfx::Size coded_size = frame->coded_size(); @@ -77,7 +77,7 @@ TEST(VideoFrameMac, CheckFormats) { auto frame = VideoFrame::CreateFrame(format_pair.chrome, size, gfx::Rect(size), size, kTimestamp); ASSERT_TRUE(frame.get()); - auto pb = WrapVideoFrameInCVPixelBuffer(*frame); + auto pb = WrapVideoFrameInCVPixelBuffer(frame); if (format_pair.corevideo) { EXPECT_EQ(format_pair.corevideo, CVPixelBufferGetPixelFormatType(pb)); } else { @@ -99,7 +99,7 @@ TEST(VideoFrameMac, CheckLifetime) { base::BindOnce(&Increment, &instances_destroyed)); ASSERT_TRUE(wrapper_frame.get()); - auto pb = WrapVideoFrameInCVPixelBuffer(*wrapper_frame); + auto pb = WrapVideoFrameInCVPixelBuffer(wrapper_frame); ASSERT_TRUE(pb.get()); wrapper_frame = nullptr; @@ -156,7 +156,7 @@ TEST(VideoFrameMac, CorrectlyWrapsFramesWithPadding) { ASSERT_TRUE(frame.get()); FillFrameWithPredictableValues(*frame); - auto pb = WrapVideoFrameInCVPixelBuffer(*frame); + auto pb = WrapVideoFrameInCVPixelBuffer(frame); ASSERT_TRUE(pb.get()); EXPECT_EQ(kCVPixelFormatType_420YpCbCr8Planar, CVPixelBufferGetPixelFormatType(pb)); diff --git a/chromium/media/base/mac/videotoolbox_helpers.cc b/chromium/media/base/mac/videotoolbox_helpers.cc index 8b0bb92b3b0..3e689a3173d 100644 --- a/chromium/media/base/mac/videotoolbox_helpers.cc +++ b/chromium/media/base/mac/videotoolbox_helpers.cc @@ -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/base/mac/videotoolbox_helpers.h b/chromium/media/base/mac/videotoolbox_helpers.h index 1f24b6d2ff4..a00512be900 100644 --- a/chromium/media/base/mac/videotoolbox_helpers.h +++ b/chromium/media/base/mac/videotoolbox_helpers.h @@ -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/base/media.cc b/chromium/media/base/media.cc index ef6ffe81646..7f2220ea360 100644 --- a/chromium/media/base/media.cc +++ b/chromium/media/base/media.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/media.h b/chromium/media/base/media.h index 7ee3f33870e..436192f2fd6 100644 --- a/chromium/media/base/media.h +++ b/chromium/media/base/media.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/base/media_client.cc b/chromium/media/base/media_client.cc index 011f3b74137..3e54a2e392a 100644 --- a/chromium/media/base/media_client.cc +++ b/chromium/media/base/media_client.cc @@ -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/base/media_client.h b/chromium/media/base/media_client.h index 5e8ac795f72..fd22d95e89c 100644 --- a/chromium/media/base/media_client.h +++ b/chromium/media/base/media_client.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. @@ -10,7 +10,7 @@ #include "media/base/audio_codecs.h" #include "media/base/audio_parameters.h" -#include "media/base/key_system_properties.h" +#include "media/base/key_system_info.h" #include "media/base/media_export.h" #include "media/base/media_types.h" #include "media/base/video_codecs.h" diff --git a/chromium/media/base/media_content_type.cc b/chromium/media/base/media_content_type.cc index 2d3ca0b83bf..5e0c1421ef3 100644 --- a/chromium/media/base/media_content_type.cc +++ b/chromium/media/base/media_content_type.cc @@ -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/base/media_content_type.h b/chromium/media/base/media_content_type.h index efafd43ef52..4e3e127c9df 100644 --- a/chromium/media/base/media_content_type.h +++ b/chromium/media/base/media_content_type.h @@ -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/base/media_controller.h b/chromium/media/base/media_controller.h index afd1f063cbf..47cdd30b6e0 100644 --- a/chromium/media/base/media_controller.h +++ b/chromium/media/base/media_controller.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/media_drm_key_type.h b/chromium/media/base/media_drm_key_type.h index fea284d0ed2..6c037ca4914 100644 --- a/chromium/media/base/media_drm_key_type.h +++ b/chromium/media/base/media_drm_key_type.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/media_drm_storage.cc b/chromium/media/base/media_drm_storage.cc index f27eba98ea1..43d78e301a7 100644 --- a/chromium/media/base/media_drm_storage.cc +++ b/chromium/media/base/media_drm_storage.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/base/media_drm_storage.h b/chromium/media/base/media_drm_storage.h index 08fc91ca355..f3c7f68942e 100644 --- a/chromium/media/base/media_drm_storage.h +++ b/chromium/media/base/media_drm_storage.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/base/media_export.h b/chromium/media/base/media_export.h index 08091844ada..45785997b43 100644 --- a/chromium/media/base/media_export.h +++ b/chromium/media/base/media_export.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/base/media_log.cc b/chromium/media/base/media_log.cc index 46887da3dc2..d599c5b3838 100644 --- a/chromium/media/base/media_log.cc +++ b/chromium/media/base/media_log.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. @@ -6,7 +6,6 @@ #include <utility> -#include "base/atomic_sequence_num.h" #include "base/memory/ptr_util.h" #include "base/strings/string_util.h" #include "base/values.h" @@ -18,10 +17,6 @@ namespace media { // only in one spot. const char MediaLog::kEventKey[] = "event"; -// A count of all MediaLogs created in the current process. Used to generate -// unique IDs. -static base::AtomicSequenceNumber g_media_log_count; - MediaLog::MediaLog() : MediaLog(new ParentLogRecord(this)) {} MediaLog::MediaLog(scoped_refptr<ParentLogRecord> parent_log_record) @@ -55,8 +50,9 @@ void MediaLog::Stop() {} void MediaLog::AddMessage(MediaLogMessageLevel level, std::string message) { std::unique_ptr<MediaLogRecord> record( CreateRecord(MediaLogRecord::Type::kMessage)); - record->params.SetStringPath(MediaLogMessageLevelToString(level), - std::move(message)); + if (!base::IsStringUTF8AllowingNoncharacters(message)) + message = "WARNING: system message could not be rendered!"; + record->params.Set(MediaLogMessageLevelToString(level), std::move(message)); AddLogRecord(std::move(record)); } @@ -93,7 +89,9 @@ void MediaLog::AddLogRecord(std::unique_ptr<MediaLogRecord> record) { std::unique_ptr<MediaLogRecord> MediaLog::CreateRecord( MediaLogRecord::Type type) { auto record = std::make_unique<MediaLogRecord>(); - record->id = id(); + // Record IDs are populated by event handlers before they are sent to various + // log viewers, such as the media-internals page, or devtools. + record->id = 0; record->type = type; record->time = base::TimeTicks::Now(); return record; @@ -108,8 +106,7 @@ void MediaLog::InvalidateLog() { // Keep |parent_log_record_| around, since the lock must keep working. } -MediaLog::ParentLogRecord::ParentLogRecord(MediaLog* log) - : id(g_media_log_count.GetNext()), media_log(log) {} +MediaLog::ParentLogRecord::ParentLogRecord(MediaLog* log) : media_log(log) {} MediaLog::ParentLogRecord::~ParentLogRecord() = default; LogHelper::LogHelper(MediaLogMessageLevel level, MediaLog* media_log) diff --git a/chromium/media/base/media_log.h b/chromium/media/base/media_log.h index cce6a266327..a9d85baa5f1 100644 --- a/chromium/media/base/media_log.h +++ b/chromium/media/base/media_log.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. @@ -97,8 +97,9 @@ class MEDIA_EXPORT MediaLog { DCHECK(!status.is_ok()); std::unique_ptr<MediaLogRecord> record = CreateRecord(MediaLogRecord::Type::kMediaStatus); - auto serialized = MediaSerialize(status); - record->params.MergeDictionary(&serialized); + base::Value serialized = MediaSerialize(status); + DCHECK(serialized.is_dict()); + record->params.Merge(std::move(serialized.GetDict())); AddLogRecord(std::move(record)); } @@ -115,11 +116,6 @@ class MEDIA_EXPORT MediaLog { // TODO(tmathmeyer) Use a media::Status when that is ready. std::string GetErrorMessage(); - // Getter for |id_|. Used by MojoMediaLogService to construct MediaLogRecords - // to log into this MediaLog. Also used in trace events to associate each - // event with a specific media playback. - int32_t id() const { return parent_log_record_->id; } - // Add a record to this log. Inheritors should override AddLogRecordLocked to // do something. This needs to be public for MojoMediaLogService to use it. void AddLogRecord(std::unique_ptr<MediaLogRecord> event); @@ -152,16 +148,16 @@ class MEDIA_EXPORT MediaLog { template <MediaLogProperty P, typename T> std::unique_ptr<MediaLogRecord> CreatePropertyRecord(const T& value) { auto record = CreateRecord(MediaLogRecord::Type::kMediaPropertyChange); - record->params.SetKey(MediaLogPropertyKeyToString(P), - MediaLogPropertyTypeSupport<P, T>::Convert(value)); + record->params.Set(MediaLogPropertyKeyToString(P), + MediaLogPropertyTypeSupport<P, T>::Convert(value)); return record; } template <MediaLogEvent E, typename... Opt> std::unique_ptr<MediaLogRecord> CreateEventRecord() { std::unique_ptr<MediaLogRecord> record( CreateRecord(MediaLogRecord::Type::kMediaEventTriggered)); - record->params.SetString(MediaLog::kEventKey, - MediaLogEventTypeSupport<E, Opt...>::TypeName()); + record->params.Set(MediaLog::kEventKey, + MediaLogEventTypeSupport<E, Opt...>::TypeName()); return record; } @@ -178,9 +174,6 @@ class MEDIA_EXPORT MediaLog { ParentLogRecord(const ParentLogRecord&) = delete; ParentLogRecord& operator=(const ParentLogRecord&) = delete; - // A unique (to this process) id for this MediaLog. - int32_t id; - // |lock_| protects the rest of this structure. base::Lock lock; diff --git a/chromium/media/base/media_log_events.cc b/chromium/media/base/media_log_events.cc index c628a511c1b..384c0fa2351 100644 --- a/chromium/media/base/media_log_events.cc +++ b/chromium/media/base/media_log_events.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_log_events.h b/chromium/media/base/media_log_events.h index ddf71e1f5a2..7f74b458cdf 100644 --- a/chromium/media/base/media_log_events.h +++ b/chromium/media/base/media_log_events.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_log_message_levels.cc b/chromium/media/base/media_log_message_levels.cc index c39257c8a31..bf1359738d1 100644 --- a/chromium/media/base/media_log_message_levels.cc +++ b/chromium/media/base/media_log_message_levels.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_log_message_levels.h b/chromium/media/base/media_log_message_levels.h index d79df67db10..502fd9bb828 100644 --- a/chromium/media/base/media_log_message_levels.h +++ b/chromium/media/base/media_log_message_levels.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_log_properties.cc b/chromium/media/base/media_log_properties.cc index 6203fe01493..5d4adf31ad2 100644 --- a/chromium/media/base/media_log_properties.cc +++ b/chromium/media/base/media_log_properties.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_log_properties.h b/chromium/media/base/media_log_properties.h index ddd20e971d6..41fe6bac668 100644 --- a/chromium/media/base/media_log_properties.h +++ b/chromium/media/base/media_log_properties.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_log_record.h b/chromium/media/base/media_log_record.h index cb030168957..2caaffac6f5 100644 --- a/chromium/media/base/media_log_record.h +++ b/chromium/media/base/media_log_record.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. @@ -6,7 +6,6 @@ #define MEDIA_BASE_MEDIA_LOG_RECORD_H_ #include <stdint.h> -#include <memory> #include "base/time/time.h" #include "base/values.h" @@ -23,9 +22,7 @@ struct MediaLogRecord { MediaLogRecord& operator=(const MediaLogRecord& event) { id = event.id; type = event.type; - params.Swap(base::DictionaryValue::From( - base::Value::ToUniquePtrValue(event.params.Clone())) - .get()); + params = event.params.Clone(); time = event.time; return *this; } @@ -56,7 +53,7 @@ struct MediaLogRecord { int32_t id; Type type; - base::DictionaryValue params; + base::Value::Dict params; base::TimeTicks time; }; diff --git a/chromium/media/base/media_log_type_enforcement.h b/chromium/media/base/media_log_type_enforcement.h index 7624ce34490..979c8da5dac 100644 --- a/chromium/media/base/media_log_type_enforcement.h +++ b/chromium/media/base/media_log_type_enforcement.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -36,32 +36,32 @@ struct MediaLogEventTypeSupport {}; } \ } -#define MEDIA_LOG_EVENT_NAMED_DATA(EVENT, TYPE, DISPLAY) \ - template <> \ - struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \ - static void AddExtraData(base::Value* params, const TYPE& t) { \ - DCHECK(params); \ - params->SetKey(DISPLAY, MediaSerialize<TYPE>(t)); \ - } \ - static std::string TypeName() { return #EVENT; } \ +#define MEDIA_LOG_EVENT_NAMED_DATA(EVENT, TYPE, DISPLAY) \ + template <> \ + struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \ + static void AddExtraData(base::Value::Dict* params, const TYPE& t) { \ + DCHECK(params); \ + params->Set(DISPLAY, MediaSerialize<TYPE>(t)); \ + } \ + static std::string TypeName() { return #EVENT; } \ } -#define MEDIA_LOG_EVENT_NAMED_DATA_OP(EVENT, TYPE, DISPLAY, OP) \ - template <> \ - struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \ - static void AddExtraData(base::Value* params, const TYPE& t) { \ - DCHECK(params); \ - params->SetKey(DISPLAY, MediaSerialize<TYPE>(OP(t))); \ - } \ - static std::string TypeName() { return #EVENT; } \ +#define MEDIA_LOG_EVENT_NAMED_DATA_OP(EVENT, TYPE, DISPLAY, OP) \ + template <> \ + struct MediaLogEventTypeSupport<MediaLogEvent::EVENT, TYPE> { \ + static void AddExtraData(base::Value::Dict* params, const TYPE& t) { \ + DCHECK(params); \ + params->Set(DISPLAY, MediaSerialize<TYPE>(OP(t))); \ + } \ + static std::string TypeName() { return #EVENT; } \ } // Specifically do not create the Convert or DisplayName methods -#define MEDIA_LOG_EVENT_TYPELESS(EVENT) \ - template <> \ - struct MediaLogEventTypeSupport<MediaLogEvent::EVENT> { \ - static std::string TypeName() { return #EVENT; } \ - static void AddExtraData(base::Value* params) {} \ +#define MEDIA_LOG_EVENT_TYPELESS(EVENT) \ + template <> \ + struct MediaLogEventTypeSupport<MediaLogEvent::EVENT> { \ + static std::string TypeName() { return #EVENT; } \ + static void AddExtraData(base::Value::Dict* params) {} \ } } // namespace media diff --git a/chromium/media/base/media_log_unittest.cc b/chromium/media/base/media_log_unittest.cc index 97e641a1736..52f85c48c32 100644 --- a/chromium/media/base/media_log_unittest.cc +++ b/chromium/media/base/media_log_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -46,7 +46,7 @@ TEST_F(MediaLogTest, ClonedLogsInhertParentPlayerId) { child_media_log->AddMessage(MediaLogMessageLevel::kERROR, "test"); auto event = root_log->take_most_recent_event(); EXPECT_NE(event, nullptr); - EXPECT_EQ(event->id, root_log->id()); + EXPECT_EQ(event->id, 0); } TEST_F(MediaLogTest, DontTruncateShortUrlString) { @@ -58,13 +58,13 @@ TEST_F(MediaLogTest, DontTruncateShortUrlString) { root_log_->AddEvent<MediaLogEvent::kLoad>(short_url); auto event = root_log_->take_most_recent_event(); EXPECT_NE(event, nullptr); - EXPECT_EQ(*event->params.FindStringPath("url"), "chromium.org"); + EXPECT_EQ(*event->params.FindString("url"), "chromium.org"); // Verify that CreatedEvent does not truncate the short URL. root_log_->AddEvent<MediaLogEvent::kWebMediaPlayerCreated>(short_url); event = root_log_->take_most_recent_event(); EXPECT_NE(event, nullptr); - EXPECT_EQ(*event->params.FindStringPath("origin_url"), "chromium.org"); + EXPECT_EQ(*event->params.FindString("origin_url"), "chromium.org"); } TEST_F(MediaLogTest, TruncateLongUrlStrings) { @@ -90,13 +90,13 @@ TEST_F(MediaLogTest, TruncateLongUrlStrings) { root_log_->AddEvent<MediaLogEvent::kLoad>(long_url); auto event = root_log_->take_most_recent_event(); EXPECT_NE(event, nullptr); - EXPECT_EQ(*event->params.FindStringPath("url"), expected_url); + EXPECT_EQ(*event->params.FindString("url"), expected_url); // Verify that CreatedEvent does not truncate the short URL. root_log_->AddEvent<MediaLogEvent::kWebMediaPlayerCreated>(long_url); event = root_log_->take_most_recent_event(); EXPECT_NE(event, nullptr); - EXPECT_EQ(*event->params.FindStringPath("origin_url"), expected_url); + EXPECT_EQ(*event->params.FindString("origin_url"), expected_url); } } // namespace media diff --git a/chromium/media/base/media_observer.cc b/chromium/media/base/media_observer.cc index de70f9f6abc..125a79dfb99 100644 --- a/chromium/media/base/media_observer.cc +++ b/chromium/media/base/media_observer.cc @@ -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/base/media_observer.h b/chromium/media/base/media_observer.h index 533b60dd728..34dfd49b86a 100644 --- a/chromium/media/base/media_observer.h +++ b/chromium/media/base/media_observer.h @@ -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. @@ -73,6 +73,9 @@ class MEDIA_EXPORT MediaObserver { virtual void OnPlaying() = 0; virtual void OnPaused() = 0; + // Called when the media is frozen. + virtual void OnFrozen() = 0; + // Called when the data source is asynchronously initialized. virtual void OnDataSourceInitialized(const GURL& url_after_redirects) = 0; diff --git a/chromium/media/base/media_permission.cc b/chromium/media/base/media_permission.cc index 307ccb91ec4..0de7e7ff22d 100644 --- a/chromium/media/base/media_permission.cc +++ b/chromium/media/base/media_permission.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/media_permission.h b/chromium/media/base/media_permission.h index b58ae16498e..99df4196f7b 100644 --- a/chromium/media/base/media_permission.h +++ b/chromium/media/base/media_permission.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/media_player_logging_id.cc b/chromium/media/base/media_player_logging_id.cc new file mode 100644 index 00000000000..f22ce91b210 --- /dev/null +++ b/chromium/media/base/media_player_logging_id.cc @@ -0,0 +1,21 @@ +// 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. + +#include "media/base/media_player_logging_id.h" + +namespace media { + +namespace { + +// A count of all MediaLogs created in the current process. Used to generate +// unique IDs. +static base::AtomicSequenceNumber g_next_player_id; + +} // namespace + +MediaPlayerLoggingID GetNextMediaPlayerLoggingID() { + return g_next_player_id.GetNext(); +} + +} // namespace media diff --git a/chromium/media/base/media_player_logging_id.h b/chromium/media/base/media_player_logging_id.h new file mode 100644 index 00000000000..836e368d085 --- /dev/null +++ b/chromium/media/base/media_player_logging_id.h @@ -0,0 +1,20 @@ +// 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. + +#ifndef MEDIA_BASE_MEDIA_PLAYER_LOGGING_ID_H_ +#define MEDIA_BASE_MEDIA_PLAYER_LOGGING_ID_H_ + +#include "base/atomic_sequence_num.h" +#include "media/base/media_export.h" + +namespace media { + +// alias the name for readability +using MediaPlayerLoggingID = int32_t; + +MEDIA_EXPORT MediaPlayerLoggingID GetNextMediaPlayerLoggingID(); + +} // namespace media + +#endif // MEDIA_BASE_MEDIA_PLAYER_LOGGING_ID_H_ diff --git a/chromium/media/base/media_resource.cc b/chromium/media/base/media_resource.cc index 7ca58445bba..802a8ddc90e 100644 --- a/chromium/media/base/media_resource.cc +++ b/chromium/media/base/media_resource.cc @@ -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/base/media_resource.h b/chromium/media/base/media_resource.h index b3e687143b3..90d278cc474 100644 --- a/chromium/media/base/media_resource.h +++ b/chromium/media/base/media_resource.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/base/media_serializers.h b/chromium/media/base/media_serializers.h index a41080d969b..2148825be71 100644 --- a/chromium/media/base/media_serializers.h +++ b/chromium/media/base/media_serializers.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -263,7 +263,12 @@ struct MediaSerializer<VideoTransformation> { template <> struct MediaSerializer<VideoColorSpace> { static inline base::Value Serialize(const VideoColorSpace& value) { - return base::Value(value.ToGfxColorSpace().ToString()); + base::Value result(base::Value::Type::DICTIONARY); + FIELD_SERIALIZE("primaries", value.primaries); + FIELD_SERIALIZE("transfer", value.transfer); + FIELD_SERIALIZE("matrix", value.matrix); + FIELD_SERIALIZE("range", value.range); + return result; } }; @@ -483,6 +488,97 @@ struct MediaSerializer<base::Location> { } }; +#define ENUM_CASE_TO_STRING(ENUM_NAME) \ + case ENUM_NAME: \ + return base::Value(##ENUM_NAME); + +#define ENUM_CLASS_CASE_TO_STRING(ENUM_CLASS, ENUM_NAME) \ + case ENUM_CLASS::ENUM_NAME: \ + return base::Value(#ENUM_NAME); + +// Enum (simple) +template <> +struct MediaSerializer<VideoColorSpace::PrimaryID> { + static inline base::Value Serialize(VideoColorSpace::PrimaryID value) { + switch (value) { + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, INVALID); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT709); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, UNSPECIFIED); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT470M); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT470BG); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTE170M); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTE240M); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, FILM); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, BT2020); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTEST428_1); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTEST431_2); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, SMPTEST432_1); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::PrimaryID, EBU_3213_E); + } + } +}; + +// Enum (simple) +template <> +struct MediaSerializer<VideoColorSpace::TransferID> { + static inline base::Value Serialize(VideoColorSpace::TransferID value) { + switch (value) { + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, INVALID); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT709); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, UNSPECIFIED); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, GAMMA22); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, GAMMA28); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTE170M); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTE240M); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, LINEAR); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, LOG); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, LOG_SQRT); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, IEC61966_2_4); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT1361_ECG); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, IEC61966_2_1); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT2020_10); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, BT2020_12); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTEST2084); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, SMPTEST428_1); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::TransferID, ARIB_STD_B67); + } + } +}; + +// Enum (simple) +template <> +struct MediaSerializer<VideoColorSpace::MatrixID> { + static inline base::Value Serialize(VideoColorSpace::MatrixID value) { + switch (value) { + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, RGB); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT709); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, UNSPECIFIED); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, FCC); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT470BG); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, SMPTE170M); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, SMPTE240M); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, YCOCG); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT2020_NCL); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, BT2020_CL); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, YDZDX); + ENUM_CLASS_CASE_TO_STRING(VideoColorSpace::MatrixID, INVALID); + } + } +}; + +// Enum (simple) +template <> +struct MediaSerializer<gfx::ColorSpace::RangeID> { + static inline base::Value Serialize(gfx::ColorSpace::RangeID value) { + switch (value) { + ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, INVALID); + ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, LIMITED); + ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, FULL); + ENUM_CLASS_CASE_TO_STRING(gfx::ColorSpace::RangeID, DERIVED); + } + } +}; + #undef FIELD_SERIALIZE } // namespace internal diff --git a/chromium/media/base/media_serializers_base.h b/chromium/media/base/media_serializers_base.h index bbc6ce34f68..2208346460b 100644 --- a/chromium/media/base/media_serializers_base.h +++ b/chromium/media/base/media_serializers_base.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_serializers_unittest.cc b/chromium/media/base/media_serializers_unittest.cc index 53407ded0f0..91545a7af28 100644 --- a/chromium/media/base/media_serializers_unittest.cc +++ b/chromium/media/base/media_serializers_unittest.cc @@ -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/base/media_shmem_export.h b/chromium/media/base/media_shmem_export.h index d7973e462a2..352d219a477 100644 --- a/chromium/media/base/media_shmem_export.h +++ b/chromium/media/base/media_shmem_export.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/base/media_status.cc b/chromium/media/base/media_status.cc index 63e988e8141..3fff6a5adb1 100644 --- a/chromium/media/base/media_status.cc +++ b/chromium/media/base/media_status.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "media/base/media_status.h" diff --git a/chromium/media/base/media_status.h b/chromium/media/base/media_status.h index f1e8b5cc645..0612904880c 100644 --- a/chromium/media/base/media_status.h +++ b/chromium/media/base/media_status.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/media_status_observer.h b/chromium/media/base/media_status_observer.h index b9cccac1c88..6c8abf04a32 100644 --- a/chromium/media/base/media_status_observer.h +++ b/chromium/media/base/media_status_observer.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/media_switches.cc b/chromium/media/base/media_switches.cc index b41411546bd..24b2208d8dd 100644 --- a/chromium/media/base/media_switches.cc +++ b/chromium/media/base/media_switches.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. @@ -19,6 +19,14 @@ namespace switches { // Allow users to specify a custom buffer size for debugging purpose. const char kAudioBufferSize[] = "audio-buffer-size"; +#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN) +// Audio codecs supported by the HDMI sink is retrieved from the audio +// service process. EDID contains the Short Audio Descriptors, which list +// the audio decoders supported, and the information is presented as a +// bitmask of supported audio codecs. +const char kAudioCodecsFromEDID[] = "audio-codecs-from-edid"; +#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN) + // Set a timeout (in milliseconds) for the audio service to quit if there are no // client connections to it. If the value is negative the service never quits. const char kAudioServiceQuitTimeoutMs[] = "audio-service-quit-timeout-ms"; @@ -72,12 +80,6 @@ const char kTrySupportedChannelLayouts[] = "try-supported-channel-layouts"; // Number of buffers to use for WaveOut. const char kWaveOutBuffers[] = "waveout-buffers"; - -// Emulates audio capture timestamps instead of using timestamps from the actual -// audio device. -// See crbug.com/1315231 for more details. -const char kUseFakeAudioCaptureTimestamps[] = - "use-fake-audio-capture-timestamps"; #endif // BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_FUCHSIA) @@ -95,6 +97,12 @@ const char kDisableAudioInput[] = "disable-audio-input"; // Present video content as overlays. const char kUseOverlaysForVideo[] = "use-overlays-for-video"; +// Minimum size for buffer size used for output video frames in +// FuchsiaVideoDecoder. May be set to avoid re-allocating video buffers when an +// application upgrades video resolution mid-stream. +const char kMinVideoDecoderOutputBufferSize[] = + "min-video-decoder-output-buffer-size"; + // Forces AudioManagerFuchsia to assume that the AudioCapturer implements echo // cancellation. // TODO(crbug.com/852834): Remove this once AudioManagerFuchsia is updated to @@ -196,10 +204,12 @@ const char kOverrideEnabledCdmInterfaceVersion[] = // Overrides hardware secure codecs support for testing. If specified, real // platform hardware secure codecs check will be skipped. Valid codecs are: -// - video: "vp8", "vp9", "avc1", "hevc", "dolbyvision" +// - video: "vp8", "vp9", "avc1", "hevc", "dolbyvision", "av01" +// - video that does not support clear lead: `<video>-no-clearlead`, where +// <video> is from the list above. // - audio: "mp4a", "vorbis" // Codecs are separated by comma. For example: -// --override-hardware-secure-codecs-for-testing=vp8,vp9,vorbis +// --override-hardware-secure-codecs-for-testing=vp8,vp9-no-clearlead,vorbis // --override-hardware-secure-codecs-for-testing=avc1,mp4a // CENC encryption scheme is assumed to be supported for the specified codecs. // If no valid codecs specified, no hardware secure codecs are supported. This @@ -257,75 +267,86 @@ const char kMaxChromeOSDecoderThreads[] = "max-chromeos-decoder-threads"; namespace media { // Prefer FFmpeg to LibVPX for Vp8 decoding with opaque alpha mode. -const base::Feature kFFmpegDecodeOpaqueVP8{"FFmpegDecodeOpaqueVP8", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kFFmpegDecodeOpaqueVP8, + "FFmpegDecodeOpaqueVP8", + base::FEATURE_ENABLED_BY_DEFAULT); // Only used for disabling overlay fullscreen (aka SurfaceView) in Clank. -const base::Feature kOverlayFullscreenVideo{"overlay-fullscreen-video", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kOverlayFullscreenVideo, + "overlay-fullscreen-video", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables user control over muting tab audio from the tab strip. -const base::Feature kEnableTabMuting{"EnableTabMuting", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kEnableTabMuting, + "EnableTabMuting", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable Picture-in-Picture. -const base::Feature kPictureInPicture{"PictureInPicture", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kPictureInPicture, + "PictureInPicture", + base::FEATURE_ENABLED_BY_DEFAULT); #if BUILDFLAG(ENABLE_PLATFORM_HEVC) // Enables HEVC hardware accelerated decoding. -const base::Feature kPlatformHEVCDecoderSupport{ - "PlatformHEVCDecoderSupport", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kPlatformHEVCDecoderSupport, + "PlatformHEVCDecoderSupport", + base::FEATURE_ENABLED_BY_DEFAULT); #endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) // Only decode preload=metadata elements upon visibility. // TODO(crbug.com/879406): Remove this after M76 ships to stable -const base::Feature kPreloadMetadataLazyLoad{"PreloadMetadataLazyLoad", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kPreloadMetadataLazyLoad, + "PreloadMetadataLazyLoad", + base::FEATURE_ENABLED_BY_DEFAULT); // Let videos be resumed via remote controls (for example, the notification) // when in background. -const base::Feature kResumeBackgroundVideo { - "resume-background-video", +BASE_FEATURE(kResumeBackgroundVideo, + "resume-background-video", #if BUILDFLAG(IS_ANDROID) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // When enabled, MediaCapabilities will check with GPU Video Accelerator // Factories to determine isPowerEfficient = true/false. -const base::Feature kMediaCapabilitiesQueryGpuFactories{ - "MediaCapabilitiesQueryGpuFactories", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaCapabilitiesQueryGpuFactories, + "MediaCapabilitiesQueryGpuFactories", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable Media Capabilities with finch-parameters. -const base::Feature kMediaCapabilitiesWithParameters{ - "MediaCapabilitiesWithParameters", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaCapabilitiesWithParameters, + "MediaCapabilitiesWithParameters", + base::FEATURE_ENABLED_BY_DEFAULT); // Used to set a few tunable parameters for the WebRTC Media Capabilities // implementation. -const base::Feature kWebrtcMediaCapabilitiesParameters{ - "WebrtcMediaCapabilitiesParameters", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kWebrtcMediaCapabilitiesParameters, + "WebrtcMediaCapabilitiesParameters", + base::FEATURE_ENABLED_BY_DEFAULT); // Display the Cast overlay button on the media controls. -const base::Feature kMediaCastOverlayButton{"MediaCastOverlayButton", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaCastOverlayButton, + "MediaCastOverlayButton", + base::FEATURE_ENABLED_BY_DEFAULT); // Use AndroidOverlay only if required for secure video playback. This requires // that |kOverlayFullscreenVideo| is true, else it is ignored. -const base::Feature kUseAndroidOverlayForSecureOnly{ - "UseAndroidOverlayForSecureOnly", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kUseAndroidOverlayForSecureOnly, + "UseAndroidOverlayForSecureOnly", + base::FEATURE_DISABLED_BY_DEFAULT); // Allows usage of OS-level (platform) audio encoders. -const base::Feature kPlatformAudioEncoder { - "PlatformAudioEncoder", +BASE_FEATURE(kPlatformAudioEncoder, + "PlatformAudioEncoder", #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // If enabled, RTCVideoDecoderAdapter will wrap a DecoderStream as a video // decoder, rather than using MojoVideoDecoder. This causes the RTC external @@ -333,34 +354,40 @@ const base::Feature kPlatformAudioEncoder { // non-RTC pipeline. // TODO(liberato): This also causes the external decoder to use software // decoding sometimes, which changes the interpretation of "ExternalDecoder". -const base::Feature kUseDecoderStreamForWebRTC{ - "UseDecoderStreamForWebRTC", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kUseDecoderStreamForWebRTC, + "UseDecoderStreamForWebRTC", + base::FEATURE_DISABLED_BY_DEFAULT); // If enabled, when RTCVideoDecoderAdapter is used then SW decoders will be // exposed directly to WebRTC. -const base::Feature kExposeSwDecodersToWebRTC{ - "ExposeSwDecodersToWebRTC", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kExposeSwDecodersToWebRTC, + "ExposeSwDecodersToWebRTC", + base::FEATURE_DISABLED_BY_DEFAULT); // Let video without audio be paused when it is playing in the background. -const base::Feature kBackgroundVideoPauseOptimization{ - "BackgroundVideoPauseOptimization", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kBackgroundVideoPauseOptimization, + "BackgroundVideoPauseOptimization", + base::FEATURE_ENABLED_BY_DEFAULT); // CDM host verification is enabled by default. Can be disabled for testing. // Has no effect if ENABLE_CDM_HOST_VERIFICATION buildflag is false. -const base::Feature kCdmHostVerification{"CdmHostVerification", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kCdmHostVerification, + "CdmHostVerification", + base::FEATURE_ENABLED_BY_DEFAULT); // Use per-CDM-type, per-user and per-site CDM processes (for library CDM). If // disabled, the CDM processes are only per-CDM-type, meaning different sites // using the same CDM type would share one CDM process. -const base::Feature kCdmProcessSiteIsolation{"CdmProcessSiteIsolation", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kCdmProcessSiteIsolation, + "CdmProcessSiteIsolation", + base::FEATURE_ENABLED_BY_DEFAULT); #if BUILDFLAG(CHROME_WIDE_ECHO_CANCELLATION) // If echo cancellation for a mic signal is requested, mix and cancel all audio // playback going to a specific output device in the audio service. -const base::Feature kChromeWideEchoCancellation{ - "ChromeWideEchoCancellation", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kChromeWideEchoCancellation, + "ChromeWideEchoCancellation", + base::FEATURE_DISABLED_BY_DEFAULT); // If non-zero, audio processing is done on a dedicated processing thread which // receives audio from the audio capture thread via a fifo of a specified size. @@ -397,24 +424,26 @@ const base::FeatureParam<bool> kChromeWideEchoCancellationAllowAllSampleRates{ // Make MSE garbage collection algorithm more aggressive when we are under // moderate or critical memory pressure. This will relieve memory pressure by // releasing stale data from MSE buffers. -const base::Feature kMemoryPressureBasedSourceBufferGC{ - "MemoryPressureBasedSourceBufferGC", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMemoryPressureBasedSourceBufferGC, + "MemoryPressureBasedSourceBufferGC", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable binding multiple shared images to a single GpuMemoryBuffer for video // frames created by video capture. -const base::Feature kMultiPlaneVideoCaptureSharedImages { - "MultiPlaneVideoCaptureSharedImages", +BASE_FEATURE(kMultiPlaneVideoCaptureSharedImages, + "MultiPlaneVideoCaptureSharedImages", #if BUILDFLAG(IS_MAC) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // Controls whether the Open Screen libcast SenderSession is used for // initializing and managing streaming sessions, or the legacy implementation. -const base::Feature kOpenscreenCastStreamingSession{ - "OpenscreenCastStreamingSession", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kOpenscreenCastStreamingSession, + "OpenscreenCastStreamingSession", + base::FEATURE_DISABLED_BY_DEFAULT); // Approach original pre-REC MSE object URL autorevoking behavior, though await // actual attempt to use the object URL for attachment to perform revocation. @@ -431,47 +460,54 @@ const base::Feature kOpenscreenCastStreamingSession{ // (MSE-in-workers), where there could be significant delay between the worker // thread creation of the object URL and the main thread usage of the object URL // for starting attachment to HTMLME. -const base::Feature kRevokeMediaSourceObjectURLOnAttach{ - "RevokeMediaSourceObjectURLOnAttach", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kRevokeMediaSourceObjectURLOnAttach, + "RevokeMediaSourceObjectURLOnAttach", + base::FEATURE_ENABLED_BY_DEFAULT); -const base::Feature kD3D11VideoDecoderUseSharedHandle{ - "D3D11VideoDecoderUseSharedHandle", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kD3D11VideoDecoderUseSharedHandle, + "D3D11VideoDecoderUseSharedHandle", + base::FEATURE_DISABLED_BY_DEFAULT); // Falls back to other decoders after audio/video decode error happens. The // implementation may choose different strategies on when to fallback. See // DecoderStream for details. When disabled, playback will fail immediately // after a decode error happens. This can be useful in debugging and testing // because the behavior is simpler and more predictable. -const base::Feature kFallbackAfterDecodeError{"FallbackAfterDecodeError", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kFallbackAfterDecodeError, + "FallbackAfterDecodeError", + base::FEATURE_ENABLED_BY_DEFAULT); // Use Gav1VideoDecoder to decode AV1 streams. -const base::Feature kGav1VideoDecoder{"Gav1VideoDecoder", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kGav1VideoDecoder, + "Gav1VideoDecoder", + base::FEATURE_DISABLED_BY_DEFAULT); // Show toolbar button that opens dialog for controlling media sessions. -const base::Feature kGlobalMediaControls { - "GlobalMediaControls", +BASE_FEATURE(kGlobalMediaControls, + "GlobalMediaControls", #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // Auto-dismiss global media controls. -const base::Feature kGlobalMediaControlsAutoDismiss{ - "GlobalMediaControlsAutoDismiss", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kGlobalMediaControlsAutoDismiss, + "GlobalMediaControlsAutoDismiss", + base::FEATURE_ENABLED_BY_DEFAULT); #if BUILDFLAG(IS_CHROMEOS) // Show Cast sessions in Global Media Controls. -const base::Feature kGlobalMediaControlsForCast{ - "GlobalMediaControlsForCast", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kGlobalMediaControlsForCast, + "GlobalMediaControlsForCast", + base::FEATURE_DISABLED_BY_DEFAULT); #endif // Allow Global Media Controls in system tray of CrOS. -const base::Feature kGlobalMediaControlsForChromeOS{ - "GlobalMediaControlsForChromeOS", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kGlobalMediaControlsForChromeOS, + "GlobalMediaControlsForChromeOS", + base::FEATURE_ENABLED_BY_DEFAULT); constexpr base::FeatureParam<kCrosGlobalMediaControlsPinOptions>::Option kCrosGlobalMediaControlsParamOptions[] = { @@ -487,147 +523,169 @@ constexpr base::FeatureParam<kCrosGlobalMediaControlsPinOptions> &kCrosGlobalMediaControlsParamOptions); // Show picture-in-picture button in Global Media Controls. -const base::Feature kGlobalMediaControlsPictureInPicture { - "GlobalMediaControlsPictureInPicture", +BASE_FEATURE(kGlobalMediaControlsPictureInPicture, + "GlobalMediaControlsPictureInPicture", #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_CHROMEOS_LACROS) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // Enable selection of audio output device in Global Media Controls. -const base::Feature kGlobalMediaControlsSeamlessTransfer{ - "GlobalMediaControlsSeamlessTransfer", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kGlobalMediaControlsSeamlessTransfer, + "GlobalMediaControlsSeamlessTransfer", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable an updated version of the Global Media Controls UI. -const base::Feature kGlobalMediaControlsModernUI{ - "GlobalMediaControlsModernUI", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kGlobalMediaControlsModernUI, + "GlobalMediaControlsModernUI", + base::FEATURE_DISABLED_BY_DEFAULT); // CanPlayThrough issued according to standard. -const base::Feature kSpecCompliantCanPlayThrough{ - "SpecCompliantCanPlayThrough", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kSpecCompliantCanPlayThrough, + "SpecCompliantCanPlayThrough", + base::FEATURE_ENABLED_BY_DEFAULT); // Disables the real audio output stream after silent audio has been delivered // for too long. Should save quite a bit of power in the muted video case. -const base::Feature kSuspendMutedAudio{"SuspendMutedAudio", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kSuspendMutedAudio, + "SuspendMutedAudio", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables using the media history store to store media engagement metrics. -const base::Feature kUseMediaHistoryStore{"UseMediaHistoryStore", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kUseMediaHistoryStore, + "UseMediaHistoryStore", + base::FEATURE_DISABLED_BY_DEFAULT); // Use R16 texture for 9-16 bit channel instead of half-float conversion by CPU. -const base::Feature kUseR16Texture{"use-r16-texture", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kUseR16Texture, + "use-r16-texture", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables the Unified Autoplay policy by overriding the platform's default // autoplay policy. -const base::Feature kUnifiedAutoplay{"UnifiedAutoplay", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kUnifiedAutoplay, + "UnifiedAutoplay", + base::FEATURE_ENABLED_BY_DEFAULT); #if BUILDFLAG(IS_LINUX) // Enable vaapi video decoding on linux. This is already enabled by default on // chromeos, but needs an experiment on linux. -const base::Feature kVaapiVideoDecodeLinux{"VaapiVideoDecoder", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiVideoDecodeLinux, + "VaapiVideoDecoder", + base::FEATURE_ENABLED_BY_DEFAULT); -const base::Feature kVaapiVideoEncodeLinux{"VaapiVideoEncoder", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiVideoEncodeLinux, + "VaapiVideoEncoder", + base::FEATURE_DISABLED_BY_DEFAULT); // Ignore the non-intel driver blacklist for VaapiVideoDecoder implementations. // Intended for manual usage only in order to gague the status of newer driver // implementations. -const base::Feature kVaapiIgnoreDriverChecks{"VaapiIgnoreDriverChecks", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiIgnoreDriverChecks, + "VaapiIgnoreDriverChecks", + base::FEATURE_DISABLED_BY_DEFAULT); #endif // BUILDFLAG(IS_LINUX) // Enable VA-API hardware decode acceleration for AV1. -const base::Feature kVaapiAV1Decoder{"VaapiAV1Decoder", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiAV1Decoder, + "VaapiAV1Decoder", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable VA-API hardware low power encoder for all codecs on intel Gen9x gpu. -const base::Feature kVaapiLowPowerEncoderGen9x{ - "VaapiLowPowerEncoderGen9x", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiLowPowerEncoderGen9x, + "VaapiLowPowerEncoderGen9x", + base::FEATURE_DISABLED_BY_DEFAULT); // Reject creation of encode/decode VAContexts when the requested resolution is // outside the enumerated minimum and maximum. TODO(b/171041334): Remove and // enable by default once the ARC++ hw codecs issue is fixed. -const base::Feature kVaapiEnforceVideoMinMaxResolution{ - "VaapiEnforceVideoMinMaxResolution", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiEnforceVideoMinMaxResolution, + "VaapiEnforceVideoMinMaxResolution", + base::FEATURE_DISABLED_BY_DEFAULT); // Ensure the advertised minimum supported resolution is larger than or equal to // a given one (likely QVGA + 1) for certain codecs/modes and platforms, for // performance reasons. This does not affect JPEG decoding. -const base::Feature kVaapiVideoMinResolutionForPerformance{ - "VaapiVideoMinResolutionForPerformance", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiVideoMinResolutionForPerformance, + "VaapiVideoMinResolutionForPerformance", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable VA-API hardware encode acceleration for VP8. -const base::Feature kVaapiVP8Encoder{"VaapiVP8Encoder", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiVP8Encoder, + "VaapiVP8Encoder", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable VA-API hardware encode acceleration for VP9. -const base::Feature kVaapiVP9Encoder{"VaapiVP9Encoder", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiVP9Encoder, + "VaapiVP9Encoder", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable global VA-API lock. Disable this to use lock-free VA-API function // calls for thread safe backends. -const base::Feature kGlobalVaapiLock{"GlobalVaapiLock", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kGlobalVaapiLock, + "GlobalVaapiLock", + base::FEATURE_ENABLED_BY_DEFAULT); #if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS) // TODO(b/214589754): revisit the need for the BUILDFLAG(IS_CHROMEOS) guard (as // opposed to BUILDFLAG(IS_CHROMEOS_ASH)) when the final design for HW // encoding is implemented for lacros-chrome. // Enable H264 temporal layer encoding with HW encoder on ChromeOS. -const base::Feature kVaapiH264TemporalLayerHWEncoding{ - "VaapiH264TemporalLayerEncoding", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiH264TemporalLayerHWEncoding, + "VaapiH264TemporalLayerEncoding", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable VP8 temporal layer encoding with HW encoder on ChromeOS. -const base::Feature kVaapiVp8TemporalLayerHWEncoding{ - "VaapiVp8TemporalLayerEncoding", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiVp8TemporalLayerHWEncoding, + "VaapiVp8TemporalLayerEncoding", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable VP9 k-SVC encoding with HW encoder for webrtc use case on ChromeOS. -const base::Feature kVaapiVp9kSVCHWEncoding{"VaapiVp9kSVCHWEncoding", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVaapiVp9kSVCHWEncoding, + "VaapiVp9kSVCHWEncoding", + base::FEATURE_ENABLED_BY_DEFAULT); #endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS) // Inform video blitter of video color space. -const base::Feature kVideoBlitColorAccuracy{"video-blit-color-accuracy", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kVideoBlitColorAccuracy, + "video-blit-color-accuracy", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable VP9 k-SVC decoding with HW decoder for webrtc use case. -const base::Feature kVp9kSVCHWDecoding { - "Vp9kSVCHWDecoding", +BASE_FEATURE(kVp9kSVCHWDecoding, + "Vp9kSVCHWDecoding", #if BUILDFLAG(IS_CHROMEOS) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // Takes a reference on a video frame, keeping it alive during the duration of a // video.requestVideoFrameCallback call. Doesn't change anything to the API for // now, as this is only used to measure the potential impact of keeping frames // alive for longer. See crbug.com/1259784. -const base::Feature kKeepRvfcFrameAlive{"keep-rvfc-frame-alive", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kKeepRvfcFrameAlive, + "keep-rvfc-frame-alive", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables support for External Clear Key (ECK) key system for testing on // supported platforms. On platforms that do not support ECK, this feature has // no effect. -const base::Feature kExternalClearKeyForTesting{ - "ExternalClearKeyForTesting", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kExternalClearKeyForTesting, + "ExternalClearKeyForTesting", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables the Live Caption feature on supported devices. -const base::Feature kLiveCaption{"LiveCaption", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kLiveCaption, "LiveCaption", base::FEATURE_ENABLED_BY_DEFAULT); // Controls whether a "Share this tab instead" button should be shown for // getDisplayMedia captures. Note: This flag does not control if the "Share this // tab instead" button is shown for chrome.desktopCapture captures. -const base::Feature kShareThisTabInsteadButtonGetDisplayMedia{ - "ShareThisTabInsteadButtonGetDisplayMedia", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kShareThisTabInsteadButtonGetDisplayMedia, + "ShareThisTabInsteadButtonGetDisplayMedia", + base::FEATURE_ENABLED_BY_DEFAULT); // If kShareThisTabInsteadButtonGetDisplayMedia is ENABLED, this flag controls // whether a "Share this tab instead" button should be enabled for @@ -636,225 +694,275 @@ const base::Feature kShareThisTabInsteadButtonGetDisplayMedia{ // effect. // Note: This flag does not control if the "Share this tab instead" button is // shown for chrome.desktopCapture captures. -const base::Feature kShareThisTabInsteadButtonGetDisplayMediaAudio{ - "ShareThisTabInsteadButtonGetDisplayMediaAudio", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kShareThisTabInsteadButtonGetDisplayMediaAudio, + "ShareThisTabInsteadButtonGetDisplayMediaAudio", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable the Speaker Change Detection feature, which inserts a line break when // the Speech On-Device API (SODA) detects a speaker change. -const base::Feature kSpeakerChangeDetection{"SpeakerChangeDetection", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kSpeakerChangeDetection, + "SpeakerChangeDetection", + base::FEATURE_DISABLED_BY_DEFAULT); // Live Caption can be used in multiple languages, as opposed to just English. -const base::Feature kLiveCaptionMultiLanguage{ - "LiveCaptionMultiLanguage", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kLiveCaptionMultiLanguage, + "LiveCaptionMultiLanguage", + base::FEATURE_DISABLED_BY_DEFAULT); + +// Enable or disable Live Caption from the right click menu. +BASE_FEATURE(kLiveCaptionRightClick, + "LiveCaptionRightClick", + base::FEATURE_DISABLED_BY_DEFAULT); // Live Caption runs system-wide on ChromeOS, as opposed to just in the browser. -const base::Feature kLiveCaptionSystemWideOnChromeOS{ - "LiveCaptionSystemWideOnChromeOS", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kLiveCaptionSystemWideOnChromeOS, + "LiveCaptionSystemWideOnChromeOS", + base::FEATURE_DISABLED_BY_DEFAULT); + +// Live Translate translates captions generated by Live Caption. +BASE_FEATURE(kLiveTranslate, + "LiveTranslate", + base::FEATURE_DISABLED_BY_DEFAULT); // Prevents UrlProvisionFetcher from making a provisioning request. If // specified, any provisioning request made will not be sent to the provisioning // server, and the response will indicate a failure to communicate with the // provisioning server. -const base::Feature kFailUrlProvisionFetcherForTesting{ - "FailUrlProvisionFetcherForTesting", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kFailUrlProvisionFetcherForTesting, + "FailUrlProvisionFetcherForTesting", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables hardware secure decryption if supported by hardware and CDM. // TODO(xhwang): Currently this is only used for development of new features. // Apply this to Android and ChromeOS as well where hardware secure decryption // is already available. -const base::Feature kHardwareSecureDecryption{ - "HardwareSecureDecryption", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kHardwareSecureDecryption, + "HardwareSecureDecryption", + base::FEATURE_DISABLED_BY_DEFAULT); + +// By default, a codec is not supported for hardware secure decryption if it +// does not support clear lead. This option forces the support for testing. +const base::FeatureParam<bool> kHardwareSecureDecryptionForceSupportClearLead{ + &kHardwareSecureDecryption, "force_support_clear_lead", false}; // Same as `kHardwareSecureDecryption` above, but only enable experimental // sub key systems. Which sub key system is experimental is key system specific. -const base::Feature kHardwareSecureDecryptionExperiment{ - "HardwareSecureDecryptionExperiment", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kHardwareSecureDecryptionExperiment, + "HardwareSecureDecryptionExperiment", + base::FEATURE_DISABLED_BY_DEFAULT); // Allows automatically disabling hardware secure Content Decryption Module // (CDM) after failures or crashes to fallback to software secure CDMs. If this // feature is disabled, the fallback will never happen and users could be stuck // in playback failures. -const base::Feature kHardwareSecureDecryptionFallback{ - "HardwareSecureDecryptionFallback", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kHardwareSecureDecryptionFallback, + "HardwareSecureDecryptionFallback", + base::FEATURE_ENABLED_BY_DEFAULT); + +// The minimum and maximum number of days to disable hardware secure Content +// Decryption Module (CDM) as part of the fallback logic. +const base::FeatureParam<int> kHardwareSecureDecryptionFallbackMinDisablingDays{ + &kHardwareSecureDecryptionFallback, "min_disabling_days", 30}; +const base::FeatureParam<int> kHardwareSecureDecryptionFallbackMaxDisablingDays{ + &kHardwareSecureDecryptionFallback, "max_disabling_days", 180}; -const base::Feature kWakeLockOptimisationHiddenMuted{ - "kWakeLockOptimisationHiddenMuted", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kWakeLockOptimisationHiddenMuted, + "kWakeLockOptimisationHiddenMuted", + base::FEATURE_ENABLED_BY_DEFAULT); // If active, enable HiDPI mode that increases the display scale factor // while capturing a low-resolution tab. -const base::Feature kWebContentsCaptureHiDpi{"WebContentsCaptureHiDPI", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kWebContentsCaptureHiDpi, + "WebContentsCaptureHiDPI", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables handling of hardware media keys for controlling media. -const base::Feature kHardwareMediaKeyHandling { - "HardwareMediaKeyHandling", +BASE_FEATURE(kHardwareMediaKeyHandling, + "HardwareMediaKeyHandling", #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \ BUILDFLAG(USE_MPRIS) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // Enables a platform-specific resolution cutoff for prioritizing platform // decoders over software decoders or vice-versa. -const base::Feature kResolutionBasedDecoderPriority{ - "ResolutionBasedDecoderPriority", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kResolutionBasedDecoderPriority, + "ResolutionBasedDecoderPriority", + base::FEATURE_DISABLED_BY_DEFAULT); // Forces use of hardware (platform) video decoders in // `media::DecoderSelector`. -const base::Feature kForceHardwareVideoDecoders{ - "ForceHardwareVideoDecoders", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kForceHardwareVideoDecoders, + "ForceHardwareVideoDecoders", + base::FEATURE_DISABLED_BY_DEFAULT); // Forces use of hardware (platform) audio decoders in // `media::DecoderSelector`. -const base::Feature kForceHardwareAudioDecoders{ - "ForceHardwareAudioDecoders", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kForceHardwareAudioDecoders, + "ForceHardwareAudioDecoders", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables low-delay video rendering in media pipeline on "live" stream. -const base::Feature kLowDelayVideoRenderingOnLiveStream{ - "low-delay-video-rendering-on-live-stream", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kLowDelayVideoRenderingOnLiveStream, + "low-delay-video-rendering-on-live-stream", + base::FEATURE_ENABLED_BY_DEFAULT); // Whether the autoplay policy should ignore Web Audio. When ignored, the // autoplay policy will be hardcoded to be the legacy one on based on the // platform -const base::Feature kAutoplayIgnoreWebAudio{"AutoplayIgnoreWebAudio", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kAutoplayIgnoreWebAudio, + "AutoplayIgnoreWebAudio", + base::FEATURE_DISABLED_BY_DEFAULT); // Whether we should show a setting to disable autoplay policy. -const base::Feature kAutoplayDisableSettings{"AutoplayDisableSettings", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kAutoplayDisableSettings, + "AutoplayDisableSettings", + base::FEATURE_DISABLED_BY_DEFAULT); #if BUILDFLAG(IS_ANDROID) // Should we allow video playback to use an overlay if it's not needed for // security? Normally, we'd always want to allow this, except as part of the // power testing A/B experiment. https://crbug.com/1081346 . -const base::Feature kAllowNonSecureOverlays{"AllowNonSecureOverlays", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kAllowNonSecureOverlays, + "AllowNonSecureOverlays", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable a gesture to make the media controls expaned into the display cutout. // TODO(beccahughes): Remove this. -const base::Feature kMediaControlsExpandGesture{ - "MediaControlsExpandGesture", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaControlsExpandGesture, + "MediaControlsExpandGesture", + base::FEATURE_ENABLED_BY_DEFAULT); // An experimental feature to enable persistent-license type support in MediaDrm // when using Encrypted Media Extensions (EME) API. // TODO(xhwang): Remove this after feature launch. See http://crbug.com/493521 -const base::Feature kMediaDrmPersistentLicense{ - "MediaDrmPersistentLicense", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaDrmPersistentLicense, + "MediaDrmPersistentLicense", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables MediaDrmOriginIdManager to provide preprovisioned origin IDs for // MediaDrmBridge. If disabled, MediaDrmBridge will get unprovisioned origin IDs // which will trigger provisioning process after MediaDrmBridge is created. -const base::Feature kMediaDrmPreprovisioning{"MediaDrmPreprovisioning", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaDrmPreprovisioning, + "MediaDrmPreprovisioning", + base::FEATURE_ENABLED_BY_DEFAULT); // Determines if MediaDrmOriginIdManager should attempt to pre-provision origin // IDs at startup (whenever a profile is loaded). Also used by tests that // disable it so that the tests can setup before pre-provisioning is done. // Note: Has no effect if kMediaDrmPreprovisioning feature is disabled. -const base::Feature kMediaDrmPreprovisioningAtStartup{ - "MediaDrmPreprovisioningAtStartup", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaDrmPreprovisioningAtStartup, + "MediaDrmPreprovisioningAtStartup", + base::FEATURE_ENABLED_BY_DEFAULT); // Enable picture in picture web api for android. -const base::Feature kPictureInPictureAPI{"PictureInPictureAPI", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kPictureInPictureAPI, + "PictureInPictureAPI", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables CanPlayType() (and other queries) for HLS MIME types. Note that // disabling this also causes navigation to .m3u8 files to trigger downloading // instead of playback. -const base::Feature kCanPlayHls{"CanPlayHls", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kCanPlayHls, "CanPlayHls", base::FEATURE_ENABLED_BY_DEFAULT); // Enables the use of MediaPlayerRenderer for HLS playback. When disabled, // HLS manifests will fail to load (triggering source fallback or load error). -const base::Feature kHlsPlayer{"HlsPlayer", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kHlsPlayer, "HlsPlayer", base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, Playing media sessions will request audio focus from the // Android system. -const base::Feature kRequestSystemAudioFocus{"RequestSystemAudioFocus", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kRequestSystemAudioFocus, + "RequestSystemAudioFocus", + base::FEATURE_ENABLED_BY_DEFAULT); // Use the (hacky) AudioManager.getOutputLatency() call to get the estimated // hardware latency for a stream for OpenSLES playback. This is normally not // needed, except for some Android TV devices. -const base::Feature kUseAudioLatencyFromHAL{"UseAudioLatencyFromHAL", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kUseAudioLatencyFromHAL, + "UseAudioLatencyFromHAL", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable pooling of SharedImageVideo objects for use by MCVD, to save a hop to // the GPU main thread during VideoFrame construction. -const base::Feature kUsePooledSharedImageVideoProvider{ - "UsePooledSharedImageVideoProvider", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kUsePooledSharedImageVideoProvider, + "UsePooledSharedImageVideoProvider", + base::FEATURE_ENABLED_BY_DEFAULT); // Historically we hardcoded sRGB for color space. This flags controls if we // pass real color space to VideoFrame/SharedImages. -const base::Feature kUseRealColorSpaceForAndroidVideo{ - "UseRealColorSpaceForAndroidVideo", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kUseRealColorSpaceForAndroidVideo, + "UseRealColorSpaceForAndroidVideo", + base::FEATURE_ENABLED_BY_DEFAULT); #endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) // Enable Variable Bitrate encoding with hardware accelerated encoders on // ChromeOS. -const base::Feature kChromeOSHWVBREncoding{"ChromeOSHWVBREncoding", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kChromeOSHWVBREncoding, + "ChromeOSHWVBREncoding", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable the hardware-accelerated direct video decoder instead of the one // needing the VdaVideoDecoder adapter. This flag is used mainly as a // chrome:flag for developers debugging issues as well as to be able to // experiment with direct VideoDecoder path on Linux Desktop. // TODO(b/159825227): remove when the direct video decoder is fully launched. -const base::Feature kUseChromeOSDirectVideoDecoder{ - "UseChromeOSDirectVideoDecoder", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kUseChromeOSDirectVideoDecoder, + "UseChromeOSDirectVideoDecoder", + base::FEATURE_ENABLED_BY_DEFAULT); // Limit the number of concurrent hardware decoder instances on ChromeOS. -const base::Feature kLimitConcurrentDecoderInstances{ - "LimitConcurrentDecoderInstances", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kLimitConcurrentDecoderInstances, + "LimitConcurrentDecoderInstances", + base::FEATURE_ENABLED_BY_DEFAULT); #if defined(ARCH_CPU_ARM_FAMILY) // Some architectures have separate image processor hardware that // can be used by Chromium's ImageProcessor to color convert/crop/etc. // video buffers. Sometimes it is more efficient/performant/correct -// to use libYUV instead of the hardware to do this processing. -const base::Feature kPreferLibYuvImageProcessor{ - "PreferLibYUVImageProcessor", base::FEATURE_DISABLED_BY_DEFAULT}; +// to use a libYUV or GL based implementation instead of the hardware to +// do this processing. +BASE_FEATURE(kPreferLibYuvImageProcessor, + "PreferLibYUVImageProcessor", + base::FEATURE_DISABLED_BY_DEFAULT); +BASE_FEATURE(kPreferGLImageProcessor, + "PreferGLImageProcessor", + base::FEATURE_DISABLED_BY_DEFAULT); #endif // defined(ARCH_CPU_ARM_FAMILY) #if BUILDFLAG(IS_CHROMEOS) // ChromeOS has one of two VideoDecoder implementations active based on // SoC/board specific configurations that are sent via command line flags. This // switch allows using the non default implementation for testing. // TODO(b/159825227): remove when the "old" video decoder is fully launched. -const base::Feature kUseAlternateVideoDecoderImplementation{ - "UseAlternateVideoDecoderImplementation", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kUseAlternateVideoDecoderImplementation, + "UseAlternateVideoDecoderImplementation", + base::FEATURE_DISABLED_BY_DEFAULT); #endif // BUILDFLAG(IS_CHROMEOS) #endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) -#if BUILDFLAG(IS_MAC) -// Enable binding multiple shared images to a single GpuMemoryBuffer for -// accelerated video decode using VideoToolbox. -const base::Feature kMultiPlaneVideoToolboxSharedImages{ - "MultiPlaneVideoToolboxSharedImages", base::FEATURE_ENABLED_BY_DEFAULT}; -#endif // BUILDFLAG(IS_MAC) - #if BUILDFLAG(IS_WIN) // Does NV12->NV12 video copy on the main thread right before the texture's // used by GL. -const base::Feature kDelayCopyNV12Textures{"DelayCopyNV12Textures", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kDelayCopyNV12Textures, + "DelayCopyNV12Textures", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables DirectShow GetPhotoState implementation // Created to act as a kill switch by disabling it, in the case of the // resurgence of https://crbug.com/722038 -const base::Feature kDirectShowGetPhotoState{"DirectShowGetPhotoState", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kDirectShowGetPhotoState, + "DirectShowGetPhotoState", + base::FEATURE_ENABLED_BY_DEFAULT); // Includes Infrared cameras in the list returned for EnumerateDevices() on // Windows. -const base::Feature kIncludeIRCamerasInDeviceEnumeration{ - "IncludeIRCamerasInDeviceEnumeration", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kIncludeIRCamerasInDeviceEnumeration, + "IncludeIRCamerasInDeviceEnumeration", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables AV1 encode acceleration for Windows. const base::Feature MEDIA_EXPORT kMediaFoundationAV1Encoding{ @@ -871,14 +979,16 @@ const base::Feature MEDIA_EXPORT kMediaFoundationVP9Encoding{ "MediaFoundationVP9Encoding", base::FEATURE_DISABLED_BY_DEFAULT}; // Enables MediaFoundation based video capture -const base::Feature kMediaFoundationVideoCapture{ - "MediaFoundationVideoCapture", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaFoundationVideoCapture, + "MediaFoundationVideoCapture", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables MediaFoundation based video capture with D3D11 // For feature check of kMediaFoundationD3D11VideoCapture at runtime, // please use IsMediaFoundationD3D11VideoCaptureEnabled() instead. -const base::Feature kMediaFoundationD3D11VideoCapture{ - "MediaFoundationD3D11VideoCapture", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaFoundationD3D11VideoCapture, + "MediaFoundationD3D11VideoCapture", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables VP8 decode acceleration for Windows. const base::Feature MEDIA_EXPORT kMediaFoundationVP8Decoding{ @@ -886,8 +996,9 @@ const base::Feature MEDIA_EXPORT kMediaFoundationVP8Decoding{ // Enables the use of MediaFoundationRenderer for clear content on supported // systems. -const base::Feature kMediaFoundationClearPlayback{ - "MediaFoundationClearPlayback", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaFoundationClearPlayback, + "MediaFoundationClearPlayback", + base::FEATURE_DISABLED_BY_DEFAULT); // Use the AUDCLNT_STREAMOPTIONS_RAW option on WASAPI input audio streams in // combination with the IAudioClient2::SetClientProperties() API. @@ -898,9 +1009,16 @@ const base::Feature kMediaFoundationClearPlayback{ const base::Feature MEDIA_EXPORT kWasapiRawAudioCapture{ "WASAPIRawAudioCapture", base::FEATURE_ENABLED_BY_DEFAULT}; +// Emulates audio capture timestamps instead of using timestamps from the actual +// audio device. +// See crbug.com/1315231 for more details. +const base::Feature MEDIA_EXPORT kUseFakeAudioCaptureTimestamps{ + "UseFakeAudioCaptureTimestamps", base::FEATURE_DISABLED_BY_DEFAULT}; + // Enable VP9 kSVC decoding with HW decoder for webrtc use case on Windows. -const base::Feature kD3D11Vp9kSVCHWDecoding{"D3D11Vp9kSVCHWDecoding", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kD3D11Vp9kSVCHWDecoding, + "D3D11Vp9kSVCHWDecoding", + base::FEATURE_DISABLED_BY_DEFAULT); // The Media Foundation Rendering Strategy determines which presentation mode // Media Foundation Renderer should use for presenting clear content. This @@ -920,8 +1038,9 @@ const base::Feature kD3D11Vp9kSVCHWDecoding{"D3D11Vp9kSVCHWDecoding", // --enable-features=MediaFoundationClearRendering:strategy/direct-composition // --enable-features=MediaFoundationClearRendering:strategy/frame-server // --enable-features=MediaFoundationClearRendering:strategy/dynamic -const base::Feature kMediaFoundationClearRendering = { - "MediaFoundationClearRendering", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaFoundationClearRendering, + "MediaFoundationClearRendering", + base::FEATURE_ENABLED_BY_DEFAULT); constexpr base::FeatureParam<MediaFoundationClearRenderingStrategy>::Option kMediaFoundationClearRenderingStrategyOptions[] = { @@ -949,6 +1068,13 @@ const base::Feature MEDIA_EXPORT kUseOutOfProcessVideoDecoding{ "UseOutOfProcessVideoDecoding", base::FEATURE_DISABLED_BY_DEFAULT}; #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +// Spawn utility processes to perform hardware encode acceleration instead of +// using the GPU process. +const base::Feature MEDIA_EXPORT kUseOutOfProcessVideoEncoding{ + "UseOutOfProcessVideoEncoding", base::FEATURE_DISABLED_BY_DEFAULT}; +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) { // Return the autoplay policy set in the command line, if any. if (command_line.HasSwitch(switches::kAutoplayPolicy)) @@ -967,12 +1093,14 @@ std::string GetEffectiveAutoplayPolicy(const base::CommandLine& command_line) { // Enables Media Engagement Index recording. This data will be used to determine // when to bypass autoplay policies. This is recorded on all platforms. -const base::Feature kRecordMediaEngagementScores{ - "RecordMediaEngagementScores", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kRecordMediaEngagementScores, + "RecordMediaEngagementScores", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables Media Engagement Index recording for Web Audio playbacks. -const base::Feature kRecordWebAudioEngagement{"RecordWebAudioEngagement", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kRecordWebAudioEngagement, + "RecordWebAudioEngagement", + base::FEATURE_ENABLED_BY_DEFAULT); // The following Media Engagement flags are not enabled on mobile platforms: // - MediaEngagementBypassAutoplayPolicies: enables the Media Engagement Index @@ -982,90 +1110,105 @@ const base::Feature kRecordWebAudioEngagement{"RecordWebAudioEngagement", // having a high MEI until there is enough local data to determine the user's // preferred behaviour. #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) -const base::Feature kMediaEngagementBypassAutoplayPolicies{ - "MediaEngagementBypassAutoplayPolicies", base::FEATURE_DISABLED_BY_DEFAULT}; -const base::Feature kPreloadMediaEngagementData{ - "PreloadMediaEngagementData", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaEngagementBypassAutoplayPolicies, + "MediaEngagementBypassAutoplayPolicies", + base::FEATURE_DISABLED_BY_DEFAULT); +BASE_FEATURE(kPreloadMediaEngagementData, + "PreloadMediaEngagementData", + base::FEATURE_DISABLED_BY_DEFAULT); #else -const base::Feature kMediaEngagementBypassAutoplayPolicies{ - "MediaEngagementBypassAutoplayPolicies", base::FEATURE_ENABLED_BY_DEFAULT}; -const base::Feature kPreloadMediaEngagementData{ - "PreloadMediaEngagementData", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaEngagementBypassAutoplayPolicies, + "MediaEngagementBypassAutoplayPolicies", + base::FEATURE_ENABLED_BY_DEFAULT); +BASE_FEATURE(kPreloadMediaEngagementData, + "PreloadMediaEngagementData", + base::FEATURE_ENABLED_BY_DEFAULT); #endif -const base::Feature kMediaEngagementHTTPSOnly{ - "MediaEngagementHTTPSOnly", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaEngagementHTTPSOnly, + "MediaEngagementHTTPSOnly", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables experimental local learning for media. Used in the context of media // capabilities only. Adds reporting only; does not change media behavior. -const base::Feature kMediaLearningExperiment{"MediaLearningExperiment", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaLearningExperiment, + "MediaLearningExperiment", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables the general purpose media machine learning framework. Adds reporting // only; does not change media behavior. -const base::Feature kMediaLearningFramework{"MediaLearningFramework", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaLearningFramework, + "MediaLearningFramework", + base::FEATURE_DISABLED_BY_DEFAULT); // Enables the smoothness prediction experiment. Requires // kMediaLearningFramework to be enabled also, else it does nothing. -const base::Feature kMediaLearningSmoothnessExperiment{ - "MediaLearningSmoothnessExperiment", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaLearningSmoothnessExperiment, + "MediaLearningSmoothnessExperiment", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable the prototype global optimization of tuneables via finch. See // media/base/tuneable.h for how to create tuneable parameters. -const base::Feature kMediaOptimizer{"JointMediaOptimizer", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaOptimizer, + "JointMediaOptimizer", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable aggregate power measurement for media playback. -const base::Feature kMediaPowerExperiment{"MediaPowerExperiment", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaPowerExperiment, + "MediaPowerExperiment", + base::FEATURE_DISABLED_BY_DEFAULT); // Enable WebRTC actions for the Media Session API. -const base::Feature kMediaSessionWebRTC{"MediaSessionWebRTC", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kMediaSessionWebRTC, + "MediaSessionWebRTC", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables flash to be ducked by audio focus. This is enabled on Chrome OS which // has audio focus enabled. -const base::Feature kAudioFocusDuckFlash { - "AudioFocusDuckFlash", +BASE_FEATURE(kAudioFocusDuckFlash, + "AudioFocusDuckFlash", #if BUILDFLAG(IS_CHROMEOS_ASH) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // Only affects Android. Suspends a media session when audio focus is lost; when // this setting is disabled, an Android media session will not be suspended when // Audio focus is lost. This is used by Cast which sometimes needs to drive // multiple media sessions. -const base::Feature kAudioFocusLossSuspendMediaSession{ - "AudioFocusMediaSession", base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kAudioFocusLossSuspendMediaSession, + "AudioFocusMediaSession", + base::FEATURE_ENABLED_BY_DEFAULT); // Enables the internal Media Session logic without enabling the Media Session // service. -const base::Feature kInternalMediaSession { - "InternalMediaSession", +BASE_FEATURE(kInternalMediaSession, + "InternalMediaSession", #if BUILDFLAG(IS_ANDROID) - base::FEATURE_ENABLED_BY_DEFAULT + base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_DISABLED_BY_DEFAULT + base::FEATURE_DISABLED_BY_DEFAULT #endif -}; +); // Keypress detection which serves as input to noise suppression methods // in WebRTC clients. This functionality is enabled by default but it can be // disabled experemantally by using --disable-features=KeyPressMonitoring. -const base::Feature kKeyPressMonitoring{"KeyPressMonitoring", - base::FEATURE_ENABLED_BY_DEFAULT}; +BASE_FEATURE(kKeyPressMonitoring, + "KeyPressMonitoring", + base::FEATURE_ENABLED_BY_DEFAULT); -const base::Feature kUseFakeDeviceForMediaStream{ - "use-fake-device-for-media-stream", base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kUseFakeDeviceForMediaStream, + "use-fake-device-for-media-stream", + base::FEATURE_DISABLED_BY_DEFAULT); // Makes VideoCadenceEstimator use Bresenham-like algorithm for frame cadence // estimations. -const base::Feature kBresenhamCadence{"BresenhamCadence", - base::FEATURE_DISABLED_BY_DEFAULT}; +BASE_FEATURE(kBresenhamCadence, + "BresenhamCadence", + base::FEATURE_DISABLED_BY_DEFAULT); bool IsChromeWideEchoCancellationEnabled() { #if BUILDFLAG(CHROME_WIDE_ECHO_CANCELLATION) diff --git a/chromium/media/base/media_switches.h b/chromium/media/base/media_switches.h index 582c358348b..d481a84f2ab 100644 --- a/chromium/media/base/media_switches.h +++ b/chromium/media/base/media_switches.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. @@ -24,6 +24,10 @@ namespace switches { MEDIA_EXPORT extern const char kAudioBufferSize[]; +#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN) +MEDIA_EXPORT extern const char kAudioCodecsFromEDID[]; +#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) && BUILDFLAG(IS_WIN) + MEDIA_EXPORT extern const char kAudioServiceQuitTimeoutMs[]; MEDIA_EXPORT extern const char kAutoplayPolicy[]; @@ -48,7 +52,6 @@ MEDIA_EXPORT extern const char kEnableExclusiveAudio[]; MEDIA_EXPORT extern const char kForceWaveAudio[]; MEDIA_EXPORT extern const char kTrySupportedChannelLayouts[]; MEDIA_EXPORT extern const char kWaveOutBuffers[]; -MEDIA_EXPORT extern const char kUseFakeAudioCaptureTimestamps[]; #endif #if BUILDFLAG(IS_FUCHSIA) @@ -56,6 +59,7 @@ MEDIA_EXPORT extern const char kEnableProtectedVideoBuffers[]; MEDIA_EXPORT extern const char kForceProtectedVideoOutputBuffers[]; MEDIA_EXPORT extern const char kDisableAudioInput[]; MEDIA_EXPORT extern const char kUseOverlaysForVideo[]; +MEDIA_EXPORT extern const char kMinVideoDecoderOutputBufferSize[]; MEDIA_EXPORT extern const char kAudioCapturerWithEchoCancellation[]; #endif @@ -115,16 +119,16 @@ namespace media { // All features in alphabetical order. The features should be documented // alongside the definition of their values in the .cc file. -MEDIA_EXPORT extern const base::Feature kAudioFocusDuckFlash; -MEDIA_EXPORT extern const base::Feature kAudioFocusLossSuspendMediaSession; -MEDIA_EXPORT extern const base::Feature kAutoplayIgnoreWebAudio; -MEDIA_EXPORT extern const base::Feature kAutoplayDisableSettings; -MEDIA_EXPORT extern const base::Feature kBackgroundVideoPauseOptimization; -MEDIA_EXPORT extern const base::Feature kBresenhamCadence; -MEDIA_EXPORT extern const base::Feature kCdmHostVerification; -MEDIA_EXPORT extern const base::Feature kCdmProcessSiteIsolation; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kAudioFocusDuckFlash); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kAudioFocusLossSuspendMediaSession); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kAutoplayIgnoreWebAudio); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kAutoplayDisableSettings); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kBackgroundVideoPauseOptimization); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kBresenhamCadence); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kCdmHostVerification); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kCdmProcessSiteIsolation); #if BUILDFLAG(CHROME_WIDE_ECHO_CANCELLATION) -MEDIA_EXPORT extern const base::Feature kChromeWideEchoCancellation; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kChromeWideEchoCancellation); MEDIA_EXPORT extern const base::FeatureParam<int> kChromeWideEchoCancellationProcessingFifoSize; MEDIA_EXPORT extern const base::FeatureParam<bool> @@ -134,155 +138,160 @@ MEDIA_EXPORT extern const base::FeatureParam<double> MEDIA_EXPORT extern const base::FeatureParam<bool> kChromeWideEchoCancellationAllowAllSampleRates; #endif -MEDIA_EXPORT extern const base::Feature kD3D11VideoDecoderUseSharedHandle; -MEDIA_EXPORT extern const base::Feature kEnableTabMuting; -MEDIA_EXPORT extern const base::Feature kExposeSwDecodersToWebRTC; -MEDIA_EXPORT extern const base::Feature kExternalClearKeyForTesting; -MEDIA_EXPORT extern const base::Feature kFFmpegDecodeOpaqueVP8; -MEDIA_EXPORT extern const base::Feature kFailUrlProvisionFetcherForTesting; -MEDIA_EXPORT extern const base::Feature kFallbackAfterDecodeError; -MEDIA_EXPORT extern const base::Feature kGav1VideoDecoder; -MEDIA_EXPORT extern const base::Feature kGlobalMediaControls; -MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsAutoDismiss; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kD3D11VideoDecoderUseSharedHandle); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kEnableTabMuting); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kExposeSwDecodersToWebRTC); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kExternalClearKeyForTesting); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kFFmpegDecodeOpaqueVP8); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kFailUrlProvisionFetcherForTesting); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kFallbackAfterDecodeError); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGav1VideoDecoder); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControls); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsAutoDismiss); #if BUILDFLAG(IS_CHROMEOS) -MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsForCast; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsForCast); #endif -MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsForChromeOS; -MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsPictureInPicture; -MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsSeamlessTransfer; -MEDIA_EXPORT extern const base::Feature kGlobalMediaControlsModernUI; -MEDIA_EXPORT extern const base::Feature kHardwareMediaKeyHandling; -MEDIA_EXPORT extern const base::Feature kHardwareSecureDecryption; -MEDIA_EXPORT extern const base::Feature kHardwareSecureDecryptionExperiment; -MEDIA_EXPORT extern const base::Feature kHardwareSecureDecryptionFallback; -MEDIA_EXPORT extern const base::Feature kInternalMediaSession; -MEDIA_EXPORT extern const base::Feature kKeepRvfcFrameAlive; -MEDIA_EXPORT extern const base::Feature kKeyPressMonitoring; -MEDIA_EXPORT extern const base::Feature kLiveCaption; -MEDIA_EXPORT extern const base::Feature kLiveCaptionMultiLanguage; -MEDIA_EXPORT extern const base::Feature kLiveCaptionSystemWideOnChromeOS; -MEDIA_EXPORT extern const base::Feature kLowDelayVideoRenderingOnLiveStream; -MEDIA_EXPORT extern const base::Feature kMediaCapabilitiesQueryGpuFactories; -MEDIA_EXPORT extern const base::Feature kMediaCapabilitiesWithParameters; -MEDIA_EXPORT extern const base::Feature kMediaCastOverlayButton; -MEDIA_EXPORT extern const base::Feature kMediaEngagementBypassAutoplayPolicies; -MEDIA_EXPORT extern const base::Feature kMediaEngagementHTTPSOnly; -MEDIA_EXPORT extern const base::Feature kMediaLearningExperiment; -MEDIA_EXPORT extern const base::Feature kMediaLearningFramework; -MEDIA_EXPORT extern const base::Feature kMediaLearningSmoothnessExperiment; -MEDIA_EXPORT extern const base::Feature kMediaOptimizer; -MEDIA_EXPORT extern const base::Feature kMediaPowerExperiment; -MEDIA_EXPORT extern const base::Feature kMediaSessionWebRTC; -MEDIA_EXPORT extern const base::Feature kMemoryPressureBasedSourceBufferGC; -MEDIA_EXPORT extern const base::Feature kMultiPlaneVideoCaptureSharedImages; -MEDIA_EXPORT extern const base::Feature kOpenscreenCastStreamingSession; -MEDIA_EXPORT extern const base::Feature kOverlayFullscreenVideo; -MEDIA_EXPORT extern const base::Feature kPictureInPicture; -MEDIA_EXPORT extern const base::Feature kPlatformAudioEncoder; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsForChromeOS); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsPictureInPicture); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsSeamlessTransfer); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalMediaControlsModernUI); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareMediaKeyHandling); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareSecureDecryption); +MEDIA_EXPORT extern const base::FeatureParam<bool> + kHardwareSecureDecryptionForceSupportClearLead; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareSecureDecryptionExperiment); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kHardwareSecureDecryptionFallback); +MEDIA_EXPORT extern const base::FeatureParam<int> + kHardwareSecureDecryptionFallbackMinDisablingDays; +MEDIA_EXPORT extern const base::FeatureParam<int> + kHardwareSecureDecryptionFallbackMaxDisablingDays; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kInternalMediaSession); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kKeepRvfcFrameAlive); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kKeyPressMonitoring); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaption); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaptionRightClick); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaptionMultiLanguage); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveCaptionSystemWideOnChromeOS); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kLiveTranslate); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kLowDelayVideoRenderingOnLiveStream); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaCapabilitiesQueryGpuFactories); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaCapabilitiesWithParameters); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaCastOverlayButton); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaEngagementBypassAutoplayPolicies); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaEngagementHTTPSOnly); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaLearningExperiment); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaLearningFramework); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaLearningSmoothnessExperiment); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaOptimizer); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaPowerExperiment); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaSessionWebRTC); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMemoryPressureBasedSourceBufferGC); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMultiPlaneVideoCaptureSharedImages); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kOpenscreenCastStreamingSession); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kOverlayFullscreenVideo); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPictureInPicture); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlatformAudioEncoder); #if BUILDFLAG(ENABLE_PLATFORM_HEVC) -MEDIA_EXPORT extern const base::Feature kPlatformHEVCDecoderSupport; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlatformHEVCDecoderSupport); #endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) -MEDIA_EXPORT extern const base::Feature kPlaybackSpeedButton; -MEDIA_EXPORT extern const base::Feature kPreloadMediaEngagementData; -MEDIA_EXPORT extern const base::Feature kPreloadMetadataLazyLoad; -MEDIA_EXPORT extern const base::Feature kPreloadMetadataSuspend; -MEDIA_EXPORT extern const base::Feature kRecordMediaEngagementScores; -MEDIA_EXPORT extern const base::Feature kRecordWebAudioEngagement; -MEDIA_EXPORT extern const base::Feature kResumeBackgroundVideo; -MEDIA_EXPORT extern const base::Feature kRevokeMediaSourceObjectURLOnAttach; -MEDIA_EXPORT extern const base::Feature - kShareThisTabInsteadButtonGetDisplayMedia; -MEDIA_EXPORT extern const base::Feature - kShareThisTabInsteadButtonGetDisplayMediaAudio; -MEDIA_EXPORT extern const base::Feature kSpeakerChangeDetection; -MEDIA_EXPORT extern const base::Feature kSpecCompliantCanPlayThrough; -MEDIA_EXPORT extern const base::Feature kSuspendMutedAudio; -MEDIA_EXPORT extern const base::Feature kUnifiedAutoplay; -MEDIA_EXPORT extern const base::Feature kUseAndroidOverlayForSecureOnly; -MEDIA_EXPORT extern const base::Feature kUseDecoderStreamForWebRTC; -MEDIA_EXPORT extern const base::Feature kUseFakeDeviceForMediaStream; -MEDIA_EXPORT extern const base::Feature kUseMediaHistoryStore; -MEDIA_EXPORT extern const base::Feature kUseR16Texture; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlaybackSpeedButton); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMediaEngagementData); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMetadataLazyLoad); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMetadataSuspend); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordMediaEngagementScores); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordWebAudioEngagement); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kResumeBackgroundVideo); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kRevokeMediaSourceObjectURLOnAttach); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kShareThisTabInsteadButtonGetDisplayMedia); +MEDIA_EXPORT BASE_DECLARE_FEATURE( + kShareThisTabInsteadButtonGetDisplayMediaAudio); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kSpeakerChangeDetection); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kSpecCompliantCanPlayThrough); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kSuspendMutedAudio); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUnifiedAutoplay); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAndroidOverlayForSecureOnly); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseDecoderStreamForWebRTC); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeDeviceForMediaStream); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseMediaHistoryStore); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseR16Texture); #if BUILDFLAG(IS_LINUX) -MEDIA_EXPORT extern const base::Feature kVaapiVideoDecodeLinux; -MEDIA_EXPORT extern const base::Feature kVaapiVideoEncodeLinux; -MEDIA_EXPORT extern const base::Feature kVaapiIgnoreDriverChecks; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoDecodeLinux); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoEncodeLinux); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiIgnoreDriverChecks); #endif // BUILDFLAG(IS_LINUX) -MEDIA_EXPORT extern const base::Feature kVaapiAV1Decoder; -MEDIA_EXPORT extern const base::Feature kVaapiLowPowerEncoderGen9x; -MEDIA_EXPORT extern const base::Feature kVaapiEnforceVideoMinMaxResolution; -MEDIA_EXPORT extern const base::Feature kVaapiVideoMinResolutionForPerformance; -MEDIA_EXPORT extern const base::Feature kVaapiVP8Encoder; -MEDIA_EXPORT extern const base::Feature kVaapiVP9Encoder; -MEDIA_EXPORT extern const base::Feature kGlobalVaapiLock; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiAV1Decoder); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiLowPowerEncoderGen9x); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiEnforceVideoMinMaxResolution); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoMinResolutionForPerformance); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVP8Encoder); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVP9Encoder); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kGlobalVaapiLock); #if defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS) -MEDIA_EXPORT extern const base::Feature kVaapiH264TemporalLayerHWEncoding; -MEDIA_EXPORT extern const base::Feature kVaapiVp8TemporalLayerHWEncoding; -MEDIA_EXPORT extern const base::Feature kVaapiVp9kSVCHWEncoding; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiH264TemporalLayerHWEncoding); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp8TemporalLayerHWEncoding); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp9kSVCHWEncoding); #endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS) -MEDIA_EXPORT extern const base::Feature kVideoBlitColorAccuracy; -MEDIA_EXPORT extern const base::Feature kVp9kSVCHWDecoding; -MEDIA_EXPORT extern const base::Feature kWakeLockOptimisationHiddenMuted; -MEDIA_EXPORT extern const base::Feature kWebContentsCaptureHiDpi; -MEDIA_EXPORT extern const base::Feature kWebrtcMediaCapabilitiesParameters; -MEDIA_EXPORT extern const base::Feature kResolutionBasedDecoderPriority; -MEDIA_EXPORT extern const base::Feature kForceHardwareVideoDecoders; -MEDIA_EXPORT extern const base::Feature kForceHardwareAudioDecoders; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVideoBlitColorAccuracy); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kVp9kSVCHWDecoding); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kWakeLockOptimisationHiddenMuted); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kWebContentsCaptureHiDpi); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kWebrtcMediaCapabilitiesParameters); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kResolutionBasedDecoderPriority); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kForceHardwareVideoDecoders); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kForceHardwareAudioDecoders); #if BUILDFLAG(IS_ANDROID) -MEDIA_EXPORT extern const base::Feature kAllowNonSecureOverlays; -MEDIA_EXPORT extern const base::Feature kMediaControlsExpandGesture; -MEDIA_EXPORT extern const base::Feature kMediaDrmPersistentLicense; -MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioning; -MEDIA_EXPORT extern const base::Feature kMediaDrmPreprovisioningAtStartup; -MEDIA_EXPORT extern const base::Feature kCanPlayHls; -MEDIA_EXPORT extern const base::Feature kPictureInPictureAPI; -MEDIA_EXPORT extern const base::Feature kHlsPlayer; -MEDIA_EXPORT extern const base::Feature kRequestSystemAudioFocus; -MEDIA_EXPORT extern const base::Feature kUseAudioLatencyFromHAL; -MEDIA_EXPORT extern const base::Feature kUsePooledSharedImageVideoProvider; -MEDIA_EXPORT extern const base::Feature kUseRealColorSpaceForAndroidVideo; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kAllowNonSecureOverlays); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaControlsExpandGesture); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaDrmPersistentLicense); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaDrmPreprovisioning); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaDrmPreprovisioningAtStartup); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kCanPlayHls); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPictureInPictureAPI); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kHlsPlayer); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kRequestSystemAudioFocus); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAudioLatencyFromHAL); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUsePooledSharedImageVideoProvider); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseRealColorSpaceForAndroidVideo); #endif // BUILDFLAG(IS_ANDROID) #if BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) -MEDIA_EXPORT extern const base::Feature kChromeOSHWVBREncoding; -MEDIA_EXPORT extern const base::Feature kUseChromeOSDirectVideoDecoder; -MEDIA_EXPORT extern const base::Feature kLimitConcurrentDecoderInstances; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kChromeOSHWVBREncoding); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseChromeOSDirectVideoDecoder); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kLimitConcurrentDecoderInstances); #if defined(ARCH_CPU_ARM_FAMILY) -MEDIA_EXPORT extern const base::Feature kPreferLibYuvImageProcessor; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreferLibYuvImageProcessor); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreferGLImageProcessor); #endif // defined(ARCH_CPU_ARM_FAMILY) #if BUILDFLAG(IS_CHROMEOS) -MEDIA_EXPORT extern const base::Feature kUseAlternateVideoDecoderImplementation; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAlternateVideoDecoderImplementation); #endif // BUILDFLAG(IS_CHROMEOS) #endif // BUILDFLAG(USE_CHROMEOS_MEDIA_ACCELERATION) -#if BUILDFLAG(IS_MAC) -MEDIA_EXPORT extern const base::Feature kMultiPlaneVideoToolboxSharedImages; -#endif // BUILDFLAG(IS_MAC) - #if BUILDFLAG(IS_WIN) -MEDIA_EXPORT extern const base::Feature kDelayCopyNV12Textures; -MEDIA_EXPORT extern const base::Feature kDirectShowGetPhotoState; -MEDIA_EXPORT extern const base::Feature kIncludeIRCamerasInDeviceEnumeration; -MEDIA_EXPORT extern const base::Feature kMediaFoundationAV1Encoding; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kDelayCopyNV12Textures); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kDirectShowGetPhotoState); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kIncludeIRCamerasInDeviceEnumeration); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationAV1Encoding); // For feature check of kMediaFoundationH264CbpEncoding at runtime, // please use IsMediaFoundationH264CbpEncodingEnabled() instead. -MEDIA_EXPORT extern const base::Feature kMediaFoundationH264CbpEncoding; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationH264CbpEncoding); -MEDIA_EXPORT extern const base::Feature kMediaFoundationVP9Encoding; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationVP9Encoding); -MEDIA_EXPORT extern const base::Feature kMediaFoundationVideoCapture; -MEDIA_EXPORT extern const base::Feature kMediaFoundationVP8Decoding; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationVideoCapture); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationVP8Decoding); // For feature check of kMediaFoundationD3D11VideoCapture at runtime, // please use IsMediaFoundationD3D11VideoCaptureEnabled() instead. -MEDIA_EXPORT extern const base::Feature kMediaFoundationD3D11VideoCapture; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationD3D11VideoCapture); -MEDIA_EXPORT extern const base::Feature kMediaFoundationClearPlayback; -MEDIA_EXPORT extern const base::Feature kAllowMediaFoundationFrameServerMode; -MEDIA_EXPORT extern const base::Feature kWasapiRawAudioCapture; -MEDIA_EXPORT extern const base::Feature kD3D11Vp9kSVCHWDecoding; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationClearPlayback); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kAllowMediaFoundationFrameServerMode); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kWasapiRawAudioCapture); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeAudioCaptureTimestamps); +MEDIA_EXPORT BASE_DECLARE_FEATURE(kD3D11Vp9kSVCHWDecoding); // Strategy affecting how Media Foundation Renderer determines its rendering // mode when used with clear video media. This strategy does not impact @@ -300,18 +309,22 @@ enum class MediaFoundationClearRenderingStrategy { // Under this feature, a given MediaFoundationClearRenderingStrategy param is // used by the Media Foundation Renderer for Clear content scenarios. -MEDIA_EXPORT extern const base::Feature kMediaFoundationClearRendering; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kMediaFoundationClearRendering); MEDIA_EXPORT extern const base::FeatureParam< MediaFoundationClearRenderingStrategy> kMediaFoundationClearRenderingStrategyParam; #endif // BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_CHROMEOS) -MEDIA_EXPORT extern const base::Feature kDeprecateLowUsageCodecs; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kDeprecateLowUsageCodecs); #endif #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -MEDIA_EXPORT extern const base::Feature kUseOutOfProcessVideoDecoding; +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseOutOfProcessVideoDecoding); +#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) + +#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) +MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseOutOfProcessVideoEncoding); #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) // Based on a |command_line| and the current platform, returns the effective diff --git a/chromium/media/base/media_track.cc b/chromium/media/base/media_track.cc index a8fb272776e..0ca8ed68fc0 100644 --- a/chromium/media/base/media_track.cc +++ b/chromium/media/base/media_track.cc @@ -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/base/media_track.h b/chromium/media/base/media_track.h index c0e020a9caa..370958923aa 100644 --- a/chromium/media/base/media_track.h +++ b/chromium/media/base/media_track.h @@ -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/base/media_tracks.cc b/chromium/media/base/media_tracks.cc index 39da608055f..25763611108 100644 --- a/chromium/media/base/media_tracks.cc +++ b/chromium/media/base/media_tracks.cc @@ -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/base/media_tracks.h b/chromium/media/base/media_tracks.h index 6407c23b0bd..f52341b9c34 100644 --- a/chromium/media/base/media_tracks.h +++ b/chromium/media/base/media_tracks.h @@ -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/base/media_types.cc b/chromium/media/base/media_types.cc index a33fb235c3f..807fda7955f 100644 --- a/chromium/media/base/media_types.cc +++ b/chromium/media/base/media_types.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/media_types.h b/chromium/media/base/media_types.h index f0b910ab1a9..3139d1a1492 100644 --- a/chromium/media/base/media_types.h +++ b/chromium/media/base/media_types.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/media_url_demuxer.cc b/chromium/media/base/media_url_demuxer.cc index 344b44d85d5..180887a1924 100644 --- a/chromium/media/base/media_url_demuxer.cc +++ b/chromium/media/base/media_url_demuxer.cc @@ -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/base/media_url_demuxer.h b/chromium/media/base/media_url_demuxer.h index b2a8c39cb26..f4c721a2848 100644 --- a/chromium/media/base/media_url_demuxer.h +++ b/chromium/media/base/media_url_demuxer.h @@ -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/base/media_url_demuxer_unittest.cc b/chromium/media/base/media_url_demuxer_unittest.cc index bdf01d2ff38..efea95fa94a 100644 --- a/chromium/media/base/media_url_demuxer_unittest.cc +++ b/chromium/media/base/media_url_demuxer_unittest.cc @@ -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/base/media_url_params.cc b/chromium/media/base/media_url_params.cc index 236efaff6d5..f7c078a09c8 100644 --- a/chromium/media/base/media_url_params.cc +++ b/chromium/media/base/media_url_params.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/media_url_params.h b/chromium/media/base/media_url_params.h index ebbc80c91ef..15128b49ed0 100644 --- a/chromium/media/base/media_url_params.h +++ b/chromium/media/base/media_url_params.h @@ -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/base/media_util.cc b/chromium/media/base/media_util.cc index dafaad63ccd..27451d93483 100644 --- a/chromium/media/base/media_util.cc +++ b/chromium/media/base/media_util.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -18,6 +18,8 @@ AudioParameters::Format ConvertAudioCodecToBitstreamFormat(AudioCodec codec) { return AudioParameters::Format::AUDIO_BITSTREAM_EAC3; case AudioCodec::kDTS: return AudioParameters::Format::AUDIO_BITSTREAM_DTS; + case AudioCodec::kDTSXP2: + return AudioParameters::Format::AUDIO_BITSTREAM_DTSX_P2; // No support for DTS_HD yet as this section is related to the incoming // stream type. DTS_HD support is only added for audio track output to // support audiosink reporting DTS_HD support. diff --git a/chromium/media/base/media_util.h b/chromium/media/base/media_util.h index b2d3b117faf..9481757af0b 100644 --- a/chromium/media/base/media_util.h +++ b/chromium/media/base/media_util.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/memory_dump_provider_proxy.cc b/chromium/media/base/memory_dump_provider_proxy.cc index 72117cb3a78..8dcde768831 100644 --- a/chromium/media/base/memory_dump_provider_proxy.cc +++ b/chromium/media/base/memory_dump_provider_proxy.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/memory_dump_provider_proxy.h b/chromium/media/base/memory_dump_provider_proxy.h index 24783d3231c..fa418aadd0e 100644 --- a/chromium/media/base/memory_dump_provider_proxy.h +++ b/chromium/media/base/memory_dump_provider_proxy.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/mime_util.cc b/chromium/media/base/mime_util.cc index ff8aa2e13ab..e199a949114 100644 --- a/chromium/media/base/mime_util.cc +++ b/chromium/media/base/mime_util.cc @@ -1,10 +1,11 @@ -// Copyright 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. #include "media/base/mime_util.h" #include "base/no_destructor.h" +#include "base/strings/string_piece.h" #include "media/base/mime_util_internal.h" namespace media { @@ -15,22 +16,22 @@ static const internal::MimeUtil* GetMimeUtil() { return &(*mime_util); } -bool IsSupportedMediaMimeType(const std::string& mime_type) { +bool IsSupportedMediaMimeType(base::StringPiece mime_type) { return GetMimeUtil()->IsSupportedMediaMimeType(mime_type); } -SupportsType IsSupportedMediaFormat(const std::string& mime_type, +SupportsType IsSupportedMediaFormat(base::StringPiece mime_type, const std::vector<std::string>& codecs) { return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, false); } SupportsType IsSupportedEncryptedMediaFormat( - const std::string& mime_type, + base::StringPiece mime_type, const std::vector<std::string>& codecs) { return GetMimeUtil()->IsSupportedMediaFormat(mime_type, codecs, true); } -void SplitCodecs(const std::string& codecs, +void SplitCodecs(base::StringPiece codecs, std::vector<std::string>* codecs_out) { GetMimeUtil()->SplitCodecs(codecs, codecs_out); } @@ -39,8 +40,8 @@ void StripCodecs(std::vector<std::string>* codecs) { GetMimeUtil()->StripCodecs(codecs); } -bool ParseVideoCodecString(const std::string& mime_type, - const std::string& codec_id, +bool ParseVideoCodecString(base::StringPiece mime_type, + base::StringPiece codec_id, bool* ambiguous_codec_string, VideoCodec* out_codec, VideoCodecProfile* out_profile, @@ -51,8 +52,8 @@ bool ParseVideoCodecString(const std::string& mime_type, out_level, out_colorspace); } -bool ParseAudioCodecString(const std::string& mime_type, - const std::string& codec_id, +bool ParseAudioCodecString(base::StringPiece mime_type, + base::StringPiece codec_id, bool* ambiguous_codec_string, AudioCodec* out_codec) { return GetMimeUtil()->ParseAudioCodecString( diff --git a/chromium/media/base/mime_util.h b/chromium/media/base/mime_util.h index c0106e528be..4f23e2278c1 100644 --- a/chromium/media/base/mime_util.h +++ b/chromium/media/base/mime_util.h @@ -1,4 +1,4 @@ -// Copyright 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. @@ -8,6 +8,7 @@ #include <string> #include <vector> +#include "base/strings/string_piece_forward.h" #include "media/base/audio_codecs.h" #include "media/base/media_export.h" #include "media/base/video_codecs.h" @@ -16,13 +17,13 @@ namespace media { // Check to see if a particular MIME type is in the list of // supported/recognized MIME types. -MEDIA_EXPORT bool IsSupportedMediaMimeType(const std::string& mime_type); +MEDIA_EXPORT bool IsSupportedMediaMimeType(base::StringPiece mime_type); // Splits |codecs| separated by comma into |codecs_out|. Codecs in |codecs| may // or may not be quoted. For example, "\"aaa.b.c,dd.eee\"" and "aaa.b.c,dd.eee" // will both be split into {"aaa.b.c", "dd.eee"}. // See http://www.ietf.org/rfc/rfc4281.txt. -MEDIA_EXPORT void SplitCodecs(const std::string& codecs, +MEDIA_EXPORT void SplitCodecs(base::StringPiece, std::vector<std::string>* codecs_out); // Strips the profile and level info from |codecs| in place. For example, @@ -40,8 +41,8 @@ MEDIA_EXPORT void StripCodecs(std::vector<std::string>* codecs); // // Returns false if parsing fails (invalid string, or unrecognized video codec), // in which case values for |out_*| arguments are undefined. -MEDIA_EXPORT bool ParseVideoCodecString(const std::string& mime_type, - const std::string& codec_id, +MEDIA_EXPORT bool ParseVideoCodecString(base::StringPiece mime_type, + base::StringPiece codec_id, bool* out_is_ambiguous, VideoCodec* out_codec, VideoCodecProfile* out_profile, @@ -57,8 +58,8 @@ MEDIA_EXPORT bool ParseVideoCodecString(const std::string& mime_type, // // Returns false if parsing fails (invalid string, or unrecognized audio codec), // in which case values for |out_*| arguments are undefined. -MEDIA_EXPORT bool ParseAudioCodecString(const std::string& mime_type, - const std::string& codec_id, +MEDIA_EXPORT bool ParseAudioCodecString(base::StringPiece mime_type, + base::StringPiece codec_id, bool* out_is_ambiguous, AudioCodec* out_codec); @@ -87,12 +88,12 @@ enum class SupportsType { // |mime_type| is supported but at least one of the codecs within |codecs| is // not supported for the |mime_type|. MEDIA_EXPORT SupportsType -IsSupportedMediaFormat(const std::string& mime_type, +IsSupportedMediaFormat(base::StringPiece mime_type, const std::vector<std::string>& codecs); // Similar to the above, but for encrypted formats. MEDIA_EXPORT SupportsType -IsSupportedEncryptedMediaFormat(const std::string& mime_type, +IsSupportedEncryptedMediaFormat(base::StringPiece mime_type, const std::vector<std::string>& codecs); } // namespace media diff --git a/chromium/media/base/mime_util_internal.cc b/chromium/media/base/mime_util_internal.cc index 2d89808c1b0..5779a4706e6 100644 --- a/chromium/media/base/mime_util_internal.cc +++ b/chromium/media/base/mime_util_internal.cc @@ -1,4 +1,4 @@ -// Copyright 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. @@ -10,6 +10,7 @@ #include "base/no_destructor.h" #include "base/notreached.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "build/build_config.h" @@ -30,8 +31,7 @@ #include "media/base/android/media_codec_util.h" // nogncheck #endif -namespace media { -namespace internal { +namespace media::internal { // A map from codec string to MimeUtil::Codec. using StringToCodecMap = base::flat_map<std::string, MimeUtil::Codec>; @@ -102,8 +102,8 @@ const StringToCodecMap& GetStringToCodecMap() { return *kStringToCodecMap; } -static bool ParseVp9CodecID(const std::string& mime_type_lower_case, - const std::string& codec_id, +static bool ParseVp9CodecID(base::StringPiece mime_type_lower_case, + base::StringPiece codec_id, VideoCodecProfile* out_profile, uint8_t* out_level, VideoColorSpace* out_color_space) { @@ -147,10 +147,6 @@ static MimeUtil::ParsedCodecResult MakeDefaultParsedCodecResult() { MimeUtil::MimeUtil() { #if BUILDFLAG(IS_ANDROID) -#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) - platform_info_.has_platform_dv_decoder = - MediaCodecUtil::IsDolbyVisionDecoderAvailable(); -#endif platform_info_.has_platform_vp8_decoder = MediaCodecUtil::IsVp8DecoderAvailable(); platform_info_.has_platform_vp9_decoder = @@ -224,7 +220,7 @@ VideoCodec MimeUtilToVideoCodec(MimeUtil::Codec codec) { SupportsType MimeUtil::AreSupportedCodecs( const std::vector<ParsedCodecResult>& parsed_codecs, - const std::string& mime_type_lower_case, + base::StringPiece mime_type_lower_case, bool is_encrypted) const { DCHECK(!parsed_codecs.empty()); DCHECK_EQ(base::ToLowerASCII(mime_type_lower_case), mime_type_lower_case); @@ -418,16 +414,15 @@ void MimeUtil::AddSupportedMediaFormats() { #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) } -void MimeUtil::AddContainerWithCodecs(const std::string& mime_type, - const CodecSet& codecs) { - media_format_map_[mime_type] = codecs; +void MimeUtil::AddContainerWithCodecs(std::string mime_type, CodecSet codecs) { + media_format_map_.insert_or_assign(std::move(mime_type), std::move(codecs)); } -bool MimeUtil::IsSupportedMediaMimeType(const std::string& mime_type) const { +bool MimeUtil::IsSupportedMediaMimeType(base::StringPiece mime_type) const { return media_format_map_.contains(base::ToLowerASCII(mime_type)); } -void MimeUtil::SplitCodecs(const std::string& codecs, +void MimeUtil::SplitCodecs(base::StringPiece codecs, std::vector<std::string>* codecs_out) const { *codecs_out = base::SplitString(base::TrimString(codecs, "\"", base::TRIM_ALL), ",", @@ -440,15 +435,15 @@ void MimeUtil::SplitCodecs(const std::string& codecs, void MimeUtil::StripCodecs(std::vector<std::string>* codecs) const { // Strip everything past the first '.' - for (auto it = codecs->begin(); it != codecs->end(); ++it) { - size_t found = it->find_first_of('.'); + for (auto& codec : *codecs) { + size_t found = codec.find_first_of('.'); if (found != std::string::npos) - it->resize(found); + codec.resize(found); } } -bool MimeUtil::ParseVideoCodecString(const std::string& mime_type, - const std::string& codec_id, +bool MimeUtil::ParseVideoCodecString(base::StringPiece mime_type, + base::StringPiece codec_id, bool* out_is_ambiguous, VideoCodec* out_codec, VideoCodecProfile* out_profile, @@ -464,7 +459,7 @@ bool MimeUtil::ParseVideoCodecString(const std::string& mime_type, std::vector<ParsedCodecResult> parsed_results; std::vector<std::string> codec_strings; if (!codec_id.empty()) - codec_strings.push_back(codec_id); + codec_strings.emplace_back(codec_id); if (!ParseCodecStrings(base::ToLowerASCII(mime_type), codec_strings, &parsed_results)) { @@ -490,8 +485,8 @@ bool MimeUtil::ParseVideoCodecString(const std::string& mime_type, return true; } -bool MimeUtil::ParseAudioCodecString(const std::string& mime_type, - const std::string& codec_id, +bool MimeUtil::ParseAudioCodecString(base::StringPiece mime_type, + base::StringPiece codec_id, bool* out_is_ambiguous, AudioCodec* out_codec) const { DCHECK(out_is_ambiguous); @@ -501,7 +496,7 @@ bool MimeUtil::ParseAudioCodecString(const std::string& mime_type, std::vector<ParsedCodecResult> parsed_results; std::vector<std::string> codec_strings; if (!codec_id.empty()) - codec_strings.push_back(codec_id); + codec_strings.emplace_back(codec_id); if (!ParseCodecStrings(base::ToLowerASCII(mime_type), codec_strings, &parsed_results)) { @@ -525,7 +520,7 @@ bool MimeUtil::ParseAudioCodecString(const std::string& mime_type, } SupportsType MimeUtil::IsSupportedMediaFormat( - const std::string& mime_type, + base::StringPiece mime_type, const std::vector<std::string>& codecs, bool is_encrypted) const { const std::string mime_type_lower_case = base::ToLowerASCII(mime_type); @@ -555,12 +550,11 @@ SupportsType MimeUtil::IsSupportedMediaFormat( } // static -bool MimeUtil::IsCodecSupportedOnAndroid( - Codec codec, - const std::string& mime_type_lower_case, - bool is_encrypted, - VideoCodecProfile video_profile, - const PlatformInfo& platform_info) { +bool MimeUtil::IsCodecSupportedOnAndroid(Codec codec, + base::StringPiece mime_type_lower_case, + bool is_encrypted, + VideoCodecProfile video_profile, + const PlatformInfo& platform_info) { DVLOG(3) << __func__; DCHECK_NE(mime_type_lower_case, ""); @@ -654,7 +648,7 @@ bool MimeUtil::IsCodecSupportedOnAndroid( case DOLBY_VISION: #if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) - return platform_info.has_platform_dv_decoder; + return true; #else return false; #endif @@ -680,7 +674,7 @@ bool MimeUtil::IsCodecSupportedOnAndroid( } bool MimeUtil::ParseCodecStrings( - const std::string& mime_type_lower_case, + base::StringPiece mime_type_lower_case, const std::vector<std::string>& codecs, std::vector<ParsedCodecResult>* out_results) const { DCHECK(out_results); @@ -768,8 +762,8 @@ bool MimeUtil::ParseCodecStrings( return true; } -bool MimeUtil::ParseCodecHelper(const std::string& mime_type_lower_case, - const std::string& codec_id, +bool MimeUtil::ParseCodecHelper(base::StringPiece mime_type_lower_case, + base::StringPiece codec_id, ParsedCodecResult* out_result) const { DCHECK_EQ(base::ToLowerASCII(mime_type_lower_case), mime_type_lower_case); DCHECK(out_result); @@ -871,7 +865,7 @@ bool MimeUtil::ParseCodecHelper(const std::string& mime_type_lower_case, return false; } -SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case, +SupportsType MimeUtil::IsCodecSupported(base::StringPiece mime_type_lower_case, Codec codec, VideoCodecProfile video_profile, uint8_t video_level, @@ -948,7 +942,7 @@ SupportsType MimeUtil::IsCodecSupported(const std::string& mime_type_lower_case, : SupportsType::kSupported; } -bool MimeUtil::GetDefaultCodec(const std::string& mime_type, +bool MimeUtil::GetDefaultCodec(base::StringPiece mime_type, Codec* default_codec) const { // Codecs below are unambiguously implied by the mime type string. DO NOT add // default codecs for ambiguous mime types. @@ -972,5 +966,4 @@ bool MimeUtil::GetDefaultCodec(const std::string& mime_type, return false; } -} // namespace internal -} // namespace media +} // namespace media::internal diff --git a/chromium/media/base/mime_util_internal.h b/chromium/media/base/mime_util_internal.h index 6affc4798eb..849ce4ba202 100644 --- a/chromium/media/base/mime_util_internal.h +++ b/chromium/media/base/mime_util_internal.h @@ -1,4 +1,4 @@ -// Copyright 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. @@ -10,15 +10,14 @@ #include "base/containers/flat_map.h" #include "base/containers/flat_set.h" +#include "base/strings/string_piece_forward.h" #include "build/build_config.h" #include "media/base/media_export.h" #include "media/base/mime_util.h" #include "media/base/video_codecs.h" #include "media/base/video_color_space.h" -namespace media { - -namespace internal { +namespace media::internal { // Internal utility class for handling mime types. Should only be invoked by // tests and the functions within mime_util.cc -- NOT for direct use by others. @@ -79,23 +78,23 @@ class MEDIA_EXPORT MimeUtil { }; // See mime_util.h for more information on these methods. - bool IsSupportedMediaMimeType(const std::string& mime_type) const; - void SplitCodecs(const std::string& codecs, + bool IsSupportedMediaMimeType(base::StringPiece mime_type) const; + void SplitCodecs(base::StringPiece codecs, std::vector<std::string>* codecs_out) const; void StripCodecs(std::vector<std::string>* codecs) const; bool ParseVideoCodecString( - const std::string& mime_type, // fixme, make optional - const std::string& codec_id, + base::StringPiece mime_type, // fixme, make optional + base::StringPiece codec_id, bool* out_is_ambiguous, VideoCodec* out_codec, VideoCodecProfile* out_profile, uint8_t* out_level, VideoColorSpace* out_color_space) const; - bool ParseAudioCodecString(const std::string& mime_type, - const std::string& codec_id, + bool ParseAudioCodecString(base::StringPiece mime_type, + base::StringPiece codec_id, bool* out_is_ambiguous, AudioCodec* out_codec) const; - SupportsType IsSupportedMediaFormat(const std::string& mime_type, + SupportsType IsSupportedMediaFormat(base::StringPiece mime_type, const std::vector<std::string>& codecs, bool is_encrypted) const; @@ -105,7 +104,7 @@ class MEDIA_EXPORT MimeUtil { // |platform_info| describes the availability of various platform features; // see PlatformInfo for more details. static bool IsCodecSupportedOnAndroid(Codec codec, - const std::string& mime_type_lower_case, + base::StringPiece mime_type_lower_case, bool is_encrypted, VideoCodecProfile video_profile, const PlatformInfo& platform_info); @@ -121,8 +120,7 @@ class MEDIA_EXPORT MimeUtil { void AddSupportedMediaFormats(); // Adds |mime_type| with the specified codecs to |media_format_map_|. - void AddContainerWithCodecs(const std::string& mime_type, - const CodecSet& codecs_list); + void AddContainerWithCodecs(std::string mime_type, CodecSet codecs_list); // Returns SupportsType::kSupported if all codec IDs in |codecs| are // unambiguous and are supported in |mime_type_lower_case|. kMaybeSupported is @@ -133,7 +131,7 @@ class MEDIA_EXPORT MimeUtil { // encrypted blocks. SupportsType AreSupportedCodecs( const std::vector<ParsedCodecResult>& parsed_codecs, - const std::string& mime_type_lower_case, + base::StringPiece mime_type_lower_case, bool is_encrypted) const; // Parse the combination of |mime_type_lower_case| and |codecs|. Returns true @@ -142,7 +140,7 @@ class MEDIA_EXPORT MimeUtil { // - invalid/unrecognized codec strings and mime_types // - invalid combinations of codec strings and mime_types (e.g. H264 in WebM) // See comment for ParseCodecHelper(). - bool ParseCodecStrings(const std::string& mime_type_lower_case, + bool ParseCodecStrings(base::StringPiece mime_type_lower_case, const std::vector<std::string>& codecs, std::vector<ParsedCodecResult>* out_results) const; @@ -167,8 +165,8 @@ class MEDIA_EXPORT MimeUtil { // |out_result|'s |video_color_space| will report the codec strings color // space when provided. Most codec strings do not yet describe color, so this // will often be set to the default of REC709. - bool ParseCodecHelper(const std::string& mime_type_lower_case, - const std::string& codec_id, + bool ParseCodecHelper(base::StringPiece mime_type_lower_case, + base::StringPiece codec_id, ParsedCodecResult* out_result) const; // Returns kSupported if |codec| when platform supports codec contained in @@ -179,7 +177,7 @@ class MEDIA_EXPORT MimeUtil { // blocks. // TODO(chcunningham): Make this method return a bool. Platform support should // always be knowable for a fully specified codec. - SupportsType IsCodecSupported(const std::string& mime_type_lower_case, + SupportsType IsCodecSupported(base::StringPiece mime_type_lower_case, Codec codec, VideoCodecProfile video_profile, uint8_t video_level, @@ -192,7 +190,7 @@ class MEDIA_EXPORT MimeUtil { // Returns true and sets |*default_codec| if |mime_type_lower_case| has a // default codec associated with it. Returns false otherwise and the value of // |*default_codec| is undefined. - bool GetDefaultCodec(const std::string& mime_type_lower_case, + bool GetDefaultCodec(base::StringPiece mime_type_lower_case, Codec* default_codec) const; #if BUILDFLAG(IS_ANDROID) @@ -204,7 +202,6 @@ class MEDIA_EXPORT MimeUtil { MediaFormatMappings media_format_map_; }; -} // namespace internal -} // namespace media +} // namespace media::internal #endif // MEDIA_BASE_MIME_UTIL_INTERNAL_H_ diff --git a/chromium/media/base/mime_util_unittest.cc b/chromium/media/base/mime_util_unittest.cc index 8137fbc7d5b..85d72c9c4f5 100644 --- a/chromium/media/base/mime_util_unittest.cc +++ b/chromium/media/base/mime_util_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,8 +23,7 @@ #include "base/android/build_info.h" #endif -namespace media { -namespace internal { +namespace media::internal { #if BUILDFLAG(USE_PROPRIETARY_CODECS) // TODO(https://crbug.com/1117275): Remove conditioning of kUsePropCodecs when @@ -123,7 +122,11 @@ static MimeUtil::PlatformInfo VaryAllFields() { // This is to validate MimeUtil::IsCodecSupportedOnPlatform(), which is used // only on Android platform. static bool HasDolbyVisionSupport() { +#if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) + return true; +#else return false; +#endif } static bool HasEac3Support() { @@ -149,8 +152,8 @@ TEST(MimeUtilTest, CommonMediaMimeType) { EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("application/x-mpegurl")); EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("Application/X-MPEGURL")); - EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType( - "application/vnd.apple.mpegurl")); + EXPECT_EQ(kHlsSupported, + IsSupportedMediaMimeType("application/vnd.apple.mpegurl")); EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("audio/mpegurl")); EXPECT_EQ(kHlsSupported, IsSupportedMediaMimeType("audio/x-mpegurl")); EXPECT_TRUE(IsSupportedMediaMimeType("audio/mp4")); @@ -211,18 +214,18 @@ TEST(MimeUtilTest, SplitAndStripCodecs) { {",", 2, {"", ""}, {"", ""}}, }; - for (size_t i = 0; i < std::size(tests); ++i) { + for (const auto& test : tests) { std::vector<std::string> codecs_out; - SplitCodecs(tests[i].original, &codecs_out); - ASSERT_EQ(tests[i].expected_size, codecs_out.size()); - for (size_t j = 0; j < tests[i].expected_size; ++j) - EXPECT_EQ(tests[i].split_results[j], codecs_out[j]); + SplitCodecs(test.original, &codecs_out); + ASSERT_EQ(test.expected_size, codecs_out.size()); + for (size_t j = 0; j < test.expected_size; ++j) + EXPECT_EQ(test.split_results[j], codecs_out[j]); StripCodecs(&codecs_out); - ASSERT_EQ(tests[i].expected_size, codecs_out.size()); - for (size_t j = 0; j < tests[i].expected_size; ++j) - EXPECT_EQ(tests[i].strip_results[j], codecs_out[j]); + ASSERT_EQ(test.expected_size, codecs_out.size()); + for (size_t j = 0; j < test.expected_size; ++j) + EXPECT_EQ(test.strip_results[j], codecs_out[j]); } } @@ -726,5 +729,4 @@ TEST(IsCodecSupportedOnAndroidTest, AndroidHLSAAC) { // platform support). } -} // namespace internal -} // namespace media +} // namespace media::internal diff --git a/chromium/media/base/mock_audio_renderer_sink.cc b/chromium/media/base/mock_audio_renderer_sink.cc index 4c7c656d135..5cb182eb8fe 100644 --- a/chromium/media/base/mock_audio_renderer_sink.cc +++ b/chromium/media/base/mock_audio_renderer_sink.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. @@ -20,7 +20,7 @@ MockAudioRendererSink::MockAudioRendererSink(const std::string& device_id, device_id, device_status, AudioParameters(AudioParameters::AUDIO_FAKE, - CHANNEL_LAYOUT_STEREO, + ChannelLayoutConfig::Stereo(), AudioParameters::kTelephoneSampleRate, 1)) {} diff --git a/chromium/media/base/mock_audio_renderer_sink.h b/chromium/media/base/mock_audio_renderer_sink.h index d37d06240c6..68d1f709d20 100644 --- a/chromium/media/base/mock_audio_renderer_sink.h +++ b/chromium/media/base/mock_audio_renderer_sink.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/base/mock_demuxer_host.cc b/chromium/media/base/mock_demuxer_host.cc index 5a33a0da3e4..c0ae9760e6d 100644 --- a/chromium/media/base/mock_demuxer_host.cc +++ b/chromium/media/base/mock_demuxer_host.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/base/mock_demuxer_host.h b/chromium/media/base/mock_demuxer_host.h index 51d5025cfa2..cc1a11c8536 100644 --- a/chromium/media/base/mock_demuxer_host.h +++ b/chromium/media/base/mock_demuxer_host.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/base/mock_filters.cc b/chromium/media/base/mock_filters.cc index 3ab836a646c..a502332521d 100644 --- a/chromium/media/base/mock_filters.cc +++ b/chromium/media/base/mock_filters.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/base/mock_filters.h b/chromium/media/base/mock_filters.h index 4d6126d9bef..e2b22f028d6 100644 --- a/chromium/media/base/mock_filters.h +++ b/chromium/media/base/mock_filters.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -89,19 +89,19 @@ class MockPipeline : public Pipeline { void Start(StartType start_type, Demuxer* demuxer, Client* client, - PipelineStatusCallback seek_cb) { + PipelineStatusCallback seek_cb) override { OnStart(start_type, demuxer, client, seek_cb); } MOCK_METHOD4(OnStart, void(StartType, Demuxer*, Client*, PipelineStatusCallback&)); MOCK_METHOD0(Stop, void()); - void Seek(base::TimeDelta time, PipelineStatusCallback seek_cb) { + void Seek(base::TimeDelta time, PipelineStatusCallback seek_cb) override { OnSeek(time, seek_cb); } MOCK_METHOD2(OnSeek, void(base::TimeDelta, PipelineStatusCallback&)); - void Suspend(PipelineStatusCallback cb) { OnSuspend(cb); } + void Suspend(PipelineStatusCallback cb) override { OnSuspend(cb); } MOCK_METHOD1(OnSuspend, void(PipelineStatusCallback&)); - void Resume(base::TimeDelta time, PipelineStatusCallback seek_cb) { + void Resume(base::TimeDelta time, PipelineStatusCallback seek_cb) override { OnResume(time, seek_cb); } MOCK_METHOD2(OnResume, void(base::TimeDelta, PipelineStatusCallback&)); @@ -163,14 +163,14 @@ class MockDemuxer : public Demuxer { // Demuxer implementation. std::string GetDisplayName() const override; - void Initialize(DemuxerHost* host, PipelineStatusCallback cb) { + void Initialize(DemuxerHost* host, PipelineStatusCallback cb) override { OnInitialize(host, cb); } MOCK_METHOD2(OnInitialize, void(DemuxerHost* host, PipelineStatusCallback& cb)); MOCK_METHOD1(StartWaitingForSeek, void(base::TimeDelta)); MOCK_METHOD1(CancelPendingSeek, void(base::TimeDelta)); - void Seek(base::TimeDelta time, PipelineStatusCallback cb) { + void Seek(base::TimeDelta time, PipelineStatusCallback cb) override { OnSeek(time, cb); } MOCK_METHOD2(OnSeek, void(base::TimeDelta time, PipelineStatusCallback& cb)); @@ -435,7 +435,7 @@ class MockVideoRenderer : public VideoRenderer { CdmContext* cdm_context, RendererClient* client, const TimeSource::WallClockTimeCB& wall_clock_time_cb, - PipelineStatusCallback init_cb) { + PipelineStatusCallback init_cb) override { OnInitialize(stream, cdm_context, client, wall_clock_time_cb, init_cb); } MOCK_METHOD5(OnInitialize, @@ -465,7 +465,7 @@ class MockAudioRenderer : public AudioRenderer { void Initialize(DemuxerStream* stream, CdmContext* cdm_context, RendererClient* client, - PipelineStatusCallback init_cb) { + PipelineStatusCallback init_cb) override { OnInitialize(stream, cdm_context, client, init_cb); } MOCK_METHOD4(OnInitialize, @@ -835,16 +835,15 @@ class MockStreamParser : public StreamParser { ~MockStreamParser() override; // StreamParser interface - MOCK_METHOD8( - Init, - void(InitCB init_cb, - const NewConfigCB& config_cb, - const NewBuffersCB& new_buffers_cb, - bool ignore_text_track, - const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, - const NewMediaSegmentCB& new_segment_cb, - const EndMediaSegmentCB& end_of_segment_cb, - MediaLog* media_log)); + MOCK_METHOD8(Init, + void(InitCB init_cb, + NewConfigCB config_cb, + NewBuffersCB new_buffers_cb, + bool ignore_text_track, + EncryptedMediaInitDataCB encrypted_media_init_data_cb, + NewMediaSegmentCB new_segment_cb, + EndMediaSegmentCB end_of_segment_cb, + MediaLog* media_log)); MOCK_METHOD0(Flush, void()); MOCK_CONST_METHOD0(GetGenerateTimestampsFlag, bool()); MOCK_METHOD2(Parse, bool(const uint8_t*, int)); diff --git a/chromium/media/base/mock_media_log.cc b/chromium/media/base/mock_media_log.cc index 80d0d304261..eccb18d2a89 100644 --- a/chromium/media/base/mock_media_log.cc +++ b/chromium/media/base/mock_media_log.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -23,9 +23,9 @@ std::string MockMediaLog::MediaEventToLogString(const MediaLogRecord& event) { // event for figuring out media pipeline failures, and just reporting // pipeline status as numeric code is not very helpful/user-friendly. if (event.type == MediaLogRecord::Type::kMediaStatus) { - const std::string* group = event.params.FindStringKey("group"); + const std::string* group = event.params.FindString("group"); if (group && *group == "PipelineStatus") { - auto code = event.params.FindIntKey("code").value_or(0); + auto code = event.params.FindInt("code").value_or(0); return PipelineStatusToString(static_cast<PipelineStatusCodes>(code)); } } diff --git a/chromium/media/base/mock_media_log.h b/chromium/media/base/mock_media_log.h index 2ab57f02a7d..7c162519343 100644 --- a/chromium/media/base/mock_media_log.h +++ b/chromium/media/base/mock_media_log.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/mock_video_renderer_sink.cc b/chromium/media/base/mock_video_renderer_sink.cc index 131ad4a374e..2de98c4c08b 100644 --- a/chromium/media/base/mock_video_renderer_sink.cc +++ b/chromium/media/base/mock_video_renderer_sink.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/mock_video_renderer_sink.h b/chromium/media/base/mock_video_renderer_sink.h index 7509c65b3b1..db48d7fc369 100644 --- a/chromium/media/base/mock_video_renderer_sink.h +++ b/chromium/media/base/mock_video_renderer_sink.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/moving_average.cc b/chromium/media/base/moving_average.cc index c3d9d6bbd98..13495bb9f90 100644 --- a/chromium/media/base/moving_average.cc +++ b/chromium/media/base/moving_average.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/moving_average.h b/chromium/media/base/moving_average.h index 92df3fada1a..7e6d42dc80c 100644 --- a/chromium/media/base/moving_average.h +++ b/chromium/media/base/moving_average.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/moving_average_unittest.cc b/chromium/media/base/moving_average_unittest.cc index f3d06d89db1..70ab263d922 100644 --- a/chromium/media/base/moving_average_unittest.cc +++ b/chromium/media/base/moving_average_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/multi_channel_resampler.cc b/chromium/media/base/multi_channel_resampler.cc index b37b72632a0..d7ce47b6f1e 100644 --- a/chromium/media/base/multi_channel_resampler.cc +++ b/chromium/media/base/multi_channel_resampler.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/base/multi_channel_resampler.h b/chromium/media/base/multi_channel_resampler.h index f0f9d9a0009..9d3c4bd5028 100644 --- a/chromium/media/base/multi_channel_resampler.h +++ b/chromium/media/base/multi_channel_resampler.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/base/multi_channel_resampler_unittest.cc b/chromium/media/base/multi_channel_resampler_unittest.cc index 0f2285b89d4..b106375d895 100644 --- a/chromium/media/base/multi_channel_resampler_unittest.cc +++ b/chromium/media/base/multi_channel_resampler_unittest.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/base/null_video_sink.cc b/chromium/media/base/null_video_sink.cc index a69b9755461..d1b0f86cbc4 100644 --- a/chromium/media/base/null_video_sink.cc +++ b/chromium/media/base/null_video_sink.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/null_video_sink.h b/chromium/media/base/null_video_sink.h index 28ddf2a6043..b6cba54a68d 100644 --- a/chromium/media/base/null_video_sink.h +++ b/chromium/media/base/null_video_sink.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/null_video_sink_unittest.cc b/chromium/media/base/null_video_sink_unittest.cc index 63dbe22988f..47a301b811f 100644 --- a/chromium/media/base/null_video_sink_unittest.cc +++ b/chromium/media/base/null_video_sink_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/offloading_audio_encoder.cc b/chromium/media/base/offloading_audio_encoder.cc index eafa2f0e292..ccbd07665b8 100644 --- a/chromium/media/base/offloading_audio_encoder.cc +++ b/chromium/media/base/offloading_audio_encoder.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/offloading_audio_encoder.h b/chromium/media/base/offloading_audio_encoder.h index 63a2f70d2b1..af67ffedef7 100644 --- a/chromium/media/base/offloading_audio_encoder.h +++ b/chromium/media/base/offloading_audio_encoder.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/offloading_audio_encoder_unittest.cc b/chromium/media/base/offloading_audio_encoder_unittest.cc index 39c2719ac85..617db335a60 100644 --- a/chromium/media/base/offloading_audio_encoder_unittest.cc +++ b/chromium/media/base/offloading_audio_encoder_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/offloading_video_encoder.cc b/chromium/media/base/offloading_video_encoder.cc index a2517981ec9..f037da44400 100644 --- a/chromium/media/base/offloading_video_encoder.cc +++ b/chromium/media/base/offloading_video_encoder.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/offloading_video_encoder.h b/chromium/media/base/offloading_video_encoder.h index 8b296d61358..60129884221 100644 --- a/chromium/media/base/offloading_video_encoder.h +++ b/chromium/media/base/offloading_video_encoder.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/offloading_video_encoder_unittest.cc b/chromium/media/base/offloading_video_encoder_unittest.cc index c5afc025474..301e2847ba5 100644 --- a/chromium/media/base/offloading_video_encoder_unittest.cc +++ b/chromium/media/base/offloading_video_encoder_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/output_device_info.cc b/chromium/media/base/output_device_info.cc index b1270471f08..04f10148524 100644 --- a/chromium/media/base/output_device_info.cc +++ b/chromium/media/base/output_device_info.cc @@ -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/base/output_device_info.h b/chromium/media/base/output_device_info.h index 88290779234..7387896fa3d 100644 --- a/chromium/media/base/output_device_info.h +++ b/chromium/media/base/output_device_info.h @@ -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/base/overlay_info.cc b/chromium/media/base/overlay_info.cc index 5f6e83307a1..e2bbfdb9926 100644 --- a/chromium/media/base/overlay_info.cc +++ b/chromium/media/base/overlay_info.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/base/overlay_info.h b/chromium/media/base/overlay_info.h index 02915514b5b..88b0b22f273 100644 --- a/chromium/media/base/overlay_info.h +++ b/chromium/media/base/overlay_info.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/base/pipeline.h b/chromium/media/base/pipeline.h index 0dd708ea7a5..d97fb4abab3 100644 --- a/chromium/media/base/pipeline.h +++ b/chromium/media/base/pipeline.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/base/pipeline_impl.cc b/chromium/media/base/pipeline_impl.cc index c37a9568876..4f79aa74fc0 100644 --- a/chromium/media/base/pipeline_impl.cc +++ b/chromium/media/base/pipeline_impl.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/base/pipeline_impl.h b/chromium/media/base/pipeline_impl.h index 37d884deb69..04d1fa61679 100644 --- a/chromium/media/base/pipeline_impl.h +++ b/chromium/media/base/pipeline_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 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/base/pipeline_impl_unittest.cc b/chromium/media/base/pipeline_impl_unittest.cc index c9f047b0cb8..36c9927e7b8 100644 --- a/chromium/media/base/pipeline_impl_unittest.cc +++ b/chromium/media/base/pipeline_impl_unittest.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/base/pipeline_metadata.cc b/chromium/media/base/pipeline_metadata.cc index f8cc6ca985d..828fe238523 100644 --- a/chromium/media/base/pipeline_metadata.cc +++ b/chromium/media/base/pipeline_metadata.cc @@ -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/base/pipeline_metadata.h b/chromium/media/base/pipeline_metadata.h index 4f34ff80061..6f2a351c7ae 100644 --- a/chromium/media/base/pipeline_metadata.h +++ b/chromium/media/base/pipeline_metadata.h @@ -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/base/pipeline_status.cc b/chromium/media/base/pipeline_status.cc index 0d6dee26406..7b1fcd82079 100644 --- a/chromium/media/base/pipeline_status.cc +++ b/chromium/media/base/pipeline_status.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/pipeline_status.h b/chromium/media/base/pipeline_status.h index 2dad3518925..ba6196944d8 100644 --- a/chromium/media/base/pipeline_status.h +++ b/chromium/media/base/pipeline_status.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/base/provision_fetcher.h b/chromium/media/base/provision_fetcher.h index 48135306722..9a073997b0d 100644 --- a/chromium/media/base/provision_fetcher.h +++ b/chromium/media/base/provision_fetcher.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/ranges.cc b/chromium/media/base/ranges.cc index b7b2b55adb8..2f4d81e6c42 100644 --- a/chromium/media/base/ranges.cc +++ b/chromium/media/base/ranges.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/base/ranges.h b/chromium/media/base/ranges.h index d9aa4803d69..0ebea16b310 100644 --- a/chromium/media/base/ranges.h +++ b/chromium/media/base/ranges.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/base/ranges_unittest.cc b/chromium/media/base/ranges_unittest.cc index b76e7fe4543..687a1ae4044 100644 --- a/chromium/media/base/ranges_unittest.cc +++ b/chromium/media/base/ranges_unittest.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/base/reentrancy_checker.cc b/chromium/media/base/reentrancy_checker.cc index 296503debd6..98b8f37986c 100644 --- a/chromium/media/base/reentrancy_checker.cc +++ b/chromium/media/base/reentrancy_checker.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/reentrancy_checker.h b/chromium/media/base/reentrancy_checker.h index 1519694934e..e84890b6a76 100644 --- a/chromium/media/base/reentrancy_checker.h +++ b/chromium/media/base/reentrancy_checker.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/reentrancy_checker_unittest.cc b/chromium/media/base/reentrancy_checker_unittest.cc index 0f0ae67882f..f028067d36d 100644 --- a/chromium/media/base/reentrancy_checker_unittest.cc +++ b/chromium/media/base/reentrancy_checker_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/renderer.cc b/chromium/media/base/renderer.cc index e2cb8d39e22..232de6cbb36 100644 --- a/chromium/media/base/renderer.cc +++ b/chromium/media/base/renderer.cc @@ -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/base/renderer.h b/chromium/media/base/renderer.h index b7738604fa2..8fdc6080c14 100644 --- a/chromium/media/base/renderer.h +++ b/chromium/media/base/renderer.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/base/renderer_client.cc b/chromium/media/base/renderer_client.cc index ff7c1d57aef..6690bab966e 100644 --- a/chromium/media/base/renderer_client.cc +++ b/chromium/media/base/renderer_client.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/renderer_client.h b/chromium/media/base/renderer_client.h index e8e3de956a8..ad3ffecc307 100644 --- a/chromium/media/base/renderer_client.h +++ b/chromium/media/base/renderer_client.h @@ -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/base/renderer_factory.cc b/chromium/media/base/renderer_factory.cc index 00998b88c32..1cee7a73f3b 100644 --- a/chromium/media/base/renderer_factory.cc +++ b/chromium/media/base/renderer_factory.cc @@ -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/base/renderer_factory.h b/chromium/media/base/renderer_factory.h index 42e55006f00..c3b417e4a83 100644 --- a/chromium/media/base/renderer_factory.h +++ b/chromium/media/base/renderer_factory.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/base/renderer_factory_selector.cc b/chromium/media/base/renderer_factory_selector.cc index 15c5c2f1953..83249b215b1 100644 --- a/chromium/media/base/renderer_factory_selector.cc +++ b/chromium/media/base/renderer_factory_selector.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/base/renderer_factory_selector.h b/chromium/media/base/renderer_factory_selector.h index 8be6f06500e..96eee86f7e7 100644 --- a/chromium/media/base/renderer_factory_selector.h +++ b/chromium/media/base/renderer_factory_selector.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/base/renderer_factory_selector_unittest.cc b/chromium/media/base/renderer_factory_selector_unittest.cc index 755b07d0742..31b113bdb62 100644 --- a/chromium/media/base/renderer_factory_selector_unittest.cc +++ b/chromium/media/base/renderer_factory_selector_unittest.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/base/routing_token_callback.h b/chromium/media/base/routing_token_callback.h index cecff0f6219..6603260531f 100644 --- a/chromium/media/base/routing_token_callback.h +++ b/chromium/media/base/routing_token_callback.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/base/run_all_perftests.cc b/chromium/media/base/run_all_perftests.cc index 435d8060899..ba1663f1121 100644 --- a/chromium/media/base/run_all_perftests.cc +++ b/chromium/media/base/run_all_perftests.cc @@ -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/base/sample_format.cc b/chromium/media/base/sample_format.cc index a87817f4aab..4b973f632e2 100644 --- a/chromium/media/base/sample_format.cc +++ b/chromium/media/base/sample_format.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -30,6 +30,7 @@ int SampleFormatToBytesPerChannel(SampleFormat sample_format) { case kSampleFormatF32: case kSampleFormatPlanarF32: case kSampleFormatPlanarS32: + case kSampleFormatIECDts: return 4; } @@ -73,6 +74,8 @@ const char* SampleFormatToString(SampleFormat sample_format) { return "Compressed DTS bitstream"; case kSampleFormatDtsxP2: return "Compressed DTSXP2 bitstream"; + case kSampleFormatIECDts: + return "IEC-61937 encapsulated DTS bitstream"; } NOTREACHED() << "Invalid sample format provided: " << sample_format; return ""; @@ -96,6 +99,7 @@ bool IsPlanar(SampleFormat sample_format) { case kSampleFormatMpegHAudio: case kSampleFormatDts: case kSampleFormatDtsxP2: + case kSampleFormatIECDts: return false; } @@ -115,6 +119,7 @@ bool IsInterleaved(SampleFormat sample_format) { case kSampleFormatMpegHAudio: case kSampleFormatDts: case kSampleFormatDtsxP2: + case kSampleFormatIECDts: return true; case kUnknownSampleFormat: case kSampleFormatPlanarU8: @@ -135,6 +140,7 @@ bool IsBitstream(SampleFormat sample_format) { case kSampleFormatMpegHAudio: case kSampleFormatDts: case kSampleFormatDtsxP2: + case kSampleFormatIECDts: // If on-device decoding is required, the sample format will be // kSampleFormatS16, so it will return false. If bit-stream passthrough // is required, the sample format would already be diff --git a/chromium/media/base/sample_format.h b/chromium/media/base/sample_format.h index 3f9204d0f2d..ed4735a80da 100644 --- a/chromium/media/base/sample_format.h +++ b/chromium/media/base/sample_format.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,9 +29,10 @@ enum SampleFormat { kSampleFormatPlanarU8, // Unsigned 8-bit w/ bias of 128 planar. kSampleFormatDts, // Compressed DTS audio bitstream. kSampleFormatDtsxP2, // Compressed DTSX audio bitstream. + kSampleFormatIECDts, // IEC-61937 encapsulated DTS audio bitstream. // Must always be equal to largest value ever logged. - kSampleFormatMax = kSampleFormatDtsxP2, + kSampleFormatMax = kSampleFormatIECDts, }; // Returns the number of bytes used per channel for the specified diff --git a/chromium/media/base/sample_rates.cc b/chromium/media/base/sample_rates.cc index 9d55ba747e8..8439b2dff88 100644 --- a/chromium/media/base/sample_rates.cc +++ b/chromium/media/base/sample_rates.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/base/sample_rates.h b/chromium/media/base/sample_rates.h index 80aa2ff5ca9..ca6e1849251 100644 --- a/chromium/media/base/sample_rates.h +++ b/chromium/media/base/sample_rates.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/base/scoped_async_trace.cc b/chromium/media/base/scoped_async_trace.cc index 83f6d5f64b0..3bfc07dbf95 100644 --- a/chromium/media/base/scoped_async_trace.cc +++ b/chromium/media/base/scoped_async_trace.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/scoped_async_trace.h b/chromium/media/base/scoped_async_trace.h index d6912a7b541..ae0eafeab72 100644 --- a/chromium/media/base/scoped_async_trace.h +++ b/chromium/media/base/scoped_async_trace.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/scopedfd_helper.cc b/chromium/media/base/scopedfd_helper.cc index 8dcf3dc1f16..966425e0b2f 100644 --- a/chromium/media/base/scopedfd_helper.cc +++ b/chromium/media/base/scopedfd_helper.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/scopedfd_helper.h b/chromium/media/base/scopedfd_helper.h index 68b7880bfcf..cb1a677fe07 100644 --- a/chromium/media/base/scopedfd_helper.h +++ b/chromium/media/base/scopedfd_helper.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/seekable_buffer.cc b/chromium/media/base/seekable_buffer.cc index a3766bcc003..ff98e068b5f 100644 --- a/chromium/media/base/seekable_buffer.cc +++ b/chromium/media/base/seekable_buffer.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/base/seekable_buffer.h b/chromium/media/base/seekable_buffer.h index 605e196fb0f..70ff4dc8c20 100644 --- a/chromium/media/base/seekable_buffer.h +++ b/chromium/media/base/seekable_buffer.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/base/seekable_buffer_unittest.cc b/chromium/media/base/seekable_buffer_unittest.cc index df18af5d516..8e913202627 100644 --- a/chromium/media/base/seekable_buffer_unittest.cc +++ b/chromium/media/base/seekable_buffer_unittest.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/base/serial_runner.cc b/chromium/media/base/serial_runner.cc index 683974a3b2c..d43a34ece33 100644 --- a/chromium/media/base/serial_runner.cc +++ b/chromium/media/base/serial_runner.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/base/serial_runner.h b/chromium/media/base/serial_runner.h index da9117d9490..959816eb028 100644 --- a/chromium/media/base/serial_runner.h +++ b/chromium/media/base/serial_runner.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/base/serial_runner_unittest.cc b/chromium/media/base/serial_runner_unittest.cc index b37bff497c4..e3e4a40d3a3 100644 --- a/chromium/media/base/serial_runner_unittest.cc +++ b/chromium/media/base/serial_runner_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/silent_sink_suspender.cc b/chromium/media/base/silent_sink_suspender.cc index ce424681ab4..d5ab8f5b3cd 100644 --- a/chromium/media/base/silent_sink_suspender.cc +++ b/chromium/media/base/silent_sink_suspender.cc @@ -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/base/silent_sink_suspender.h b/chromium/media/base/silent_sink_suspender.h index 7be7ab3900c..2432e27e077 100644 --- a/chromium/media/base/silent_sink_suspender.h +++ b/chromium/media/base/silent_sink_suspender.h @@ -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/base/silent_sink_suspender_unittest.cc b/chromium/media/base/silent_sink_suspender_unittest.cc index e9a69e3b318..520cf26c73d 100644 --- a/chromium/media/base/silent_sink_suspender_unittest.cc +++ b/chromium/media/base/silent_sink_suspender_unittest.cc @@ -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. @@ -19,7 +19,10 @@ namespace media { class SilentSinkSuspenderTest : public testing::Test { public: SilentSinkSuspenderTest() - : params_(AudioParameters::AUDIO_FAKE, CHANNEL_LAYOUT_MONO, 44100, 128), + : params_(AudioParameters::AUDIO_FAKE, + ChannelLayoutConfig::Mono(), + 44100, + 128), mock_sink_(new testing::StrictMock<MockAudioRendererSink>()), fake_callback_(0.1, params_.sample_rate()), temp_bus_(AudioBus::Create(params_)), diff --git a/chromium/media/base/simple_sync_token_client.cc b/chromium/media/base/simple_sync_token_client.cc index fcd06296ee6..373be4d6757 100644 --- a/chromium/media/base/simple_sync_token_client.cc +++ b/chromium/media/base/simple_sync_token_client.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/simple_sync_token_client.h b/chromium/media/base/simple_sync_token_client.h index 5c8fbb76ebb..c5857793940 100644 --- a/chromium/media/base/simple_sync_token_client.h +++ b/chromium/media/base/simple_sync_token_client.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/simple_watch_timer.cc b/chromium/media/base/simple_watch_timer.cc index c9108924709..aa9a39e89de 100644 --- a/chromium/media/base/simple_watch_timer.cc +++ b/chromium/media/base/simple_watch_timer.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/simple_watch_timer.h b/chromium/media/base/simple_watch_timer.h index 2963fe02bf5..152ff7dad9c 100644 --- a/chromium/media/base/simple_watch_timer.h +++ b/chromium/media/base/simple_watch_timer.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/sinc_resampler.cc b/chromium/media/base/sinc_resampler.cc index 96a032910d7..1a53e84b5c0 100644 --- a/chromium/media/base/sinc_resampler.cc +++ b/chromium/media/base/sinc_resampler.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/base/sinc_resampler.h b/chromium/media/base/sinc_resampler.h index 6d069fb4d0a..5ba1adab604 100644 --- a/chromium/media/base/sinc_resampler.h +++ b/chromium/media/base/sinc_resampler.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/base/sinc_resampler_perftest.cc b/chromium/media/base/sinc_resampler_perftest.cc index 4ac8c8a2941..122e6962031 100644 --- a/chromium/media/base/sinc_resampler_perftest.cc +++ b/chromium/media/base/sinc_resampler_perftest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/sinc_resampler_unittest.cc b/chromium/media/base/sinc_resampler_unittest.cc index 2faaade27a7..f77053c6536 100644 --- a/chromium/media/base/sinc_resampler_unittest.cc +++ b/chromium/media/base/sinc_resampler_unittest.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/base/speech_recognition_client.h b/chromium/media/base/speech_recognition_client.h index 8103b6a6eca..6182c2e58b1 100644 --- a/chromium/media/base/speech_recognition_client.h +++ b/chromium/media/base/speech_recognition_client.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/status.cc b/chromium/media/base/status.cc index 060b46a4ad8..792c38e68c9 100644 --- a/chromium/media/base/status.cc +++ b/chromium/media/base/status.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/status.h b/chromium/media/base/status.h index 4d5452c1148..7d80fd598e6 100644 --- a/chromium/media/base/status.h +++ b/chromium/media/base/status.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/status_unittest.cc b/chromium/media/base/status_unittest.cc index d77e18258fd..c8a23241fd8 100644 --- a/chromium/media/base/status_unittest.cc +++ b/chromium/media/base/status_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/stream_parser.cc b/chromium/media/base/stream_parser.cc index e7cb46769ed..69a45b81da1 100644 --- a/chromium/media/base/stream_parser.cc +++ b/chromium/media/base/stream_parser.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/base/stream_parser.h b/chromium/media/base/stream_parser.h index 4a0b0cae194..86069bbea60 100644 --- a/chromium/media/base/stream_parser.h +++ b/chromium/media/base/stream_parser.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. @@ -119,15 +119,14 @@ class MEDIA_EXPORT StreamParser { // been parsed to determine the initial stream configurations, presentation // start time, and duration. If |ignore_text_track| is true, then no text // buffers should be passed later by the parser to |new_buffers_cb|. - virtual void Init( - InitCB init_cb, - const NewConfigCB& config_cb, - const NewBuffersCB& new_buffers_cb, - bool ignore_text_track, - const EncryptedMediaInitDataCB& encrypted_media_init_data_cb, - const NewMediaSegmentCB& new_segment_cb, - const EndMediaSegmentCB& end_of_segment_cb, - MediaLog* media_log) = 0; + virtual void Init(InitCB init_cb, + NewConfigCB config_cb, + NewBuffersCB new_buffers_cb, + bool ignore_text_track, + EncryptedMediaInitDataCB encrypted_media_init_data_cb, + NewMediaSegmentCB new_segment_cb, + EndMediaSegmentCB end_of_segment_cb, + MediaLog* media_log) = 0; // Called during the reset parser state algorithm. This flushes the current // parser and puts the parser in a state where it can receive data. This diff --git a/chromium/media/base/stream_parser_buffer.cc b/chromium/media/base/stream_parser_buffer.cc index c064da21aae..63bdb31c7e7 100644 --- a/chromium/media/base/stream_parser_buffer.cc +++ b/chromium/media/base/stream_parser_buffer.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/base/stream_parser_buffer.h b/chromium/media/base/stream_parser_buffer.h index 9e4462905ff..55390b40e79 100644 --- a/chromium/media/base/stream_parser_buffer.h +++ b/chromium/media/base/stream_parser_buffer.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/base/stream_parser_unittest.cc b/chromium/media/base/stream_parser_unittest.cc index 4be5165bd00..9f407047587 100644 --- a/chromium/media/base/stream_parser_unittest.cc +++ b/chromium/media/base/stream_parser_unittest.cc @@ -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/base/subsample_entry.cc b/chromium/media/base/subsample_entry.cc index 85975ce2005..c9ee2617b4f 100644 --- a/chromium/media/base/subsample_entry.cc +++ b/chromium/media/base/subsample_entry.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/subsample_entry.h b/chromium/media/base/subsample_entry.h index f4117f61c5a..9c5328935d9 100644 --- a/chromium/media/base/subsample_entry.h +++ b/chromium/media/base/subsample_entry.h @@ -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/base/subsample_entry_unittest.cc b/chromium/media/base/subsample_entry_unittest.cc index 84b0d28c6c0..5622a4e3713 100644 --- a/chromium/media/base/subsample_entry_unittest.cc +++ b/chromium/media/base/subsample_entry_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/supported_types.cc b/chromium/media/base/supported_types.cc index c2efcdbb743..c47d83f0c06 100644 --- a/chromium/media/base/supported_types.cc +++ b/chromium/media/base/supported_types.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. @@ -205,7 +205,8 @@ bool IsHevcProfileSupported(const VideoType& type) { return false; #if BUILDFLAG(ENABLE_PLATFORM_HEVC) -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) +#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_CHROMEOS_LACROS) // TODO(b/171813538): For Lacros, the supplemental profile cache will be // asking lacros-gpu, but we will be doing decoding in ash-gpu. Until the @@ -217,14 +218,6 @@ bool IsHevcProfileSupported(const VideoType& type) { } #endif // BUILDFLAG(IS_CHROMEOS_LACROS) return GetSupplementalProfileCache()->IsProfileSupported(type.profile); -#elif BUILDFLAG(IS_MAC) - if (__builtin_available(macOS 11.0, *)) - return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport) && - (type.profile == HEVCPROFILE_MAIN || - type.profile == HEVCPROFILE_MAIN10 || - type.profile == HEVCPROFILE_MAIN_STILL_PICTURE || - type.profile == HEVCPROFILE_REXT); - return false; #elif BUILDFLAG(IS_ANDROID) // Technically android 5.0 mandates support for only HEVC main profile, // however some platforms (like chromecast) have had more profiles supported @@ -232,7 +225,8 @@ bool IsHevcProfileSupported(const VideoType& type) { return base::FeatureList::IsEnabled(kPlatformHEVCDecoderSupport); #else return true; -#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) +#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || + // BUILDFLAG(IS_MAC) #else return false; #endif // BUILDFLAG(ENABLE_PLATFORM_HEVC) @@ -404,6 +398,28 @@ bool IsDefaultSupportedAudioType(const AudioType& type) { } } +bool IsBuiltInVideoCodec(VideoCodec codec) { +#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) + if (codec == VideoCodec::kTheora) + return true; + if (codec == VideoCodec::kVP8) + return true; +#if BUILDFLAG(USE_PROPRIETARY_CODECS) + if (codec == VideoCodec::kH264) + return true; +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) +#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) +#if BUILDFLAG(ENABLE_LIBVPX) + if (codec == VideoCodec::kVP8 || codec == VideoCodec::kVP9) + return true; +#endif // BUILDFLAG(ENABLE_LIBVPX) +#if BUILDFLAG(ENABLE_AV1_DECODER) + if (codec == VideoCodec::kAV1) + return true; +#endif // BUILDFLAG(ENABLE_AV1_DECODER) + return false; +} + void UpdateDefaultSupportedVideoProfiles( const base::flat_set<media::VideoCodecProfile>& profiles) { GetSupplementalProfileCache()->UpdateCache(profiles); diff --git a/chromium/media/base/supported_types.h b/chromium/media/base/supported_types.h index 0bbb6e6cc3f..0e8148e1ab7 100644 --- a/chromium/media/base/supported_types.h +++ b/chromium/media/base/supported_types.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #define MEDIA_BASE_SUPPORTED_TYPES_H_ #include "base/containers/flat_set.h" +#include "media/base/media_export.h" #include "media/base/media_types.h" namespace media { @@ -22,6 +23,10 @@ MEDIA_EXPORT bool IsSupportedVideoType(const VideoType& type); MEDIA_EXPORT bool IsDefaultSupportedAudioType(const AudioType& type); MEDIA_EXPORT bool IsDefaultSupportedVideoType(const VideoType& type); +// This function describe if the specific video codec is a built into the binary +// or not. +MEDIA_EXPORT bool IsBuiltInVideoCodec(VideoCodec codec); + // This function lets the caller add additional codec profiles to those // supported by default. Used primarily to add hardware codec profiles once // support is known. diff --git a/chromium/media/base/supported_types_unittest.cc b/chromium/media/base/supported_types_unittest.cc index 1d0f12e0bfa..360b591c079 100644 --- a/chromium/media/base/supported_types_unittest.cc +++ b/chromium/media/base/supported_types_unittest.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. @@ -52,9 +52,6 @@ TEST(SupportedTypesTest, IsSupportedVideoTypeBasics) { EXPECT_FALSE( IsSupportedVideoType({VideoCodec::kMPEG2, VIDEO_CODEC_PROFILE_UNKNOWN, kUnspecifiedLevel, kColorSpace})); - EXPECT_FALSE( - IsSupportedVideoType({VideoCodec::kHEVC, VIDEO_CODEC_PROFILE_UNKNOWN, - kUnspecifiedLevel, kColorSpace})); // Expect conditional support for the following. EXPECT_EQ(kPropCodecsEnabled, @@ -64,6 +61,16 @@ TEST(SupportedTypesTest, IsSupportedVideoTypeBasics) { kMpeg4Supported, IsSupportedVideoType({VideoCodec::kMPEG4, VIDEO_CODEC_PROFILE_UNKNOWN, kUnspecifiedLevel, kColorSpace})); + +#if BUILDFLAG(ENABLE_PLATFORM_HEVC) && BUILDFLAG(IS_ANDROID) + EXPECT_TRUE( + IsSupportedVideoType({VideoCodec::kHEVC, VIDEO_CODEC_PROFILE_UNKNOWN, + kUnspecifiedLevel, kColorSpace})); +#else + EXPECT_FALSE( + IsSupportedVideoType({VideoCodec::kHEVC, VIDEO_CODEC_PROFILE_UNKNOWN, + kUnspecifiedLevel, kColorSpace})); +#endif } TEST(SupportedTypesTest, IsSupportedVideoType_VP9TransferFunctions) { @@ -236,14 +243,13 @@ TEST(SupportedTypesTest, IsSupportedAudioTypeWithSpatialRenderingBasics) { EXPECT_FALSE(IsSupportedAudioType({AudioCodec::kMpegHAudio, AudioCodecProfile::kUnknown, is_spatial_rendering})); -#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) +#if BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) EXPECT_FALSE(IsSupportedAudioType( {AudioCodec::kDTS, AudioCodecProfile::kUnknown, is_spatial_rendering})); EXPECT_FALSE( IsSupportedAudioType({AudioCodec::kDTSXP2, AudioCodecProfile::kUnknown, is_spatial_rendering})); -#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) && - // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) +#endif // BUILDFLAG(ENABLE_PLATFORM_DTS_AUDIO) EXPECT_FALSE( IsSupportedAudioType({AudioCodec::kUnknown, AudioCodecProfile::kUnknown, is_spatial_rendering})); @@ -317,4 +323,44 @@ TEST(SupportedTypesTest, IsSupportedVideoTypeWithHdrMetadataBasics) { kUnspecifiedLevel, color_space, gfx::HdrMetadataType::kSmpteSt2094_40})); } + +TEST(SupportedTypesTest, IsBuiltInVideoCodec) { +#if BUILDFLAG(USE_PROPRIETARY_CODECS) && BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) + EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kH264)); +#else + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kH264)); +#endif // BUILDFLAG(USE_PROPRIETARY_CODECS) && + // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) + +#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) + EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kTheora)); +#else + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kTheora)); +#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) + +#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) || BUILDFLAG(ENABLE_LIBVPX) + EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kVP8)); +#else + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kVP8)); +#endif // BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) || BUILDFLAG(ENABLE_LIBVPX) + +#if BUILDFLAG(ENABLE_LIBVPX) + EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kVP9)); +#else + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kVP9)); +#endif // BUILDFLAG(ENABLE_LIBVPX) + +#if BUILDFLAG(ENABLE_AV1_DECODER) + EXPECT_TRUE(IsBuiltInVideoCodec(VideoCodec::kAV1)); +#else + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kAV1)); +#endif // BUILDFLAG(ENABLE_AV1_DECODER) + + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kUnknown)); + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kMPEG4)); + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kVC1)); + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kMPEG2)); + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kHEVC)); + EXPECT_FALSE(IsBuiltInVideoCodec(VideoCodec::kDolbyVision)); +} } // namespace media diff --git a/chromium/media/base/supported_video_decoder_config.cc b/chromium/media/base/supported_video_decoder_config.cc index b3966073ee6..89b750bdbc0 100644 --- a/chromium/media/base/supported_video_decoder_config.cc +++ b/chromium/media/base/supported_video_decoder_config.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/supported_video_decoder_config.h b/chromium/media/base/supported_video_decoder_config.h index fc899eba76f..19ee80bf848 100644 --- a/chromium/media/base/supported_video_decoder_config.h +++ b/chromium/media/base/supported_video_decoder_config.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/supported_video_decoder_config_unittest.cc b/chromium/media/base/supported_video_decoder_config_unittest.cc index 14f0ad9146f..e9356c64c37 100644 --- a/chromium/media/base/supported_video_decoder_config_unittest.cc +++ b/chromium/media/base/supported_video_decoder_config_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/svc_scalability_mode.cc b/chromium/media/base/svc_scalability_mode.cc index 13eca157f43..d08fe196eb0 100644 --- a/chromium/media/base/svc_scalability_mode.cc +++ b/chromium/media/base/svc_scalability_mode.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/svc_scalability_mode.h b/chromium/media/base/svc_scalability_mode.h index 65ce610af07..cd6cf5a20e1 100644 --- a/chromium/media/base/svc_scalability_mode.h +++ b/chromium/media/base/svc_scalability_mode.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/test_data_util.cc b/chromium/media/base/test_data_util.cc index 0858b67d0dc..bdb5b3ecd42 100644 --- a/chromium/media/base/test_data_util.cc +++ b/chromium/media/base/test_data_util.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. @@ -223,6 +223,13 @@ scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name) { return buffer; } +scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name, + base::TimeDelta pts) { + auto buffer = ReadTestDataFile(name); + buffer->set_timestamp(pts); + return buffer; +} + bool LookupTestKeyVector(const std::vector<uint8_t>& key_id, bool allow_rotation, std::vector<uint8_t>* key) { diff --git a/chromium/media/base/test_data_util.h b/chromium/media/base/test_data_util.h index 79adec7de2e..2b1bb9fe7db 100644 --- a/chromium/media/base/test_data_util.h +++ b/chromium/media/base/test_data_util.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. @@ -12,6 +12,7 @@ #include "base/files/file_path.h" #include "base/memory/ref_counted.h" #include "base/strings/string_split.h" +#include "base/time/time.h" namespace media { @@ -44,6 +45,11 @@ std::string GetURLQueryString(const base::StringPairs& query_params); // |buffer| - The contents of the file. scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name); +// Reads a decoder buffer from a file as well, but also sets the presentation +// timestamp on it. +scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name, + base::TimeDelta pts); + // If the provided |key_id| is that of a test key, returns true and fills the // |key|, otherwise returns false. If |allowRotation| is true, then other valid // values are obtained by rotating the original key_id and key. Two overloads diff --git a/chromium/media/base/test_helpers.cc b/chromium/media/base/test_helpers.cc index 3a870c038d0..bb991588440 100644 --- a/chromium/media/base/test_helpers.cc +++ b/chromium/media/base/test_helpers.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. @@ -308,7 +308,7 @@ int TestAudioConfig::HighSampleRateValue() { // static AudioParameters TestAudioParameters::Normal() { return AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, - CHANNEL_LAYOUT_STEREO, 48000, 2048); + ChannelLayoutConfig::Stereo(), 48000, 2048); } template <class T> diff --git a/chromium/media/base/test_helpers.h b/chromium/media/base/test_helpers.h index b90bd816e99..f0b5fa30e52 100644 --- a/chromium/media/base/test_helpers.h +++ b/chromium/media/base/test_helpers.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/base/test_random.h b/chromium/media/base/test_random.h index 6c5eb51392b..699372758c7 100644 --- a/chromium/media/base/test_random.h +++ b/chromium/media/base/test_random.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/text_cue.cc b/chromium/media/base/text_cue.cc index 98d7757409a..9a99336e740 100644 --- a/chromium/media/base/text_cue.cc +++ b/chromium/media/base/text_cue.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/text_cue.h b/chromium/media/base/text_cue.h index fb5e8621b04..8cb57fe5df4 100644 --- a/chromium/media/base/text_cue.h +++ b/chromium/media/base/text_cue.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/text_ranges.cc b/chromium/media/base/text_ranges.cc index c57dc65529e..a52ed0d5f5e 100644 --- a/chromium/media/base/text_ranges.cc +++ b/chromium/media/base/text_ranges.cc @@ -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/base/text_ranges.h b/chromium/media/base/text_ranges.h index 64a384039b5..903c79296a5 100644 --- a/chromium/media/base/text_ranges.h +++ b/chromium/media/base/text_ranges.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/base/text_ranges_unittest.cc b/chromium/media/base/text_ranges_unittest.cc index 979ec2dd9b3..fd62bca83d9 100644 --- a/chromium/media/base/text_ranges_unittest.cc +++ b/chromium/media/base/text_ranges_unittest.cc @@ -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/base/text_renderer.cc b/chromium/media/base/text_renderer.cc index 93b3dba0861..d57f750f819 100644 --- a/chromium/media/base/text_renderer.cc +++ b/chromium/media/base/text_renderer.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/text_renderer.h b/chromium/media/base/text_renderer.h index 8efadcbf238..1494900090e 100644 --- a/chromium/media/base/text_renderer.h +++ b/chromium/media/base/text_renderer.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/text_renderer_unittest.cc b/chromium/media/base/text_renderer_unittest.cc index 68e805b7234..294f42537da 100644 --- a/chromium/media/base/text_renderer_unittest.cc +++ b/chromium/media/base/text_renderer_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/text_track.h b/chromium/media/base/text_track.h index 4d594a0bc50..abe49706cf0 100644 --- a/chromium/media/base/text_track.h +++ b/chromium/media/base/text_track.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/base/text_track_config.cc b/chromium/media/base/text_track_config.cc index a736883b956..33ed51db546 100644 --- a/chromium/media/base/text_track_config.cc +++ b/chromium/media/base/text_track_config.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/text_track_config.h b/chromium/media/base/text_track_config.h index 07f604d9fb3..c06226eb90b 100644 --- a/chromium/media/base/text_track_config.h +++ b/chromium/media/base/text_track_config.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/time_delta_interpolator.cc b/chromium/media/base/time_delta_interpolator.cc index a6eb4bfad72..06861b5a54a 100644 --- a/chromium/media/base/time_delta_interpolator.cc +++ b/chromium/media/base/time_delta_interpolator.cc @@ -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/base/time_delta_interpolator.h b/chromium/media/base/time_delta_interpolator.h index 80fe94b9b72..95757ca0183 100644 --- a/chromium/media/base/time_delta_interpolator.h +++ b/chromium/media/base/time_delta_interpolator.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/base/time_delta_interpolator_unittest.cc b/chromium/media/base/time_delta_interpolator_unittest.cc index c1c7935ea31..7caa8a193c4 100644 --- a/chromium/media/base/time_delta_interpolator_unittest.cc +++ b/chromium/media/base/time_delta_interpolator_unittest.cc @@ -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/base/time_source.h b/chromium/media/base/time_source.h index 92d6528d909..3dc2b8a530b 100644 --- a/chromium/media/base/time_source.h +++ b/chromium/media/base/time_source.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/base/timestamp_constants.h b/chromium/media/base/timestamp_constants.h index 1e47f8f0f00..715f54f38fb 100644 --- a/chromium/media/base/timestamp_constants.h +++ b/chromium/media/base/timestamp_constants.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/base/tuneable.cc b/chromium/media/base/tuneable.cc index d018fd6eee1..cc6b3d5e5ff 100644 --- a/chromium/media/base/tuneable.cc +++ b/chromium/media/base/tuneable.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/tuneable.h b/chromium/media/base/tuneable.h index bee6e132942..b9808a50424 100644 --- a/chromium/media/base/tuneable.h +++ b/chromium/media/base/tuneable.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/tuneable_unittest.cc b/chromium/media/base/tuneable_unittest.cc index f1e5108c1ff..70b6ee56fd1 100644 --- a/chromium/media/base/tuneable_unittest.cc +++ b/chromium/media/base/tuneable_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/use_after_free_checker.h b/chromium/media/base/use_after_free_checker.h index b50f704603d..86692309b83 100644 --- a/chromium/media/base/use_after_free_checker.h +++ b/chromium/media/base/use_after_free_checker.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/user_input_monitor.cc b/chromium/media/base/user_input_monitor.cc index ecea25e9ea6..6fa9f619f85 100644 --- a/chromium/media/base/user_input_monitor.cc +++ b/chromium/media/base/user_input_monitor.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/user_input_monitor.h b/chromium/media/base/user_input_monitor.h index 08c529924e3..ea1eda9ec74 100644 --- a/chromium/media/base/user_input_monitor.h +++ b/chromium/media/base/user_input_monitor.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/user_input_monitor_linux.cc b/chromium/media/base/user_input_monitor_linux.cc index 4aabec94662..3fc7a43f0c8 100644 --- a/chromium/media/base/user_input_monitor_linux.cc +++ b/chromium/media/base/user_input_monitor_linux.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/user_input_monitor_mac.cc b/chromium/media/base/user_input_monitor_mac.cc index 8cf48912bc3..0c2e3263eb0 100644 --- a/chromium/media/base/user_input_monitor_mac.cc +++ b/chromium/media/base/user_input_monitor_mac.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/user_input_monitor_unittest.cc b/chromium/media/base/user_input_monitor_unittest.cc index 58c9d92716a..71990e8c75c 100644 --- a/chromium/media/base/user_input_monitor_unittest.cc +++ b/chromium/media/base/user_input_monitor_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/user_input_monitor_win.cc b/chromium/media/base/user_input_monitor_win.cc index 9867d33d0b2..56c9f5e5dc0 100644 --- a/chromium/media/base/user_input_monitor_win.cc +++ b/chromium/media/base/user_input_monitor_win.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/vector_math.cc b/chromium/media/base/vector_math.cc index e919bbaa15a..39f29c2a5f9 100644 --- a/chromium/media/base/vector_math.cc +++ b/chromium/media/base/vector_math.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. @@ -8,33 +8,23 @@ #include <algorithm> #include "base/check_op.h" +#include "base/cpu.h" #include "base/memory/aligned_memory.h" #include "build/build_config.h" // NaCl does not allow intrinsics. #if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL) -#include <xmmintrin.h> -// Don't use custom SSE versions where the auto-vectorized C version performs -// better, which is anywhere clang is used. +#include <immintrin.h> +// Including these headers directly should generally be avoided. Since +// Chrome is compiled with -msse3 (the minimal requirement), we include the +// headers directly to make the intrinsics available. +#include <avxintrin.h> +#include <avx2intrin.h> +#include <fmaintrin.h> // TODO(pcc): Linux currently uses ThinLTO which has broken auto-vectorization // in clang, so use our intrinsic version for now. http://crbug.com/738085 -#if !defined(__clang__) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) -#define FMAC_FUNC FMAC_SSE -#define FMUL_FUNC FMUL_SSE -#else -#define FMAC_FUNC FMAC_C -#define FMUL_FUNC FMUL_C -#endif -#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE #elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) #include <arm_neon.h> -#define FMAC_FUNC FMAC_NEON -#define FMUL_FUNC FMUL_NEON -#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON -#else -#define FMAC_FUNC FMAC_C -#define FMUL_FUNC FMUL_C -#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_C #endif namespace media { @@ -43,7 +33,20 @@ namespace vector_math { void FMAC(const float src[], float scale, int len, float dest[]) { DCHECK(base::IsAligned(src, kRequiredAlignment)); DCHECK(base::IsAligned(dest, kRequiredAlignment)); - return FMAC_FUNC(src, scale, len, dest); + static const auto fmac_func = [] { +#if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL) + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) + return FMAC_AVX2; + return FMAC_SSE; +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + return FMAC_NEON; +#else + return FMAC_C; +#endif + }(); + + return fmac_func(src, scale, len, dest); } void FMAC_C(const float src[], float scale, int len, float dest[]) { @@ -54,7 +57,20 @@ void FMAC_C(const float src[], float scale, int len, float dest[]) { void FMUL(const float src[], float scale, int len, float dest[]) { DCHECK(base::IsAligned(src, kRequiredAlignment)); DCHECK(base::IsAligned(dest, kRequiredAlignment)); - return FMUL_FUNC(src, scale, len, dest); + static const auto fmul_func = [] { +#if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL) + base::CPU cpu; + if (cpu.has_avx2()) + return FMUL_AVX2; + return FMUL_SSE; +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + return FMUL_NEON; +#else + return FMUL_C; +#endif + }(); + + return fmul_func(src, scale, len, dest); } void FMUL_C(const float src[], float scale, int len, float dest[]) { @@ -65,7 +81,20 @@ void FMUL_C(const float src[], float scale, int len, float dest[]) { std::pair<float, float> EWMAAndMaxPower( float initial_value, const float src[], int len, float smoothing_factor) { DCHECK(base::IsAligned(src, kRequiredAlignment)); - return EWMAAndMaxPower_FUNC(initial_value, src, len, smoothing_factor); + static const auto ewma_and_max_power_func = [] { +#if defined(ARCH_CPU_X86_FAMILY) && !BUILDFLAG(IS_NACL) + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) + return EWMAAndMaxPower_AVX2; + return EWMAAndMaxPower_SSE; +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + return EWMAAndMaxPower_NEON; +#else + return EWMAAndMaxPower_C; +#endif + }(); + + return ewma_and_max_power_func(initial_value, src, len, smoothing_factor); } std::pair<float, float> EWMAAndMaxPower_C( @@ -95,6 +124,44 @@ void FMUL_SSE(const float src[], float scale, int len, float dest[]) { dest[i] = src[i] * scale; } +__attribute__((target("avx2"))) void FMUL_AVX2(const float src[], + float scale, + int len, + float dest[]) { + const int rem = len % 8; + const int last_index = len - rem; + __m256 m_scale = _mm256_set1_ps(scale); + // TODO(crbug.com/1191301): Remove below alignment conditionals when AudioBus + // |kChannelAlignment| updated to 32. + bool aligned_src = (reinterpret_cast<uintptr_t>(src) & 0x1F) == 0; + bool aligned_dest = (reinterpret_cast<uintptr_t>(dest) & 0x1F) == 0; + if (aligned_src) { + if (aligned_dest) { + for (int i = 0; i < last_index; i += 8) + _mm256_store_ps(dest + i, + _mm256_mul_ps(_mm256_load_ps(src + i), m_scale)); + } else { + for (int i = 0; i < last_index; i += 8) + _mm256_storeu_ps(dest + i, + _mm256_mul_ps(_mm256_load_ps(src + i), m_scale)); + } + } else { + if (aligned_dest) { + for (int i = 0; i < last_index; i += 8) + _mm256_store_ps(dest + i, + _mm256_mul_ps(_mm256_loadu_ps(src + i), m_scale)); + } else { + for (int i = 0; i < last_index; i += 8) + _mm256_storeu_ps(dest + i, + _mm256_mul_ps(_mm256_loadu_ps(src + i), m_scale)); + } + } + + // Handle any remaining values that wouldn't fit in an SSE pass. + for (int i = last_index; i < len; ++i) + dest[i] = src[i] * scale; +} + void FMAC_SSE(const float src[], float scale, int len, float dest[]) { const int rem = len % 4; const int last_index = len - rem; @@ -109,6 +176,48 @@ void FMAC_SSE(const float src[], float scale, int len, float dest[]) { dest[i] += src[i] * scale; } +__attribute__((target("avx2,fma"))) void FMAC_AVX2(const float src[], + float scale, + int len, + float dest[]) { + const int rem = len % 8; + const int last_index = len - rem; + __m256 m_scale = _mm256_set1_ps(scale); + // TODO(crbug.com/1191301): Remove below alignment conditionals when AudioBus + // |kChannelAlignment| updated to 32. + bool aligned_src = (reinterpret_cast<uintptr_t>(src) & 0x1F) == 0; + bool aligned_dest = (reinterpret_cast<uintptr_t>(dest) & 0x1F) == 0; + if (aligned_src) { + if (aligned_dest) { + for (int i = 0; i < last_index; i += 8) + _mm256_store_ps(dest + i, + _mm256_fmadd_ps(_mm256_load_ps(src + i), m_scale, + _mm256_load_ps(dest + i))); + } else { + for (int i = 0; i < last_index; i += 8) + _mm256_storeu_ps(dest + i, + _mm256_fmadd_ps(_mm256_load_ps(src + i), m_scale, + _mm256_loadu_ps(dest + i))); + } + } else { + if (aligned_dest) { + for (int i = 0; i < last_index; i += 8) + _mm256_store_ps(dest + i, + _mm256_fmadd_ps(_mm256_loadu_ps(src + i), m_scale, + _mm256_load_ps(dest + i))); + } else { + for (int i = 0; i < last_index; i += 8) + _mm256_storeu_ps(dest + i, + _mm256_fmadd_ps(_mm256_loadu_ps(src + i), m_scale, + _mm256_loadu_ps(dest + i))); + } + } + + // Handle any remaining values that wouldn't fit in an SSE pass. + for (int i = last_index; i < len; ++i) + dest[i] += src[i] * scale; +} + // Convenience macro to extract float 0 through 3 from the vector |a|. This is // needed because compilers other than clang don't support access via // operator[](). @@ -185,6 +294,79 @@ std::pair<float, float> EWMAAndMaxPower_SSE( return result; } + +__attribute__((target("avx2,fma"))) std::pair<float, float> +EWMAAndMaxPower_AVX2(float initial_value, + const float src[], + int len, + float smoothing_factor) { + const int rem = len % 8; + const int last_index = len - rem; + const float weight_prev = 1.0f - smoothing_factor; + + // y[7] = a(S[7]^2) + a(1-a)(S[6]^2) + a(1-a)^2(S[5]^2) + a(1-a)^3(S[4]^2) + + // a(1-a)^4(S[3]^2) + a(1-a)^5(S[2]^2) + a(1-a)^6(S[1]^2) + + // a(1-a)^7(S[0]^2) + (1-a)^8 * y[-1]. + // = SumS[0-7] + (1-a)^8 * y[-1]. + // y[15] = SumS[8-15] + (1-a)^8 * y[7]. + // y[23] = SumS[16-23] + (1-a)^8 * y[15]. + // ...... + // So the strategy is to read 8 float data at a time, and then + // calculate the average power and the maximum squared element value. + const __m256 sum_coeff = + !weight_prev + ? _mm256_set_ps(smoothing_factor, 0, 0, 0, 0, 0, 0, 0) + : _mm256_set_ps(smoothing_factor, smoothing_factor * weight_prev, + smoothing_factor * std::pow(weight_prev, 2), + smoothing_factor * std::pow(weight_prev, 3), + smoothing_factor * std::pow(weight_prev, 4), + smoothing_factor * std::pow(weight_prev, 5), + smoothing_factor * std::pow(weight_prev, 6), + smoothing_factor * std::pow(weight_prev, 7)); + + __m256 max = _mm256_setzero_ps(); + __m256 res = _mm256_set_ps(initial_value, 0, 0, 0, 0, 0, 0, 0); + __m256 res_coeff = !weight_prev ? _mm256_set1_ps(0) + : _mm256_set1_ps(std::pow(weight_prev, 8)); + bool aligned_src = (reinterpret_cast<uintptr_t>(src) & 0x1F) == 0; + int i = 0; + for (; i < last_index; i += 8) { + __m256 sample = + aligned_src ? _mm256_load_ps(src + i) : _mm256_loadu_ps(src + i); + __m256 sample_x2 = _mm256_mul_ps(sample, sample); + max = _mm256_max_ps(max, sample_x2); + res = _mm256_fmadd_ps(sample_x2, sum_coeff, _mm256_mul_ps(res, res_coeff)); + } + + std::pair<float, float> result(initial_value, 0); + // Sum components together to get the average power. + __m128 m128_sums = + _mm_add_ps(_mm256_extractf128_ps(res, 0), _mm256_extractf128_ps(res, 1)); + m128_sums = _mm_add_ps(_mm_movehl_ps(m128_sums, m128_sums), m128_sums); + float res_sum; + _mm_store_ss(&res_sum, + _mm_add_ss(m128_sums, _mm_shuffle_ps(m128_sums, m128_sums, 1))); + result.first = res_sum; + + __m128 m128_max = _mm_setzero_ps(); + m128_max = + _mm_max_ps(_mm256_extractf128_ps(max, 0), _mm256_extractf128_ps(max, 1)); + m128_max = _mm_max_ps( + m128_max, _mm_shuffle_ps(m128_max, m128_max, _MM_SHUFFLE(3, 3, 1, 1))); + m128_max = _mm_max_ss(m128_max, _mm_shuffle_ps(m128_max, m128_max, 2)); + result.second = std::max(EXTRACT_FLOAT(m128_max, 0), result.second); + + // Handle remaining values at the end of |src|. + for (; i < len; ++i) { + result.first *= weight_prev; + const float sample = src[i]; + const float sample_squared = sample * sample; + result.first += sample_squared * smoothing_factor; + result.second = std::max(result.second, sample_squared); + } + + return result; +} #endif #if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) diff --git a/chromium/media/base/vector_math.h b/chromium/media/base/vector_math.h index 66ca849fa98..edad49cb563 100644 --- a/chromium/media/base/vector_math.h +++ b/chromium/media/base/vector_math.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/base/vector_math_perftest.cc b/chromium/media/base/vector_math_perftest.cc index 690c274a95f..362f32e9ded 100644 --- a/chromium/media/base/vector_math_perftest.cc +++ b/chromium/media/base/vector_math_perftest.cc @@ -1,9 +1,10 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <memory> +#include "base/cpu.h" #include "base/memory/aligned_memory.h" #include "base/time/time.h" #include "build/build_config.h" @@ -86,38 +87,43 @@ class VectorMathPerfTest : public testing::Test { std::unique_ptr<float, base::AlignedFreeDeleter> output_vector_; }; -// Define platform dependent function names for SIMD optimized methods. -#if defined(ARCH_CPU_X86_FAMILY) -#define FMAC_FUNC FMAC_SSE -#define FMUL_FUNC FMUL_SSE -#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_SSE -#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) -#define FMAC_FUNC FMAC_NEON -#define FMUL_FUNC FMUL_NEON -#define EWMAAndMaxPower_FUNC EWMAAndMaxPower_NEON -#endif - // Benchmarks for each optimized vector_math::FMAC() method. // Benchmark FMAC_C(). TEST_F(VectorMathPerfTest, FMAC_unoptimized) { RunBenchmark(vector_math::FMAC_C, true, "_fmac", "unoptimized"); } -#if defined(FMAC_FUNC) // Benchmark FMAC_FUNC() with unaligned size. TEST_F(VectorMathPerfTest, FMAC_optimized_unaligned) { ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment / sizeof(float)), 0U); - RunBenchmark(vector_math::FMAC_FUNC, false, "_fmac", "optimized_unaligned"); +#if defined(ARCH_CPU_X86_FAMILY) + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) { + RunBenchmark(vector_math::FMAC_AVX2, false, "_fmac", "optimized_unaligned"); + } else if (cpu.has_sse2()) { + RunBenchmark(vector_math::FMAC_SSE, false, "_fmac", "optimized_unaligned"); + } +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + RunBenchmark(vector_math::FMAC_NEON, false, "_fmac", "optimized_unaligned"); +#endif } // Benchmark FMAC_FUNC() with aligned size. TEST_F(VectorMathPerfTest, FMAC_optimized_aligned) { ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), 0U); - RunBenchmark(vector_math::FMAC_FUNC, true, "_fmac", "optimized_aligned"); -} +#if defined(ARCH_CPU_X86_FAMILY) + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) { + RunBenchmark(vector_math::FMAC_AVX2, true, "_fmac", "optimized_aligned"); + } else if (cpu.has_sse2()) { + RunBenchmark(vector_math::FMAC_SSE, true, "_fmac", "optimized_aligned"); + } +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + RunBenchmark(vector_math::FMAC_NEON, true, "_fmac", "optimized_aligned"); #endif +} // Benchmarks for each optimized vector_math::FMUL() method. // Benchmark FMUL_C(). @@ -125,21 +131,37 @@ TEST_F(VectorMathPerfTest, FMUL_unoptimized) { RunBenchmark(vector_math::FMUL_C, true, "_fmul", "unoptimized"); } -#if defined(FMUL_FUNC) // Benchmark FMUL_FUNC() with unaligned size. TEST_F(VectorMathPerfTest, FMUL_optimized_unaligned) { ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment / sizeof(float)), 0U); - RunBenchmark(vector_math::FMUL_FUNC, false, "_fmul", "optimized_unaligned"); +#if defined(ARCH_CPU_X86_FAMILY) + base::CPU cpu; + if (cpu.has_avx2()) { + RunBenchmark(vector_math::FMUL_AVX2, false, "_fmul", "optimized_unaligned"); + } else if (cpu.has_sse2()) { + RunBenchmark(vector_math::FMUL_SSE, false, "_fmul", "optimized_unaligned"); + } +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + RunBenchmark(vector_math::FMUL_NEON, false, "_fmul", "optimized_unaligned"); +#endif } // Benchmark FMUL_FUNC() with aligned size. TEST_F(VectorMathPerfTest, FMUL_optimized_aligned) { ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), 0U); - RunBenchmark(vector_math::FMUL_FUNC, true, "_fmul", "optimized_aligned"); -} +#if defined(ARCH_CPU_X86_FAMILY) + base::CPU cpu; + if (cpu.has_avx2()) { + RunBenchmark(vector_math::FMUL_AVX2, true, "_fmul", "optimized_aligned"); + } else if (cpu.has_sse2()) { + RunBenchmark(vector_math::FMUL_SSE, true, "_fmul", "optimized_aligned"); + } +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + RunBenchmark(vector_math::FMUL_NEON, true, "_fmul", "optimized_aligned"); #endif +} // Benchmarks for each optimized vector_math::EWMAAndMaxPower() method. // Benchmark EWMAAndMaxPower_C(). @@ -148,22 +170,42 @@ TEST_F(VectorMathPerfTest, EWMAAndMaxPower_unoptimized) { "_ewma_and_max_power", "unoptimized"); } -#if defined(EWMAAndMaxPower_FUNC) // Benchmark EWMAAndMaxPower_FUNC() with unaligned size. TEST_F(VectorMathPerfTest, EWMAAndMaxPower_optimized_unaligned) { ASSERT_NE((kVectorSize - 1) % (vector_math::kRequiredAlignment / sizeof(float)), 0U); - RunBenchmark(vector_math::EWMAAndMaxPower_FUNC, kVectorSize - 1, +#if defined(ARCH_CPU_X86_FAMILY) + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) { + RunBenchmark(vector_math::EWMAAndMaxPower_AVX2, kVectorSize - 1, + "_ewma_and_max_power", "optimized_unaligned"); + } else if (cpu.has_sse2()) { + RunBenchmark(vector_math::EWMAAndMaxPower_SSE, kVectorSize - 1, + "_ewma_and_max_power", "optimized_unaligned"); + } +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + RunBenchmark(vector_math::EWMAAndMaxPower_NEON, kVectorSize - 1, "_ewma_and_max_power", "optimized_unaligned"); +#endif } // Benchmark EWMAAndMaxPower_FUNC() with aligned size. TEST_F(VectorMathPerfTest, EWMAAndMaxPower_optimized_aligned) { ASSERT_EQ(kVectorSize % (vector_math::kRequiredAlignment / sizeof(float)), 0U); - RunBenchmark(vector_math::EWMAAndMaxPower_FUNC, kVectorSize, +#if defined(ARCH_CPU_X86_FAMILY) + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) { + RunBenchmark(vector_math::EWMAAndMaxPower_AVX2, kVectorSize, + "_ewma_and_max_power", "optimized_aligned"); + } else if (cpu.has_sse2()) { + RunBenchmark(vector_math::EWMAAndMaxPower_SSE, kVectorSize, + "_ewma_and_max_power", "optimized_aligned"); + } +#elif defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) + RunBenchmark(vector_math::EWMAAndMaxPower_NEON, kVectorSize, "_ewma_and_max_power", "optimized_aligned"); -} #endif +} } // namespace media diff --git a/chromium/media/base/vector_math_testing.h b/chromium/media/base/vector_math_testing.h index ca7db161310..87441e032d9 100644 --- a/chromium/media/base/vector_math_testing.h +++ b/chromium/media/base/vector_math_testing.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. @@ -42,6 +42,19 @@ MEDIA_SHMEM_EXPORT std::pair<float, float> EWMAAndMaxPower_SSE( const float src[], int len, float smoothing_factor); +MEDIA_SHMEM_EXPORT void FMAC_AVX2(const float src[], + float scale, + int len, + float dest[]); +MEDIA_SHMEM_EXPORT void FMUL_AVX2(const float src[], + float scale, + int len, + float dest[]); +MEDIA_SHMEM_EXPORT std::pair<float, float> EWMAAndMaxPower_AVX2( + float initial_value, + const float src[], + int len, + float smoothing_factor); #endif #if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) diff --git a/chromium/media/base/vector_math_unittest.cc b/chromium/media/base/vector_math_unittest.cc index 8b24360ba75..b6a2abd2b11 100644 --- a/chromium/media/base/vector_math_unittest.cc +++ b/chromium/media/base/vector_math_unittest.cc @@ -1,10 +1,11 @@ -// 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. #include <cmath> #include <memory> +#include "base/cpu.h" #include "base/memory/aligned_memory.h" #include "base/strings/string_number_conversions.h" #include "base/strings/stringize_macros.h" @@ -80,6 +81,16 @@ TEST_F(VectorMathTest, FMAC) { input_vector_.get(), kScale, kVectorSize, output_vector_.get()); VerifyOutput(kResult); } + { + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) { + SCOPED_TRACE("FMAC_AVX2"); + FillTestVectors(kInputFillValue, kOutputFillValue); + vector_math::FMAC_AVX2(input_vector_.get(), kScale, kVectorSize, + output_vector_.get()); + VerifyOutput(kResult); + } + } #endif #if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) @@ -121,6 +132,16 @@ TEST_F(VectorMathTest, FMUL) { input_vector_.get(), kScale, kVectorSize, output_vector_.get()); VerifyOutput(kResult); } + { + base::CPU cpu; + if (cpu.has_avx2()) { + SCOPED_TRACE("FMUL_AVX2"); + FillTestVectors(kInputFillValue, kOutputFillValue); + vector_math::FMUL_AVX2(input_vector_.get(), kScale, kVectorSize, + output_vector_.get()); + VerifyOutput(kResult); + } + } #endif #if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) @@ -219,6 +240,17 @@ class EWMATestScenario { EXPECT_NEAR(expected_final_avg_, result.first, 0.0000001f); EXPECT_NEAR(expected_max_, result.second, 0.0000001f); } + { + base::CPU cpu; + if (cpu.has_avx2() && cpu.has_fma3()) { + SCOPED_TRACE("EWMAAndMaxPower_AVX2"); + const std::pair<float, float>& result = + vector_math::EWMAAndMaxPower_AVX2(initial_value_, data_.get(), + data_len_, smoothing_factor_); + EXPECT_NEAR(expected_final_avg_, result.first, 0.0000001f); + EXPECT_NEAR(expected_max_, result.second, 0.0000001f); + } + } #endif #if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) diff --git a/chromium/media/base/video_aspect_ratio.cc b/chromium/media/base/video_aspect_ratio.cc index d5a9d882377..dac01e2cad7 100644 --- a/chromium/media/base/video_aspect_ratio.cc +++ b/chromium/media/base/video_aspect_ratio.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/video_aspect_ratio.h b/chromium/media/base/video_aspect_ratio.h index 246f15be5a1..b001fcf1e06 100644 --- a/chromium/media/base/video_aspect_ratio.h +++ b/chromium/media/base/video_aspect_ratio.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/video_aspect_ratio_unittest.cc b/chromium/media/base/video_aspect_ratio_unittest.cc index ce466661146..67d94fef9f6 100644 --- a/chromium/media/base/video_aspect_ratio_unittest.cc +++ b/chromium/media/base/video_aspect_ratio_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/video_bitrate_allocation.cc b/chromium/media/base/video_bitrate_allocation.cc index 8c66ffb3288..99506147ba4 100644 --- a/chromium/media/base/video_bitrate_allocation.cc +++ b/chromium/media/base/video_bitrate_allocation.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_bitrate_allocation.h b/chromium/media/base/video_bitrate_allocation.h index 18c3f193c4c..7a8b5b359c1 100644 --- a/chromium/media/base/video_bitrate_allocation.h +++ b/chromium/media/base/video_bitrate_allocation.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_bitrate_allocation_unittest.cc b/chromium/media/base/video_bitrate_allocation_unittest.cc index 7606827d195..e38342b9321 100644 --- a/chromium/media/base/video_bitrate_allocation_unittest.cc +++ b/chromium/media/base/video_bitrate_allocation_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_codecs.cc b/chromium/media/base/video_codecs.cc index 4af7ed4684b..1df9c4b0c4c 100644 --- a/chromium/media/base/video_codecs.cc +++ b/chromium/media/base/video_codecs.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,6 +7,7 @@ #include "base/logging.h" #include "base/notreached.h" #include "base/strings/string_number_conversions.h" +#include "base/strings/string_piece.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" @@ -16,6 +17,8 @@ namespace media { // The names come from src/third_party/ffmpeg/libavcodec/codec_desc.c +// TODO(crbug.com/1357080): The returned strings are used by ChunkDemuxer in +// the code logic as well in tests. Merge with GetCodecNameForUMA() if possible. std::string GetCodecName(VideoCodec codec) { switch (codec) { case VideoCodec::kUnknown: @@ -45,6 +48,36 @@ std::string GetCodecName(VideoCodec codec) { return ""; } +// Reported as part of some UMA names. NEVER change existing strings! +std::string GetCodecNameForUMA(VideoCodec codec) { + switch (codec) { + case VideoCodec::kUnknown: + return "Unknown"; + case VideoCodec::kH264: + return "H264"; + case VideoCodec::kHEVC: + return "HEVC"; + case VideoCodec::kDolbyVision: + return "DolbyVision"; + case VideoCodec::kVC1: + return "VC1"; + case VideoCodec::kMPEG2: + return "MPEG2Video"; + case VideoCodec::kMPEG4: + return "MPEG4"; + case VideoCodec::kTheora: + return "Theora"; + case VideoCodec::kVP8: + return "VP8"; + case VideoCodec::kVP9: + return "VP9"; + case VideoCodec::kAV1: + return "AV1"; + } + NOTREACHED(); + return ""; +} + std::string GetProfileName(VideoCodecProfile profile) { switch (profile) { case VIDEO_CODEC_PROFILE_UNKNOWN: @@ -172,7 +205,7 @@ std::string BuildH264MimeSuffix(media::VideoCodecProfile profile, return base::StringPrintf(".%s%04x", profile_str.c_str(), level); } -bool ParseNewStyleVp9CodecID(const std::string& codec_id, +bool ParseNewStyleVp9CodecID(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc, VideoColorSpace* color_space) { @@ -310,7 +343,7 @@ bool ParseNewStyleVp9CodecID(const std::string& codec_id, return true; } -bool ParseLegacyVp9CodecID(const std::string& codec_id, +bool ParseLegacyVp9CodecID(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc) { if (codec_id == "vp9" || codec_id == "vp9.0") { @@ -326,7 +359,7 @@ bool ParseLegacyVp9CodecID(const std::string& codec_id, } #if BUILDFLAG(ENABLE_AV1_DECODER) -bool ParseAv1CodecId(const std::string& codec_id, +bool ParseAv1CodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc, VideoColorSpace* color_space) { @@ -528,7 +561,7 @@ bool ParseAv1CodecId(const std::string& codec_id, } #endif // BUILDFLAG(ENABLE_AV1_DECODER) -bool ParseAVCCodecId(const std::string& codec_id, +bool ParseAVCCodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc) { // Make sure we have avc1.xxxxxx or avc3.xxxxxx , where xxxxxx are hex digits @@ -627,7 +660,7 @@ static char IntToHex(int i) { return kHexString[i]; } -std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id) { +std::string TranslateLegacyAvc1CodecIds(base::StringPiece codec_id) { // Special handling for old, pre-RFC 6381 format avc1 strings, which are still // being used by some HLS apps to preserve backward compatibility with older // iOS devices. The old format was avc1.<profile>.<level> @@ -664,14 +697,14 @@ std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id) { } // This is not a valid legacy avc1 codec id - return the original codec id. - return codec_id; + return std::string(codec_id); } #endif #if BUILDFLAG(ENABLE_PLATFORM_HEVC) // The specification for HEVC codec id strings can be found in ISO IEC 14496-15 // dated 2012 or newer in the Annex E.3 -bool ParseHEVCCodecId(const std::string& codec_id, +bool ParseHEVCCodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc) { if (!base::StartsWith(codec_id, "hev1.", base::CompareCase::SENSITIVE) && @@ -829,19 +862,20 @@ bool ParseHEVCCodecId(const std::string& codec_id, #endif #if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) -bool IsDolbyVisionAVCCodecId(const std::string& codec_id) { +bool IsDolbyVisionAVCCodecId(base::StringPiece codec_id) { return base::StartsWith(codec_id, "dva1.", base::CompareCase::SENSITIVE) || base::StartsWith(codec_id, "dvav.", base::CompareCase::SENSITIVE); } -bool IsDolbyVisionHEVCCodecId(const std::string& codec_id) { +bool IsDolbyVisionHEVCCodecId(base::StringPiece codec_id) { return base::StartsWith(codec_id, "dvh1.", base::CompareCase::SENSITIVE) || base::StartsWith(codec_id, "dvhe.", base::CompareCase::SENSITIVE); } // The specification for Dolby Vision codec id strings can be found in Dolby -// Vision streams within the MPEG-DASH format. -bool ParseDolbyVisionCodecId(const std::string& codec_id, +// Vision streams within the MPEG-DASH format: +// https://professional.dolby.com/siteassets/content-creation/dolby-vision-for-content-creators/dolbyvisioninmpegdashspecification_v2_0_public_20190107.pdf +bool ParseDolbyVisionCodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc) { if (!IsDolbyVisionAVCCodecId(codec_id) && @@ -922,7 +956,7 @@ bool ParseDolbyVisionCodecId(const std::string& codec_id, // Level string should be two digits. unsigned level_id = 0; if (elem[2].size() != 2 || !base::StringToUint(elem[2], &level_id) || - level_id > 9 || level_id < 1) { + level_id > 13 || level_id < 1) { DVLOG(4) << __func__ << ": invalid format level_id=" << elem[2]; return false; } @@ -933,7 +967,7 @@ bool ParseDolbyVisionCodecId(const std::string& codec_id, } #endif -VideoCodec StringToVideoCodec(const std::string& codec_id) { +VideoCodec StringToVideoCodec(base::StringPiece codec_id) { VideoCodec codec = VideoCodec::kUnknown; VideoCodecProfile profile = VIDEO_CODEC_PROFILE_UNKNOWN; uint8_t level = 0; @@ -942,7 +976,7 @@ VideoCodec StringToVideoCodec(const std::string& codec_id) { return codec; } -void ParseCodec(const std::string& codec_id, +void ParseCodec(base::StringPiece codec_id, VideoCodec& codec, VideoCodecProfile& profile, uint8_t& level, diff --git a/chromium/media/base/video_codecs.h b/chromium/media/base/video_codecs.h index c5222568255..fe68796d084 100644 --- a/chromium/media/base/video_codecs.h +++ b/chromium/media/base/video_codecs.h @@ -1,4 +1,4 @@ -// Copyright 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. @@ -7,6 +7,8 @@ #include <stdint.h> #include <string> + +#include "base/strings/string_piece_forward.h" #include "media/base/media_export.h" #include "media/media_buildflags.h" @@ -114,7 +116,12 @@ struct CodecProfileLevel { VideoCodecLevel level; }; +// Returns a name for `codec` for logging and display purposes. std::string MEDIA_EXPORT GetCodecName(VideoCodec codec); + +// Returns a name for `codec` to be used for UMA reporting. +std::string MEDIA_EXPORT GetCodecNameForUMA(VideoCodec codec); + std::string MEDIA_EXPORT GetProfileName(VideoCodecProfile profile); std::string MEDIA_EXPORT BuildH264MimeSuffix(VideoCodecProfile profile, uint8_t level); @@ -125,45 +132,45 @@ std::string MEDIA_EXPORT BuildH264MimeSuffix(VideoCodecProfile profile, // ParseLegacyVp9CodecID handles parsing of legacy VP9 codec strings defined // for WebM. // TODO(kqyang): Consolidate the two functions once we address crbug.com/667834 -MEDIA_EXPORT bool ParseNewStyleVp9CodecID(const std::string& codec_id, +MEDIA_EXPORT bool ParseNewStyleVp9CodecID(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc, VideoColorSpace* color_space); -MEDIA_EXPORT bool ParseLegacyVp9CodecID(const std::string& codec_id, +MEDIA_EXPORT bool ParseLegacyVp9CodecID(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc); #if BUILDFLAG(ENABLE_AV1_DECODER) -MEDIA_EXPORT bool ParseAv1CodecId(const std::string& codec_id, +MEDIA_EXPORT bool ParseAv1CodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc, VideoColorSpace* color_space); #endif // Handle parsing AVC/H.264 codec ids as outlined in RFC 6381 and ISO-14496-10. -MEDIA_EXPORT bool ParseAVCCodecId(const std::string& codec_id, +MEDIA_EXPORT bool ParseAVCCodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc); #if BUILDFLAG(ENABLE_PLATFORM_HEVC) -MEDIA_EXPORT bool ParseHEVCCodecId(const std::string& codec_id, +MEDIA_EXPORT bool ParseHEVCCodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_idc); #endif #if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) -MEDIA_EXPORT bool ParseDolbyVisionCodecId(const std::string& codec_id, +MEDIA_EXPORT bool ParseDolbyVisionCodecId(base::StringPiece codec_id, VideoCodecProfile* profile, uint8_t* level_id); #endif -MEDIA_EXPORT void ParseCodec(const std::string& codec_id, +MEDIA_EXPORT void ParseCodec(base::StringPiece codec_id, VideoCodec& codec, VideoCodecProfile& profile, uint8_t& level, VideoColorSpace& color_space); -MEDIA_EXPORT VideoCodec StringToVideoCodec(const std::string& codec_id); +MEDIA_EXPORT VideoCodec StringToVideoCodec(base::StringPiece codec_id); MEDIA_EXPORT VideoCodec VideoCodecProfileToVideoCodec(VideoCodecProfile profile); @@ -172,7 +179,7 @@ VideoCodecProfileToVideoCodec(VideoCodecProfile profile); // Translate legacy avc1 codec ids (like avc1.66.30 or avc1.77.31) into a new // style standard avc1 codec ids like avc1.4D002F. If the input codec is not // recognized as a legacy codec id, then returns the input string unchanged. -std::string TranslateLegacyAvc1CodecIds(const std::string& codec_id); +std::string TranslateLegacyAvc1CodecIds(base::StringPiece codec_id); #endif MEDIA_EXPORT std::ostream& operator<<(std::ostream& os, diff --git a/chromium/media/base/video_codecs_unittest.cc b/chromium/media/base/video_codecs_unittest.cc index 0fd5f63c739..9e4d7a4e217 100644 --- a/chromium/media/base/video_codecs_unittest.cc +++ b/chromium/media/base/video_codecs_unittest.cc @@ -1,9 +1,10 @@ -// 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. #include <set> +#include "base/strings/string_piece.h" #include "base/strings/stringprintf.h" #include "media/base/video_codecs.h" #include "media/base/video_color_space.h" @@ -705,9 +706,17 @@ TEST(ParseDolbyVisionCodecIdTest, InvalidDolbyVisionCodecIds) { EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.03.07", &profile, &level_id)); EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.06.07", &profile, &level_id)); - // Level should be numbers between 1 and 9. + // Level should be two digit number and in the range [01, 13]. EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.00", &profile, &level_id)); - EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.10", &profile, &level_id)); + EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.01", &profile, &level_id)); + EXPECT_EQ(level_id, 1); + EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.09", &profile, &level_id)); + EXPECT_EQ(level_id, 9); + EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.10", &profile, &level_id)); + EXPECT_EQ(level_id, 10); + EXPECT_TRUE(ParseDolbyVisionCodecId("dvhe.04.13", &profile, &level_id)); + EXPECT_EQ(level_id, 13); + EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.14", &profile, &level_id)); EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.20", &profile, &level_id)); EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.04.99", &profile, &level_id)); @@ -725,6 +734,8 @@ TEST(ParseDolbyVisionCodecIdTest, InvalidDolbyVisionCodecIds) { EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.5.7.", &profile, &level_id)); EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.5.7..", &profile, &level_id)); EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.5.7...", &profile, &level_id)); + EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.05.7", &profile, &level_id)); + EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe.05.007", &profile, &level_id)); EXPECT_FALSE(ParseDolbyVisionCodecId("dvhe..5", &profile, &level_id)); #endif } diff --git a/chromium/media/base/video_color_space.cc b/chromium/media/base/video_color_space.cc index 6d7dbaa8c2b..bd49a23fc2f 100644 --- a/chromium/media/base/video_color_space.cc +++ b/chromium/media/base/video_color_space.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/base/video_color_space.h b/chromium/media/base/video_color_space.h index c6107755467..25911b56a84 100644 --- a/chromium/media/base/video_color_space.h +++ b/chromium/media/base/video_color_space.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/base/video_color_space_unittest.cc b/chromium/media/base/video_color_space_unittest.cc index 71986269858..fcc703ed0c5 100644 --- a/chromium/media/base/video_color_space_unittest.cc +++ b/chromium/media/base/video_color_space_unittest.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/base/video_decoder.cc b/chromium/media/base/video_decoder.cc index ac3e05da39e..2c5a67f78c7 100644 --- a/chromium/media/base/video_decoder.cc +++ b/chromium/media/base/video_decoder.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/base/video_decoder.h b/chromium/media/base/video_decoder.h index 36f314f9a46..455f43b5ba7 100644 --- a/chromium/media/base/video_decoder.h +++ b/chromium/media/base/video_decoder.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. @@ -20,6 +20,10 @@ class DecoderBuffer; class VideoDecoderConfig; class VideoFrame; +// Interface for all video decoders. +// +// VideoDecoders may be constructed on any thread, after which all calls must +// occur on a single sequence (which may differ from the construction sequence). class MEDIA_EXPORT VideoDecoder : public Decoder { public: // Callback for Decoder initialization. diff --git a/chromium/media/base/video_decoder_config.cc b/chromium/media/base/video_decoder_config.cc index b28a2239029..94a841033a7 100644 --- a/chromium/media/base/video_decoder_config.cc +++ b/chromium/media/base/video_decoder_config.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/base/video_decoder_config.h b/chromium/media/base/video_decoder_config.h index f891848485e..2cdcc8a57e7 100644 --- a/chromium/media/base/video_decoder_config.h +++ b/chromium/media/base/video_decoder_config.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/base/video_decoder_config_unittest.cc b/chromium/media/base/video_decoder_config_unittest.cc index 6bfa5b94889..1bdc38d5f1b 100644 --- a/chromium/media/base/video_decoder_config_unittest.cc +++ b/chromium/media/base/video_decoder_config_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/video_encoder.cc b/chromium/media/base/video_encoder.cc index dffeaa0b3a7..f8b05fe7135 100644 --- a/chromium/media/base/video_encoder.cc +++ b/chromium/media/base/video_encoder.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/video_encoder.h b/chromium/media/base/video_encoder.h index dee21d5d8a5..cba5f44e0ca 100644 --- a/chromium/media/base/video_encoder.h +++ b/chromium/media/base/video_encoder.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/video_facing.h b/chromium/media/base/video_facing.h index ecd84835002..202a3072e42 100644 --- a/chromium/media/base/video_facing.h +++ b/chromium/media/base/video_facing.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/base/video_frame.cc b/chromium/media/base/video_frame.cc index 921dbbd68bf..4aa077a5678 100644 --- a/chromium/media/base/video_frame.cc +++ b/chromium/media/base/video_frame.cc @@ -1,9 +1,12 @@ -// 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. #include "media/base/video_frame.h" +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> + #include <algorithm> #include <climits> #include <numeric> @@ -76,8 +79,6 @@ std::string VideoFrame::StorageTypeToString( case VideoFrame::STORAGE_DMABUFS: return "DMABUFS"; #endif - case VideoFrame::STORAGE_MOJO_SHARED_BUFFER: - return "MOJO_SHARED_BUFFER"; case VideoFrame::STORAGE_GPU_MEMORY_BUFFER: return "GPU_MEMORY_BUFFER"; } @@ -100,8 +101,7 @@ bool VideoFrame::IsStorageTypeMappable(VideoFrame::StorageType storage_type) { // GetGpuMemoryBuffer() and call gfx::GpuMemoryBuffer::Map(). (storage_type == VideoFrame::STORAGE_UNOWNED_MEMORY || storage_type == VideoFrame::STORAGE_OWNED_MEMORY || - storage_type == VideoFrame::STORAGE_SHMEM || - storage_type == VideoFrame::STORAGE_MOJO_SHARED_BUFFER); + storage_type == VideoFrame::STORAGE_SHMEM); } // static @@ -366,7 +366,8 @@ scoped_refptr<VideoFrame> VideoFrame::WrapNativeTextures( format != PIXEL_FORMAT_NV12 && format != PIXEL_FORMAT_I420 && format != PIXEL_FORMAT_ABGR && format != PIXEL_FORMAT_XBGR && format != PIXEL_FORMAT_XR30 && format != PIXEL_FORMAT_XB30 && - format != PIXEL_FORMAT_P016LE && format != PIXEL_FORMAT_RGBAF16) { + format != PIXEL_FORMAT_P016LE && format != PIXEL_FORMAT_RGBAF16 && + format != PIXEL_FORMAT_YV12) { DLOG(ERROR) << "Unsupported pixel format: " << VideoPixelFormatToString(format); return nullptr; @@ -836,13 +837,6 @@ scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame( const gfx::Size& natural_size) { DCHECK(frame->visible_rect().Contains(visible_rect)); - // The following storage type should not be wrapped as the shared region - // cannot be owned by both the wrapped frame and the wrapping frame. - // - // TODO: We can support this now since we have a reference to the wrapped - // frame through |wrapped_frame_|. - DCHECK(frame->storage_type() != STORAGE_MOJO_SHARED_BUFFER); - if (!AreValidPixelFormatsForWrap(frame->format(), format)) { DLOG(ERROR) << __func__ << " Invalid format conversion." << VideoPixelFormatToString(frame->format()) << " to " @@ -1144,12 +1138,12 @@ void VideoFrame::HashFrameForTesting(base::MD5Context* context, } void VideoFrame::BackWithSharedMemory( - const base::UnsafeSharedMemoryRegion* region) { + const base::ReadOnlySharedMemoryRegion* region) { DCHECK(!shm_region_); DCHECK(!owned_shm_region_.IsValid()); // Either we should be backing a frame created with WrapExternal*, or we are - // wrapping an existing STORAGE_SHMEM, in which case the storage - // type has already been set to STORAGE_SHMEM. + // wrapping an existing STORAGE_SHMEM, in which case the storage type has + // already been set to STORAGE_SHMEM. DCHECK(storage_type_ == STORAGE_UNOWNED_MEMORY || storage_type_ == STORAGE_SHMEM); DCHECK(region && region->IsValid()); @@ -1158,8 +1152,8 @@ void VideoFrame::BackWithSharedMemory( } void VideoFrame::BackWithOwnedSharedMemory( - base::UnsafeSharedMemoryRegion region, - base::WritableSharedMemoryMapping mapping) { + base::ReadOnlySharedMemoryRegion region, + base::ReadOnlySharedMemoryMapping mapping) { DCHECK(!shm_region_); DCHECK(!owned_shm_region_.IsValid()); // We should be backing a frame created with WrapExternal*. We cannot be @@ -1221,6 +1215,18 @@ gfx::ColorSpace VideoFrame::ColorSpace() const { return color_space_; } +bool VideoFrame::RequiresExternalSampler() const { + const bool result = + (format() == PIXEL_FORMAT_NV12 || format() == PIXEL_FORMAT_YV12 || + format() == PIXEL_FORMAT_P016LE) && + NumTextures() == 1; + // The texture target can be 0 for Fuchsia. + DCHECK(!result || + (mailbox_holder(0).texture_target == GL_TEXTURE_EXTERNAL_OES || + mailbox_holder(0).texture_target == 0u)); + return result; +} + int VideoFrame::row_bytes(size_t plane) const { return RowBytes(plane, format(), coded_size().width()); } @@ -1233,7 +1239,8 @@ int VideoFrame::columns(size_t plane) const { return Columns(plane, format(), coded_size().width()); } -const uint8_t* VideoFrame::visible_data(size_t plane) const { +template <typename T> +T VideoFrame::GetVisibleDataInternal(T data, size_t plane) const { DCHECK(IsValidPlane(format(), plane)); DCHECK(IsMappable()); @@ -1246,15 +1253,18 @@ const uint8_t* VideoFrame::visible_data(size_t plane) const { const gfx::Size subsample = SampleSize(format(), plane); DCHECK(offset.x() % subsample.width() == 0); DCHECK(offset.y() % subsample.height() == 0); - return data(plane) + + return data + stride(plane) * (offset.y() / subsample.height()) + // Row offset. BytesPerElement(format(), plane) * // Column offset. (offset.x() / subsample.width()); } -uint8_t* VideoFrame::visible_data(size_t plane) { - return const_cast<uint8_t*>( - static_cast<const VideoFrame*>(this)->visible_data(plane)); +const uint8_t* VideoFrame::visible_data(size_t plane) const { + return GetVisibleDataInternal<const uint8_t*>(data(plane), plane); +} + +uint8_t* VideoFrame::GetWritableVisibleData(size_t plane) { + return GetVisibleDataInternal<uint8_t*>(writable_data(plane), plane); } const gpu::MailboxHolder& VideoFrame::mailbox_holder( diff --git a/chromium/media/base/video_frame.h b/chromium/media/base/video_frame.h index ed16de268c5..8c6d8738915 100644 --- a/chromium/media/base/video_frame.h +++ b/chromium/media/base/video_frame.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. @@ -18,8 +18,8 @@ #include "base/hash/md5.h" #include "base/memory/free_deleter.h" #include "base/memory/raw_ptr.h" +#include "base/memory/read_only_shared_memory_region.h" #include "base/memory/ref_counted.h" -#include "base/memory/unsafe_shared_memory_region.h" #include "base/synchronization/lock.h" #include "base/thread_annotations.h" #include "base/time/time.h" @@ -71,6 +71,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { kAPlane = 3, }; + // These values are persisted to logs. Entries should not be renumbered and + // numeric values should never be reused. // Defines the pixel storage type. Differentiates between directly accessible // |data_| and pixels that are only indirectly accessible and not via mappable // memory. @@ -81,7 +83,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { STORAGE_OPAQUE = 1, // We don't know how VideoFrame's pixels are stored. STORAGE_UNOWNED_MEMORY = 2, // External, non owned data pointers. STORAGE_OWNED_MEMORY = 3, // VideoFrame has allocated its own data buffer. - STORAGE_SHMEM = 4, // Backed by unsafe (writable) shared memory. + STORAGE_SHMEM = 4, // Backed by read-only shared memory. #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) // TODO(mcasas): Consider turning this type into STORAGE_NATIVE // based on the idea of using this same enum value for both DMA @@ -89,11 +91,8 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // STORAGE_UNOWNED_MEMORY) and handle it appropriately in all cases. STORAGE_DMABUFS = 5, // Each plane is stored into a DmaBuf. #endif - // Backed by a mojo shared buffer. This should only be used by the - // MojoSharedBufferVideoFrame subclass. - STORAGE_MOJO_SHARED_BUFFER = 6, - STORAGE_GPU_MEMORY_BUFFER = 7, - STORAGE_LAST = STORAGE_GPU_MEMORY_BUFFER, + STORAGE_GPU_MEMORY_BUFFER = 6, + STORAGE_MAX = STORAGE_GPU_MEMORY_BUFFER, }; // CB to be called on the mailbox backing this frame and its GpuMemoryBuffers @@ -417,23 +416,23 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // Returns a human readable string of StorageType. static std::string StorageTypeToString(VideoFrame::StorageType storage_type); - // A video frame wrapping external data may be backed by an unsafe shared + // A video frame wrapping external data may be backed by a read-only shared // memory region. These methods are used to appropriately transform a // VideoFrame created with WrapExternalData, WrapExternalYuvaData, etc. The - // storage type of the Video Frame will be changed to STORAGE_SHM. Once the - // backing of a VideoFrame is set, it cannot be changed. + // storage type of the Video Frame will be changed to STORAGE_READ_ONLY_SHMEM. + // Once the backing of a VideoFrame is set, it cannot be changed. // // The region is NOT owned by the video frame. Both the region and its // associated mapping must outlive this instance. - void BackWithSharedMemory(const base::UnsafeSharedMemoryRegion* region); + void BackWithSharedMemory(const base::ReadOnlySharedMemoryRegion* region); // As above, but the VideoFrame owns the shared memory region as well as the // mapping. They will be destroyed with their VideoFrame. - void BackWithOwnedSharedMemory(base::UnsafeSharedMemoryRegion region, - base::WritableSharedMemoryMapping mapping); + void BackWithOwnedSharedMemory(base::ReadOnlySharedMemoryRegion region, + base::ReadOnlySharedMemoryMapping mapping); // Valid for shared memory backed VideoFrames. - const base::UnsafeSharedMemoryRegion* shm_region() { + const base::ReadOnlySharedMemoryRegion* shm_region() const { DCHECK(IsValidSharedMemoryFrame()); DCHECK(storage_type_ == STORAGE_SHMEM); return shm_region_; @@ -482,6 +481,16 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { VideoPixelFormat format() const { return layout_.format(); } StorageType storage_type() const { return storage_type_; } + // Returns true if the video frame's contents should be accessed by sampling + // its one texture using an external sampler. Returns false if the video + // frame's planes should be accessed separately or if it's unknown whether an + // external sampler should be used. + // + // If this method returns true, VideoPixelFormatToGfxBufferFormat(format()) is + // guaranteed to not return nullopt. + // TODO(andrescj): enforce this with a test. + bool RequiresExternalSampler() const; + // The full dimensions of the video frame data. const gfx::Size& coded_size() const { return layout_.coded_size(); } // A subsection of [0, 0, coded_size().width(), coded_size.height()]. This @@ -517,7 +526,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { DCHECK(IsMappable()); return data_[plane]; } - uint8_t* data(size_t plane) { + uint8_t* writable_data(size_t plane) { DCHECK(IsValidPlane(format(), plane)); DCHECK(IsMappable()); return data_[plane]; @@ -532,7 +541,7 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // plane buffer specified by visible_rect().origin(). Memory is owned by // VideoFrame object and must not be freed by the caller. const uint8_t* visible_data(size_t plane) const; - uint8_t* visible_data(size_t plane); + uint8_t* GetWritableVisibleData(size_t plane); // Returns a mailbox holder for a given texture. // Only valid to call if this is a NATIVE_TEXTURE frame. Before using the @@ -702,6 +711,9 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // associated regions are valid. bool IsValidSharedMemoryFrame() const; + template <typename T> + T GetVisibleDataInternal(T data, size_t plane) const; + // VideFrameLayout (includes format, coded_size, and strides). const VideoFrameLayout layout_; @@ -733,12 +745,12 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> { // Shared memory handle, if this frame is STORAGE_SHMEM. The region pointed // to is unowned. - raw_ptr<const base::UnsafeSharedMemoryRegion> shm_region_ = nullptr; + raw_ptr<const base::ReadOnlySharedMemoryRegion> shm_region_ = nullptr; - // Used if this is a STORAGE_SHMEM frame with owned shared memory. In that - // case, shm_region_ will refer to this region. - base::UnsafeSharedMemoryRegion owned_shm_region_; - base::WritableSharedMemoryMapping owned_shm_mapping_; + // Used if this is a STORAGE_SHMEM frame with owned shared memory. + // In that case, shm_region_ will refer to this region. + base::ReadOnlySharedMemoryRegion owned_shm_region_; + base::ReadOnlySharedMemoryMapping owned_shm_mapping_; // GPU memory buffer, if this frame is STORAGE_GPU_MEMORY_BUFFER. std::unique_ptr<gfx::GpuMemoryBuffer> gpu_memory_buffer_; diff --git a/chromium/media/base/video_frame_layout.cc b/chromium/media/base/video_frame_layout.cc index b3d666289e4..b3307c302bf 100644 --- a/chromium/media/base/video_frame_layout.cc +++ b/chromium/media/base/video_frame_layout.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_frame_layout.h b/chromium/media/base/video_frame_layout.h index b1f40eae649..d899c15d2d3 100644 --- a/chromium/media/base/video_frame_layout.h +++ b/chromium/media/base/video_frame_layout.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_frame_layout_unittest.cc b/chromium/media/base/video_frame_layout_unittest.cc index 4ac87af1ffa..71ef5d11d75 100644 --- a/chromium/media/base/video_frame_layout_unittest.cc +++ b/chromium/media/base/video_frame_layout_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_frame_metadata.cc b/chromium/media/base/video_frame_metadata.cc index 26214645019..2f6c08c4185 100644 --- a/chromium/media/base/video_frame_metadata.cc +++ b/chromium/media/base/video_frame_metadata.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -75,4 +75,10 @@ void VideoFrameMetadata::MergeMetadataFrom( #undef MERGE_OPTIONAL_FIELD } +void VideoFrameMetadata::ClearTextureFrameMedatada() { + is_webgpu_compatible = false; + texture_origin_is_top_left = true; + read_lock_fences_enabled = false; +} + } // namespace media diff --git a/chromium/media/base/video_frame_metadata.h b/chromium/media/base/video_frame_metadata.h index de5b134f13b..dc64006c665 100644 --- a/chromium/media/base/video_frame_metadata.h +++ b/chromium/media/base/video_frame_metadata.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,6 +27,9 @@ struct MEDIA_EXPORT VideoFrameMetadata { // Merges internal values from |metadata_source|. void MergeMetadataFrom(const VideoFrameMetadata& metadata_source); + // CLear metadata fields that only make sense for texture backed frames. + void ClearTextureFrameMedatada(); + // Sources of VideoFrames use this marker to indicate that the associated // VideoFrame can be overlaid, case in which its contents do not need to be // further composited but displayed directly. diff --git a/chromium/media/base/video_frame_pool.cc b/chromium/media/base/video_frame_pool.cc index 8f6a0489fde..ec53badd74b 100644 --- a/chromium/media/base/video_frame_pool.cc +++ b/chromium/media/base/video_frame_pool.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/video_frame_pool.h b/chromium/media/base/video_frame_pool.h index 88cac326086..e6967810d6c 100644 --- a/chromium/media/base/video_frame_pool.h +++ b/chromium/media/base/video_frame_pool.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/video_frame_pool_unittest.cc b/chromium/media/base/video_frame_pool_unittest.cc index a52ba7eb833..4b659630702 100644 --- a/chromium/media/base/video_frame_pool_unittest.cc +++ b/chromium/media/base/video_frame_pool_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -120,7 +120,7 @@ TEST_F(VideoFramePoolTest, FrameValidAfterPoolDestruction) { // Write to the Y plane. The memory tools should detect a // use-after-free if the storage was actually removed by pool destruction. - memset(frame->data(VideoFrame::kYPlane), 0xff, + memset(frame->writable_data(VideoFrame::kYPlane), 0xff, frame->rows(VideoFrame::kYPlane) * frame->stride(VideoFrame::kYPlane)); } diff --git a/chromium/media/base/video_frame_unittest.cc b/chromium/media/base/video_frame_unittest.cc index f1265c11ff8..2fb254e8315 100644 --- a/chromium/media/base/video_frame_unittest.cc +++ b/chromium/media/base/video_frame_unittest.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. @@ -13,7 +13,7 @@ #include "base/callback_helpers.h" #include "base/format_macros.h" #include "base/memory/aligned_memory.h" -#include "base/memory/unsafe_shared_memory_region.h" +#include "base/memory/read_only_shared_memory_region.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" #include "gpu/command_buffer/common/mailbox_holder.h" @@ -150,14 +150,14 @@ void InitializeYV12Frame(VideoFrame* frame, double white_to_black) { EXPECT_EQ(PIXEL_FORMAT_YV12, frame->format()); const int first_black_row = static_cast<int>(frame->coded_size().height() * white_to_black); - uint8_t* y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* y_plane = frame->writable_data(VideoFrame::kYPlane); for (int row = 0; row < frame->coded_size().height(); ++row) { int color = (row < first_black_row) ? 0xFF : 0x00; memset(y_plane, color, frame->stride(VideoFrame::kYPlane)); y_plane += frame->stride(VideoFrame::kYPlane); } - uint8_t* u_plane = frame->data(VideoFrame::kUPlane); - uint8_t* v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* u_plane = frame->writable_data(VideoFrame::kUPlane); + uint8_t* v_plane = frame->writable_data(VideoFrame::kVPlane); for (int row = 0; row < frame->coded_size().height(); row += 2) { memset(u_plane, 0x80, frame->stride(VideoFrame::kUPlane)); memset(v_plane, 0x80, frame->stride(VideoFrame::kVPlane)); @@ -229,7 +229,7 @@ void ExpectFrameExtents(VideoPixelFormat format, const char* expected_hash) { EXPECT_TRUE(frame->row_bytes(plane)); EXPECT_TRUE(frame->columns(plane)); - memset(frame->data(plane), kFillByte, + memset(frame->writable_data(plane), kFillByte, frame->stride(plane) * frame->rows(plane)); } @@ -336,14 +336,14 @@ TEST(VideoFrame, CreateBlackFrame) { EXPECT_EQ(kHeight, frame->coded_size().height()); // Test frames themselves. - uint8_t* y_plane = frame->data(VideoFrame::kYPlane); + uint8_t* y_plane = frame->writable_data(VideoFrame::kYPlane); for (int y = 0; y < frame->coded_size().height(); ++y) { EXPECT_EQ(0, memcmp(kExpectedYRow, y_plane, std::size(kExpectedYRow))); y_plane += frame->stride(VideoFrame::kYPlane); } - uint8_t* u_plane = frame->data(VideoFrame::kUPlane); - uint8_t* v_plane = frame->data(VideoFrame::kVPlane); + uint8_t* u_plane = frame->writable_data(VideoFrame::kUPlane); + uint8_t* v_plane = frame->writable_data(VideoFrame::kVPlane); for (int y = 0; y < frame->coded_size().height() / 2; ++y) { EXPECT_EQ(0, memcmp(kExpectedUVRow, u_plane, std::size(kExpectedUVRow))); EXPECT_EQ(0, memcmp(kExpectedUVRow, v_plane, std::size(kExpectedUVRow))); @@ -441,20 +441,21 @@ TEST(VideoFrame, WrapExternalData) { // Create a frame that wraps read-only shared memory. TEST(VideoFrame, WrapSharedMemory) { const size_t kDataSize = 2 * 256 * 256; - base::UnsafeSharedMemoryRegion region = - base::UnsafeSharedMemoryRegion::Create(kDataSize); - ASSERT_TRUE(region.IsValid()); - base::WritableSharedMemoryMapping mapping = region.Map(); - ASSERT_TRUE(mapping.IsValid()); + base::MappedReadOnlyRegion mapped_region = + base::ReadOnlySharedMemoryRegion::Create(kDataSize); + ASSERT_TRUE(mapped_region.IsValid()); gfx::Size coded_size(256, 256); gfx::Rect visible_rect(coded_size); - CreateTestY16Frame(coded_size, visible_rect, mapping.memory()); + CreateTestY16Frame(coded_size, visible_rect, mapped_region.mapping.memory()); auto timestamp = base::Milliseconds(1); auto frame = VideoFrame::WrapExternalData( PIXEL_FORMAT_Y16, coded_size, visible_rect, visible_rect.size(), - mapping.GetMemoryAsSpan<uint8_t>().data(), kDataSize, timestamp); - frame->BackWithSharedMemory(®ion); + mapped_region.mapping.GetMemoryAsSpan<uint8_t>().data(), kDataSize, + timestamp); + EXPECT_EQ(frame->storage_type(), VideoFrame::STORAGE_UNOWNED_MEMORY); + frame->BackWithSharedMemory(&mapped_region.region); + EXPECT_EQ(frame->storage_type(), VideoFrame::STORAGE_SHMEM); EXPECT_EQ(frame->coded_size(), coded_size); EXPECT_EQ(frame->visible_rect(), visible_rect); EXPECT_EQ(frame->timestamp(), timestamp); @@ -783,6 +784,26 @@ TEST(VideoFrameMetadata, MergeMetadata) { VerifyVideoFrameMetadataEquality(empty_metadata, reference_metadata); } +TEST(VideoFrameMetadata, ClearTextureMetadata) { + VideoFrameMetadata reference_md = GetFullVideoFrameMetadata(); + reference_md.is_webgpu_compatible = true; + reference_md.texture_origin_is_top_left = false; + reference_md.read_lock_fences_enabled = true; + + VideoFrameMetadata copy_md; + copy_md.MergeMetadataFrom(reference_md); + + copy_md.ClearTextureFrameMedatada(); + EXPECT_FALSE(copy_md.is_webgpu_compatible); + EXPECT_TRUE(copy_md.texture_origin_is_top_left); + EXPECT_FALSE(copy_md.read_lock_fences_enabled); + + reference_md.is_webgpu_compatible = false; + reference_md.texture_origin_is_top_left = true; + reference_md.read_lock_fences_enabled = false; + VerifyVideoFrameMetadataEquality(copy_md, reference_md); +} + TEST(VideoFrameMetadata, PartialMergeMetadata) { VideoFrameMetadata full_metadata = GetFullVideoFrameMetadata(); diff --git a/chromium/media/base/video_renderer.cc b/chromium/media/base/video_renderer.cc index 006f04bea61..acaeada36b0 100644 --- a/chromium/media/base/video_renderer.cc +++ b/chromium/media/base/video_renderer.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/base/video_renderer.h b/chromium/media/base/video_renderer.h index 6e5611886f2..1a5a9faa31b 100644 --- a/chromium/media/base/video_renderer.h +++ b/chromium/media/base/video_renderer.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/base/video_renderer_sink.h b/chromium/media/base/video_renderer_sink.h index b7b034cdd02..6d9a77f208c 100644 --- a/chromium/media/base/video_renderer_sink.h +++ b/chromium/media/base/video_renderer_sink.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/video_thumbnail_decoder.cc b/chromium/media/base/video_thumbnail_decoder.cc index 11cd0cac32b..a6d8e0961da 100644 --- a/chromium/media/base/video_thumbnail_decoder.cc +++ b/chromium/media/base/video_thumbnail_decoder.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_thumbnail_decoder.h b/chromium/media/base/video_thumbnail_decoder.h index 4d83e7681d4..64358824f85 100644 --- a/chromium/media/base/video_thumbnail_decoder.h +++ b/chromium/media/base/video_thumbnail_decoder.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_thumbnail_decoder_unittest.cc b/chromium/media/base/video_thumbnail_decoder_unittest.cc index ed7b4ef0b8c..e68568605eb 100644 --- a/chromium/media/base/video_thumbnail_decoder_unittest.cc +++ b/chromium/media/base/video_thumbnail_decoder_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_transformation.cc b/chromium/media/base/video_transformation.cc index a293bb2ed09..65529a880a3 100644 --- a/chromium/media/base/video_transformation.cc +++ b/chromium/media/base/video_transformation.cc @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/video_transformation.h b/chromium/media/base/video_transformation.h index ca83c59caef..ee8005925a7 100644 --- a/chromium/media/base/video_transformation.h +++ b/chromium/media/base/video_transformation.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/video_transformation_unittest.cc b/chromium/media/base/video_transformation_unittest.cc index d0435e72f70..0de872d4662 100644 --- a/chromium/media/base/video_transformation_unittest.cc +++ b/chromium/media/base/video_transformation_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 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. #include "media/base/video_transformation.h" diff --git a/chromium/media/base/video_types.cc b/chromium/media/base/video_types.cc index 06315166fc0..ea148df9ec1 100644 --- a/chromium/media/base/video_types.cc +++ b/chromium/media/base/video_types.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -166,6 +166,51 @@ bool IsYuvPlanar(VideoPixelFormat format) { return false; } +bool IsRGB(VideoPixelFormat format) { + switch (format) { + case PIXEL_FORMAT_ARGB: + case PIXEL_FORMAT_XRGB: + case PIXEL_FORMAT_RGB24: + case PIXEL_FORMAT_ABGR: + case PIXEL_FORMAT_XBGR: + case PIXEL_FORMAT_XR30: + case PIXEL_FORMAT_XB30: + case PIXEL_FORMAT_BGRA: + case PIXEL_FORMAT_RGBAF16: + return true; + + case PIXEL_FORMAT_UNKNOWN: + case PIXEL_FORMAT_I420: + case PIXEL_FORMAT_YV12: + case PIXEL_FORMAT_I422: + case PIXEL_FORMAT_I420A: + case PIXEL_FORMAT_I444: + case PIXEL_FORMAT_NV12: + case PIXEL_FORMAT_NV21: + case PIXEL_FORMAT_UYVY: + case PIXEL_FORMAT_YUY2: + case PIXEL_FORMAT_MJPEG: + case PIXEL_FORMAT_YUV420P9: + case PIXEL_FORMAT_YUV420P10: + case PIXEL_FORMAT_YUV422P9: + case PIXEL_FORMAT_YUV422P10: + case PIXEL_FORMAT_YUV444P9: + case PIXEL_FORMAT_YUV444P10: + case PIXEL_FORMAT_YUV420P12: + case PIXEL_FORMAT_YUV422P12: + case PIXEL_FORMAT_YUV444P12: + case PIXEL_FORMAT_Y16: + case PIXEL_FORMAT_P016LE: + case PIXEL_FORMAT_I422A: + case PIXEL_FORMAT_I444A: + case PIXEL_FORMAT_YUV420AP10: + case PIXEL_FORMAT_YUV422AP10: + case PIXEL_FORMAT_YUV444AP10: + return false; + } + return false; +} + bool IsOpaque(VideoPixelFormat format) { switch (format) { case PIXEL_FORMAT_UNKNOWN: diff --git a/chromium/media/base/video_types.h b/chromium/media/base/video_types.h index 2ac3fb5aeb7..7f44dbf232d 100644 --- a/chromium/media/base/video_types.h +++ b/chromium/media/base/video_types.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -127,6 +127,9 @@ MEDIA_SHMEM_EXPORT std::string FourccToString(uint32_t fourcc); // Returns true if |format| is a YUV format with multiple planes. MEDIA_SHMEM_EXPORT bool IsYuvPlanar(VideoPixelFormat format); +// Returns true if |format| is an RGB format. +MEDIA_SHMEM_EXPORT bool IsRGB(VideoPixelFormat format); + // Returns true if |format| has no Alpha channel (hence is always opaque). MEDIA_SHMEM_EXPORT bool IsOpaque(VideoPixelFormat format); diff --git a/chromium/media/base/video_types_unittest.cc b/chromium/media/base/video_types_unittest.cc index b306308156c..a79134fb3ab 100644 --- a/chromium/media/base/video_types_unittest.cc +++ b/chromium/media/base/video_types_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/video_util.cc b/chromium/media/base/video_util.cc index 56a4a9a614b..85e5ee4400f 100644 --- a/chromium/media/base/video_util.cc +++ b/chromium/media/base/video_util.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. @@ -22,6 +22,7 @@ #include "media/base/video_frame.h" #include "media/base/video_frame_pool.h" #include "media/base/video_types.h" +#include "media/base/wait_and_replace_sync_token_client.h" #include "third_party/libyuv/include/libyuv.h" #include "third_party/skia/include/core/SkColorSpace.h" #include "third_party/skia/include/core/SkImage.h" @@ -66,6 +67,11 @@ void FillRegionOutsideVisibleRect(uint8_t* data, } VideoPixelFormat ReadbackFormat(const VideoFrame& frame) { + // The |frame|.BitDepth() restriction is to avoid treating a P016LE frame as a + // low-bit depth frame. + if (frame.RequiresExternalSampler() && frame.BitDepth() == 8u) + return PIXEL_FORMAT_XRGB; + switch (frame.format()) { case PIXEL_FORMAT_I420: case PIXEL_FORMAT_I420A: @@ -75,11 +81,8 @@ VideoPixelFormat ReadbackFormat(const VideoFrame& frame) { case PIXEL_FORMAT_XRGB: case PIXEL_FORMAT_ABGR: case PIXEL_FORMAT_XBGR: - return frame.format(); case PIXEL_FORMAT_NV12: - // |frame| may be backed by a graphics buffer that is NV12, but sampled as - // a single RGB texture. - return frame.NumTextures() == 1 ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_NV12; + return frame.format(); default: // Currently unsupported. return PIXEL_FORMAT_UNKNOWN; @@ -100,6 +103,9 @@ SkColorType SkColorTypeForPlane(VideoPixelFormat format, size_t plane) { case PIXEL_FORMAT_NV12: return plane == VideoFrame::kYPlane ? kAlpha_8_SkColorType : kR8G8_unorm_SkColorType; + case PIXEL_FORMAT_P016LE: + return plane == VideoFrame::kYPlane ? kA16_unorm_SkColorType + : kR16G16_unorm_SkColorType; case PIXEL_FORMAT_XBGR: case PIXEL_FORMAT_ABGR: return kRGBA_8888_SkColorType; @@ -138,6 +144,12 @@ bool ReadbackTexturePlaneToMemorySyncSkImage(const VideoFrame& src_frame, DCHECK(gr_context); VideoPixelFormat format = ReadbackFormat(src_frame); + if (format == PIXEL_FORMAT_UNKNOWN) { + DLOG(ERROR) << "Readback is not possible for this frame: " + << src_frame.AsHumanReadableString(); + return false; + } + int width = src_frame.columns(src_plane); int height = src_frame.rows(src_plane); bool has_alpha = !IsOpaque(format) && src_frame.NumTextures() == 1; @@ -202,6 +214,12 @@ bool ReadbackTexturePlaneToMemorySyncOOP(const VideoFrame& src_frame, size_t dest_stride, gpu::raster::RasterInterface* ri) { VideoPixelFormat format = ReadbackFormat(src_frame); + if (format == PIXEL_FORMAT_UNKNOWN) { + DLOG(ERROR) << "Readback is not possible for this frame: " + << src_frame.AsHumanReadableString(); + return false; + } + bool has_alpha = !IsOpaque(format) && src_frame.NumTextures() == 1; const gpu::MailboxHolder& holder = src_frame.mailbox_holder(src_plane); @@ -291,7 +309,7 @@ void LetterboxPlane(VideoFrame* frame, uint8_t fill_byte) { uint8_t* ptr = nullptr; if (frame->IsMappable()) { - ptr = frame->data(plane); + ptr = frame->writable_data(plane); } else if (frame->HasGpuMemoryBuffer()) { ptr = static_cast<uint8_t*>(frame->GetGpuMemoryBuffer()->memory(plane)); } @@ -304,11 +322,14 @@ void LetterboxPlane(VideoFrame* frame, } // namespace void FillYUV(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v) { - libyuv::I420Rect( - frame->data(VideoFrame::kYPlane), frame->stride(VideoFrame::kYPlane), - frame->data(VideoFrame::kUPlane), frame->stride(VideoFrame::kUPlane), - frame->data(VideoFrame::kVPlane), frame->stride(VideoFrame::kVPlane), 0, - 0, frame->coded_size().width(), frame->coded_size().height(), y, u, v); + libyuv::I420Rect(frame->writable_data(VideoFrame::kYPlane), + frame->stride(VideoFrame::kYPlane), + frame->writable_data(VideoFrame::kUPlane), + frame->stride(VideoFrame::kUPlane), + frame->writable_data(VideoFrame::kVPlane), + frame->stride(VideoFrame::kVPlane), 0, 0, + frame->coded_size().width(), frame->coded_size().height(), y, + u, v); } void FillYUVA(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v, uint8_t a) { @@ -316,7 +337,7 @@ void FillYUVA(VideoFrame* frame, uint8_t y, uint8_t u, uint8_t v, uint8_t a) { FillYUV(frame, y, u, v); // Fill the A plane. - libyuv::SetPlane(frame->data(VideoFrame::kAPlane), + libyuv::SetPlane(frame->writable_data(VideoFrame::kAPlane), frame->stride(VideoFrame::kAPlane), frame->row_bytes(VideoFrame::kAPlane), frame->rows(VideoFrame::kAPlane), a); @@ -673,11 +694,11 @@ bool I420CopyWithPadding(const VideoFrame& src_frame, VideoFrame* dst_frame) { src_frame.stride(VideoFrame::kUPlane), src_frame.visible_data(VideoFrame::kVPlane), src_frame.stride(VideoFrame::kVPlane), - dst_frame->data(VideoFrame::kYPlane), + dst_frame->writable_data(VideoFrame::kYPlane), dst_frame->stride(VideoFrame::kYPlane), - dst_frame->data(VideoFrame::kUPlane), + dst_frame->writable_data(VideoFrame::kUPlane), dst_frame->stride(VideoFrame::kUPlane), - dst_frame->data(VideoFrame::kVPlane), + dst_frame->writable_data(VideoFrame::kVPlane), dst_frame->stride(VideoFrame::kVPlane), src_frame.visible_rect().width(), src_frame.visible_rect().height())) @@ -685,19 +706,19 @@ bool I420CopyWithPadding(const VideoFrame& src_frame, VideoFrame* dst_frame) { // Padding the region outside the visible rect with the repeated last // column / row of the visible rect. This can improve the coding efficiency. - FillRegionOutsideVisibleRect(dst_frame->data(VideoFrame::kYPlane), + FillRegionOutsideVisibleRect(dst_frame->writable_data(VideoFrame::kYPlane), dst_frame->stride(VideoFrame::kYPlane), dst_frame->coded_size(), src_frame.visible_rect().size()); FillRegionOutsideVisibleRect( - dst_frame->data(VideoFrame::kUPlane), + dst_frame->writable_data(VideoFrame::kUPlane), dst_frame->stride(VideoFrame::kUPlane), VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kUPlane, dst_frame->coded_size()), VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kUPlane, src_frame.visible_rect().size())); FillRegionOutsideVisibleRect( - dst_frame->data(VideoFrame::kVPlane), + dst_frame->writable_data(VideoFrame::kVPlane), dst_frame->stride(VideoFrame::kVPlane), VideoFrame::PlaneSize(PIXEL_FORMAT_I420, VideoFrame::kVPlane, dst_frame->coded_size()), @@ -708,7 +729,7 @@ bool I420CopyWithPadding(const VideoFrame& src_frame, VideoFrame* dst_frame) { } scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync( - const VideoFrame& txt_frame, + VideoFrame& txt_frame, gpu::raster::RasterInterface* ri, GrDirectContext* gr_context, VideoFramePool* pool) { @@ -732,21 +753,21 @@ scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync( txt_frame.natural_size(), txt_frame.timestamp()); result->set_color_space(txt_frame.ColorSpace()); result->metadata().MergeMetadataFrom(txt_frame.metadata()); + result->metadata().ClearTextureFrameMedatada(); size_t planes = VideoFrame::NumPlanes(format); for (size_t plane = 0; plane < planes; plane++) { gfx::Rect src_rect(0, 0, txt_frame.columns(plane), txt_frame.rows(plane)); if (!ReadbackTexturePlaneToMemorySync( - txt_frame, plane, src_rect, result->data(plane), + txt_frame, plane, src_rect, result->writable_data(plane), result->stride(plane), ri, gr_context)) { return nullptr; } } - return result; } -bool ReadbackTexturePlaneToMemorySync(const VideoFrame& src_frame, +bool ReadbackTexturePlaneToMemorySync(VideoFrame& src_frame, size_t src_plane, gfx::Rect& src_rect, uint8_t* dest_pixels, @@ -755,14 +776,18 @@ bool ReadbackTexturePlaneToMemorySync(const VideoFrame& src_frame, GrDirectContext* gr_context) { DCHECK(ri); + bool result; if (gr_context) { - return ReadbackTexturePlaneToMemorySyncSkImage(src_frame, src_plane, - src_rect, dest_pixels, - dest_stride, ri, gr_context); + result = ReadbackTexturePlaneToMemorySyncSkImage( + src_frame, src_plane, src_rect, dest_pixels, dest_stride, ri, + gr_context); + } else { + result = ReadbackTexturePlaneToMemorySyncOOP(src_frame, src_plane, src_rect, + dest_pixels, dest_stride, ri); } - - return ReadbackTexturePlaneToMemorySyncOOP(src_frame, src_plane, src_rect, - dest_pixels, dest_stride, ri); + WaitAndReplaceSyncTokenClient client(ri); + src_frame.UpdateReleaseSyncToken(&client); + return result; } EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, @@ -820,11 +845,12 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, ? libyuv::ABGRToI420 : libyuv::ARGBToI420; int error = convert_fn( - src_data, src_stride, dst_frame.visible_data(VideoFrame::kYPlane), + src_data, src_stride, + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUPlane), dst_frame.stride(VideoFrame::kUPlane), - dst_frame.visible_data(VideoFrame::kVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kVPlane), dst_frame.stride(VideoFrame::kVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height()); if (error) @@ -834,7 +860,7 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, // Convert alpha channel separately libyuv::ARGBExtractAlpha( src_data, src_stride, - dst_frame.visible_data(media::VideoFrame::kAPlane), + dst_frame.GetWritableVisibleData(media::VideoFrame::kAPlane), dst_frame.stride(media::VideoFrame::kAPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height()); @@ -848,9 +874,10 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, ? libyuv::ABGRToNV12 : libyuv::ARGBToNV12; int error = convert_fn( - src_data, src_stride, dst_frame.visible_data(VideoFrame::kYPlane), + src_data, src_stride, + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane), dst_frame.stride(VideoFrame::kUVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height()); if (error) @@ -871,7 +898,7 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, src_frame.visible_data(VideoFrame::kAPlane), src_frame.stride(VideoFrame::kAPlane), src_frame.visible_rect().width(), src_frame.visible_rect().height(), - dst_frame.data(VideoFrame::kAPlane), + dst_frame.writable_data(VideoFrame::kAPlane), // TODO: Is this right? dst_frame.stride(VideoFrame::kAPlane), dst_frame.coded_size().width(), dst_frame.coded_size().height(), kDefaultFiltering); } @@ -883,11 +910,11 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, src_frame.visible_data(VideoFrame::kVPlane), src_frame.stride(VideoFrame::kVPlane), src_frame.visible_rect().width(), src_frame.visible_rect().height(), - dst_frame.visible_data(VideoFrame::kYPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUPlane), dst_frame.stride(VideoFrame::kUPlane), - dst_frame.visible_data(VideoFrame::kVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kVPlane), dst_frame.stride(VideoFrame::kVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height(), kDefaultFiltering); if (error) @@ -904,9 +931,9 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, src_frame.visible_data(VideoFrame::kUVPlane), src_frame.stride(VideoFrame::kUVPlane), src_frame.visible_rect().width(), src_frame.visible_rect().height(), - dst_frame.visible_data(VideoFrame::kYPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane), dst_frame.stride(VideoFrame::kUVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height(), kDefaultFiltering); @@ -925,11 +952,11 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, src_frame.stride(VideoFrame::kYPlane), src_frame.visible_data(VideoFrame::kUVPlane), src_frame.stride(VideoFrame::kUVPlane), - dst_frame.visible_data(VideoFrame::kYPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUPlane), dst_frame.stride(VideoFrame::kUPlane), - dst_frame.visible_data(VideoFrame::kVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kVPlane), dst_frame.stride(VideoFrame::kVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height()); if (error) @@ -962,11 +989,11 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, tmp_v, // Temporary V-plane for src UV-plane. tmp_uv_width, src_frame.visible_rect().width(), src_frame.visible_rect().height(), - dst_frame.visible_data(VideoFrame::kYPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUPlane), dst_frame.stride(VideoFrame::kUPlane), - dst_frame.visible_data(VideoFrame::kVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kVPlane), dst_frame.stride(VideoFrame::kVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height(), kDefaultFiltering); @@ -988,9 +1015,9 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, src_frame.stride(VideoFrame::kUPlane), src_frame.visible_data(VideoFrame::kVPlane), src_frame.stride(VideoFrame::kVPlane), - dst_frame.visible_data(VideoFrame::kYPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane), dst_frame.stride(VideoFrame::kUVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height()); if (error) @@ -1022,9 +1049,9 @@ EncoderStatus ConvertAndScaleFrame(const VideoFrame& src_frame, tmp_uv, // Temporary for merged UV-plane stride_uv, // Temporary stride src_frame.visible_rect().width(), src_frame.visible_rect().height(), - dst_frame.visible_data(VideoFrame::kYPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kYPlane), dst_frame.stride(VideoFrame::kYPlane), - dst_frame.visible_data(VideoFrame::kUVPlane), + dst_frame.GetWritableVisibleData(VideoFrame::kUVPlane), dst_frame.stride(VideoFrame::kUVPlane), dst_frame.visible_rect().width(), dst_frame.visible_rect().height(), kDefaultFiltering); diff --git a/chromium/media/base/video_util.h b/chromium/media/base/video_util.h index c451a57a7d4..d46355a6fc2 100644 --- a/chromium/media/base/video_util.h +++ b/chromium/media/base/video_util.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. @@ -156,7 +156,7 @@ MEDIA_EXPORT scoped_refptr<VideoFrame> ConvertToMemoryMappedFrame( // media::ConvertAndScaleFrame and put it into a new class // media:FrameSizeAndFormatConverter. MEDIA_EXPORT scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync( - const VideoFrame& txt_frame, + VideoFrame& txt_frame, gpu::raster::RasterInterface* ri, GrDirectContext* gr_context, VideoFramePool* pool = nullptr); @@ -164,7 +164,7 @@ MEDIA_EXPORT scoped_refptr<VideoFrame> ReadbackTextureBackedFrameToMemorySync( // Synchronously reads a single plane. |src_rect| is relative to the plane, // which may be smaller than |frame| due to subsampling. MEDIA_EXPORT bool ReadbackTexturePlaneToMemorySync( - const VideoFrame& src_frame, + VideoFrame& src_frame, size_t src_plane, gfx::Rect& src_rect, uint8_t* dest_pixels, diff --git a/chromium/media/base/video_util_unittest.cc b/chromium/media/base/video_util_unittest.cc index 64dc83e4b9b..e303dc71c0e 100644 --- a/chromium/media/base/video_util_unittest.cc +++ b/chromium/media/base/video_util_unittest.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. @@ -44,16 +44,16 @@ scoped_refptr<media::VideoFrame> CreateFrameWithPatternFilled( scoped_refptr<media::VideoFrame> frame(media::VideoFrame::CreateFrame( format, coded_size, visible_rect, natural_size, timestamp)); - FillPlaneWithPattern(frame->data(media::VideoFrame::kYPlane), + FillPlaneWithPattern(frame->writable_data(media::VideoFrame::kYPlane), frame->stride(media::VideoFrame::kYPlane), frame->visible_rect().size()); FillPlaneWithPattern( - frame->data(media::VideoFrame::kUPlane), + frame->writable_data(media::VideoFrame::kUPlane), frame->stride(media::VideoFrame::kUPlane), media::VideoFrame::PlaneSize(format, media::VideoFrame::kUPlane, frame->visible_rect().size())); FillPlaneWithPattern( - frame->data(media::VideoFrame::kVPlane), + frame->writable_data(media::VideoFrame::kVPlane), frame->stride(media::VideoFrame::kVPlane), media::VideoFrame::PlaneSize(format, media::VideoFrame::kVPlane, frame->visible_rect().size())); @@ -637,7 +637,7 @@ TEST_F(VideoUtilTest, WrapAsI420VideoFrame) { // ASAN. src_frame.reset(); for (auto plane : planes) - memset(dst_frame->data(plane), 1, dst_frame->stride(plane)); + memset(dst_frame->writable_data(plane), 1, dst_frame->stride(plane)); } } // namespace media diff --git a/chromium/media/base/wait_and_replace_sync_token_client.cc b/chromium/media/base/wait_and_replace_sync_token_client.cc index b78a6b0eb02..6c24795bdad 100644 --- a/chromium/media/base/wait_and_replace_sync_token_client.cc +++ b/chromium/media/base/wait_and_replace_sync_token_client.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/wait_and_replace_sync_token_client.h b/chromium/media/base/wait_and_replace_sync_token_client.h index 5a7ad527a41..8eec5897d3f 100644 --- a/chromium/media/base/wait_and_replace_sync_token_client.h +++ b/chromium/media/base/wait_and_replace_sync_token_client.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/waiting.h b/chromium/media/base/waiting.h index 93d1889be56..ec09d828eba 100644 --- a/chromium/media/base/waiting.h +++ b/chromium/media/base/waiting.h @@ -1,4 +1,4 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. +// Copyright 2018 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/base/wall_clock_time_source.cc b/chromium/media/base/wall_clock_time_source.cc index cdfcc687993..7feca1f7016 100644 --- a/chromium/media/base/wall_clock_time_source.cc +++ b/chromium/media/base/wall_clock_time_source.cc @@ -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/base/wall_clock_time_source.h b/chromium/media/base/wall_clock_time_source.h index 8a6674243dc..bfe13c3ba69 100644 --- a/chromium/media/base/wall_clock_time_source.h +++ b/chromium/media/base/wall_clock_time_source.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/base/wall_clock_time_source_unittest.cc b/chromium/media/base/wall_clock_time_source_unittest.cc index 20b701a336a..7335ffceab7 100644 --- a/chromium/media/base/wall_clock_time_source_unittest.cc +++ b/chromium/media/base/wall_clock_time_source_unittest.cc @@ -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/base/watch_time_keys.cc b/chromium/media/base/watch_time_keys.cc index c0480b51303..f482e687c60 100644 --- a/chromium/media/base/watch_time_keys.cc +++ b/chromium/media/base/watch_time_keys.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/base/watch_time_keys.h b/chromium/media/base/watch_time_keys.h index b22eb6c22a1..b6073001be2 100644 --- a/chromium/media/base/watch_time_keys.h +++ b/chromium/media/base/watch_time_keys.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/base/webvtt_util.h b/chromium/media/base/webvtt_util.h index a5c78477e1c..b368d43067a 100644 --- a/chromium/media/base/webvtt_util.h +++ b/chromium/media/base/webvtt_util.h @@ -1,4 +1,4 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// Copyright 2013 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/base/win/BUILD.gn b/chromium/media/base/win/BUILD.gn index 973ed768b42..6b0da6eeb0d 100644 --- a/chromium/media/base/win/BUILD.gn +++ b/chromium/media/base/win/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright 2015 The Chromium Authors. All rights reserved. +# Copyright 2015 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/base/win/d3d11_mocks.cc b/chromium/media/base/win/d3d11_mocks.cc index 326fe4bde33..a57f97079a5 100644 --- a/chromium/media/base/win/d3d11_mocks.cc +++ b/chromium/media/base/win/d3d11_mocks.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/base/win/d3d11_mocks.h b/chromium/media/base/win/d3d11_mocks.h index 91c611913fe..4b2ac345a90 100644 --- a/chromium/media/base/win/d3d11_mocks.h +++ b/chromium/media/base/win/d3d11_mocks.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/base/win/dcomp_texture_wrapper.h b/chromium/media/base/win/dcomp_texture_wrapper.h index 7944024f900..511621c8bb1 100644 --- a/chromium/media/base/win/dcomp_texture_wrapper.h +++ b/chromium/media/base/win/dcomp_texture_wrapper.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/win/dxgi_device_manager.cc b/chromium/media/base/win/dxgi_device_manager.cc index b83e31c1c2a..1e953a4e40e 100644 --- a/chromium/media/base/win/dxgi_device_manager.cc +++ b/chromium/media/base/win/dxgi_device_manager.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/win/dxgi_device_manager.h b/chromium/media/base/win/dxgi_device_manager.h index 8cc3b454d2e..66c581fa025 100644 --- a/chromium/media/base/win/dxgi_device_manager.h +++ b/chromium/media/base/win/dxgi_device_manager.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/win/dxgi_device_scope_handle_unittest.cc b/chromium/media/base/win/dxgi_device_scope_handle_unittest.cc index 6e98c00436b..64716c161a6 100644 --- a/chromium/media/base/win/dxgi_device_scope_handle_unittest.cc +++ b/chromium/media/base/win/dxgi_device_scope_handle_unittest.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/win/hresults.h b/chromium/media/base/win/hresults.h index c35505289c9..6e5399aab61 100644 --- a/chromium/media/base/win/hresults.h +++ b/chromium/media/base/win/hresults.h @@ -1,4 +1,4 @@ -// Copyright 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. @@ -21,6 +21,14 @@ constexpr HRESULT kErrorInitializeVideoWindowClass = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA02); constexpr HRESULT kErrorCdmProxyReceivedInInvalidState = MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA03); +constexpr HRESULT kErrorResolveCoreWinRTStringDelayload = + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA04); +constexpr HRESULT kErrorZeroProtectionSystemId = + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA05); +constexpr HRESULT kErrorLoadLibrary = + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA06); +constexpr HRESULT kErrorGetFunctionPointer = + MAKE_HRESULT(SEVERITY_ERROR, FACILITY_ITF, 0xFA07); } // namespace media diff --git a/chromium/media/base/win/media_foundation_cdm_proxy.h b/chromium/media/base/win/media_foundation_cdm_proxy.h index d56a1e79b31..7e6488b0e3e 100644 --- a/chromium/media/base/win/media_foundation_cdm_proxy.h +++ b/chromium/media/base/win/media_foundation_cdm_proxy.h @@ -1,4 +1,4 @@ -// Copyright 2019 The Chromium Authors. All rights reserved. +// Copyright 2019 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/base/win/mf_feature_checks.cc b/chromium/media/base/win/mf_feature_checks.cc index 7189f440f68..4f96939abb4 100644 --- a/chromium/media/base/win/mf_feature_checks.cc +++ b/chromium/media/base/win/mf_feature_checks.cc @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/win/mf_feature_checks.h b/chromium/media/base/win/mf_feature_checks.h index 2a5ea3b58fe..11ba17a77ce 100644 --- a/chromium/media/base/win/mf_feature_checks.h +++ b/chromium/media/base/win/mf_feature_checks.h @@ -1,4 +1,4 @@ -// Copyright 2021 The Chromium Authors. All rights reserved. +// Copyright 2021 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/base/win/mf_helpers.cc b/chromium/media/base/win/mf_helpers.cc index b04462857d4..0d558a61779 100644 --- a/chromium/media/base/win/mf_helpers.cc +++ b/chromium/media/base/win/mf_helpers.cc @@ -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/base/win/mf_helpers.h b/chromium/media/base/win/mf_helpers.h index 5a446739d1c..70b9907f62a 100644 --- a/chromium/media/base/win/mf_helpers.h +++ b/chromium/media/base/win/mf_helpers.h @@ -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/base/win/mf_initializer.cc b/chromium/media/base/win/mf_initializer.cc index eb585cad0c1..8fa6d65c337 100644 --- a/chromium/media/base/win/mf_initializer.cc +++ b/chromium/media/base/win/mf_initializer.cc @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/win/mf_initializer.h b/chromium/media/base/win/mf_initializer.h index 1c5077c2871..7a8014a10ee 100644 --- a/chromium/media/base/win/mf_initializer.h +++ b/chromium/media/base/win/mf_initializer.h @@ -1,4 +1,4 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. +// Copyright 2015 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/base/win/mf_mocks.cc b/chromium/media/base/win/mf_mocks.cc index 5c0d068f8ef..b03cb59b70e 100644 --- a/chromium/media/base/win/mf_mocks.cc +++ b/chromium/media/base/win/mf_mocks.cc @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/win/mf_mocks.h b/chromium/media/base/win/mf_mocks.h index 6f8bc4c1986..8f325e32ef5 100644 --- a/chromium/media/base/win/mf_mocks.h +++ b/chromium/media/base/win/mf_mocks.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. +// Copyright 2020 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/base/win/mf_util_export.h b/chromium/media/base/win/mf_util_export.h index 87900230a52..d761b6b16d8 100644 --- a/chromium/media/base/win/mf_util_export.h +++ b/chromium/media/base/win/mf_util_export.h @@ -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/base/win/overlay_state_observer_subscription.h b/chromium/media/base/win/overlay_state_observer_subscription.h index 16ca0870074..2a9ce8d347f 100644 --- a/chromium/media/base/win/overlay_state_observer_subscription.h +++ b/chromium/media/base/win/overlay_state_observer_subscription.h @@ -1,4 +1,4 @@ -// Copyright 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/base/win/test_utils.h b/chromium/media/base/win/test_utils.h index 8c7243af34a..a5e3752a083 100644 --- a/chromium/media/base/win/test_utils.h +++ b/chromium/media/base/win/test_utils.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. |