Repository: electron/electron (language: cpp)

Issue:
[Bug]: Desktop capturer thumbnails are generated in a low quality
### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

29.1.0

### What operating system are you using?

macOS

### Operating System Version

macOS Sonoma 14.4 (23E214)

### What arch are you using?

arm64 (including Apple Silicon)

### Last Known Working Electron version

29.0.1

### Expected Behavior

Thumbnails are generated with a good quality. (example from electron 29.0.1)
![image](https://github.com/electron/electron/assets/22202138/42115640-ce22-40d4-b3dc-2586148aac1e)


### Actual Behavior

Thumbnails are generated blurry.
![image](https://github.com/electron/electron/assets/22202138/d078749f-a3cd-45cd-ada3-6c990ea658aa)


### Testcase Gist URL

https://gist.github.com/7944bd3381db8d1cf6d7a4eca86b073e

### Additional Information

_No response_


Discussion / hints:
@MaximKalinin have you given your app permission to screen record?
> @MaximKalinin have you given your app permission to screen record?

Yes, I did.
Has there been a solution to this? I'm facing the same issue

Fix patch:
diff --git a/patches/chromium/.patches b/patches/chromium/.patches
index 801b1fef7f816..6c0178b57567d 100644
--- a/patches/chromium/.patches
+++ b/patches/chromium/.patches
@@ -137,3 +137,4 @@ cherry-pick-1b1f34234346.patch
 bindings_refactor_domdatastore.patch
 merge_fix_domarraybuffer_isdetached_and_comment_out_a_check.patch
 cherry-pick-98bcf9ef5cdd.patch
+cherry-pick-c1f25647c2fc.patch
diff --git a/patches/chromium/cherry-pick-c1f25647c2fc.patch b/patches/chromium/cherry-pick-c1f25647c2fc.patch
new file mode 100644
index 0000000000000..f52bb35ebc6c5
--- /dev/null
+++ b/patches/chromium/cherry-pick-c1f25647c2fc.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Johannes Kron <kron@chromium.org>
+Date: Tue, 13 Feb 2024 23:22:49 +0000
+Subject: Update thumbnail size when sources are selected
+
+(cherry picked from commit c1f25647c2fcbf5e5a2d574feb284bc7284b944d)
+
+Bug: b/40281869
+Change-Id: I2d5a3954886bc6a5742321aeab415362da19c0ce
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5285701
+Commit-Queue: Johannes Kron <kron@chromium.org>
+Reviewed-by: Elad Alon <eladalon@chromium.org>
+Cr-Commit-Position: refs/heads/main@{#1260137}
+
+diff --git a/chrome/browser/media/webrtc/thumbnail_capturer_mac.mm b/chrome/browser/media/webrtc/thumbnail_capturer_mac.mm
+index ebe194e9d4a77d74996cb575364a32b61ccfac52..b27f6348d338d8952716b51825586e5d29b75651 100644
+--- a/chrome/browser/media/webrtc/thumbnail_capturer_mac.mm
++++ b/chrome/browser/media/webrtc/thumbnail_capturer_mac.mm
+@@ -365,6 +365,8 @@ void API_AVAILABLE(macos(14.0))
+     gfx::Size thumbnail_size) {
+   DCHECK(task_runner_->RunsTasksInCurrentSequence());
+ 
++  thumbnail_size_ = thumbnail_size;
++
+   // The iteration is in reverse order so that the sources
+   // first in the list are captured first. This way we make sure that the first
+   // thumbnails in the view are captured first.


Test patch: