Open Bug 1252021 Opened 9 years ago Updated 3 years ago

[WebRtc]Display black frame when screen sharing with layered window or minimized windows

Categories

(Core :: WebRTC: Audio/Video, defect, P3)

44 Branch
defect

Tracking

()

People

(Reporter: xpeng, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586 Steps to reproduce: screen share with application's windows using webrtc. 1.Could not enumerate minimized windows with webrtc interface. We found that the implement of App capturer in Firefox source code : media\webrtc\trunk\webrtc\modules\desktop_capture\window_capturer_win.cc // Skip windows that are invisible, minimized, have no title, or are owned, // unless they have the app window style set. int len = GetWindowTextLength(hwnd); HWND owner = GetWindow(hwnd, GW_OWNER); LONG exstyle = GetWindowLong(hwnd, GWL_EXSTYLE); if (len == 0 || IsIconic(hwnd) || !IsWindowVisible(hwnd) || (owner && !(exstyle & WS_EX_APPWINDOW))) { return TRUE; } 2.Display black frame when screen sharing with layered window or minimized windows media\webrtc\trunk\webrtc\modules\desktop_capture\window_capturer_win.cc // Return a 1x1 black frame if the window is minimized, to match the behavior // on Mac. if (IsIconic(window_)) { BasicDesktopFrame* frame = new BasicDesktopFrame(DesktopSize(1, 1)); memset(frame->data(), 0, frame->stride() * frame->size().height()); previous_size_ = frame->size(); callback_->OnCaptureCompleted(frame); return; } ... if (!IsAeroEnabled() || !previous_size_.equals(frame->size())) { result = PrintWindow(window_, mem_dc, 0); } // Aero is enabled or PrintWindow() failed, use BitBlt. if (!result) { result = BitBlt(mem_dc, 0, 0, frame->size().width(), frame->size().height(), window_dc, cropped_rect.left() - original_rect.left(), cropped_rect.top() - original_rect.top(), SRCCOPY); } I suppose to use SRCCOPY|CAPTUREBLT option to bitblt layered windows. #define CAPTUREBLT (DWORD)0x40000000 /* Include layered windows */ Actual results: 1.Could not enumerate minimized windows with webrtc interface. 2.Display black frame when screen sharing with layered window or minimized windows Expected results: 1.enumerate minimized windows with webrtc interface 2.Display normal frame when screen sharing with layered window or minimized windows
Component: Untriaged → WebRTC
Product: Firefox → Core
I suspect we can't capture minimized windows in any case. It's worth trying number 2 (and verifying number 1). Note that it's possible there's a difference between different versions of Windows we capture on, and if Aero is on (generally the default).
Status: UNCONFIRMED → NEW
backlog: --- → webrtc/webaudio+
Rank: 23
Component: WebRTC → WebRTC: Audio/Video
Ever confirmed: true
Priority: -- → P2
Mass change P2->P3 to align with new Mozilla triage process.
Priority: P2 → P3
the issue of the minimized window: case 1). the window is in minimized state when capturing solution: send a message to the window to restore the window and then capture the window case 2). the user minimize the window which is being capturing solution:send the image of the window which is captured before
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.