feat(libwebrtc): implement AudioDecoder::Decode and DecodeRedundant #16870
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16870"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by AlexWhitehouse on 2026-11-07T19:28:00Z.
What
Two libwebrtc exports threw
..._nid_postfix not implemented:webrtc::AudioDecoder::Decode(_ZN6webrtc12AudioDecoder6DecodeEPKhmimPsPNS0_10SpeechTypeE, NIDNK438p2MZgA);webrtc::AudioDecoder::DecodeRedundant(_ZN6webrtc12AudioDecoder15DecodeRedundantEPKhmimPsPNS0_10SpeechTypeE, NIDClTxsLU-OX4).This PR implements them from
audio_decoder.ccat M134 (8d78f5de), the revision the other libwebrtc ports cite. Both functions are the same at M127 (e0b28a6a). The newAudioDecoderDecode.cppstarts with that file's notice.Each function calls the guest decoder's own virtual functions, as upstream does:
PacketDuration(PacketDurationRedundantforDecodeRedundant).duration * Channels() * sizeof(int16_t) > max_decoded_bytes, it returns -1. This uses upstream'sint×size_tarithmetic, andChannels()is only called for a non-negative duration.DecodeInternal(DecodeRedundantInternal).Other details:
TRACE_EVENT0andMsanCheckInitializeddo nothing in release builds, so this PR doesn't reproduce them.audio_decoder.hat both milestones. Calls go through the guest's System V ABI (APS5_VABI) on every host.The libwebrtc unknown-export count drops from 300 to 298.
Tested
guest_webrtc_audio_decoder_decodeandguest_webrtc_audio_decoder_decode_redundant(tests/AudioDecoderDecode.cpp). They use a fake guest vtable whose callbacks record their arguments and write recognisable samples and a speech type. They cover:main, both fail with..._nid_postfix not implemented;guest_webrtc_audio_decoder(3/3).python3 tools/check_conventions.py --base origin/main: all checks passed.python3 tools/pr_overlap.py --branch feat/libwebrtc-audio-decoder-decode: no open PR implements these exports.ParseResultstubs and the existingAudioDecoderfiles, which this PR leaves alone.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by gabichuuuuu on 2026-11-07T22:05:32Z.
Review: COMMENTED
Read
ed36d08d33againstmain.DecodeandDecodeRedundantmatchaudio_decoder.ccat8d78f5de: duration first,Channels()only for a non-negative duration, the sameint/size_tcapacity arithmetic, -1 on overflow and otherwise the*Internalresult, withspeech_typepassed through untouched. Slots 8, 9, 12, 13 and 14 match the virtual order ofaudio_decoder.hat that revision. The tests would fail onmain, including the one that leaves slot 12 null to proveChannels()is skipped for a negative duration.Count line.
mainnow lists 296 unknown exports, sodocs/dev/debt/libwebrtc.md:5should read 294 after the rebase, and the appended debt entry's context has moved too (mainadded aVideoFrame::Builderentry afterFieldTrial); GitHub currently shows a conflict.Not run here; this is from reading the code.
AI-assisted: yes.