Skip to content

Cleanup/v0.5.0 fixes 20260527192058#4

Merged
axgdev merged 16 commits into
mainfrom
cleanup/v0.5.0-fixes-20260527192058
May 27, 2026
Merged

Cleanup/v0.5.0 fixes 20260527192058#4
axgdev merged 16 commits into
mainfrom
cleanup/v0.5.0-fixes-20260527192058

Conversation

@axgdev

@axgdev axgdev commented May 27, 2026

Copy link
Copy Markdown
Owner

Fix heavy auto-save feature
Fix media sometimes not having progress bar
Fix media seeking algorithm
Playing audio displays current play time and total audio time
Remove PMP player, native player plays many formats including MP4, and many audio formats
Remove stale JS frontend code
Quick menu is native, remove js implementation
Add new option for media player as the top app

There are many improvements that need to be done for file navigation.

axgdev added 16 commits May 26, 2026 19:44
Route AVI files through the media handling path instead of the pmp-video libretro core so theme videos discovered by the file browser do not hit the crashing core launch path.

Stop treating .md files as PicoDrive content to avoid launching theme README files as Mega Drive ROMs during broad SD-card browsing.
Delete the old packaged JavaScript frontend, bytecode packaging helper, duplicate frontend languages, and JS frontend catalog source. Keep the libretro quick menu and native frontend assets.

Slim the JS2300 frontend bridge into a standalone script host for diagnostics and optional scripts. Preserve filesystem, battery, backlight, AV, storage, and diagnostic actions while dropping old JS app launch, catalog, icon, and framebuffer paths.

Update repository notes and architecture docs to describe the native frontend plus script-only JS2300 boundary. Verified with make quick-check, make, and make verify.
Remove the JavaScript quick-menu source and the libretro-host JS2300 quick-menu runtime path. The in-game pause menu now enters the native quick menu directly and no longer carries quick-menu-specific JS heap, stack, bytecode, video, input, or action glue.

Keep package and install cleanup aware of stale quick-menu.js files so upgraded SD cards do not retain the removed JavaScript menu.

Prune stale planning and recovery-audit docs, update JS2300 scripting documentation to match the current lightweight script host, and correct README/AGENTS defaults for native media and wide20/boot storage behavior.

Verified with make quick-check, make, and make verify.
Remove pmp-video from the shipped libretro core manifest, core build targets, package module list, and device system-check requirements.

Add Apps > Media Player as a native media-only browser that launches videos, music, and images through the HCRTOS/FFmpeg media stack, with Open With available from the media app for backend selection.

Update third-party notices and frontend/core documentation to describe the native media player and remove stale PMP-video references.
Throttle native video seek input while the hardware decoder is still settling or catching up, preventing rapid successive seeks from feeding the next keyframe into an unstable decoder.

Render a native audio now-playing screen from the media backend so audio playback does not depend on the frontend loading view remaining visible.

Route GB300 FFmpeg audio fallback through the SND backend and leave the output gate muted until the backend sees real signal, avoiding the audsink write failure path seen in the latest log.
Replace the native video seek cooldown with a queued seek target so repeated left/right presses accumulate while the decoder settles instead of being ignored.

Move audio playback to a persistent media-owned now-playing screen with an integrated progress bar, and stop the frontend from showing the audio loading splash.

Reduce native video startup flicker by keeping the existing screen until video is ready and revealing the video layer only after a real picture is available.
Make native video seeks supersede any in-flight catchup immediately instead of queueing behind stale decode work, and feed keyframe-to-target preroll through the hardware decoder so repeated forward seeks do not wait for a later keyframe.

Reset audio clocks, software audio buffers, resamplers, and hardware-audio stall epochs on seek so post-seek playback does not fall into false fallback or slow software sync.

Add seeking to the FFmpeg audio fallback path and clear the graphics framebuffer to black before native video playback starts so the loading screen is not left visible under the first video frame.
Keep keyframe-required video seeks bounded on high-resolution content. When the backward seek anchor is too far from the requested target or its keyframe is too large for the configured preroll budget, the native path now avoids feeding that HD burst into viddec, holds audio, tries a forward demux seek, and resumes on the next usable keyframe with pacers and AV sync realigned.

Close the video sink before viddec module resets so decoder failures do not leave stale display resources open for the next playback attempt.

Verified with make quick-check and make verify.
Replace the normal native video seek path for keyframe-required codecs with a direction-aware keyframe seek primitive. Forward seeks land on the next usable keyframe, backward seeks can land on the previous usable keyframe, and both paths hold audio until the actual keyframe is known instead of pushing preroll bursts into viddec.

This removes the resolution-sensitive preroll behavior that could overflow or poison viddec after rapid seeks. The packet loop now accepts the selected keyframe as the new AV sync point and realigns the hardware pacers to that actual timestamp.

