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

Opus Packet Loss Concealment #558

Open
rvadhavk opened this issue Sep 14, 2022 · 10 comments
Open

Opus Packet Loss Concealment #558

rvadhavk opened this issue Sep 14, 2022 · 10 comments
Assignees
Labels
extension Interface changes that extend without breaking.

Comments

@rvadhavk
Copy link

From the libopus documentation, it looks like the way to handle missing packets and have the decoder output packet loss concealment is to pass it an empty/null buffer.

But when creating an EncodedAudioChunk with a zero-length buffer and passing it to the decoder, in Chrome I get an error of "DOMException: Null or empty decoder buffer." The check in Chrome is here.

Is this the expected behavior, a Chrome implementation issue, or is this behavior something that should be clarified in the standard?

@bdrtc
Copy link
Contributor

bdrtc commented Sep 14, 2022

the same issue exist for decode opus inband fec when packet loss, chrome does not impl this and no describe for such scenario in standard。

@dalecurtis
Copy link
Contributor

@sandersdan
Copy link
Contributor

sandersdan commented Sep 14, 2022

[Edit: replacing comment]

This doesn't appear in the spec, not sure why Chrome is enforcing it.

I filed https://bugs.chromium.org/p/chromium/issues/detail?id=1363687

@sandersdan
Copy link
Contributor

Reopening as a discussion topic: should WebCodecs be exposing loss concealment, and if so is an empty buffer the right API?

@dalecurtis
Copy link
Contributor

If this is how the opus library has standardized signaling and it's what developers / RTC implementations are most familiar with, we probably should. I expect the null packet does something better than what would happen if we required developers to call flush() and skip these packets?

@aboba
Copy link
Collaborator

aboba commented Sep 20, 2022

Agree with @dalecurtis. The null packet will indeed do something better than calling flush(), whether that is concealment or potentially enabling recovery when FEC is enabled.

Note: Opus FEC is distance 1 so it cannot handle burst loss. As a result redundant audio (RED) may also be desirable, but that is typically handled in the application, and therefore probably isn't needed in WebCodecs. For a discussion of RED, see: https://webrtchacks.com/red-improving-audio-quality-with-redundancy/

@sandersdan
Copy link
Contributor

I've been testing in Chrome and it does not appear to be possible to activate this feature in libopus via ffmpeg, as ffmpeg interprets an empty packet as EOS. This likely means that the feature will not be implemented in Chrome in the short term.

@dalecurtis
Copy link
Contributor

Editor's call: Allow null packets for opus. Editors were not aware of any other codecs which have this mechanism, so not worth a new encoded audio chunk type or similar. Probably worth a note in the registry that this is how FEC works for opus.

@sandersdan
Copy link
Contributor

FYI: There is a proposed FFmpeg patch (appears to be abandoned) to implement this API; that patch worked by turning PTS discontinuities into FEC / error concealment.

@aboba
Copy link
Collaborator

aboba commented Mar 16, 2023

@dalecurtis Should this be labeled "Extension"?

@dalecurtis dalecurtis added the extension Interface changes that extend without breaking. label Mar 16, 2023
@aboba aboba added the agenda Add to Media WG call agenda label Sep 28, 2023
@aboba aboba removed the agenda Add to Media WG call agenda label May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension Interface changes that extend without breaking.
Projects
None yet
Development

No branches or pull requests

6 participants