Pārlūkot izejas kodu

内存泄漏修复

huzhiqiang 3 gadi atpakaļ
vecāks
revīzija
823c55dbdd

+ 10 - 11
BFFramework/Classes/Stuckpoint/ViewModel/PQGPUImagePlayerView.swift

@@ -406,29 +406,28 @@ public class PQGPUImagePlayerView: UIView {
             }
         }
         guard let movie = movie else { return }
-        movie.progress = { [weak self, movie] currTime, duration, prgressValue in
+        movie.progress = { [weak self] currTime, duration, prgressValue in
             guard let strongSelf = self else { return }
 
-            FilterLog(message: " movie.currentTime.seconds 进度\(movie.currentTime.seconds)")
-            self?.changeFilter(currTime: movie.currentTime.seconds)
-            
-            self?.progress?(currTime, duration, prgressValue)
+//            HHZPrint(" movie 进度\(currTime)")
+            strongSelf.changeFilter(currTime: currTime)
+            strongSelf.progress?(currTime, duration, prgressValue)
 
             DispatchQueue.main.async {
-                strongSelf.playbackTime = movie.currentTime.seconds
+                strongSelf.playbackTime = currTime
 
                 // Non-main thread change this property is not valid
                 strongSelf.animationLayer?.timeOffset = strongSelf.playbackTime
                 if strongSelf.showProgressLab {
-                    
+
                     if(strongSelf.showProgressStartTime == 0 ){
-                        strongSelf.showProgressStartTime = Float(CMTimeGetSeconds(movie.startTime ?? .zero))
+                        strongSelf.showProgressStartTime = Float(CMTimeGetSeconds(strongSelf.movie?.startTime ?? .zero))
                     }
                     if duration < 1 {
-                       
-                        strongSelf.progressLab.text =  "\((currTime - Double(CMTimeGetSeconds(movie.startTime ?? .zero))).formatDurationToHMS()) / 00:01"
+
+                        strongSelf.progressLab.text =  "\((currTime - Double(CMTimeGetSeconds(strongSelf.movie?.startTime ?? .zero))).formatDurationToHMS()) / 00:01"
                     } else {
-                        
+
                         var showTime = currTime -  Double(strongSelf.showProgressStartTime)
                         if (showTime < 0){
                             showTime = 0