Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
753 stars 191 forks source link

[BUG]: A few seconds latency of video on subscriber side when I publish video and audio together #800

Closed kotrs closed 2 years ago

kotrs commented 2 years ago

Package version

2.4.0-exp.10

Environment

* OS:iOS
* Unity version:Unity 2021.3

Steps To Reproduce

  1. Init WebRTC
  2. Publish Video and Audio
  3. Receive Video and Audio

Current Behavior

A few seconds latency of video on subscriber side when I publish video and audio together. The latency is small after connection, but during the connection it is increasing. Publishing video without audio is OK.

Expected Behavior

Latency of video on subscriber side up to 500ms

Anything else?

No response

karasusan commented 2 years ago

@kotrs Which platform are you testing?

kotrs commented 2 years ago

Publisher - MacOS Unity Editor or iOS device Subscriber - iOS device

The issue is on publisher side probably. Because the latency contineus when I disable audio subscribe on subscriber.

kotrs commented 2 years ago

I need to know if it is a feature of this package or not. Because my implementation is more complicated. The communication is established through OpenVidu server. But sample OpenVidu client web app runs with audio without latency. Then I use third party package for AEC. But the latency starts increasing when I begin sending data with SetData method in AudioStreamTrack. So it seems that problem is in WebRTC package. What is strange when I set video codec VP8 with SetCodecPreferences in sender of video of course then audio is lost. Video stream is without latency then. I tried another available codecs but then I lost video stream.

karasusan commented 2 years ago

Can you check the bitrate of audio?

kotrs commented 2 years ago

I tried to set maxbitrate of audio sender from 10kb to 500kb. But no change.

karasusan commented 2 years ago

@kotrs Is it replicate the issue when testing it without OpenVidu?

kotrs commented 2 years ago

The delay was caused by a/v synchronisation on server side. It is not problem of this package. Thank you