Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
738 stars 186 forks source link

[BUG]: High Latency in Receiving Video Stream with H264 codec #1027

Closed BerkDevanthro closed 1 month ago

BerkDevanthro commented 2 months ago

Package version

3.0.0-pre.7

Environment

* OS: Windows 11, Android
* Unity version: 2021.3.29f1
* Codec: H264, profile-level-id=42e01f, packetization-mode=1
* RTCP Feedback: NACK, NACK PLI, REMB

Steps To Reproduce

We are using the aiortc library for Python for handling WebRTC connections.

  1. Establish video reception using RTCRtpTransceiver configured for RecvOnly to handle incoming video streams.
  2. Incoming video latency is at least 1 second, using a resolution of 512px.

Current Behavior

The receiving video stream has acceptable latency only around 128px resolution with 12 frames per second.

Expected Behavior

Ideally, we would like to be able to stream in 24 frames per second for 1k resolution and below 0.1-second latency.

Anything else?

Question: Are there optimizations or configurations for Unity WebRTC to handle higher resolutions more efficiently, especially regarding H264 codec usage?

Additional Info: The issue is less noticeable in web browsers, it has fairly acceptable latency for 512px resolution, 12 frames per second.