Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Reduce FFmpeg log overhead

ashil-pilotad7c19549ec7
diff --git a/mobile/apps/photos/changes/smoother-video-upload.md b/mobile/apps/photos/changes/smoother-video-upload.md
new file mode 100644
index 0000000000..137d51ae9f
--- /dev/null
+++ b/mobile/apps/photos/changes/smoother-video-upload.md
@@ -0,0 +1 @@
+- Improved app responsiveness while backing up videos.
diff --git a/mobile/apps/photos/lib/main.dart b/mobile/apps/photos/lib/main.dart
index 1438e2d9ce..4c324e87a4 100644
--- a/mobile/apps/photos/lib/main.dart
+++ b/mobile/apps/photos/lib/main.dart
@@ -112,7 +112,7 @@ void main() async {
}
});
}
- FFmpegKitConfig.init().ignore();
+ _initializeFFmpegKit().ignore();
await rive.RiveNative.init();
MediaKit.ensureInitialized();
@@ -130,6 +130,11 @@ void main() async {
unawaited(SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge));
}
+Future<void> _initializeFFmpegKit() async {
+ await FFmpegKitConfig.init();
+ await FFmpegKitConfig.disableLogs();
+}
+
Future<void> _runInForeground(
AdaptiveThemeMode? savedThemeMode,
MediaExtentionAction initialMediaExtensionAction,
diff --git a/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart b/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
index 402e7456d6..5f003f738a 100644
--- a/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
+++ b/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
@@ -89,6 +89,9 @@ Future<Map> _getVideoProps(
RootIsolateToken rootIsolateToken,
) async {
BackgroundIsolateBinaryMessenger.ensureInitialized(rootIsolateToken);
+ // This path may run before or without the app-level initializer, so disable
+ // live log forwarding before probing to keep FFprobe output off the UI thread.
+ await FFmpegKitConfig.disableLogs();
final session = await FFprobeKit.getMediaInformation(filePath);
final mediaInfo = session.getMediaInformation();