Repository navigation
fix(libSceVideodec2): flush without draining when no picture is pending - #8660
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
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.
|
679d51e to
6047374
Compare
|
Windows data point for
|
6047374 to
1f79743
Compare
|
Rebased onto main Rerun on Linux, Release build:
|
1f79743 to
4af7e24
Compare
|
Rebased again onto main Rerun on Linux, Release build:
|
4af7e24 to
5f4b2b9
Compare
sceVideodec2Flush drained libavcodec with an empty packet whenever the decoder
was not already flushing, and the next sceVideodec2Decode then restarted the
decoder with avcodec_flush_buffers, dropping its reference pictures. A caller
that flushes after every access unit, as Sony's PSP emulator does for its
H.264 movies, lost every P picture after the first: libavcodec withholds
pictures after a restart until it reaches a keyframe, so Daxter (PPSA09695)
got 8 pictures from 459 access units and showed a black screen ("Failed to
obtain a video frame") instead of its intro movie.
Flush now drains only when a decoded access unit has not produced its picture
yet. With nothing pending there is nothing to return, and the decoder keeps its
references for the units that follow.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5f4b2b9 to
28d9f26
Compare
|
Rebased onto
I also shortened the debt entry by about a dozen characters, because the conventions checker flagged it at 1011 characters. It now passes |
What
sceVideodec2Flushdrained libavcodec with an empty packet whenever the decoder was not already flushing. The nextsceVideodec2Decodethen restarted the decoder withavcodec_flush_buffers, which drops its reference pictures. After such a restart, libavcodec's H.264 decoder withholds pictures until it reaches a keyframe.Sony's PSP emulator (PSPHD 1.7, used by Daxter PPSA09695) calls
sceVideodec2Decodeand thensceVideodec2Flushfor every access unit of its H.264 movies (480x272 Main, no B pictures). WithAPS5_TRACE_VIDEODEC=1and a temporary log of each call, the sequence isDecode, Flush, Decode, Flush, ...(461 flushes in 70 s). Only the IDR pictures came back: 8 pictures from 459 access units. The emulator logged(TextureCache) WARN : Failed to obtain a video frame.for every other frame, and the intro movie was a black screen.sceVideodec2Flushnow drains only when a decoded access unit has not produced its picture yet. With nothing pending there is nothing to return, so the decoder keeps its references and the units that follow decode normally.Decodeafter it restarts the decoder as before.The access units the title submitted, dumped and decoded offline with the same libavcodec settings (
AV_EF_EXPLODE, slice threads), give 8 of 459 pictures with a drain-and-restart after every unit and 459 of 459 without it. The FFmpeg command line decodes all 459 from the concatenated units.Tested
Linux 7.2.9-arch1-1, Ryzen 9 7950X, AMD Radeon RX 6650 XT, RADV Mesa 26.2.4.
New
testFlushAfterEveryUnitinguest_videodec2: a 658-byte 64x48 constrained-baseline IPPP stream (x264, no B pictures, SEI removed). It is decoded once without flushes and once withsceVideodec2Flushafter every unit, and both must return the same 4 pictures (NV12 hashes). It fails without the library change (a flush after each access unit lost or changed the pictures that follow it) and passes with it.guest_videodec2,guest_vdecsw,guest_avplayer,guest_avplayer_callback_closeandguest_avplayer_paused_first_videopass. That includes the existingtestDecodeAfterFlush(flush on an empty decoder, and decoding a reordered stream after a draining flush).PPSA09695 01.000.003 natively on main
434e965d46+ fix(libSceCommonDialog): return ALREADY_SYSTEM_INITIALIZED from a second sceCommonDialogInitialize #8618 (Daxter stops at startup without it, onsceCommonDialogInitialize). Same runtime and scripted input, without and with this change:Failed to obtain a video framelines in 100 s.Not verified on a console: what the console returns from a flush with pictures pending, and whether it keeps references across one.
Independent Windows data point (Windows 10 19045, MinGW GCC 15.2): the new test passes with the change and fails with the library files restored to
main, 3 of 3 each (comment).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)