mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-22 16:54:46 +03:00
Backport pull request #15032 from jellyfin/release-10.11.z
Skip invalid keyframe cache data
Original-merge: f4a53209f4
Merged-by: crobibero <cody@robibe.ro>
Backported-by: Bond_009 <bond.009@outlook.com>
This commit is contained in:
@@ -135,15 +135,22 @@ public class MigrateKeyframeData : IDatabaseMigrationRoutine
|
|||||||
return Path.Join(keyframeCachePath, prefix, filename);
|
return Path.Join(keyframeCachePath, prefix, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool TryReadFromCache(string? cachePath, [NotNullWhen(true)] out MediaEncoding.Keyframes.KeyframeData? cachedResult)
|
private bool TryReadFromCache(string? cachePath, [NotNullWhen(true)] out MediaEncoding.Keyframes.KeyframeData? cachedResult)
|
||||||
{
|
{
|
||||||
if (File.Exists(cachePath))
|
if (File.Exists(cachePath))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var bytes = File.ReadAllBytes(cachePath);
|
var bytes = File.ReadAllBytes(cachePath);
|
||||||
cachedResult = JsonSerializer.Deserialize<MediaEncoding.Keyframes.KeyframeData>(bytes, _jsonOptions);
|
cachedResult = JsonSerializer.Deserialize<MediaEncoding.Keyframes.KeyframeData>(bytes, _jsonOptions);
|
||||||
|
|
||||||
return cachedResult is not null;
|
return cachedResult is not null;
|
||||||
}
|
}
|
||||||
|
catch (JsonException jsonException)
|
||||||
|
{
|
||||||
|
_logger.LogWarning(jsonException, "Failed to read {Path}", cachePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cachedResult = null;
|
cachedResult = null;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user