Bug 1047743 - Screen sharing with multiple screens is broken (Mac only). r=jesup, a=sledru
authorMatthew A. Miller <linuxwolf@outer-planes.net>
Wed, 27 Aug 2014 10:58:14 -0600
changeset 217739 667f19dac2ccbe82efaf91acf715eaf448599b2b
parent 217738 c9102769c7417bebfe40b71f145a352ddd9e0a86
child 217740 7b3b162ff01c8e2e151b689c053c4539443d7106
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, sledru
bugs1047743
milestone33.0a2
Bug 1047743 - Screen sharing with multiple screens is broken (Mac only). r=jesup, a=sledru * * * Bug 1047743 - interdiff to not impact other platforms
media/webrtc/trunk/webrtc/modules/desktop_capture/mac/desktop_device_info_mac.mm
media/webrtc/trunk/webrtc/modules/desktop_capture/win/desktop_device_info_win.cc
media/webrtc/trunk/webrtc/modules/desktop_capture/x11/desktop_device_info_x11.cc
media/webrtc/trunk/webrtc/video_engine/desktop_capture_impl.cc
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/mac/desktop_device_info_mac.mm
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/mac/desktop_device_info_mac.mm
@@ -24,20 +24,22 @@ DesktopDeviceInfoMac::DesktopDeviceInfoM
 DesktopDeviceInfoMac::~DesktopDeviceInfoMac() {
 }
 
 #if !defined(MULTI_MONITOR_SCREENSHARE)
 int32_t DesktopDeviceInfoMac::MultiMonitorScreenshare()
 {
   DesktopDisplayDevice *pDesktopDeviceInfo = new DesktopDisplayDevice;
   if (pDesktopDeviceInfo) {
-    pDesktopDeviceInfo->setScreenId(0);
+    pDesktopDeviceInfo->setScreenId(CGMainDisplayID());
     pDesktopDeviceInfo->setDeviceName("Primary Monitor");
-    pDesktopDeviceInfo->setUniqueIdName("\\screen\\monitor#1");
 
+    char idStr[64];
+    snprintf(idStr, sizeof(idStr), "%ld", pDesktopDeviceInfo->getScreenId());
+    pDesktopDeviceInfo->setUniqueIdName(idStr);
     desktop_display_list_[pDesktopDeviceInfo->getScreenId()] = pDesktopDeviceInfo;
   }
   return 0;
 }
 #endif
 
 int32_t DesktopDeviceInfoMac::Init() {
 #if !defined(MULTI_MONITOR_SCREENSHARE)
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/win/desktop_device_info_win.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/win/desktop_device_info_win.cc
@@ -21,20 +21,22 @@ DesktopDeviceInfoWin::DesktopDeviceInfoW
 DesktopDeviceInfoWin::~DesktopDeviceInfoWin() {
 }
 
 #if !defined(MULTI_MONITOR_SCREENSHARE)
 int32_t DesktopDeviceInfoWin::MultiMonitorScreenshare()
 {
   DesktopDisplayDevice *pDesktopDeviceInfo = new DesktopDisplayDevice;
   if (pDesktopDeviceInfo) {
-    pDesktopDeviceInfo->setScreenId(0);
+    pDesktopDeviceInfo->setScreenId(webrtc::kFullDesktopScreenId);
     pDesktopDeviceInfo->setDeviceName("Primary Monitor");
-    pDesktopDeviceInfo->setUniqueIdName("\\screen\\monitor#1");
 
+    char idStr[64];
+    _snprintf_s(idStr, sizeof(idStr), sizeof(idStr) - 1, "%ld", pDesktopDeviceInfo->getScreenId());
+    pDesktopDeviceInfo->setUniqueIdName(idStr);
     desktop_display_list_[pDesktopDeviceInfo->getScreenId()] = pDesktopDeviceInfo;
   }
   return 0;
 }
 #endif
 
 int32_t DesktopDeviceInfoWin::Init() {
 #if !defined(MULTI_MONITOR_SCREENSHARE)
--- a/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/desktop_device_info_x11.cc
+++ b/media/webrtc/trunk/webrtc/modules/desktop_capture/x11/desktop_device_info_x11.cc
@@ -22,20 +22,22 @@ DesktopDeviceInfoX11::DesktopDeviceInfoX
 DesktopDeviceInfoX11::~DesktopDeviceInfoX11() {
 }
 
 #if !defined(MULTI_MONITOR_SCREENSHARE)
 int32_t DesktopDeviceInfoX11::MultiMonitorScreenshare()
 {
   DesktopDisplayDevice *pDesktopDeviceInfo = new DesktopDisplayDevice;
   if (pDesktopDeviceInfo) {
-    pDesktopDeviceInfo->setScreenId(0);
+    pDesktopDeviceInfo->setScreenId(webrtc::kFullDesktopScreenId);
     pDesktopDeviceInfo->setDeviceName("Primary Monitor");
-    pDesktopDeviceInfo->setUniqueIdName("\\screen\\monitor#1");
 
+    char idStr[64];
+    snprintf(idStr, sizeof(idStr), "%ld", idStr);
+    pDesktopDeviceInfo->setUniqueIdName(idStr);
     desktop_display_list_[pDesktopDeviceInfo->getScreenId()] = pDesktopDeviceInfo;
   }
   return 0;
 }
 #endif
 
 int32_t DesktopDeviceInfoX11::Init() {
 #if !defined(MULTI_MONITOR_SCREENSHARE)
--- a/media/webrtc/trunk/webrtc/video_engine/desktop_capture_impl.cc
+++ b/media/webrtc/trunk/webrtc/video_engine/desktop_capture_impl.cc
@@ -374,17 +374,17 @@ int32_t DesktopCaptureImpl::Init(const c
     MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(webrtc::DesktopCaptureOptions::CreateDefault(), webrtc::kFullDesktopScreenId);
     desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pAppCapturer, pMouseCursorMonitor));
   } else if (type == Screen) {
     ScreenCapturer *pScreenCapturer = ScreenCapturer::Create();
     if (!pScreenCapturer) {
       return -1;
     }
 
-    ScreenId screenid = webrtc::kFullDesktopScreenId;
+    ScreenId screenid = atoi(uniqueId);
     pScreenCapturer->SelectScreen(screenid);
     pScreenCapturer->SetMouseShapeObserver(this);
 
     MouseCursorMonitor * pMouseCursorMonitor = MouseCursorMonitor::CreateForScreen(webrtc::DesktopCaptureOptions::CreateDefault(), screenid);
     desktop_capturer_cursor_composer_.reset(new DesktopAndCursorComposer(pScreenCapturer, pMouseCursorMonitor));
   } else if (type == Window) {
     WindowCapturer *pWindowCapturer = WindowCapturer::Create();
     if (!pWindowCapturer) {