Browse Source

chore: cherry-pick 3fbd1dca6a4d from libvpx (#40024)

* chore: cherry-pick 3fbd1dca6a4d from libvpx

* build: update patches config

* chore: update patches

* chore: update patches

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Samuel Attard 1 year ago
parent
commit
415301c477
3 changed files with 31 additions and 1 deletions
  1. 3 1
      patches/config.json
  2. 1 0
      patches/libvpx/.patches
  3. 27 0
      patches/libvpx/cherry-pick-3fbd1dca6a4d.patch

+ 3 - 1
patches/config.json

@@ -25,5 +25,7 @@
 
   "src/electron/patches/skia": "src/third_party/skia",
 
-  "src/electron/patches/libwebp": "src/third_party/libwebp/src"
+  "src/electron/patches/libwebp": "src/third_party/libwebp/src",
+
+  "src/electron/patches/libvpx": "src/third_party/libvpx/source/libvpx"
 }

+ 1 - 0
patches/libvpx/.patches

@@ -0,0 +1 @@
+cherry-pick-3fbd1dca6a4d.patch

+ 27 - 0
patches/libvpx/cherry-pick-3fbd1dca6a4d.patch

@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: James Zern <[email protected]>
+Date: Mon, 25 Sep 2023 18:55:59 -0700
+Subject: VP8: disallow thread count changes
+
+Currently allocations are done at encoder creation time. Going from
+threaded to non-threaded would cause a crash.
+
+Bug: chromium:1486441
+Change-Id: Ie301c2a70847dff2f0daae408fbef1e4d42e73d4
+
+diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
+index bcf5227029731c47b54d3d8cb339c23cd0986f36..27bacad8f97e8f141627ee6f7b85ab044dad4217 100644
+--- a/vp8/encoder/onyx_if.c
++++ b/vp8/encoder/onyx_if.c
+@@ -1443,6 +1443,11 @@ void vp8_change_config(VP8_COMP *cpi, VP8_CONFIG *oxcf) {
+   last_h = cpi->oxcf.Height;
+   prev_number_of_layers = cpi->oxcf.number_of_layers;
+ 
++  if (cpi->initial_width) {
++    // TODO(https://crbug.com/1486441): Allow changing thread counts; the
++    // allocation is done once in vp8_create_compressor().
++    oxcf->multi_threaded = cpi->oxcf.multi_threaded;
++  }
+   cpi->oxcf = *oxcf;
+ 
+   switch (cpi->oxcf.Mode) {