[webrtc-extensions] Add API to control encode complexity (#191)

ssilkin has just created a new issue for https://github.com/w3c/webrtc-extensions:

== Add API to control encode complexity ==
## Background

Encode complexity settings are hardcoded for WebRTC's built-in encoders (libvpx VP8/VP9, libaom AV1 and OpenH264). The settings depend on platform, number of CPU cores and video resolution and are optimized to provide acceptable performance on a wide range of devices. In some scenarios these default settings are suboptimal. Access to encode complexity settings would allow applications to optimize the trade-off between device resource usage and compression efficiency for their use cases. For example, a higher encode complexity mode can be used to achieve better video quality and/or to reduce video bitrate.

## Proposed API

Add encodeComplexityMode to [RTCRtpEncodingParameters](https://www.w3.org/TR/webrtc/#dom-rtcrtpencodingparameters):

```
enum RTCEncodeComplexityMode {
  "low",
  "normal",
  "high"
};

partial dictionary RTCRtpEncodingParameters {
  RTCEncodeComplexityMode encodeComplexityMode = "normal";
};
```

**encodeComplexityMode** specifies the encoding complexity mode. "normal" is the default mode that provides a balance between device resource usage and compression efficiency suitable for most use cases. Relative to "normal" mode:
* "low" mode results in lower device resource usage and worse compression efficiency
* "high" mode results in higher device resource usage and better compression efficiency

The user agent SHOULD configure the encoder according to the encoding complexity mode specified. Changes in encoding performance are codec specific and are not guaranteed.

## Details

A hardcoded mapping will be used to convert complexity mode to encoding settings ([CPUUSED](https://source.chromium.org/chromium/chromium/src/+/main:third_party/libaom/source/libaom/aom/aomcx.h;drc=116d912e0ce99de575548002cbe964e3e6381097;l=220) in the case of SW libaom/libvpx encoders, [KEY_COMPLEXITY](https://developer.android.com/reference/android/media/MediaFormat#KEY_COMPLEXITY) in the case of Android MediaCodec, etc). 

Relative differences in encoding performance between different encode complexity modes are not fixed and may change in the new binary due to changes in underlying encoders and/or compilation settings.

Please view or discuss this issue at https://github.com/w3c/webrtc-extensions/issues/191 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 11 December 2023 13:17:04 UTC