Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Opus: reduce NetEQ jitterbuffer & eliminate discontinuous audio artifacts from jitter with Opus + RED #153

Open
ehfd opened this issue May 19, 2024 · 1 comment
Labels
enhancement New feature or request funding Requires funding to implement performance Performance or latency issues, not critical but impacts usage transport Underlying media or data transport protocols upstream Requires upstream development from dependencies

Comments

@ehfd
Copy link
Member

ehfd commented May 19, 2024

NetEQ jitterbuffer

Video frames can be displayed as fast as they can be received as a result of playout-delay, jitterBufferTarget, and other WebRTC settings.

However, the minimum latency for Opus audio is constrained by NetEQ. This behavior is not well-researched, but when understood, this may decrease the remaining bits of latency the audio stack has.

https://chromium.googlesource.com/external/webrtc/+/master/modules/audio_coding/neteq/g3doc/index.md
https://bloggeek.me/webrtc-discard-media-packets/

Moreover, while I have specified 2.5 (3) ms as the frame size and ptime of the Opus packets, this might not have an actual effect. This behavior should be clearly verified. Edit all sections with OPUS_FRAME: to modify this.

Opus + RED

An issue required to be solved from upstream, tracked in: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3550

Described below:

There is a lack of redundancy available with the audio stack, especially with Opus.
This causes concealment events which lead to disconnections in audio in all but the most reliable wired ethernet connections.

The inband-fec parameter of Opus doesn't work with restricted-lowdelay (CELT-only) configurations that most people would want when streaming any other type of media other than live voice (SILK).

An alternative (enabled by default with Chrome 96, other links specifying flags are before Chrome 96) is to use RED with Opus.

https://groups.google.com/g/discuss-webrtc/c/5761etCrSuA/m/hEJto5xwBgAJ

https://webrtc.github.io/samples/src/content/peerconnection/audio/

https://webrtchacks.com/red-improving-audio-quality-with-redundancy/

https://www.meetecho.com/blog/opus-red/

https://webrtchacks.com/implementing-redundant-audio-on-an-sfu/

This is what many providers (including Zoom) seem to use, and there are reports (above) that even in jittery conditions, RED with distance=2 improves concealment from 60% to 18% and 20% to 0.7%.

The current GST_WEBRTC_FEC_TYPE_ULP_RED is meant for video, and along with the string red/48000 instead of red/48000/2 that Opus requires, doesn't work overall. When manually munging the red/48000/2 string into the SDP and using rtpredenc with request-fec-encoder, RED packets are sent correctly, but those packets (2 times larger than the Opus bitrate with distance=2) are instead played by Chrome's WebRTC stack, not Opus, contrary to https://webrtc.github.io/samples/src/content/peerconnection/audio/.

I propose that this capability be called GST_WEBRTC_FEC_TYPE_OPUS_RED.

@ehfd ehfd added enhancement New feature or request upstream Requires upstream development from dependencies transport Underlying media or data transport protocols performance Performance or latency issues, not critical but impacts usage labels May 19, 2024
@ehfd ehfd changed the title Eliminate discontinuous audio with Opus + RED Eliminate discontinuous audio artifacts from jitter with Opus + RED May 19, 2024
@ehfd ehfd changed the title Eliminate discontinuous audio artifacts from jitter with Opus + RED Improve Opus: reduce NetEQ latency & eliminate discontinuous audio artifacts from jitter with Opus + RED May 20, 2024
@ehfd ehfd changed the title Improve Opus: reduce NetEQ latency & eliminate discontinuous audio artifacts from jitter with Opus + RED Improve Opus: reduce NetEQ jitterbuffer & eliminate discontinuous audio artifacts from jitter with Opus + RED May 20, 2024
@ehfd ehfd added the funding Requires funding to implement label May 20, 2024
@ehfd
Copy link
Member Author

ehfd commented May 30, 2024

It seems that NetEQ jitterbuffer latency starts to increase when there are concealment events.

This might mean that RED could help it keep it under 40 ms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request funding Requires funding to implement performance Performance or latency issues, not critical but impacts usage transport Underlying media or data transport protocols upstream Requires upstream development from dependencies
Projects
None yet
Development

No branches or pull requests

1 participant