Backport pull request #13425 from jellyfin/release-10.10.z

Open files with FileShare.Read for BlurHash calculations

Original-merge: bfe0fdbcdc

Merged-by: crobibero <cody@robibe.ro>

Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
Bond-009
2025-02-03 17:07:12 -05:00
committed by Bond_009
parent c05a41cc3c
commit 10f4f8b2ab
2 changed files with 5 additions and 3 deletions

View File

@@ -195,8 +195,10 @@ public class SkiaEncoder : IImageEncoder
return string.Empty;
}
// Use FileStream with FileShare.Read instead of having Skia open the file to allow concurrent read access
using var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
// Any larger than 128x128 is too slow and there's no visually discernible difference
return BlurHashEncoder.Encode(xComp, yComp, path, 128, 128);
return BlurHashEncoder.Encode(xComp, yComp, fileStream, 128, 128);
}
private bool RequiresSpecialCharacterHack(string path)