com.unity.webrtc
com.unity.webrtc copied to clipboard
[BUG]: The encoder sometimes chooses the wrong minimum level and causes a parameter exception
Package version
3.0.0-pre.4
Environment
* OS: Windows 2022
* Unity version: 2021 LTS
Steps To Reproduce
- Request a 1688x614 frame, frame rate 60, max bit rate 24000000, target bps 4925000
- Observe the level computing code incorrectly computes Level 4 for this request.
- Observe it should be at least 4.2.
- Observe an exception.
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.
@doctorpangloss Thank you for reporting. We investigate this issue. memo: WRS-467
Can you tell me in which environment it occurs and in which environment there is no problem?
Windows 2022 LTSC + DirectX 11 + NVEnc streaming to 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)
When using the particular parameters I wrote there, it should reproduce without needing to go through this whole rigamarole.
@doctorpangloss Thanks about detail.