Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
753 stars 191 forks source link

[BUG]: Microphone sound sometimes crackles #839

Closed ZenBre4ker closed 1 year ago

ZenBre4ker commented 1 year ago

Package version

3.0.0-pre.1

Environment

* OS: Windows 10
* Unity version:2021.3.5f1

Steps To Reproduce

Difficult to reproduce, but doable in a minute.

  1. Start the WebRTC Audio Sample Scene
  2. Activate Mic
  3. Choose your preferred Mic
  4. Push the "Start"-button
  5. You might hear your voice crackling. If not -> Hangup and repeat 4 again

Current Behavior

Sometimes the sound begins to crackle. Mostly noticeable when using a microphone, couldnt get it with a sinus yet. The sound also gets send like that when clicking the "Call"-Button.

Also noticeable is, when using a received track on a server and relaying that to all clients, some get a perfect sound and some get the same crackling. Like if webrtc does something to it instead of just sending the pure data.

Expected Behavior

Sound should be always clear or at least depend on the quality settings. Not sure if this a Unity bug with the microphone implementation. But only had it with webrtc yet.

Anything else?

No response

ZenBre4ker commented 1 year ago

This is a problem by Unity. It helps to set the clip-length to more than 1s like 10s. Or poll Microphone.GetPosition(m_deviceName) more than until it reached a position >0, like twice the sampling length.