Visitar URL original
Improve AV1 throughput by retaining dav1d frame threading by anilbeesetti · Pull Request #223 · anilbeesetti/nextlib · GitHub
Skip to content

Improve AV1 throughput by retaining dav1d frame threading - #223

Merged
anilbeesetti merged 1 commit into
mainfrom
fix/av1-frame-threading
Oct 30, 2026
Merged

anilbeesetti merged 1 commit into
mainfrom
fix/av1-frame-threading

Conversation

@anilbeesetti

@anilbeesetti anilbeesetti commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Nextlib forces AV1 into low-delay mode, which FFmpeg maps to dav1d max_frame_delay=1. This prevents parallel decoding of different frames. Investigation of anilbeesetti/nextplayer#2025 reproduced this throughput limitation and confirmed that Next Player v0.18.0 selects nextlib's dav1d decoder on Android 8.

Replace the video's one-input/one-output worker with a Media3-derived draining worker. It handles inputs without immediate output, drains delayed frames before EOS, filters seeks by decoded PTS, and discards pending drain state on flush. Keep the existing packet retry, frame ownership, conversion and decoder selection paths. Add regression fixtures, worker/lifecycle coverage, and a repeatable native Android benchmark.

Controlled native benchmark, pinned FFmpeg 9.0.1 / dav1d 1.5.4, four decoder threads, seven alternating runs on x86_64 host:

720p input Previous decode New decode Gain
8-bit 439.6 fps 615.6 fps 40.1%
10-bit 375.4 fps 544.8 fps 45.1%

Decode plus RGBA throughput improved 58.5% / 52.8%, respectively. All 180 frames were retained. These are host throughput measurements, not Android playback frame rates; Surface costs are excluded. Full methods, conversion costs, CPU sampling and reproduction commands are in AV1_PERFORMANCE.md.

Validation:

  • All four Nextlib release ABIs built; setup regression checks and 15 JVM tests passed.
  • Nine instrumentation tests passed on a disposable x86_64 Android 8.0 / API 26 emulator without KVM. Coverage includes short AV1 clips, 8/10-bit output, a single output buffer, delayed EOS, seek filtering, flush/replay, rotation and surface cleanup.
  • Native AV1 regression retained all 48 frames, including two drained frames, before and after reset for both bit depths. Existing VP9/backpressure/color/rotation/native-window regressions passed.
  • Next Player composite assembleDebug test ktlintCheck passed: 320 JVM tests, zero failures/errors/skips. Temporary AGP catalog alignment and failure enforcement are documented; no app dependencies were changed.
  • Final composite APK's native library matches the local build. Both 8/10-bit AV1 clips played through dav1d and supported paused forward/backward seeking on API 26, with no FFmpeg packet/playback errors or crashes.

The original Honor 6X and sample file were unavailable, and the report omits media parameters. Physical-device performance and VLC parity remain unverified. This fixes a measured nextlib limitation without claiming full reproduction of that device-specific symptom.

@anilbeesetti
anilbeesetti merged commit d7295bf into main Oct 30, 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