Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

WebRTC receiver jitter buffer?

Discussion in 'Unity Render Streaming' started by olavrv, Sep 27, 2022.

  1. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    478
    We have some problems with latency; The latency is low when we connect to the WebRTC sender via web browser, but when the Unity application is loading a scene, it seems like the buffer of video stream on receiver builds up - and latency is increased from 60ms to 500ms

    We have monitored the jitter buffer on the web receiver, and it seems that this builds up as a result of the Unity application loading scenes.

    Is there a way to "reset" / clear the jitter buffer (if this is the cause of the latency)?

    Appreciate any help with this issue, thanks!
     
  2. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    478
  3. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    543
    Which version of the WebRTC package are you using?
     
  4. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    478
    We are using 2.4.0-exp.10
     
  5. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    478
    @kazuki_unity729 I would really appreciate it if you can help with this - because other than this issue everything works beautiful! :cool:
     
  6. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    543
    > We have monitored the jitter buffer on the web receiver, and it seems that this builds up as a result of the Unity application loading scenes.

    I assume that loading scenes would make a CPU spike and it makes delay of packing audio buffer.
    AudioStreamTrack makes the component internally and fetches audio buffer using OnAudioFilterRead method here. I have not been sure the detail of issue yet, but I guess there are isues around these code.
    https://github.com/Unity-Technologi.../Runtime/Scripts/AudioCustomFilter.cs#L46-L57
     
  7. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    478
    We are not streaming audio and have not added this component. Will it help to add this component?
     
  8. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    543
    Sorry I misunderstood,
    I would like to know the easiest way to replicate your issue?
    Is your issue reproduced by repeating loading scene?
     
  9. olavrv

    olavrv

    Joined:
    May 26, 2015
    Posts:
    478
    When the Unity application that is sending video stream is loading a scene, the WebRTC receiver builds up a latency in video stream. The latency is higher the longer the loading time is on the sender. It seems like it is the "freezing" of the sender application that is causing this latency, since we tried right clicking in unity editor on sender app, and this had same result.
     
  10. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    543
    Thank you for the detail, I will try to replicate the issue.
     
    SHO4X likes this.