Skip to content

refactor: simplify desktop_capturer patch - #30685

Merged
nornagon merged 5 commits into
mainfrom
simplify-desktop-capturer-patch
Sep 3, 2021
Merged

nornagon merged 5 commits into
mainfrom
simplify-desktop-capturer-patch

Conversation

@nornagon

Copy link
Copy Markdown
Contributor

Description of Change

This refactors our patch to native_desktop_media_list.cc, which was adding functionality that seems to already have been present in the unaltered Chrome version of the class. The one remaining piece of the patch is to use Electron's grit resources instead of Chrome's.

Checklist

  • PR description included and stakeholders cc'd
  • npm test passes
  • tests are changed or added

Release Notes

Notes: none

@nornagon
nornagon requested a review from deepak1556 August 24, 2021 22:11
@nornagon
nornagon requested a review from a team as a code owner August 24, 2021 22:11
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Aug 24, 2021
@nornagon nornagon added no-backport semver/patch backwards-compatible bug fixes labels Aug 24, 2021
codebytere
codebytere previously approved these changes Aug 25, 2021
@codebytere
codebytere self-requested a review August 25, 2021 07:50
@codebytere

codebytere commented Aug 25, 2021 •

Copy link
Copy Markdown
Member

looks like

desktopCapturer getMediaSourceId should match DesktopCapturerSource.id

desktopCapturer getSources should not incorrectly duplicate window_id

are failing as a result of this 🤔

@codebytere
codebytere dismissed their stale review August 25, 2021 07:50

meant to comment

@electron-cation electron-cation Bot removed the new-pr 🌱 PR opened recently label Aug 25, 2021
@deepak1556

Copy link
Copy Markdown
Member

Failing test is unrelated, it is due to #30682 because the related patch was removed here.

@nornagon relying on DesktopMediaList::Update for one-shot capture is good to me. My only concern is that does this path get the correct thumbnails, when I tested this code way long back it didn't work as expected hence I resorted to use the repeating implementation with the patch. If there are no issues with thumbnails then LGTM.

@nornagon
nornagon force-pushed the simplify-desktop-capturer-patch branch from e40cd9e to 099df96 Compare August 26, 2021 21:40
@nornagon

Copy link
Copy Markdown
Contributor Author

ping @deepak1556

@deepak1556

Copy link
Copy Markdown
Member

Failing tests on mac might be due to lack of capture sources leading to the refresh callback never completing, can you check locally if the tests pass which might confirm the theory.

@nornagon

Copy link
Copy Markdown
Contributor Author

Ah, d'oh, sorry, I assumed the CI was flake. Sorry for the spurious ping. Will investigate.

@nornagon

nornagon commented Sep 1, 2021

Copy link
Copy Markdown
Contributor Author

@deepak1556 hm, the tests are passing locally 🤔

@deepak1556

Copy link
Copy Markdown
Member

yeah you are definitely hitting #14835 (comment) in the ci due to lack of sources. I originally worked around it by adding a new observer event

 void DesktopMediaListBase::UpdateSourcesList(
     const std::vector<SourceDescription>& new_sources) {
+  // Notify observer when there was no new source captured.
+  if (new_sources.empty()) {
+    observer_->OnSourceUnchanged(this);
+    return;
+  }

@nornagon

nornagon commented Sep 1, 2021

Copy link
Copy Markdown
Contributor Author

Ah, gotcha. I'll see if I can find a simpler way to work around that, otherwise I'll restore that part of the patch.

@nornagon

nornagon commented Sep 3, 2021

Copy link
Copy Markdown
Contributor Author

@deepak1556 it looks like the tests are passing now (modulo the main failure that was fixed yesterday)

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@nornagon
nornagon merged commit 1dcb8a3 into main Sep 3, 2021
@nornagon
nornagon deleted the simplify-desktop-capturer-patch branch September 3, 2021 23:37
@release-clerk

release-clerk Bot commented Sep 3, 2021

Copy link
Copy Markdown

No Release Notes

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

Labels

no-backport semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants