New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 632995 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Sep 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

desktopCapture: cursor bitmap too small when sharing a retina display

Reported by thembr...@gmail.com, Jul 31 2016

Issue description

UserAgent: Mozilla/5.0 (X11; CrOS armv7l 8530.30.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.29 Safari/537.36

Steps to reproduce the problem:
1. On Mac OS with a retina display, use desktopCapture API (for example use Google Cast -> cast desktop or Google Hangout -> share screen)
2. Take a look at cursor size in shared desktop stream

What is the expected behavior?
Mouse cursor should have regular size

What went wrong?
Mouse cursor is very tiny and barely visible.

Did this work before? N/A 

Chrome version: 51.0.2704.103  Channel: n/a
OS Version: El Capitan
Flash Version: Shockwave Flash 22.0 r0
 
Components: Internals>Cast
Labels: Needs-TestConfirmation
Test Engineering, can you please confirm this? I don't have any Retina hardware available locally.

Comment 3 by ajha@chromium.org, Aug 5 2016

Cc: ajha@chromium.org
Labels: -Needs-TestConfirmation M-54
Status: Untriaged (was: Unconfirmed)
Able to reproduce the issue on the latest canary(54.0.2820.0) on MacBook Pro Retina Version: 10.10.5.

Cursor was sized very small when shared the screen from the Retina display and observed the shared screen on Windows system.

On older chrome versions:30.0.1549.0, 40.0.2172.0 was unable to share the screen and the issue is reproducible on 47.0.2526.58.

Marking this Untriaged and triaging as Non-regression issue for more inputs. 
632995.png
342 KB View Download
Components: -Internals>Cast Blink>GetUserMedia>Desktop

Comment 5 by mcasas@chromium.org, Aug 22 2016

Cc: sergeyu@chromium.org qiangchen@chromium.org m...@chromium.org
Cc: isheriff@chromium.org
Cc: -sergeyu@chromium.org
Owner: sergeyu@chromium.org
Status: Assigned (was: Untriaged)
sergeyu@: can you have a look or reassign this?
sergeyu@ ping
Cc: sergeyu@chromium.org
Owner: qiangchen@chromium.org
The problem is that MouseCursorMonitorMac takes only low-res representation of the cursor. It needs to be fixed to grab hi-res version of the image. 
qiangchen@ is this something you will have time to do for M54? If not please update the milestone accordingly.
Labels: -M-54 M-55
I am not familiar with that part of code. Move to M55, as M54 has already been branched.
Update: I've verified that the [Cursor currentSystemCursor] returns a cursor with only non-retina image. (Because it has only one representation and its physical size == logical size)

Thus the only thing we can do is to scale up the cursor image we can get. But as you know a scaled-up image would not look as clear as an HD image.

sergeyu@: what is your opinion?

Comment 13 by m...@chromium.org, Sep 17 2016

FYI--isheriff@ originally implemented this feature, so he's probably more familiar with this than sergeyu@.

To answer the questions at-hand: Maybe there are alternate Cocoa APIs to get the high-res system cursor? Try googling for it! :)
ping isheriff@ for more ideas.
Cc: thakis@chromium.org
The particular snippet of capturing cursor actually comes from MouseCursorMonitorMac which was originally written by sergeyu@

I am not sure about what the right API is to get high res version of the system cursor (looking at NSCursor API does not seem to provide any info) 

thakis@, any pointers on this ?
[NSCursor image] hands you an NSImage, which will have a low-res and a high-res bitmap attached to it I think. ...oh, qiangchen says they checked that. Maybe it's a vector representation, what happens if you NSLog(@"%@", cursorImg) with the cursor image? If you draw it to a 2x offscreen graphics context, is it drawn sharply?
Re#16: Yes. I found there is only one representation in [NSCursor image].
The attachment is the snapshot of screen capture with scaled cursor.

test (4).webm
1.6 MB View Download
Try changing https://cs.chromium.org/chromium/src/third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm?rcl=0&l=242 to pass in a rect that's 2x in size.width and size.height and see if that makes things sharp.
Tried. That parameter has no effect at all. It is not used to scale the image, but is used to select a representation with similar size. Now that [NSCursor currentSystemCursor] has only one representation, the parameter does not play a role.

In #16, the snapshot contains already scaled cursor. Does it look OK? I use libyuv::ARGBScale to do the scaling.
If the one representation is a vector representation, it'll look good rasterized at any size. So that there's only one doesn't necessarily matter.

Instead of scaling the bitmap, I'd try to get a bitmap at the right size from cocoa in the first place.
Update:
You are right. Actually, we just need to paint the cursor onto another NSImage using current graphics context, and the result will be retina. Then we patch the retina cursor on to the frame instead of using the raw cursor.
test (5).webm
1.8 MB View Download
Status: Fixed (was: Assigned)

Comment 23 by demia...@gmail.com, Jan 26 2017

Can someone please tell me in which version of Chrome has this been released? I'm trying to apply patch to Chrome 54 (using Electron) and modified files do not exist and cannot even find them.
I need to build Electron based on Chrome 54 with this fix. Thanks!

Comment 24 by e...@highfive.com, May 23 2017

As a drive by observer, I see the change was committed to the webrtc repo with the following change.  Hopefully you have already discovered this yourself!

commit 6f79d840ba238b8122d7ab354f54a444bb22a4ca
Author: qiangchen <qiangchen@chromium.org>
Date:   Wed Sep 21 16:44:55 2016 -0700

    Bug Fix: Mac Retina Screen Capture's Mouse Cursor Too Small
    
    On retina display, when we do screen capture, the mouse cursor
    looks too small. The reason is that we painted the cursor with
    low resolution on to the frame directly.
    
    This CL fixes the bug.
    
    BUG= 632995 
    
    Review-Url: https://codereview.webrtc.org/2350743003
    Cr-Commit-Position: refs/heads/master@{#14340}

Sign in to add a comment