Skip to content

armgit / ente

Public Imported from GitHub
0

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

fix: allow manual video stream creation when ML is waiting

Prateek Sunalfd963a1c8ecd
diff --git a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
index 32ff15e352..23e36d6730 100644
--- a/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
+++ b/mobile/apps/photos/lib/services/machine_learning/compute_controller.dart
@@ -74,9 +74,10 @@ class ComputeController {
bool ml = false,
bool stream = false,
bool bypassInteractionCheck = false,
+ bool bypassMLWaiting = false,
}) {
_logger.info(
- "Requesting compute: ml: $ml, stream: $stream, bypassInteraction: $bypassInteractionCheck",
+ "Requesting compute: ml: $ml, stream: $stream, bypassInteraction: $bypassInteractionCheck, bypassMLWaiting: $bypassMLWaiting",
);
if (!_isDeviceHealthy) {
_logger.info("Device not healthy, denying request.");
@@ -90,7 +91,7 @@ class ComputeController {
if (ml) {
result = _requestML();
} else if (stream) {
- result = _requestStream();
+ result = _requestStream(bypassMLWaiting);
} else {
_logger.severe("No compute request specified, denying request.");
}
@@ -117,14 +118,14 @@ class ComputeController {
return false;
}
- bool _requestStream() {
- if (_currentRunState == ComputeRunState.idle && !_waitingToRunML) {
+ bool _requestStream([bool bypassMLWaiting = false]) {
+ if (_currentRunState == ComputeRunState.idle && (bypassMLWaiting || !_waitingToRunML)) {
_logger.info("Stream request granted");
_currentRunState = ComputeRunState.generatingStream;
return true;
}
_logger.info(
- "Stream request denied, current state: $_currentRunState, wants to run ML: $_waitingToRunML",
+ "Stream request denied, current state: $_currentRunState, wants to run ML: $_waitingToRunML, bypassMLWaiting: $bypassMLWaiting",
);
return false;
}
diff --git a/mobile/apps/photos/lib/services/video_preview_service.dart b/mobile/apps/photos/lib/services/video_preview_service.dart
index dc46e3db57..b8dfec235a 100644
--- a/mobile/apps/photos/lib/services/video_preview_service.dart
+++ b/mobile/apps/photos/lib/services/video_preview_service.dart
@@ -1135,6 +1135,7 @@ class VideoPreviewService {
computeController.requestCompute(
stream: true,
bypassInteractionCheck: true,
+ bypassMLWaiting: true,
);
}