Harden native decoder failure handling by tracking hardware decode/display failures, resetting llav_vdec, vidsink, and viddec in dependency order, and skipping software-video fallback after native hardware errors to avoid churning the same poisoned display path.

Verified with git diff --check, make quick-check, and make verify.
Treat post-seek hardware decoder clocks as stale until playback reaches the new seek epoch. Hardware-ahead caps now use an effective clock floor instead of blocking on old VIDDEC/AUDDEC timestamps, which keeps the shared keyframe seek path responsive on GB300 and SF2000.

Interrupt wall pacing and hardware-ahead waits when media controls are pending, so repeated seek requests are consumed immediately instead of waiting for decoder-ahead timeouts.

Use one keyframe seek algorithm across devices by resetting AVSYNC at the selected keyframe and removing the SF2000-specific AV sync skip. The catchup log now reports keyframe mode instead of the legacy skip label.

Also route auddec-only seek current calculations through the same pacer model, so compressed audio seeks do not fall back to stale hardware time after the first seek.

Verified with git diff --check, make quick-check, and make verify.
The 0169 logs showed SF2000 and GB300 were both using the keyframe seek barrier, but VIDDEC_FLUSH was still keyed off the audio routing preference: SF2000 passed rate_milli=0 while GB300 passed rate_milli=1000. Seek flushes now always resume viddec at normal speed so both devices use the same native seek algorithm.

Bound the native video compressed KSHM ring to an 8 MiB default across resolutions and expose MEDIA_VIDEO_KSHM_SIZE as the main tuning knob. This reduces normal-heap pressure before high-resolution decoder setup while keeping the low-resolution override available.

Add a media launch breadcrumb before disk log suspension so a hard hardware-video freeze still leaves the selected file in the persisted log. Rename the startup seek policy field away from seek_catchup to avoid confusing packet dropping with accelerated catch-up playback.

Verified with git diff --check, make quick-check, and make verify.
Recovered 0170 shows SF2000 high-resolution video initializes and reveals frames, then after seek the video decoder stops accepting the next ES packet header with EPERM until timeout. Add a bounded native viddec reopen and demux reseek recovery so playback can continue from the same target instead of aborting the session.

Treat repeated video EPERM writes as a fast hardware-refusal signal and enter recovery after a short timeout, while keeping the normal write-space timeout for ordinary EAGAIN and EBUSY backpressure.

Stop drawing the media loading screen at 100 percent. The frontend now blacks out and closes its UI framebuffer at native media handoff, which prevents stale loading pixels behind the video plane and lets the native progress overlay own the framebuffer.

Verified with git diff --check, make quick-check, and make verify.
0172 showed 1080p seeking recovering successfully several times before playback failed only because the native video write recovery counter hit a per-session cap. Change that guard into a consecutive-failure streak and reset it after the next successful packet write, so independent seeks can keep using fast decoder reopen recovery without exhausting a session budget.

Make the native progress overlay visible with hardware video active by treating it as a small framebuffer strip below the video window. The video layer remains on top, but its display rect is shortened after the bar is drawn so the prepared strip can be seen without relying on framebuffer alpha support.

Clear overlay pixels on close and keep the video layer state explicit across reveal, hide, and decoder reopen transitions.

Verified with git diff --check, make quick-check, and make verify.
0174 showed video overlay strips being enabled even when framebuffer overlay drawing had failed, leaving only a black reclaimed strip. Keep a cached framebuffer handle through native video startup, draw/present through that handle, and only mark the overlay active after pixels are successfully written. The progress strip and bar are also made larger and higher contrast.

FFmpeg WAV seeks were using SND_IOCTL_DROP; the log showed DROP returning success but the next write failing with EPERM and a stuck delay. Replace software-audio seek drops with a close/reopen/start output reset so seek state is rebuilt from a clean audio ring.

Direct WAV now handles seek controls in both PCM and MS ADPCM loops using the same reset building block, with file position, played clock, and overlay state updated together. Successful playback is tracked separately from the current playhead so seeking back to zero does not look like decode failure.

Verified with make quick-check and make verify.
0176 showed the media session closing and the frontend framebuffer reopening, then waiting until the next input before the menu became visible. The reopened framebuffer can be black while the draw de-duplication signature still matches the last menu frame, so draw() may skip the first return present.

Invalidate the frontend draw signature and mark a present required after returning from media, game, and script handoffs. For media this happens after restoring the Open With parent view, so the first post-media frame is the actual destination menu.

Verified with make quick-check and make verify.
It is too heavy in SD card writes, this could be implemented differently in the future
@axgdev axgdev merged commit 49dae62 into main May 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant