From 0579afe02b6a746a1f742f573d2c7279c27a6492 Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Mon, 1 Jul 2024 15:47:15 +0000 Subject: [PATCH] Make a happy path for keyframes.Slices --- transcoder/src/keyframes.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/transcoder/src/keyframes.go b/transcoder/src/keyframes.go index c687a6f6..96cbf6d6 100644 --- a/transcoder/src/keyframes.go +++ b/transcoder/src/keyframes.go @@ -35,7 +35,12 @@ func (kf *Keyframe) Slice(start int32, end int32) []float64 { } kf.info.mutex.RLock() defer kf.info.mutex.RUnlock() + ref := kf.Keyframes[start:end] + if kf.IsDone { + return ref + } + // make a copy since we will continue to mutate the array. ret := make([]float64, end-start) copy(ret, ref) return ret