Browse Source

chore: cherry-pick a0a48e0132bc from chromium (#22984)

* chore: cherry-pick a0a48e0132bc from chromium

* resolve conflict
Jeremy Apthorp 5 years ago
parent
commit
4ae22e003b

+ 1 - 0
patches/common/chromium/.patches

@@ -102,3 +102,4 @@ move_readablestream_requests_onto_the_stack_before_iteration.patch
 streams_convert_state_dchecks_to_checks.patch
 audiocontext_haspendingactivity_unless_it_s_closed.patch
 protect_automatic_pull_handlers_with_mutex.patch
+mojovideoencodeacceleratorservice_handle_potential_later.patch

+ 40 - 0
patches/common/chromium/mojovideoencodeacceleratorservice_handle_potential_later.patch

@@ -0,0 +1,40 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Miguel Casas <[email protected]>
+Date: Thu, 5 Mar 2020 19:42:53 +0000
+Subject: MojoVideoEncodeAcceleratorService: handle potential later
+ Initialize()
+
+This CL fixes a potential Initialize()-after-Initialize() of the said
+service, as described in the bug, following the suggestion in #c11.
+
+Bug: 1056222
+Change-Id: Idd951d3f0bee62b94382ffe80e4e6b3cef33e6d9
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090031
+Commit-Queue: Miguel Casas <[email protected]>
+Commit-Queue: Chrome Cunningham <[email protected]>
+Auto-Submit: Miguel Casas <[email protected]>
+Reviewed-by: danakj <[email protected]>
+Reviewed-by: Chrome Cunningham <[email protected]>
+Cr-Commit-Position: refs/heads/master@{#747376}
+
+diff --git a/media/mojo/services/mojo_video_encode_accelerator_service.cc b/media/mojo/services/mojo_video_encode_accelerator_service.cc
+index f3d1a547d733df65485684ba8432109905cbd377..325744e69af3c99b94aa86e8f7cab3fd7b3d6189 100644
+--- a/media/mojo/services/mojo_video_encode_accelerator_service.cc
++++ b/media/mojo/services/mojo_video_encode_accelerator_service.cc
+@@ -49,10 +49,15 @@ void MojoVideoEncodeAcceleratorService::Initialize(
+     InitializeCallback success_callback) {
+   DVLOG(1) << __func__ << " " << config.AsHumanReadableString();
+   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+-  DCHECK(!encoder_);
+   DCHECK_EQ(PIXEL_FORMAT_I420, config.input_format)
+       << "Only I420 format supported";
+ 
++  if (encoder_) {
++    DLOG(ERROR) << __func__ << " VEA is already initialized";
++    std::move(success_callback).Run(false);
++    return;
++  }
++
+   if (!client) {
+     DLOG(ERROR) << __func__ << "null |client|";
+     std::move(success_callback).Run(false);