Просмотр исходного кода

1,修改 LOG 信息 2, 高版本 IOS 系统 视频读取问题

jsonwang 3 лет назад
Родитель
Сommit
514592e6d9
1 измененных файлов с 7 добавлено и 7 удалено
  1. 7 7
      BFFramework/Classes/PQGPUImage/akfilters/PQMovieFilter.swift

+ 7 - 7
BFFramework/Classes/PQGPUImage/akfilters/PQMovieFilter.swift

@@ -146,9 +146,9 @@ class PQMovieFilter: PQBaseFilter {
         do {
             // 测试代码
             //            try  loadAsset(url:URL(fileURLWithPath:"22222.MP4", relativeTo:Bundle.main.resourceURL!), videoComposition: nil)
-            // locationPath 有可能直接使用系统相册地址 e.g.视频地址 var/mobile/Media/DCIM/125APPLE/IMG_5189.MOV 就不用拼接沙盒地址了
+            // locationPath 有可能直接使用系统相册地址  处理不同 IOS 版本 路径有所区别 e.g.视频地址 var/mobile/Media/DCIM/125APPLE/IMG_5189.MOV 就不用拼接沙盒地址了
             var videoFilePath = movieSticker.locationPath
-            if !videoFilePath.contains("var/mobile/Media/DCIM/") {
+            if !videoFilePath.contains("var/mobile/Media") {
                 videoFilePath = documensDirectory + videoFilePath
             }
             FilterLog(message: "视频地址 \(String(describing: videoFilePath))")
@@ -347,6 +347,7 @@ class PQMovieFilter: PQBaseFilter {
         
         BFLog(message: "查找的帧时间为:\(CMTimeGetSeconds(showTimeStamp))")
         
+        let beginDecoderTime: TimeInterval = Date().timeIntervalSince1970
         if assetReader == nil {
             FilterLog(message: "assetReader is error 出现严重错误!!!!!!!!!!!!!!")
             return nil
@@ -362,7 +363,6 @@ class PQMovieFilter: PQBaseFilter {
         
         while assetReader?.status == .reading {
   
-            let beginDecoderTime: TimeInterval = Date().timeIntervalSince1970
             targetSampleBuffer = videoTrackOutput!.copyNextSampleBuffer()
             if(targetSampleBuffer == nil){
                 BFLog(message: " copyNextSampleBuffer is nil error!!!")
@@ -372,13 +372,13 @@ class PQMovieFilter: PQBaseFilter {
             
             //目标帧 时间
             if targetSampleBuffer != nil && CMTimeGetSeconds(targetTimeStamp) > CMTimeGetSeconds(showTimeStamp){
-                FilterLog(message: "查找的帧时间为:\(CMTimeGetSeconds(showTimeStamp))  命中时间为: \(CMTimeGetSeconds(targetTimeStamp))")
-                
+                let endDecoderTime: TimeInterval = Date().timeIntervalSince1970
+                FilterLog(message: "查找的帧时间为:\(CMTimeGetSeconds(showTimeStamp))  命中时间为: \(CMTimeGetSeconds(targetTimeStamp))  查找时长为\(TimeInterval(endDecoderTime - beginDecoderTime)))")
+  
                 return targetSampleBuffer
 
             }
-            let endDecoderTime: TimeInterval = Date().timeIntervalSince1970
-            FilterLog(message: "\(beginDecoderTime) \(endDecoderTime)解帧时长  \(TimeInterval(endDecoderTime - beginDecoderTime))")
+          
         }
         
         return nil