Probably how I'll handle the PSF2 playback using libsd: Maybe do something like a "logging" mechanism.
R3000 is processed on EE. Just enough of SPU2 is implemented on EE, so that state / echo buffer readbacks are "good enough".
Reads/writes/DMA xfers are logged on EE, minimized to libsd calls, and sent to IOP with DMA. No sound data (state / echo buffer etc) goes back to EE.
--
Probably how I would implement UDPIPU is either one of two of the following:
RTP and any of:
1. MPEG2 I-frames decoded by IPU, possibly lz4 compressed
2. H.264
and any of:
1. Opus
2. ADPCM
3. PCM
The choice I will make will depend on benchmarks.
I will probably base the protocol on what Moonlight is doing.
For now, the design is looking like a bridge application would be needed to bridge PS2 and Gamestream server.
On a related note, looks like there is an OSS server for Gamestream:
https://github.com/loki-47-6F-64/sunshine
--
Seems like GCC 12 is close to being released:
https://gcc.gnu.org/pipermail/gcc/2022-April/238491.html
--
I haven't gotten the design for UDPBD write support nailed down yet.
What complicates things is that the server is a loop based design while the client uses an interrupt based design in addition to loops.
Server blocks on recvfrom and then does sendto based on the contents of the packet.
Client calls a function based on an interrupt. Client sends packets by direct address writes (DMA is only done for read).
So basically:
For UDPBD connect, server sends identify packet, client receives identify packet and calls interrupt, read headers by address reads, response by direct address writes.
For UDPBD read, data is fragmented into several parts, loop for each part, send read command for range, wait semaphore.
- Server receives read command, fragments range and sends multiple of those packets.
- Client receives read packet and calls interrupt, read headers by address reads, DMA right into user buffer, signal semaphore.
I'd think I'd like to simplify the read by removing the loop from the initial send, and instead requesting the whole range. Instead, make the server calculate the fragmentation and when the client should send ACKs/NAKs and reset the timeout alarm.