diff --git a/juggler/protocol/PageHandler.js b/juggler/protocol/PageHandler.js index 96e6ad06ac65f..0ca7fa6f115c6 100644 --- a/juggler/protocol/PageHandler.js +++ b/juggler/protocol/PageHandler.js @@ -296,7 +296,8 @@ class PageHandler { const docShell = this._pageTarget._gBrowser.ownerGlobal.docShell; // Exclude address bar and navigation control from the video. const rect = this._pageTarget.linkedBrowser().getBoundingClientRect(); - this._videoSessionId = screencast.startVideoRecording(docShell, file, width, height, scale || 0, rect.top); + const devicePixelRatio = this._pageTarget._window.devicePixelRatio; + this._videoSessionId = screencast.startVideoRecording(docShell, file, width, height, scale || 0, devicePixelRatio * rect.top); } stopVideoRecording() { diff --git a/juggler/screencast/nsScreencastService.cpp b/juggler/screencast/nsScreencastService.cpp index 94afa759979e0..eb3b9d0153924 100644 --- a/juggler/screencast/nsScreencastService.cpp +++ b/juggler/screencast/nsScreencastService.cpp @@ -37,30 +37,14 @@ rtc::scoped_refptr CreateWindowCapturer(nsIWidget* w HeadlessWidget* headlessWidget = static_cast(widget); return HeadlessWindowCapturer::Create(headlessWidget); } -#ifdef MOZ_WIDGET_GTK - mozilla::widget::CompositorWidgetInitData initData; - widget->GetCompositorWidgetInitData(&initData); - const mozilla::widget::GtkCompositorWidgetInitData& gtkInitData = initData.get_GtkCompositorWidgetInitData(); - nsCString windowId; -# ifdef MOZ_X11 - windowId.AppendPrintf("%lu", gtkInitData.XWindow()); - return webrtc::DesktopCaptureImpl::Create(sessionId, windowId.get(), webrtc::CaptureDeviceType::Window); -# else - // TODO: support in wayland - fprintf(stderr, "Video capture for Wayland is not implemented\n"); - return nullptr; -# endif -#elif defined(_WIN32) - mozilla::widget::CompositorWidgetInitData initData; - widget->GetCompositorWidgetInitData(&initData); - const mozilla::widget::WinCompositorWidgetInitData& winInitData = initData.get_WinCompositorWidgetInitData(); + uintptr_t rawWindowId = reinterpret_cast(widget->GetNativeData(NS_NATIVE_WINDOW_WEBRTC_DEVICE_ID)); + if (!rawWindowId) { + fprintf(stderr, "Failed to get native window id\n"); + return nullptr; + } nsCString windowId; - windowId.AppendPrintf("%lu", winInitData.hWnd()); + windowId.AppendPrintf("%" PRIuPTR, rawWindowId); return webrtc::DesktopCaptureImpl::Create(sessionId, windowId.get(), webrtc::CaptureDeviceType::Window); -#else - fprintf(stderr, "Video capture is not implemented on this platform\n"); - return nullptr; -#endif } }