fix(libSceVoice): queue the packets sceVoiceWriteToIPort accepts #7566
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7566"
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 slick-daddy on 2026-10-18T14:30:46Z.
What
sceVoiceWriteToIPort threw NotImplemented_nid_no_patch, so no title could hand a voice packet to the library. It now checks data, size, the library state and the port like the other port calls, writes to IN_PCMAUDIO and IN_VOICE ports only (IN_DEVICE and output ports throw), and takes size as both input and output: the packet is queued in the port and the accepted byte count is written back, a write that does not fit reporting 0 so the caller retries.
A PCM write ignores frameGaps and is capped by pcmaudio.buffer_size from SceVoicePortParam (5 x 3840-byte fallback when the port declares none). An encoded write takes 1 frame plus frameGaps missing frames, a negative gap acting as a backfill offset that occupies 1 frame here, and is capped at 5 frames of 20 ms, the frame being (bitrate * 20 + 7999) / 8000 for a voice port, which is what sceVoiceGetPortInfo reports. The four-argument signature is the PS Vita one in VitaSDK voice.h. Each packet records the frames it occupies, so the queue totals are read off the packets and sceVoiceResetPort drops them. libSceVoice moves from 19/22 to 20/22; sceVoiceEnableChat and sceVoiceDisableChat stay unimplemented.
Tested
Host tests only, no title and no console: guest_voice extended with PCM buffer_size, ignored PCM gap, negative-gap backfill and IN_DEVICE rejection cases. tools/check_conventions.py --base origin/main passes. MinGW and full guest test run not available on this machine (no MinGW/Ninja in PATH).
Checklist
Other things worth reading before merge:
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:31:32Z.
Progress report (
7a36de6→c2423e4)📈 System libraries: 82.53% (+0.02%, +1 implemented functions)
✅ 1 implemented
sceVoiceWriteToIPortImported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-18T14:59:04Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
core/libs/tests/GuestVoice.cppImported from boykopovar/AnyPS5. Originally posted by wachi35676 on 2026-10-19T01:10:01Z.
This implements the same export as #6090, which was opened on 2026-10-14 and tested on Linux there. The overlap isn't mentioned in this PR.
The queue model conflicts with the PS Vita
sceVoiceWriteToIPortdocumentation in the VitaSDK header that this debt file already cites,voice.h#L446-L467. It has the same four-argument signature, so the PS3Ex2assumption isn't needed. The header says:frame_gap;IN_PCMAUDIOandIN_VOICEports are written;buffer_sizefromSceVoicePortParam(#L141-L145).RPCS3's
cellVoiceWriteToIPortEx2(#L836-L853) only checks the port, and leavessizealone.Reproduced with a probe on Windows 11 (GCC 15.2.0) and on Linux (GCC 13.3), base
a373e85e5with this PR:sceVoiceResetPort. A title that retries on 0 never gets through.pcmaudio.buffer_sizeis ignored; the cap is a fixed 5 × 3840 bytes.frame_gapon a PCM port takes queue space.frame_gapthrows.IN_DEVICEport accepts writes.guest_voiceitself passes on both hosts, and aborts withExport.cppreverted.AI-assisted: yes (Claude Code); results above were run on this machine.
Imported from boykopovar/AnyPS5. Originally posted by slick-daddy on 2026-10-19T11:36:27Z.
Verified each point against the codebase and reworked the branch. Depends on 6090 is now declared in the PR body since both implement sceVoiceWriteToIPort and need convergence before merge. PCM buffer_size, PCM gap ignore, negative-gap backfill, IN_DEVICE rejection, and Vita signature source are addressed. Queue drain stays documented debt: libSceVoiceChat reports signed out so no packet can reach an output port, and a full queue reports 0 bytes as the full-queue signal.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T16:28:45Z.
Closing as a duplicate of #6090, which implements the same export (
sceVoiceWriteToIPort), was opened first, has review feedback and a Linux run from another contributor. The overlap is the whole PR (same function, sameGuestVoice.cpptest), so it can't be trimmed, and the checklist line "no other open PR implements the same functions" doesn't hold.Separately, the queue model rests on values with no source: 5 frames, the 3840-byte fallback, a negative gap occupying 1 frame, and
*size = 0on a full queue. None of KytyPS5, shadPS4 or prosper has a body for this call, nothing reads or drains the queue (byte_countstays 0 andsceVoiceReadFromOPortreturns nothing), and none of it is measured, so it adds state with no consumer.If you want the Vita semantics (PCM ignoring
frame_gap, encoded gap handling) in, please propose them on #6090 so there is a single change for this export. Welcome to reopen once that is settled.Pull request closed