From 475813c42c901b9dac512f01ddcd3acd77228813 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Thu, 8 Aug 2024 00:05:16 +0200 Subject: [PATCH] Prevent keyframes scan when value already exists in db --- transcoder/src/keyframes.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/transcoder/src/keyframes.go b/transcoder/src/keyframes.go index a621710d..18cb9e32 100644 --- a/transcoder/src/keyframes.go +++ b/transcoder/src/keyframes.go @@ -83,6 +83,13 @@ type KeyframeKey struct { } func (s *MetadataService) GetKeyframes(info *MediaInfo, isVideo bool, idx uint32) (*Keyframe, error) { + if isVideo && info.Videos[idx].Keyframes != nil { + return info.Videos[idx].Keyframes, nil + } + if !isVideo && info.Audios[idx].Keyframes != nil { + return info.Audios[idx].Keyframes, nil + } + get_running, set := s.keyframeLock.Start(KeyframeKey{ Sha: info.Sha, IsVideo: isVideo,