diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/media/cdm | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/media/cdm')
20 files changed, 43 insertions, 49 deletions
diff --git a/chromium/media/cdm/aes_decryptor.cc b/chromium/media/cdm/aes_decryptor.cc index 9b49a33dc2b..c8247812ef7 100644 --- a/chromium/media/cdm/aes_decryptor.cc +++ b/chromium/media/cdm/aes_decryptor.cc @@ -488,7 +488,8 @@ void AesDecryptor::RegisterNewKeyCB(StreamType stream_type, void AesDecryptor::Decrypt(StreamType stream_type, scoped_refptr<DecoderBuffer> encrypted, DecryptCB decrypt_cb) { - DVLOG(3) << __func__ << ": " << encrypted->AsHumanReadableString(); + DVLOG(3) << __func__ << ": " + << encrypted->AsHumanReadableString(/*verbose=*/true); if (!encrypted->decrypt_config()) { // If there is no DecryptConfig, then the data is unencrypted so return it diff --git a/chromium/media/cdm/aes_decryptor_unittest.cc b/chromium/media/cdm/aes_decryptor_unittest.cc index 0a812f3c310..df16bd852cd 100644 --- a/chromium/media/cdm/aes_decryptor_unittest.cc +++ b/chromium/media/cdm/aes_decryptor_unittest.cc @@ -284,7 +284,6 @@ class AesDecryptorTest : public testing::TestWithParam<TestType> { std::unique_ptr<CdmAuxiliaryHelper> cdm_helper( new MockCdmAuxiliaryHelper(std::move(allocator))); CdmAdapter::Create(helper_->KeySystemName(), - url::Origin::Create(GURL("http://foo.com")), cdm_config, create_cdm_func, std::move(cdm_helper), base::Bind(&MockCdmClient::OnSessionMessage, base::Unretained(&cdm_client_)), diff --git a/chromium/media/cdm/cbcs_decryptor_fuzzer.cc b/chromium/media/cdm/cbcs_decryptor_fuzzer.cc index 8b3bdad5ebe..c0a328594dc 100644 --- a/chromium/media/cdm/cbcs_decryptor_fuzzer.cc +++ b/chromium/media/cdm/cbcs_decryptor_fuzzer.cc @@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "base/logging.h" #include "crypto/symmetric_key.h" #include "media/base/decoder_buffer.h" #include "media/base/encryption_pattern.h" diff --git a/chromium/media/cdm/cdm_adapter.cc b/chromium/media/cdm/cdm_adapter.cc index caf9974ec57..bd619e71dc1 100644 --- a/chromium/media/cdm/cdm_adapter.cc +++ b/chromium/media/cdm/cdm_adapter.cc @@ -171,7 +171,6 @@ using crash_reporter::ScopedCrashKeyString; // static void CdmAdapter::Create( const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, CreateCdmFunc create_cdm_func, std::unique_ptr<CdmAuxiliaryHelper> helper, @@ -187,8 +186,8 @@ void CdmAdapter::Create( DCHECK(session_expiration_update_cb); scoped_refptr<CdmAdapter> cdm = - new CdmAdapter(key_system, security_origin, cdm_config, create_cdm_func, - std::move(helper), session_message_cb, session_closed_cb, + new CdmAdapter(key_system, cdm_config, create_cdm_func, std::move(helper), + session_message_cb, session_closed_cb, session_keys_change_cb, session_expiration_update_cb); // |cdm| ownership passed to the promise. @@ -198,7 +197,6 @@ void CdmAdapter::Create( CdmAdapter::CdmAdapter( const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, CreateCdmFunc create_cdm_func, std::unique_ptr<CdmAuxiliaryHelper> helper, @@ -207,7 +205,6 @@ CdmAdapter::CdmAdapter( const SessionKeysChangeCB& session_keys_change_cb, const SessionExpirationUpdateCB& session_expiration_update_cb) : key_system_(key_system), - origin_string_(security_origin.Serialize()), cdm_config_(cdm_config), create_cdm_func_(create_cdm_func), helper_(std::move(helper)), @@ -215,6 +212,7 @@ CdmAdapter::CdmAdapter( session_closed_cb_(session_closed_cb), session_keys_change_cb_(session_keys_change_cb), session_expiration_update_cb_(session_expiration_update_cb), + cdm_origin_(helper_->GetCdmOrigin().Serialize()), task_runner_(base::ThreadTaskRunnerHandle::Get()), pool_(new AudioBufferMemoryPool()) { DVLOG(1) << __func__; @@ -440,10 +438,11 @@ void CdmAdapter::RegisterNewKeyCB(StreamType stream_type, void CdmAdapter::Decrypt(StreamType stream_type, scoped_refptr<DecoderBuffer> encrypted, DecryptCB decrypt_cb) { - DVLOG(3) << __func__ << ": " << encrypted->AsHumanReadableString(); + DVLOG(3) << __func__ << ": " + << encrypted->AsHumanReadableString(/*verbose=*/true); DCHECK(task_runner_->BelongsToCurrentThread()); - ScopedCrashKeyString scoped_crash_key(&g_origin_crash_key, origin_string_); + ScopedCrashKeyString scoped_crash_key(&g_origin_crash_key, cdm_origin_); cdm::InputBuffer_2 input_buffer = {}; std::vector<cdm::SubsampleEntry> subsamples; @@ -559,10 +558,11 @@ void CdmAdapter::InitializeVideoDecoder(const VideoDecoderConfig& config, void CdmAdapter::DecryptAndDecodeAudio(scoped_refptr<DecoderBuffer> encrypted, const AudioDecodeCB& audio_decode_cb) { - DVLOG(3) << __func__ << ": " << encrypted->AsHumanReadableString(); + DVLOG(3) << __func__ << ": " + << encrypted->AsHumanReadableString(/*verbose=*/true); DCHECK(task_runner_->BelongsToCurrentThread()); - ScopedCrashKeyString scoped_crash_key(&g_origin_crash_key, origin_string_); + ScopedCrashKeyString scoped_crash_key(&g_origin_crash_key, cdm_origin_); cdm::InputBuffer_2 input_buffer = {}; std::vector<cdm::SubsampleEntry> subsamples; @@ -597,10 +597,11 @@ void CdmAdapter::DecryptAndDecodeAudio(scoped_refptr<DecoderBuffer> encrypted, void CdmAdapter::DecryptAndDecodeVideo(scoped_refptr<DecoderBuffer> encrypted, const VideoDecodeCB& video_decode_cb) { - DVLOG(3) << __func__ << ": " << encrypted->AsHumanReadableString(); + DVLOG(3) << __func__ << ": " + << encrypted->AsHumanReadableString(/*verbose=*/true); DCHECK(task_runner_->BelongsToCurrentThread()); - ScopedCrashKeyString scoped_crash_key(&g_origin_crash_key, origin_string_); + ScopedCrashKeyString scoped_crash_key(&g_origin_crash_key, cdm_origin_); cdm::InputBuffer_2 input_buffer = {}; std::vector<cdm::SubsampleEntry> subsamples; @@ -633,10 +634,7 @@ void CdmAdapter::DecryptAndDecodeVideo(scoped_refptr<DecoderBuffer> encrypted, return; } - if (is_video_encrypted_) { - decoded_frame->metadata()->SetBoolean(VideoFrameMetadata::PROTECTED_VIDEO, - true); - } + decoded_frame->metadata()->protected_video = is_video_encrypted_; video_decode_cb.Run(Decryptor::kSuccess, decoded_frame); } diff --git a/chromium/media/cdm/cdm_adapter.h b/chromium/media/cdm/cdm_adapter.h index 2b87592bb62..199c1b51d67 100644 --- a/chromium/media/cdm/cdm_adapter.h +++ b/chromium/media/cdm/cdm_adapter.h @@ -55,7 +55,6 @@ class MEDIA_EXPORT CdmAdapter : public ContentDecryptionModule, // |cdm_created_cb| will be called when the CDM is initialized. static void Create( const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, CreateCdmFunc create_cdm_func, std::unique_ptr<CdmAuxiliaryHelper> helper, @@ -157,7 +156,6 @@ class MEDIA_EXPORT CdmAdapter : public ContentDecryptionModule, private: CdmAdapter(const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, CreateCdmFunc create_cdm_func, std::unique_ptr<CdmAuxiliaryHelper> helper, @@ -209,7 +207,6 @@ class MEDIA_EXPORT CdmAdapter : public ContentDecryptionModule, void OnFileRead(int file_size_bytes); const std::string key_system_; - const std::string origin_string_; const CdmConfig cdm_config_; CreateCdmFunc create_cdm_func_; @@ -223,6 +220,9 @@ class MEDIA_EXPORT CdmAdapter : public ContentDecryptionModule, SessionKeysChangeCB session_keys_change_cb_; SessionExpirationUpdateCB session_expiration_update_cb_; + // CDM origin used in crash reporting. + const std::string cdm_origin_; + scoped_refptr<base::SingleThreadTaskRunner> task_runner_; scoped_refptr<AudioBufferMemoryPool> pool_; diff --git a/chromium/media/cdm/cdm_adapter_factory.cc b/chromium/media/cdm/cdm_adapter_factory.cc index 358988cc632..7af6fbd35bd 100644 --- a/chromium/media/cdm/cdm_adapter_factory.cc +++ b/chromium/media/cdm/cdm_adapter_factory.cc @@ -22,7 +22,6 @@ CdmAdapterFactory::~CdmAdapterFactory() = default; void CdmAdapterFactory::Create( const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, const SessionMessageCB& session_message_cb, const SessionClosedCB& session_closed_cb, @@ -31,14 +30,6 @@ void CdmAdapterFactory::Create( CdmCreatedCB cdm_created_cb) { DVLOG(1) << __func__ << ": key_system=" << key_system; - if (security_origin.opaque()) { - LOG(ERROR) << "Invalid Origin: " << security_origin; - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(cdm_created_cb), nullptr, "Invalid origin.")); - return; - } - CdmAdapter::CreateCdmFunc create_cdm_func = CdmModule::GetInstance()->GetCreateCdmFunc(); if (!create_cdm_func) { @@ -56,7 +47,7 @@ void CdmAdapterFactory::Create( return; } - CdmAdapter::Create(key_system, security_origin, cdm_config, create_cdm_func, + CdmAdapter::Create(key_system, cdm_config, create_cdm_func, std::move(cdm_helper), session_message_cb, session_closed_cb, session_keys_change_cb, session_expiration_update_cb, std::move(cdm_created_cb)); diff --git a/chromium/media/cdm/cdm_adapter_factory.h b/chromium/media/cdm/cdm_adapter_factory.h index 2bffc6ec3da..a7ed60de4a7 100644 --- a/chromium/media/cdm/cdm_adapter_factory.h +++ b/chromium/media/cdm/cdm_adapter_factory.h @@ -26,7 +26,6 @@ class MEDIA_EXPORT CdmAdapterFactory final : public CdmFactory { // CdmFactory implementation. void Create(const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, const SessionMessageCB& session_message_cb, const SessionClosedCB& session_closed_cb, diff --git a/chromium/media/cdm/cdm_adapter_unittest.cc b/chromium/media/cdm/cdm_adapter_unittest.cc index c8d9ad159b1..3b8cc935370 100644 --- a/chromium/media/cdm/cdm_adapter_unittest.cc +++ b/chromium/media/cdm/cdm_adapter_unittest.cc @@ -140,9 +140,8 @@ class CdmAdapterTestBase : public testing::Test, std::unique_ptr<StrictMock<MockCdmAuxiliaryHelper>> cdm_helper( new StrictMock<MockCdmAuxiliaryHelper>(std::move(allocator))); cdm_helper_ = cdm_helper.get(); - CdmAdapter::Create(GetKeySystemName(), - url::Origin::Create(GURL("http://foo.com")), cdm_config, - GetCreateCdmFunc(), std::move(cdm_helper), + CdmAdapter::Create(GetKeySystemName(), cdm_config, GetCreateCdmFunc(), + std::move(cdm_helper), base::Bind(&MockCdmClient::OnSessionMessage, base::Unretained(&cdm_client_)), base::Bind(&MockCdmClient::OnSessionClosed, diff --git a/chromium/media/cdm/cdm_auxiliary_helper.cc b/chromium/media/cdm/cdm_auxiliary_helper.cc index 4d163e112aa..6183e10da98 100644 --- a/chromium/media/cdm/cdm_auxiliary_helper.cc +++ b/chromium/media/cdm/cdm_auxiliary_helper.cc @@ -18,6 +18,10 @@ cdm::FileIO* CdmAuxiliaryHelper::CreateCdmFileIO(cdm::FileIOClient* client) { return nullptr; } +url::Origin CdmAuxiliaryHelper::GetCdmOrigin() { + return url::Origin(); +} + cdm::Buffer* CdmAuxiliaryHelper::CreateCdmBuffer(size_t capacity) { return nullptr; } diff --git a/chromium/media/cdm/cdm_auxiliary_helper.h b/chromium/media/cdm/cdm_auxiliary_helper.h index b6c829351a1..9bbf1301d12 100644 --- a/chromium/media/cdm/cdm_auxiliary_helper.h +++ b/chromium/media/cdm/cdm_auxiliary_helper.h @@ -17,6 +17,7 @@ #include "media/cdm/output_protection.h" #include "media/cdm/platform_verification.h" #include "media/media_buildflags.h" +#include "url/origin.h" namespace cdm { class FileIO; @@ -46,6 +47,10 @@ class MEDIA_EXPORT CdmAuxiliaryHelper : public CdmAllocator, // needed anymore. virtual cdm::FileIO* CreateCdmFileIO(cdm::FileIOClient* client); + // Gets the origin of the frame associated with the CDM, which could be empty + // if the origin is unavailable or if error happened. + virtual url::Origin GetCdmOrigin(); + // CdmAllocator implementation. cdm::Buffer* CreateCdmBuffer(size_t capacity) override; std::unique_ptr<VideoFrameImpl> CreateCdmVideoFrame() override; diff --git a/chromium/media/cdm/cdm_host_file.cc b/chromium/media/cdm/cdm_host_file.cc index 839dc5784f5..e4ad487d1f4 100644 --- a/chromium/media/cdm/cdm_host_file.cc +++ b/chromium/media/cdm/cdm_host_file.cc @@ -8,7 +8,9 @@ #include "base/command_line.h" #include "base/feature_list.h" +#include "base/files/file_util.h" #include "base/logging.h" +#include "base/macros.h" #include "base/memory/ptr_util.h" #include "media/cdm/api/content_decryption_module_ext.h" @@ -36,6 +38,9 @@ std::unique_ptr<CdmHostFile> CdmHostFile::Create( DVLOG(1) << " " << sig_file.IsValid() << ": " << sig_file_path.MaybeAsASCII(); + // Preread file at |file_path| for better performance. + ignore_result(PreReadFile(file_path, /*is_executable=*/false)); + return std::unique_ptr<CdmHostFile>( new CdmHostFile(file_path, std::move(file), std::move(sig_file))); } diff --git a/chromium/media/cdm/cdm_host_files.h b/chromium/media/cdm/cdm_host_files.h index a6782f7239e..7ed87f68f9a 100644 --- a/chromium/media/cdm/cdm_host_files.h +++ b/chromium/media/cdm/cdm_host_files.h @@ -11,7 +11,6 @@ #include "base/files/file.h" #include "base/files/file_path.h" #include "base/lazy_instance.h" -#include "base/logging.h" #include "base/macros.h" #include "base/memory/ptr_util.h" #include "base/native_library.h" diff --git a/chromium/media/cdm/cdm_module.cc b/chromium/media/cdm/cdm_module.cc index 6f451fcfad7..28cba10d248 100644 --- a/chromium/media/cdm/cdm_module.cc +++ b/chromium/media/cdm/cdm_module.cc @@ -9,6 +9,7 @@ #include "base/memory/ptr_util.h" #include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_macros.h" +#include "base/notreached.h" #include "base/time/time.h" #include "build/build_config.h" #include "components/crash/core/common/crash_key.h" diff --git a/chromium/media/cdm/cdm_wrapper.h b/chromium/media/cdm/cdm_wrapper.h index ed49aa29bf6..ef0eab69bf2 100644 --- a/chromium/media/cdm/cdm_wrapper.h +++ b/chromium/media/cdm/cdm_wrapper.h @@ -9,9 +9,9 @@ #include <string> +#include "base/check.h" #include "base/compiler_specific.h" #include "base/feature_list.h" -#include "base/logging.h" #include "base/macros.h" #include "media/base/media_switches.h" #include "media/cdm/api/content_decryption_module.h" diff --git a/chromium/media/cdm/cenc_decryptor_fuzzer.cc b/chromium/media/cdm/cenc_decryptor_fuzzer.cc index 3574f130822..1f485394db8 100644 --- a/chromium/media/cdm/cenc_decryptor_fuzzer.cc +++ b/chromium/media/cdm/cenc_decryptor_fuzzer.cc @@ -9,6 +9,7 @@ #include <string> #include <vector> +#include "base/logging.h" #include "crypto/symmetric_key.h" #include "media/base/decoder_buffer.h" #include "media/base/subsample_entry.h" diff --git a/chromium/media/cdm/default_cdm_factory.cc b/chromium/media/cdm/default_cdm_factory.cc index 2d1ea7eb27a..49b7ae0f8e9 100644 --- a/chromium/media/cdm/default_cdm_factory.cc +++ b/chromium/media/cdm/default_cdm_factory.cc @@ -34,20 +34,12 @@ static bool ShouldCreateAesDecryptor(const std::string& key_system) { void DefaultCdmFactory::Create( const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, const SessionMessageCB& session_message_cb, const SessionClosedCB& session_closed_cb, const SessionKeysChangeCB& session_keys_change_cb, const SessionExpirationUpdateCB& session_expiration_update_cb, CdmCreatedCB cdm_created_cb) { - if (security_origin.opaque()) { - base::ThreadTaskRunnerHandle::Get()->PostTask( - FROM_HERE, - base::BindOnce(std::move(cdm_created_cb), nullptr, "Invalid origin.")); - return; - } - if (!ShouldCreateAesDecryptor(key_system)) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(cdm_created_cb), nullptr, diff --git a/chromium/media/cdm/default_cdm_factory.h b/chromium/media/cdm/default_cdm_factory.h index 5c1941eced4..62c50f22617 100644 --- a/chromium/media/cdm/default_cdm_factory.h +++ b/chromium/media/cdm/default_cdm_factory.h @@ -20,7 +20,6 @@ class MEDIA_EXPORT DefaultCdmFactory : public CdmFactory { // CdmFactory implementation. void Create(const std::string& key_system, - const url::Origin& security_origin, const CdmConfig& cdm_config, const SessionMessageCB& session_message_cb, const SessionClosedCB& session_closed_cb, diff --git a/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h b/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h index 22ebd602a0a..728706ebe9a 100644 --- a/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h +++ b/chromium/media/cdm/library_cdm/cdm_host_proxy_impl.h @@ -7,7 +7,6 @@ #include "media/cdm/library_cdm/cdm_host_proxy.h" -#include "base/logging.h" #include "base/macros.h" namespace media { diff --git a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc index 35a9c0d8ae6..c52f6c47eee 100644 --- a/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc +++ b/chromium/media/cdm/library_cdm/clear_key_cdm/cdm_video_decoder.cc @@ -42,7 +42,7 @@ #include "media/filters/dav1d_video_decoder.h" #endif -#if BUILDFLAG(ENABLE_FFMPEG) +#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) #include "media/filters/ffmpeg_video_decoder.h" #endif @@ -260,7 +260,7 @@ class VideoDecoderAdapter : public CdmVideoDecoder { void OnVideoFrameReady(scoped_refptr<VideoFrame> video_frame) { // Do not queue EOS frames, which is not needed. - if (video_frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM)) + if (video_frame->metadata()->end_of_stream) return; decoded_video_frames_.push(std::move(video_frame)); @@ -326,7 +326,7 @@ std::unique_ptr<CdmVideoDecoder> CreateVideoDecoder( #endif } -#if BUILDFLAG(ENABLE_FFMPEG) +#if BUILDFLAG(ENABLE_FFMPEG_VIDEO_DECODERS) if (!video_decoder) video_decoder.reset(new FFmpegVideoDecoder(null_media_log.get())); #endif diff --git a/chromium/media/cdm/library_cdm/mock_library_cdm.cc b/chromium/media/cdm/library_cdm/mock_library_cdm.cc index 44bb672b3b8..46a1c576e60 100644 --- a/chromium/media/cdm/library_cdm/mock_library_cdm.cc +++ b/chromium/media/cdm/library_cdm/mock_library_cdm.cc @@ -6,6 +6,7 @@ #include <string> +#include "base/check.h" #include "base/logging.h" #include "media/cdm/library_cdm/cdm_host_proxy.h" #include "media/cdm/library_cdm/cdm_host_proxy_impl.h" |