New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: disable fetching thumbnails if thumbnailSize is 0 #14906
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @CapOM thanks for the PR
Can you make this backwards compatible by setting the thumbnails to nativeImage.createEmpty()
when width and height are 0
. This should be consistent with what was happening previously making this semver/minor
instead of semver/major
.
Hi, thx for the suggestion, where exactly ? Because dict.Set("thumbnail", Should already make it backward compatible cause the media_list_source.thumbnail is initialized with the gfx::ImageSkia 's default constructor, i.e. an empty image. |
Gentle ping ? |
If that's the case can you add a test to verify that 👍 Also you'll need to rebase this onto latest master as the desktop capturer API was refactored recently |
@CapOM This is now conflicting with master as well, just need to rebase and address
so that we can review and merge |
Since that chromium/src/chrome is now pulled from upstream instead of the old electron/chromium_src duplication I think I will first try to have the change on chromium_src/chrome/browser/media/native_desktop_media_list.cc in chromium upstream. |
Patch is now merged in chromium: https://chromium-review.googlesource.com/c/chromium/src/+/1295111 . So once it reaches electron's chromium I will rebase this PR which will just contain the doc part so. |
@CapOM please update the PR description with the proper template (copy from a new PR) |
@miniak Hi, can you provide more details about how to do that, I am not sure to follow, thx |
@CapOM The pull request should follow the format described here: https://raw.githubusercontent.com/electron/electron/master/.github/PULL_REQUEST_TEMPLATE.md |
Thx I will do it once electron uses chromium72 (see comment above) |
@CapOM Chromium 72 is merged, can you please rebase your PR? |
3a09180
to
e6aa4e5
Compare
Done |
e6aa4e5
to
308fa22
Compare
Hi, I added 'feat: ' in the PR and I added a release note in the commit description. Please take a look, thx! |
@CapOM could you rebase this on |
308fa22
to
697a010
Compare
@MarshallOfSound Hi, I want to add a test for what you suggested but I get:
Any idea ? This is on Ubuntu |
@codebytere Thx, this other way you pointed works. |
697a010
to
b8f272b
Compare
Hi @MarshallOfSound , I added a unit test to verify what you suggested, please take a look, thx |
b8f272b
to
11b6878
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some docs change suggestions 👍 Thanks for the test 🎉
docs/api/desktop-capturer.md
Outdated
@@ -82,7 +82,9 @@ The `desktopCapturer` module has the following methods: | |||
* `types` String[] - An array of Strings that lists the types of desktop sources | |||
to be captured, available types are `screen` and `window`. | |||
* `thumbnailSize` [Size](structures/size.md) (optional) - The size that the media source thumbnail | |||
should be scaled to. Default is `150` x `150`. | |||
should be scaled to. Default is `150` x `150`. Set width or height to 0 when not interested in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be scaled to. Default is `150` x `150`. Set width or height to 0 when not interested in | |
should be scaled to. Default is `150` x `150`. Set width or height to 0 when you do not need |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/api/desktop-capturer.md
Outdated
@@ -82,7 +82,9 @@ The `desktopCapturer` module has the following methods: | |||
* `types` String[] - An array of Strings that lists the types of desktop sources | |||
to be captured, available types are `screen` and `window`. | |||
* `thumbnailSize` [Size](structures/size.md) (optional) - The size that the media source thumbnail | |||
should be scaled to. Default is `150` x `150`. | |||
should be scaled to. Default is `150` x `150`. Set width or height to 0 when not interested in | |||
the thumbnails. This save some processing like capturing the content of each window and screen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the thumbnails. This save some processing like capturing the content of each window and screen | |
the thumbnails. This will save the processing time required for capturing the content of each window and screen. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/api/desktop-capturer.md
Outdated
should be scaled to. Default is `150` x `150`. | ||
should be scaled to. Default is `150` x `150`. Set width or height to 0 when not interested in | ||
the thumbnails. This save some processing like capturing the content of each window and screen | ||
plus the downscaling to the thumbnail size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plus the downscaling to the thumbnail size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
11b6878
to
4f385e6
Compare
Capturing window thmubnails is expensive as it actually uses the window capturer and it records one full frame per window and then downscale to the default size 150x150. When only interested in the window names or the app icons we do not need all of this. Underlying change is merged in chromium72 so this patch only modifies the doc, see: https://chromium.googlesource.com/chromium/src.git/+log/72.0.3626.52/chrome/browser/media/webrtc/native_desktop_media_list.cc Example: desktopCapturer.getSources({thumbnailSize: {width: 0, height: 0}}, ...) Also added a unit test in spec/api-desktop-capturer-spec.js that verifies that the returned thumbails are of type NativeImage and empty, when the user disable fetching thumbnails. notes: Can disable fetching the thumbnails for the DesktopCapturer. electron#14872
4f385e6
to
d253f23
Compare
Thx for the suggested changes. Done. I also copy/paster the new doc to the doc of the promisified version of desktopCapturer.getSources . |
Hi, gentle ping ? |
Release Notes Persisted
|
Description of Change
Refs: #14872.
Capturing window thumbnails is expensive as it actually use the
window capturer and record one full frame per window and then
downscale then to the default size 150x150. When only interested
in the app icons we do not need all of this.
Example:
desktopCapturer.getSources({thumbnailSize: {width: 0, height: 0}}, ...)
Release Notes
Notes: Added ability disable fetching thumbnails for in
desktopCapturer.getSources()