Skip to content

armgit / ente

Public Imported from GitHub
0

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

Set sv = 1 for files that are skipped

Manav Rathibe2665f57f9a
diff --git a/desktop/src/main/services/ffmpeg-worker.ts b/desktop/src/main/services/ffmpeg-worker.ts
index c186f0a32b..86604c1f63 100644
--- a/desktop/src/main/services/ffmpeg-worker.ts
+++ b/desktop/src/main/services/ffmpeg-worker.ts
@@ -227,6 +227,8 @@ const ffmpegGenerateHLSPlaylistAndSegments = async (
// going to use for the conversion), then a streaming variant is not much
// use. Skip such cases.
//
+ // See also: [Note: Marking files which do not need video processing]
+ //
// ---
//
// [Note: HEVC/H.265 issues]
diff --git a/web/packages/gallery/services/video.ts b/web/packages/gallery/services/video.ts
index 0594596e48..79cf1d5090 100644
--- a/web/packages/gallery/services/video.ts
+++ b/web/packages/gallery/services/video.ts
@@ -12,6 +12,10 @@ import { getKV, getKVN, setKV } from "ente-base/kv";
import { ensureLocalUser } from "ente-base/local-user";
import log from "ente-base/log";
import { fileLogID, type EnteFile } from "ente-media/file";
+import {
+ filePublicMagicMetadata,
+ updateRemotePublicMagicMetadata,
+} from "ente-media/file-metadata";
import { FileType } from "ente-media/file-type";
import {
getAllLocalFiles,
@@ -732,9 +736,14 @@ const backfillQueue = async (
const videoFiles = uniqueFilesByID(
allCollectionFiles.filter(
(f) =>
+ // Only files the user owns.
f.ownerID == userID &&
+ // Only videos.
f.metadata.fileType == FileType.video &&
- !localTrashFileIDs.has(f.id),
+ // Not in trash.
+ !localTrashFileIDs.has(f.id) &&
+ // See: [Note: Marking files which do not need video processing]
+ filePublicMagicMetadata(f)?.sv != 1,
),
);
@@ -845,6 +854,8 @@ const processQueueItem = async ({
if (!res) {
log.info(`Generate HLS for ${fileLogID(file)} | not-required`);
+ // See: [Note: Marking files which do not need video processing]
+ await updateRemotePublicMagicMetadata(file, { sv: 1 });
return;
}
diff --git a/web/packages/media/file-metadata.ts b/web/packages/media/file-metadata.ts
index 4fcda2e238..e59d8d88e5 100644
--- a/web/packages/media/file-metadata.ts
+++ b/web/packages/media/file-metadata.ts
@@ -274,6 +274,33 @@ export interface PublicMagicMetadata {
*/
caption?: string;
uploaderName?: string;
+ /**
+ * An arbitrary integer set to indicate that this file should be skipped for
+ * the purpose of HLS generation.
+ *
+ * Current semantics:
+ *
+ * - if 1, skip this file
+ * - otherwise attempt processing
+ *
+ * [Note: Marking files which do not need video processing]
+ *
+ * Some video files do not require generation of a HLS stream. The current
+ * logic is H.264 files less than 10 MB, but this might change in future
+ * clients.
+ *
+ * For such skipped files, there thus won't be a HLS playlist generated.
+ * However, we still need a way to indicate to other clients that this file
+ * has already been looked at.
+ *
+ * To that end, we add a flag to the public magic metadata for the file. To
+ * allow future flexibility, this flag is an integer "streaming version".
+ * Currently it is set to 1 by a client who recognizes that this file does
+ * not need processing, and other clients can ignore this file if they find
+ * sv == 1. In the future, there might be other values for sv (e.g. if the
+ * skip logic changes).
+ */
+ sv?: number;
}
/**