webrtc / samples

WebRTC Web demos and samples
https://webrtc.github.io/samples
BSD 3-Clause "New" or "Revised" License
13.94k stars 5.71k forks source link

Scalable Video Codec prevent incorrect Safari usage #1596

Open opusonline opened 1 year ago

opusonline commented 1 year ago

Please read first!

Please use discuss-webrtc for general technical discussions and questions. If you have found an issue/bug with the native libwebrtc SDK or a browser's behaviour around WebRTC please create an issue in the relevant bug tracker. You can find more information on how to submit a bug and do so in the right place here

Note: If the checkboxes above are not checked (which you do after the issue is posted), the issue will be closed.

Browser affected

Browser name including version (e.g. Chrome 64.0.3282.119) Tested on Safari 15.6.1 and 16.1

Description

Scalable Video Codec sample shows incorrect results on Safari browsers due to Safari's special behaviour with navigator.mediaCapabilities.encodingInfo. Safari reports supported: true and just ignoring the scalabilityMode parameter. Fortunately, Safari includes a supportedConfiguration object within the encodingInfo result, where an additional check can be performed.

if (info.supported && (!info.supportedConfiguration || info.supportedConfiguration.video.scalabilityMode === mode)) {
  // ...
}

Steps to reproduce

Open https://webrtc.github.io/samples/src/content/extensions/svc/ in Safari (>= 15.4), click "Start", allow camera access, select "video/VP8" as Codec preferences.

Expected results

If Safari really supports SVC, only L1T1, L1T2, and L1T3 should be listed. Since Safari doesn't support SVC, the list should be empty.

Actual results

Every single scalability mode is available, even though VP8 should only support L1T1, L1T2, and L1T3.