mirror of
https://github.com/TheBozos/BozoEngine.git
synced 2026-12-01 07:38:19 -10:00
Sony's libmpeg calls the stream callbacks inside sceMpegDemuxPss / sceMpegDemuxPssRing and Nodata inside sceMpegGetPicture, on the caller's thread. The native library queued them for whichever thread ran next, which deadlocks Steambot Chronicles' player (Sony's sample): its video callback waits on the IPU input ring's lock held by the thread it was stacked on. With the option on (off by default), each callback is a handler bound to the calling thread and the call is made again after it: the demux going on from where it was, GetPicture calling Nodata again until a picture is there. - Kernel::queue(handler, thread): a handler that runs only on that thread; handlerQueuedFor(thread) for the dispatcher's checks; the bindings saved in an optional section (older states load with none). - Libraries::queueHandlerOn and restartCall: the free host stops the thread at the call's own address. - MpegState::demuxResuming / demuxBytes, saved as an optional tail of the mpeg section. - Tests: thread-bound handlers (handler_stacks), the demux and Nodata loop (mpeg_callbacks). Co-Authored-By: Claude Opus 5.5 <[email protected]>