w3c / w3c/webcodecs

isConfigSupported: definition of "invalid"

Open
#744 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs-tests
Dominant language
HTML
Stars
1.3k
Forks
194
Avg merge
1d 13h
Merged PRs (30d)
3

Description

The behavior of isConfigSupported API for unsupported configurations is different on Chromium and Safari.

The specification says (for Audio and Video encoders and decoders):

"If config is not a valid.... return a promise rejected with TypeError."

However, the definition of "invalid" appears to differ between implementations.

On Chromium, when an unsupported scalabilityMode value is provided, the promise resolves with supported set to "false", but on Safari, the promise is rejected.

Live example: https://webrtc.internaut.com/wc/isup2/

A snippet:

async function modeProperties(mode, enc, config) {
  config.scalabilityMode = mode;
  if (enc == 'true') {
    // check whether the encoder supports the configuration
    try {
      const encoderSupport = await VideoEncoder.isConfigSupported(config);
      if (encoderSupport.supported) {
        addToEventLog('For encode ' + preferredCodec + ' ' + mode + ' is supported');
      } else {
        addToEventLog('For encode ' + preferredCodec + ' ' + mode + ' is NOT supported');
        //addToEventLog('Config details:\n' + JSON.stringify(encoderSupport.config));
      }
    } catch (e) {
     // Safari will end up here for unsupported scalabilityMode values, Chromium will not
      addToEventLog('For encode ' + preferredCodec + ' ' + mode + ' is considered INVALID');
    }
  } else {
    // check whether the decoder supports the configuration
    try {
      const decoderSupport = await VideoDecoder.isConfigSupported(config);
      if (decoderSupport.supported) {
        addToEventLog('For decode ' + preferredCodec + ' ' + mode + ' is supported');
      } else {
        addToEventLog('For decode ' + preferredCodec + ' ' + mode + ' is NOT supported');
      }
    } catch (e) {
     // Safari will end up here for unsupported scalabilityMode values, Chromium will not
      addToEventLog('For decode ' + preferredCodec + ' ' + mode + ' is considered INVALID');
    }
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the specification text quoted in the issue and reproduce the live example at https://webrtc.internaut.com/wc/isup2/ in Chromium and Safari. Compare how VideoEncoder.isConfigSupported and VideoDecoder.isConfigSupported handle unsupported scalabilityMode values; done means the specification or implementation discrepancy has a decided resolution.

Written by the indexing model from the issue text.

Assessment

Domain
api, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.