mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-14 15:10:22 +02:00
perf: optimize native worker snapshot writes with delta mode
Replace full-queue snapshot writes on every progress tick with a lightweight delta mode that only includes the active item. - Progress tick (1s loop) now writes item_delta with only the active item instead of serializing the entire queue - Full compact_items snapshots are reserved for important events: start, pause/resume/cancel, item boundaries, finish, and service stop/destroy - Compact items omit large static fields (item_json, track_name, artist_name) that Dart already has from queue restore - Snapshot always carries item_ids for adoption correlation - Dart-side _applyAndroidNativeWorkerSnapshot handles item_delta as a single-item fallback when items array is absent - Dart-side _tryAdoptAndroidNativeWorkerSnapshot reads item_ids as fallback when items is not present - Add deferred SAF publish: native worker writes to cache, runs all finalization locally, then publishes once to SAF at the end - Forward defer_saf_publish through DownloadRequestPayload
This commit is contained in:
@@ -44,6 +44,7 @@ class DownloadRequestPayload {
|
||||
final String safFileName;
|
||||
final String safOutputExt;
|
||||
final bool stageSafOutput;
|
||||
final bool deferSafPublish;
|
||||
final bool requiresContainerConversion;
|
||||
final String songLinkRegion;
|
||||
|
||||
@@ -91,6 +92,7 @@ class DownloadRequestPayload {
|
||||
this.safFileName = '',
|
||||
this.safOutputExt = '',
|
||||
this.stageSafOutput = false,
|
||||
this.deferSafPublish = false,
|
||||
this.requiresContainerConversion = false,
|
||||
this.songLinkRegion = 'US',
|
||||
});
|
||||
@@ -140,6 +142,7 @@ class DownloadRequestPayload {
|
||||
'saf_file_name': safFileName,
|
||||
'saf_output_ext': safOutputExt,
|
||||
'stage_saf_output': stageSafOutput,
|
||||
'defer_saf_publish': deferSafPublish,
|
||||
'requires_container_conversion': requiresContainerConversion,
|
||||
'songlink_region': songLinkRegion,
|
||||
};
|
||||
@@ -193,6 +196,7 @@ class DownloadRequestPayload {
|
||||
safFileName: safFileName,
|
||||
safOutputExt: safOutputExt,
|
||||
stageSafOutput: stageSafOutput,
|
||||
deferSafPublish: deferSafPublish,
|
||||
requiresContainerConversion: requiresContainerConversion,
|
||||
songLinkRegion: songLinkRegion,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user