]> khamidou — GitHub mirrors - electron.git/commitdiff
Make desktop capture API work on Windows.
authorHaojian Wu <hokein.wu@gmail.com>
Sat, 3 Oct 2015 02:41:08 +0000 (10:41 +0800)
committerHaojian Wu <hokein.wu@gmail.com>
Sat, 3 Oct 2015 02:51:02 +0000 (10:51 +0800)
atom.gyp
atom/browser/api/atom_api_desktop_capturer.cc

index ed885743c6a6c41c5d114831dc5b6c671eaa1369..77ad2e22ae396a2b70c8dfd73602cc3e9b25b4b6 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
               '-lcomctl32.lib',
               '-lcomdlg32.lib',
               '-lwininet.lib',
+              '-lwinmm.lib',
             ],
           },
+          'defines': [
+            # The usage of "webrtc/modules/desktop_capture/desktop_capture_options.h"
+            # is required to see this macro.
+            'WEBRTC_WIN',
+          ],
           'dependencies': [
             # Node is built as static_library on Windows, so we also need to
             # include its dependencies here.
           ],
         }],  # OS=="win"
         ['OS=="mac"', {
+          'defines': [
+            # The usage of "webrtc/modules/desktop_capture/desktop_capture_options.h"
+            # is required to see this macro.
+            'WEBRTC_MAC',
+          ],
           'dependencies': [
             'vendor/crashpad/client/client.gyp:crashpad_client',
             'vendor/crashpad/handler/handler.gyp:crashpad_handler',
index c3a573715703e65571e476f2aaedc965925332b7..96786d098912766573f79af84e89a67415009a41 100644 (file)
@@ -47,10 +47,23 @@ const int kThumbnailHeight = 150;
 }  // namespace
 
 DesktopCapturer::DesktopCapturer(bool show_screens, bool show_windows) {
+  webrtc::DesktopCaptureOptions options =
+      webrtc::DesktopCaptureOptions::CreateDefault();
+
+#if defined(OS_WIN)
+  // On windows, desktop effects (e.g. Aero) will be disabled when the Desktop
+  // capture API is active by default.
+  // We keep the desktop effects in most times. Howerver, the screen still
+  // fickers when the API is capturing the window due to limitation of current
+  // implemetation. This is a known and wontFix issue in webrtc (see:
+  // http://code.google.com/p/webrtc/issues/detail?id=3373)
+  options.set_disable_effects(false);
+#endif
+
   scoped_ptr<webrtc::ScreenCapturer> screen_capturer(
-      show_screens ? webrtc::ScreenCapturer::Create() : nullptr);
+      show_screens ? webrtc::ScreenCapturer::Create(options) : nullptr);
   scoped_ptr<webrtc::WindowCapturer> window_capturer(
-      show_windows ? webrtc::WindowCapturer::Create() : nullptr);
+      show_windows ? webrtc::WindowCapturer::Create(options) : nullptr);
   media_list_.reset(new NativeDesktopMediaList(screen_capturer.Pass(),
       window_capturer.Pass()));
   media_list_->SetThumbnailSize(gfx::Size(kThumbnailWidth, kThumbnailHeight));