瀏覽代碼

提高displayLink 任务优先级别

jsonwang 4 年之前
父節點
當前提交
6f989ce399
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4 4
      BFFramework/Classes/PQGPUImage/akfilters/PQMovieInput.swift

+ 4 - 4
BFFramework/Classes/PQGPUImage/akfilters/PQMovieInput.swift

@@ -155,8 +155,8 @@ public class PQMovieInput: ImageSource {
         // 设置触发频率 这个周期可以通过frameInterval属性设置,CADisplayLink的selector每秒调用次数=60/frameInterval。比如当frameInterval设为2,每秒调用就变成30次
 
         displayLink?.frameInterval = 2
-        // 加入循环
-        displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.default)
+        // 加入循环 要使用 common 不要让级别高的卡住回调事件
+        displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
         displayLink?.isPaused = true
         if #available(iOS 10.0, *) {
             seekQueue = DispatchQueue(label: "PQ.MovieInput.seeking", qos: .userInteractive, attributes: .initiallyInactive, autoreleaseFrequency: .never, target: nil)
@@ -252,8 +252,8 @@ public class PQMovieInput: ImageSource {
 
             let prgressValue = currTime / duration
 
-            FilterLog(message: "播放进行中 总用时: \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) 播放进度当前时间:\(currTime)")
-            if prgressValue > 1 {
+            FilterLog(message: "播放进行中 总用时: \(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0)) 播放进度当前时间:\(currTime) 进度:\(prgressValue)")
+            if prgressValue >= 1 {
                 FilterLog(message: "全部播放完成 总用时为:\(CFAbsoluteTimeGetCurrent() - (debugStartTime ?? 0.0))")
  
                 self.delegate?.didFinishMovie()