Unity-Technologies / Unity-Technologies/com.unity.webrtc

[BUG]: The encoder sometimes chooses the wrong minimum level and causes a parameter exception

Open
#896 3 comments 0 reactions 1 assignee View on GitHub

@karasusan is already working on this.

Since Apr 13, 2023.

bug issued
Dominant language
Assembly
Stars
852
Forks
238
PR merge metrics
No merged PRs in 30d

Description

Package version

3.0.0-pre.4

Environment
* OS: Windows 2022
* Unity version: 2021 LTS
Steps To Reproduce
  1. Request a 1688x614 frame, frame rate 60, max bit rate 24000000, target bps 4925000
  2. Observe the level computing code incorrectly computes Level 4 for this request.
  3. Observe it should be at least 4.2.
  4. Observe an exception.
  5. m_level = std::max(m_level, NV_ENC_LEVEL_H264_42); resolves the issue.

Windows 2022 LTSC + DirectX 11 + NVEnc streaming to Windows Chrome: Works
Windows 2022 LTSC + DirectX 11 + NVEnc streaming to Mobile Safari, Portrait: Works
Windows 2022 LTSC + DirectX 11 + libvpx streaming to Mobile Safari, Portrait: Works
Windows 2022 LTSC + DirectX 11 + libvpx streaming to Mobile Safari, Landscape: Works
Windows 2022 LTSC + DirectX 11 + NVEnc streaming to Mobile Safari, Landscape: Does not work (see parameters to repro)

Current Behavior

An invalid parameter exception thrown by m_encoder->CreateEncoder(&m_initializeParams);

Expected Behavior

Select Profile 4.2 instead of 4.

Anything else?

The workaround is to always set the level to at least 4.2.

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.