Files
AnyPS5/docs/dev/debt/libwebrtc.md
T

24 lines
12 KiB
Markdown

# libwebrtc technical debt
### Unknown function info
- [351 exports (60 without a known name, bound by NID)](../../../core/libs/prx/libwebrtc/Export.cpp) (libwebrtc) - every function export of `libwebrtc.sprx` from the firmware 13.60 export table that the next section does not implement, names from aerolib.csv only where `tools/nid_names.py` `compute_nid` reproduces the NID. Signatures, parameter layouts and behaviour are unknown; every export throws through `NotImplemented_nid_no_patch`
- [31 data exports](../../../core/libs/prx/libwebrtc/Export.cpp) (libwebrtc) - the module also exports 31 data objects (+qcl2IzxTzg, -ix-knPYqWA, 00mefEErs+Y, 5FM0YOa3NWc, 67nsSkXmJ7E, 7I2xDnqfDV4, 8Dzy4JayJSU, CVCDyAzGrhI, HpbtuVdvO-w, PGIpx6NnFLE, Q+xnDp4KI-s, QXDv9OpZNvM, aOOjLmup+u4, g5USRJNh3bU, hvpHGXjlpbk, iU6+qODNSjU, jpkYoOv34AM, lHLJlq3NEqE, lQJvoyxHov4, nUaORqH85DQ, o6LS+08kOUs, oh8srl3AcNE, oslHzys1vV0, sp5NqvqDdHw, t66Gw3OIpSo, tr8vseK8-ro, uSis0q+bv6k, uTz5pEKL+hM, uxkudCJIYJA, whHm70jlRXw, yW0sV3sCdPA); they are not defined, so imports of them stay unresolved until their layout is known
### Public source implementations
- [Source revision](../../../core/libs/prx/libwebrtc/Export.cpp) (libwebrtc) - the module's exact WebRTC revision is not identified. Its `rtc::` names and `InterleavedView` resampler overloads place it between M127 ([branch-heads/6533](https://webrtc.googlesource.com/src/+/e0b28a6a81a989c1f5c89e30fcd247870047390d)) and M134 ([branch-heads/6998](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100)), so the exports below follow code that is the same at both. Nothing is checked on the console. Closes when: the revision is identified and the exports are compared with the console.
- [absl::numbers_internal::FastIntToBuffer(int, char*)](../../../core/libs/prx/libwebrtc/Export.cpp) (libwebrtc) - follows the abseil both branches pin, [65ef38d368](https://chromium.googlesource.com/chromium/src/third_party/+/65ef38d36813d1ad9d4cbf8a18b32ac3691f418b/abseil-cpp/absl/strings/numbers.cc) and [d212a71416](https://chromium.googlesource.com/chromium/src/third_party/+/d212a71416ad7c6ceca04d6d27dfdd84fd00c04c/abseil-cpp/absl/strings/numbers.cc): the decimal text and a NUL, returning a pointer to the NUL. For magnitudes from 10 to 99999999 its 8-byte store also zeroes the bytes after the digits up to 8 from the first digit. A null buffer, which abseil writes through, throws. Closes when: compared with the console.
- [rtc::TimeMillis and rtc::TimeMicros](../../../core/libs/prx/libwebrtc/Export.cpp) (libwebrtc) - follow `TimeNanos` and the POSIX `SystemTimeNanos` in [time_utils.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/time_utils.cc) and [system_time.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/system_time.cc), the same at both branches: the guest `CLOCK_MONOTONIC` in nanoseconds, divided down. Whether the module is built with `WEBRTC_EXCLUDE_SYSTEM_TIME` and a console clock of its own is unknown. No export sets a clock for testing, so the `g_clock` path is left out. A failing `clock_gettime` throws. Closes when: compared with the console.
- [rtc::ExpFilter::Reset and Apply](../../../core/libs/prx/libwebrtc/src/ExpFilter.cpp) (libwebrtc) - adapted from [exp_filter.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/numerics/exp_filter.cc), with its WebRTC copyright notice and BSD licence at the top of the file, on the 12-byte `alpha_`, `filtered_` and `max_` layout of `exp_filter.h`. -1 marks both an unset output and no maximum, so an output that lands on exactly -1 restarts the filter on the next sample, as upstream does. The last bit of a result can differ if the console build fuses the multiply-adds. A null filter throws. Closes when: compared with the console.
- [webrtc::rtcp::CommonHeader::Parse](../../../core/libs/prx/libwebrtc/src/RtcpCommonHeader.cpp) (libwebrtc) - adapted from [common_header.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/modules/rtp_rtcp/source/rtcp_packet/common_header.cc), with its WebRTC copyright notice and BSD licence at the top of the file, on the 16-byte layout of `common_header.h`: packet type, count or format and padding size at 0 to 2, payload size at 4 and payload pointer at 8. Its checks run in the same order, so a short buffer or a wrong version leaves the header untouched and the later failures leave the fields already parsed. The `RTC_LOG(LS_WARNING)` message each failure logs upstream is not emitted. A null header, or a null buffer of 4 bytes or more, which upstream reads, throws. Closes when: the warnings are logged through libwebrtc's logging and the parse is compared with the console.
- [WebRtcOpus encoder functions](../../../core/libs/prx/libwebrtc/src/Opus.cpp) (libwebrtc) - the 16 `WebRtcOpus_*` encoder exports are adapted from [opus_interface.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/modules/audio_coding/codecs/opus/opus_interface.cc), with its WebRTC copyright notice and BSD licence at the top of the file. They encode through the bundled libopus 1.6.1, not WebRTC's pinned copy, so packet bytes can differ. Signatures match at both revisions; M127 only adds a DTX change behind the `WebRTC-Audio-OpusAvoidNoisePumpingDuringDtx` field trial, which stays off because `InitFieldTrialsFromString` throws. Frames over 60 ms, up to 120 ms, throw: they depend on `WEBRTC_OPUS_SUPPORT_120MS_PTIME`. A null encoder or buffer in `Encode`, which upstream reads, throws. Closes when: the build flag is known and packets are compared with the console.
- [WebRtcVad_Create, WebRtcVad_Free, WebRtcVad_Init, WebRtcVad_set_mode and WebRtcVad_Process](../../../core/libs/prx/libwebrtc/Vad.cpp) use the opaque-handle C API and validation rules from [upstream WebRTC](https://github.com/webrtc-mirror/webrtc/blob/3710345e71ad3a7c1f4ed4efef152fd4fc24869a/common_audio/vad/webrtc_vad.c), with the signal-processing core from [libfvad](https://github.com/dpirch/libfvad/tree/532ab666c20d3cfda38bca63abbb0f152706c369). PS5 signatures and classification parity are not measured; differences between the console core and this WebRTC-derived revision remain unverified. Handles are host allocations and expose no guest-visible object layout.
- [webrtc::TaskQueueBase::Current and CurrentTaskQueueSetter](../../../core/libs/prx/libwebrtc/src/TaskQueueBase.cpp) (libwebrtc) - adapted from [task_queue_base.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/task_queue/task_queue_base.cc), with its WebRTC copyright notice and BSD licence at the top of the file. A thread-local pointer starts null on every thread; the 8-byte setter stores the current queue in `previous_`, makes its queue current, and its destructor makes `previous_` current again. The file's `thread_local` and pthread-key variants behave the same. A null setter, which upstream writes through, throws. Closes when: compared with the console.
- [rtc::IPAddress::ipv4_address, ipv6_address, v4AddressAsHostOrderInteger, operator== and rtc::CountIPMaskBits](../../../core/libs/prx/libwebrtc/src/IpAddress.cpp) (libwebrtc) - adapted from [ip_address.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/rtc_base/ip_address.cc), with its WebRTC copyright notice and BSD licence at the top of the file, on the 32-byte layout of `ip_address.h`: the vtable pointer at 0, `family_` at 8 and the `in_addr` or `in6_addr` union at 12. `AF_UNSPEC`, `AF_INET` and `AF_INET6` are 0, 2 and 28, as in [FreeBSD's socket.h](https://github.com/freebsd/freebsd-src/blob/55ac3c32b9ddba18b78bb3c58325294ba2e0bf6b/sys/sys/socket.h#L221-L256) and libSceNet. `CountIPMaskBits` counts from the top bit to the lowest set bit of the first word that is not all ones, so a mask with gaps counts them, as upstream does. A null address, which upstream reads, throws. Closes when: compared with the console.
- [webrtc::AudioFrame::AudioFrame(), Mute, muted, data, mutable_data and AudioFrameOperations::Mute(AudioFrame*)](../../../core/libs/prx/libwebrtc/src/AudioFrame.cpp) (libwebrtc) - adapted from [audio_frame.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/audio/audio_frame.cc) and [audio_frame_operations.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/audio/utility/audio_frame_operations.cc), with their WebRTC copyright notices and BSD licence at the top of each file, on the 15456-byte layout of `audio_frame.h` with `muted_` at 15432 and the libc++ `std::optional` that abseil's `ABSL_OPTION_USE_STD_OPTIONAL 2` selects. The constructor leaves the samples uninitialized, as upstream does. A muted frame's `data()` points to a shared zeroed buffer. `AudioFrameOperations::Mute` on more than 7680 samples, which only an `RTC_DCHECK_GE` rejects, throws. A null frame throws. Closes when: compared with the console.
- [webrtc::ANAStats::ANAStats() and the AudioEncoder GetANAStats, GetDtx, SetTargetBitrate, DisableAudioNetworkAdaptor, OnReceivedRtt, OnReceivedOverhead and SetReceiverFrameLengthRange defaults](../../../core/libs/prx/libwebrtc/src/AudioEncoder.cpp) (libwebrtc) - adapted from [audio_encoder.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/audio_codecs/audio_encoder.cc), with its WebRTC copyright notice and BSD licence at the top of the file. `ANAStats` is the 56-byte struct of seven libc++ `std::optional`s (value, then the engaged flag) that abseil's `ABSL_OPTION_USE_STD_OPTIONAL 2` selects; the constructor and `GetANAStats` leave all of them empty, and `GetANAStats` returns it through the caller's result pointer. `GetDtx` returns false and the other defaults do nothing, as upstream. A null `ANAStats` or result throws. Closes when: compared with the console.
- [webrtc::AudioDeviceGeneric BuiltInAECIsAvailable, BuiltInAGCIsAvailable, BuiltInNSIsAvailable, EnableBuiltInAEC, EnableBuiltInAGC, EnableBuiltInNS and GetPlayoutUnderrunCount](../../../core/libs/prx/libwebrtc/src/AudioDeviceGeneric.cpp) (libwebrtc) - adapted from [audio_device_generic.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/modules/audio_device/audio_device_generic.cc), with its WebRTC copyright notice and BSD licence at the top of the file. As upstream, the availability checks return false and the others return -1 without reading the device. The `RTC_LOG_F(LS_ERROR)` "Not supported on this platform" message each call logs upstream is not emitted. Closes when: the message is logged through libwebrtc's logging and the defaults are compared with the console.
- [webrtc::AudioDecoder HasDecodePlc, DecodePlc, GeneratePlc and ErrorCode](../../../core/libs/prx/libwebrtc/src/AudioDecoder.cpp) (libwebrtc) - adapted from [audio_decoder.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/api/audio_codecs/audio_decoder.cc), with its WebRTC copyright notice and BSD licence at the top of the file. As upstream, `HasDecodePlc` returns false, `DecodePlc` and `ErrorCode` return 0, and `GeneratePlc` leaves the concealment buffer untouched, none of them reading the decoder or the output. Closes when: compared with the console.
- [webrtc::GetAvailableCpuFeatures](../../../core/libs/prx/libwebrtc/src/CpuFeatures.cpp) (libwebrtc) - whether the module is built with `WEBRTC_ENABLE_AVX2` is unknown; this follows the default x86 build, where `avx2` needs AVX, XSAVE, OSXSAVE, the kernel saving the YMM state, AVX2 and BMI2. Without that flag the console reports `avx2` false on every CPU. Adapted from [cpu_features.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/modules/audio_processing/agc2/cpu_features.cc) and `GetCPUInfo` in [system_wrappers/source/cpu_features.cc](https://webrtc.googlesource.com/src/+/8d78f5de6c27b2c793039989ea381f1428fb0100/system_wrappers/source/cpu_features.cc), with their WebRTC notices and BSD licence at the top of the file: `sse2` is CPUID leaf 1 EDX bit 26 and `neon` is false. The features are those of the host CPU running the title, not the console's Zen 2. Closes when: the build flag is known.