Bug 247310

Summary: In M1 Ventura safari 16.1, when the constraints passed in by getDisplayMedia contain the 'ideal' parameter, screen sharing will fail.
Product: WebKit Reporter: Yuwei Zhang <913007768zyw>
Component: WebRTCAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ivan.zahrodskyi, jer.noble, linlei2099, madara.freimane, ralphbliu, rv.maksim, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: Safari 16   
Hardware: Mac (Apple Silicon)   
OS: macOS 13   
Attachments:
Description Flags
Share screenshot
none
application window share screenshot none

Description Yuwei Zhang 2022-11-01 01:08:22 PDT
In M1 Ventura safari 16.1, when the constraints passed in by getDisplayMedia contain the 'ideal' parameter, screen sharing will fail.

Tested devices and browsers:
Bug is reproducible with Safari on:
- M1 Pro (MacOS Ventura) safari 16.1 (18614.2.9.1.12)
---------------------------------------------------------------

Use case:

Failed: https://zhangyuwei-1254112368.cos.ap-guangzhou.myqcloud.com/safari/gdm-ideal-failed.html
constraints:
{
   video: {
     width: { ideal: 1920, max: 1920 },
     audio: { ideal: 1080, max: 1080 }
   }
}

Success: https://zhangyuwei-1254112368.cos.ap-guangzhou.myqcloud.com/safari/gdm-success.html
constraints:
{
   video: {
     width: { max: 1920 },
     audio: { max: 1080 }
   }
}
Comment 1 Radar WebKit Bug Importer 2022-11-01 12:51:28 PDT
<rdar://problem/101819966>
Comment 2 ivan.zahrodskyi 2022-11-03 03:14:37 PDT
Created attachment 463382 [details]
Share screenshot

We also faced this issue
some additions:
- there no possibility to get resolution another than 1920x1080
1280x720 doesn't work
navigator.mediaDevices(
{
   video: {
     width: 1280,
     audio: 720
   }
}
); 

- if I call navigator.mediaDevices({video: true}) and select macbook screen video has black lines on the sides (this is because video resolution is 1920x1080 but macboocs screen has another resolution and another aspect ratio)

tested with macbook pro 16 2019 (Intel) MacOS Ventura
Comment 3 ivan.zahrodskyi 2022-11-03 03:27:16 PDT
Created attachment 463383 [details]
application window share screenshot

if I call navigator.mediaDevices.getDisplayMedia({video: true});

and select some small application window (like calculator) video will have 1920x1080 resolution (see screenshot)
Comment 4 youenn fablet 2022-11-03 08:50:08 PDT
I can reproduce, it seems our call to createBufferPool fails with kCVReturnInvalidPixelBufferAttributes.
Comment 5 youenn fablet 2022-11-07 00:09:59 PST
Pull request: https://github.com/WebKit/WebKit/pull/6199
Comment 6 youenn fablet 2022-11-07 00:10:38 PST
(In reply to youenn fablet from comment #5)
> Pull request: https://github.com/WebKit/WebKit/pull/6199

This PR only fixes window capture.
Comment 7 EWS 2022-11-08 12:29:33 PST
Committed 256458@main (882a38ecdaf1): <https://commits.webkit.org/256458@main>

Reviewed commits have been landed. Closing PR #6199 and removing active labels.
Comment 8 youenn fablet 2022-11-15 01:23:33 PST
*** Bug 247883 has been marked as a duplicate of this bug. ***
Comment 9 youenn fablet 2022-12-09 02:44:14 PST
*** Bug 248964 has been marked as a duplicate of this bug. ***
Comment 10 Brian Liu 2023-01-09 20:42:34 PST
See the solution https://stackoverflow.com/a/75065525/4796724