fix(android): wire exact preview startup and device benchmarks
Gitea CI / Check code and tests (pull_request) Successful in 11m6s
Gitea CI / Build Android APK (pull_request) Successful in 5m15s
Gitea CI / Build Windows x64 app (pull_request) Successful in 2m41s
Gitea CI / Audit and package Windows x64 (pull_request) Successful in 1m2s
Gitea CI / Assemble and validate CI artifacts (pull_request) Successful in 51s
Gitea CI / Gitea CI passed (pull_request) Successful in 2s

This commit is contained in:
lingjhf committed 2026-10-08 01:37:58 +08:00
1 parent b4cb12cbe3
commit 64a3a5b547
11 files changed
+1577 -30

No files matched your search

+112
View File
@@ -6,6 +6,80 @@ backends. `test_driver/integration_test.dart` is the host driver used by
media, models, reports and credentials are supplied locally and stay outside
version control. Normal release builds use `lib/main.dart`.
## Android navigation and playhead measurements
`android_decoder_material_performance_test.dart` extends the production workspace
benchmark to other source rates and variable timestamps. Supply
`CUTDEX_TEST_SOURCE_PTS` as an independent, sorted list of original frame PTS
(one integer source tick per line), with `CUTDEX_TEST_SOURCE_TIMESCALE` set to
that clock's denominator, such as 90000. The default timescale is 1000000 for
existing integer-microsecond fixtures; preserve original source ticks for frame
boundaries that cannot be represented in microseconds. `CUTDEX_TEST_FRAME_STEP_US`
is the nominal frame period rounded to microseconds. Its eight `matchedSeeks` use
the standalone benchmark's exact request sequence. Full-source ruler drags and
20-frame local drags use the production timeline and are reported separately;
their inputs differ from the standalone source replay.
`CUTDEX_TEST_CALIBRATE=true` explicitly runs native/software calibration before
opening the workspace and verifies both sets against the external PTS list.
It asserts the admitted backend throughout later navigation and gestures.
The application opens no calibration workload automatically.
If the device's installed application has a different signing certificate,
build the development flavor with
`CUTDEX_VALIDATION_APPLICATION_ID=com.example.cutdex.decoder_validation`.
This creates `com.example.cutdex.decoder_validation.dev`, labeled
`Cutdex Decoder Test`, while preserving the installed application and its data.
For a cache baseline, set `CUTDEX_PREVIEW_REVERSE_CACHE_MIB=24`;
set it to `0` for normal device policy. These properties affect development only.
Use matching private file paths and retain the app between runs.
`android_navigation_performance_test.dart` mounts the production `EditorWorkspace`
with real `Projects`, preview and native playback providers. Its project and
application database are isolated. Supply a complete original video through
`CUTDEX_TEST_SOURCE` and an app-writable JSON path through `CUTDEX_TEST_REPORT`.
The test keeps production audible-skimming policy and uses touch input on real
timeline tabs and the timeline ruler. It measures cold/cached selection, rapid
selection replacement, exact seeks, full-source fit-to-viewport and local
20-frame drags, and both immediate release and a one-second stationary hold.
The source-frame containment checks currently require an untrimmed CFR
2997/100 fps source.
Use `--dart-define=CUTDEX_TEST_DECODER=ffmpeg` to assert the actual decoder
from initial load through seeks, both drag directions and final release.
Reports retain per-layer backend and selection-reason diagnostics.
```powershell
fvm dart tool/flutter_local.dart drive --profile --flavor development -d DEVICE_ID --keep-app-running `
--driver=test_driver/integration_test.dart `
--target=integration_test/android_navigation_performance_test.dart `
--dart-define=CUTDEX_TEST_SOURCE=/data/user/0/com.example.cutdex.dev/files/cutdex-validation/source.mp4 `
--dart-define=CUTDEX_TEST_REPORT=/data/user/0/com.example.cutdex.dev/files/cutdex-validation/results.json
```
The pinned SDK uses the published Android 0.1.3 Maven artifacts. Use explicit SDK
and Android source overrides only when comparing unpublished changes. Calibration
requires a `--debug` build; profile/production hosts do not register its channel.
UI timing ends at the
target workspace's post-frame callback. Native diagnostics record queued output
frames/content timestamps and backend seek/reuse counters; those do not measure
physical display refresh. The planned drag input rate is 60 Hz; retain actual
input timestamps and report achieved input cadence. The test uses `fullyLive`
frame scheduling and does not pump a Flutter frame for every pointer input.
Native polling has at most
one outstanding request, so decoder latency cannot accumulate diagnostic reads.
Source PTS is distinct from the requested timeline sample. A stationary release
must preserve source PTS, output-frame count and seek count; the final source
frame must cover the target tick. These counters measure queued native output,
not physical scanout. A cached timeline's nonzero frame counter alone does not
prove that its new Surface has displayed the retained frame.
Rebuild/install the normal `lib/main.dart` entry point after testing. Do not clear
app data or uninstall merely to obtain a cold sample.
Always pass `--keep-app-running`: Flutter drive otherwise uninstalls the Android
application during cleanup, which also deletes its application data.
On devices that deny access to ADB-created external app directories, copy the
fixture into the installed debuggable development app's internal files using
`run-as`, and export its report with `adb exec-out run-as PACKAGE cat PATH`.
## Desktop plugin registration
`native_desktop_plugins_test.dart` checks the real application's registration of
@@ -416,3 +490,41 @@ remove the test's own project and exports afterward.
Some devices disconnect the host driver while DocumentsUI is foreground. In
that case, inspect the original application's log and private JSON reports; a
driver disconnection alone does not establish whether the import succeeded.
## Android native Surface preview comparison
The development build can enable the experimental native source with the Gradle
property `cutdexNativeSurfacePreview=true` or environment variable
`CUTDEX_NATIVE_SURFACE_PREVIEW=true`. Production and default development builds
leave it disabled. `android_decoder_material_performance_test.dart` uses the real
EditorWorkspace with the whole original clip fitted into the timeline viewport.
Set `CUTDEX_TEST_DECODER=media3-surface` to fail if the source falls back; use
`ffmpeg` for the paired baseline. `CUTDEX_TEST_PLAYBACK=true` additionally records
three seconds of unique frame changes, play/pause acknowledgments and a frozen
paused frame. The existing seek/drag assertions independently check every observed
frame against original rational packet PTS and require zero extra release seek
or presentation for an already precise held picture.
Use a separate validation application ID to preserve the installed development
application and its projects. Supply media and PTS files inside that validation
app's sandbox; no personal fixture or benchmark report is committed here.
For example, an explicitly admitted 60 fps / 90000 Hz source can be measured with:
```powershell
$env:CUTDEX_VALIDATION_APPLICATION_ID = 'com.example.cutdex.decoder_validation'
$env:CUTDEX_NATIVE_SURFACE_PREVIEW = 'true'
fvm dart tool/flutter_local.dart drive --profile --flavor development -d DEVICE_ID --keep-app-running `
--driver=test_driver/integration_test.dart `
--target=integration_test/android_decoder_material_performance_test.dart `
--dart-define=CUTDEX_TEST_SOURCE=/data/user/0/com.example.cutdex.decoder_validation.dev/files/source.mp4 `
--dart-define=CUTDEX_TEST_SOURCE_PTS=/data/user/0/com.example.cutdex.decoder_validation.dev/files/source-pts.txt `
--dart-define=CUTDEX_TEST_SOURCE_TIMESCALE=90000 --dart-define=CUTDEX_TEST_FRAME_STEP_US=16667 `
--dart-define=CUTDEX_TEST_DECODER=media3-surface --dart-define=CUTDEX_TEST_PLAYBACK=true `
--dart-define=CUTDEX_TEST_REPORT=/data/user/0/com.example.cutdex.decoder_validation.dev/files/native-results.json
```
Repeat with `CUTDEX_NATIVE_SURFACE_PREVIEW=false`, `CUTDEX_TEST_DECODER=ffmpeg`
and another report path for the software baseline. Restore the default environment
and normal application entry point after testing. Record first-source indexing
separately from warm seek timings. Only compare inputs with matching source clocks,
targets, drag trajectories, audio/UI workloads and achieved input cadence.