This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit cce1b4f2289f9b02a3b9848dbc91c87903bf3821
Author:     Niklas Haas <[email protected]>
AuthorDate: Wed Jul 1 14:41:42 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Jul 2 14:29:42 2026 +0000

    avformat/shared: hash cache version into filename
    
    Changing version implies a non-backwards compatible disk layout.
    Alternatively, we could detect a version mismatch and delete + rebuild the
    cache file, but that's nontrivial to get right because of existing processes
    that might be concurrently trying to open the same cache file with the old
    version.
    
    Overall, cleaner and safer to just separate them by version.
    
    Sponsored-by: nxtedition AB
    Signed-off-by: Niklas Haas <[email protected]>
---
 libavformat/shared.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/libavformat/shared.c b/libavformat/shared.c
index b5da275ba4..c01d7d4e9b 100644
--- a/libavformat/shared.c
+++ b/libavformat/shared.c
@@ -59,6 +59,8 @@
  */
 #define HASH_METHOD    "SHA512/256"
 #define HASH_SIZE      32
+#define HEADER_MAGIC   MKTAG(u'\xFF', 'S', 'h', '$')
+#define HEADER_VERSION 3
 
 static int hash_uri(uint8_t hash[HASH_SIZE], const char *uri)
 {
@@ -67,8 +69,10 @@ static int hash_uri(uint8_t hash[HASH_SIZE], const char *uri)
     if (ret < 0)
         return ret;
 
+    const int16_t version = HEADER_VERSION;
     av_assert0(av_hash_get_size(ctx) == HASH_SIZE);
     av_hash_init(ctx);
+    av_hash_update(ctx, (const uint8_t *) &version, sizeof(version));
     av_hash_update(ctx, (const uint8_t *) uri, strlen(uri));
     av_hash_final(ctx, hash);
     av_hash_freep(&ctx);
@@ -78,9 +82,6 @@ static int hash_uri(uint8_t hash[HASH_SIZE], const char *uri)
     return 0;
 }
 
-#define HEADER_MAGIC   MKTAG(u'\xFF', 'S', 'h', '$')
-#define HEADER_VERSION 3
-
 enum BlockState {
     /* Reserved block state values */
     BLOCK_NONE = 0, ///< block is not cached

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to