Skip to content

feat: Implement desktopCapturer.setSkipCursor - #28302

Closed
adityak368 wants to merge 10 commits into
electron:mainfrom
adityak368:set_skip_cursor
Closed

adityak368 wants to merge 10 commits into
electron:mainfrom
adityak368:set_skip_cursor

Conversation

@adityak368

@adityak368 adityak368 commented Mar 19, 2021 •

Copy link
Copy Markdown

Description of Change

feat: Implement electron.DesktopCapturer.setSkipCursor

Useful to dynamically stop cursor capture in the stream.
By default the cursor is captured.
First argument is a deviceId so one can stop capturing
the cursor for a specific streamed source.

#23923

This is essentially a cherrypick of the the previous implementation of @CapOM

#25103

Checklist

Release Notes

Notes: Implemented DesktopCapturer.setSkipCursor API. Useful to dynamically stop cursor capture in the stream.

@adityak368
adityak368 requested review from a team as code owners March 19, 2021 20:17
@welcome

welcome Bot commented Mar 19, 2021

Copy link
Copy Markdown

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Mar 19, 2021
@nmilev-scribe

Copy link
Copy Markdown

@adityak368 If there's anything you need help with to make this PR successful, let me know!

@ns-jisorce

Copy link
Copy Markdown

Try to run the tests locally on your machine, I believe you will be able to reproduce the crashes

@zcbenz zcbenz added the semver/minor backwards-compatible functionality label Mar 24, 2021

@zcbenz zcbenz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some tests? We don't have to test its functionality, it would be helpful to know it does not crash after Chromium upgrades.

Comment thread lib/browser/rpc-server.ts Resolved
@danielehrhardt

Copy link
Copy Markdown

Tested this on Mac. Looks good.

@zcbenz

zcbenz commented Mar 29, 2021

Copy link
Copy Markdown
Contributor

This PR requires review from @electron/wg-upgrades, and requires API review from @electron/wg-api .

@ns-jisorce

Copy link
Copy Markdown

The change looks good to me, if you can restore the author on the first commit that would be nice. (in principle it would have been preserved if you did git cherry-pick)

git commit --amend --no-edit --author="Julien Isorce <[email protected]>"

Thanks!

@miniak miniak changed the title feat: Implement electron.DesktopCapturer.setSkipCursor feat: Implement desktopCapturer.setSkipCursor Mar 31, 2021

@nornagon nornagon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a significant sized patch with no champion in the maintainers group, and no functional tests. It is thus very likely to cause issues when upgrading in future.

There are a few possible paths forward for this to get merged. The first and best is to see if there is a way to achieve the same result without requiring a patch. I am not personally familiar with the code, but I think this is worth investigating.

If there really is no way to achieve this functionality without a patch, the next step would be to see if we can drastically reduce the size of the patch. Smaller patches are easier to maintain, because touching less code means the patch is less likely to conflict when upgrading.

If the patch size cannot be significantly reduced, the next thing to try would be to submit these patches upstream. See the chromium contributing guidelines and WebRTC contributing guidelines for how to get started with that.

If you try all the above and do not meet success, the final option is to significantly expand documentation and test coverage for these patches. The goal here would be that if a maintainer has to handle fixing this patch, then the tests should be able to report whether or not the feature is still working as intended, and the maintainer should be able to clearly understand the intention of each part of the patch, in order to be able to correctly resolve conflicts.

Thanks for your patience with this, I know it's a lot of work. Our maintainer team is small and we have to carefully consider the trade-offs of adding patches to the codebase. Every patch adds to the ongoing maintenance burden of keeping Electron up-to-date, and we have to ensure that the project remains sustainable.

@nornagon

nornagon commented Apr 1, 2021

Copy link
Copy Markdown
Contributor

@adityak368 surely, patching Electron is easier for you, but it is not easier for the maintainers. For context, we currently have 110 patches against Chromium, and if merged this patch would be the 6th-largest patch. Chromium constantly changes, and we regularly have to update our patches to keep pace. The more and larger patches we have, the larger our ongoing maintenance burden.

I've outlined several possible paths for moving forward already. The PR adds events which are never tested, nor is calling the method while a capture is occurring. Calling the method from the renderer is not tested either. The documentation this PR adds is pretty thin. There is no example code, it's not documented whether the events are emitted when calling setSkipCursor from the main process or only from the renderer, and there is only the barest explanation of what the feature does. We don't need an essay of docs for the feature, as it's fairly straightforward, but it could be better. If a maintainer with no context about what this feature is intended to do is expected to fix a 350-line patch in order to keep the feature working, they had better be able to understand what "working" means.

Comment thread lib/browser/desktop-capturer.ts Resolved
@adityak368
adityak368 requested a review from nornagon May 3, 2021 15:59
CapOM and others added 9 commits May 4, 2021 19:25
Useful to dynamically stop cursor capture in the stream.
By default the cursor is captured.
First argument is a deviceId so one can stop capturing
the cursor for a specific streamed source.

#23923

Notes: Can enable or disable capturing cursor while the stream is
running
…t violated.

added public api for electron browser process
updated patch so that setskipcursor runs in proper threads
fixed linting
generated patches using git-export-patches
tests: added basic tests for the set skip cursor api
…kip-cursor events

tests: added test of running setskipcursor during sharing content
docs: added sample code for setskipcursor. removed event documentation of set-skip-cursor
tests: added more cases when calling setSkipCursor during capture
@hackers365

This comment has been minimized.

@michalzaq12

This comment has been minimized.

@adityak368 adityak368 closed this Jul 11, 2021
@danielehrhardt

danielehrhardt commented Jul 11, 2021 •

Copy link
Copy Markdown

@adityak368
Why did you closed the Pull Request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-review/requested 🗳 new-pr 🌱 PR opened recently semver/minor backwards-compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants