/
cherry-pick-a0a48e0132bc.patch
44 lines (40 loc) · 1.9 KB
/
cherry-pick-a0a48e0132bc.patch
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
32
33
34
35
36
37
38
39
40
41
42
43
44
From a0a48e0132bc04736a1ef116d89ae19eea01500d Mon Sep 17 00:00:00 2001
From: Miguel Casas <mcasas@chromium.org>
Date: Thu, 5 Mar 2020 19:42:53 +0000
Subject: [PATCH] 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 <mcasas@chromium.org>
Commit-Queue: Chrome Cunningham <chcunningham@chromium.org>
Auto-Submit: Miguel Casas <mcasas@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747376}
---
.../mojo/services/mojo_video_encode_accelerator_service.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/media/mojo/services/mojo_video_encode_accelerator_service.cc b/media/mojo/services/mojo_video_encode_accelerator_service.cc
index 50ade44981a1b..51d62ebbb2180 100644
--- a/media/mojo/services/mojo_video_encode_accelerator_service.cc
+++ b/media/mojo/services/mojo_video_encode_accelerator_service.cc
@@ -48,11 +48,16 @@ void MojoVideoEncodeAcceleratorService::Initialize(
InitializeCallback success_callback) {
DVLOG(1) << __func__ << " " << config.AsHumanReadableString();
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- DCHECK(!encoder_);
DCHECK(config.input_format == PIXEL_FORMAT_I420 ||
config.input_format == PIXEL_FORMAT_NV12)
<< "Only I420 or NV12 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);