Skip to content

fix(libSceVideodec2): decode after a flush without a reset - #7252

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
thuanquang:fix/videodec2-decode-after-flush
Oct 17, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
thuanquang:fix/videodec2-decode-after-flush

Conversation

@thuanquang

Copy link
Copy Markdown
Contributor

What

TEKKEN DARK RESURRECTION (PPSA31371) runs in Sony's PSP emulator. With its first stop (#7118, #7251) cleared locally, the reporter's run reaches the Bandai Namco logo, starts a 480x272 H.264 video and aborts with Videodec2: reset required after flushing (#7118).

sceVideodec2Decode threw whenever it was called after sceVideodec2Flush without a sceVideodec2Reset in between, so the title makes that call. Since the title runs on the console, the console's library accepts it.

sceVideodec2Decode now restarts FFmpeg's decoder after a flush (avcodec_flush_buffers, which FFmpeg requires before a drained decoder takes new packets) and decodes the unit. The decoder keeps what sceVideodec2Reset would clear:

  • pictures the flush already decoded but has not returned yet, which come out before the new ones;
  • picture ownership;
  • held parameter-set units;
  • VP9 references.

shadPS4's VdecDecoder::Decode does the same when FFmpeg reports end of stream (videodec2_impl.cpp).

A technical debt entry records that what the console returns for pictures still queued at that point, and for a stream that continues across the flush without a new IDR picture, is not measured.

Tested

Windows 11 26200, Ryzen 5 5600X, WinLibs GCC 15.2.0 r7, Release, BUILD_TESTING=ON:

Checklist

🤖 Generated with Claude Code

sceVideodec2Decode threw when it followed sceVideodec2Flush without
sceVideodec2Reset. It now resets FFmpeg's drained decoder and decodes the
unit, keeping the pictures the flush has not returned yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

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.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 6709 docs/dev/debt/libSceVideodec2.md L13

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.

Pull request Shared files not compared
PR 6044 core/libs/tests/GuestVideodec2.cpp
PR 6414 core/libs/prx/libSceVideodec2/Export.cpp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants