|
@@ -130,7 +130,10 @@ public class PQMovieInput: ImageSource {
|
|
|
// public var seekQueue: DispatchQueue!
|
|
|
|
|
|
// 是否为导出模式
|
|
|
- public var mIsExport: Bool = false
|
|
|
+ public var mIsExport: Bool = false
|
|
|
+
|
|
|
+ //是否使用AVPlayer播放音乐
|
|
|
+ public var isUsedAVPlayer:Bool = false
|
|
|
|
|
|
//打印开始时间
|
|
|
var debugStartTime:CFTimeInterval?
|
|
@@ -170,10 +173,10 @@ public class PQMovieInput: ImageSource {
|
|
|
|
|
|
if #available(iOS 10, *){
|
|
|
displayLink?.preferredFramesPerSecond = 30
|
|
|
-// seekQueue = DispatchQueue(label: "PQ.MovieInput.seeking", qos: .userInteractive, attributes: .initiallyInactive, autoreleaseFrequency: .never, target: nil)
|
|
|
+
|
|
|
}else{
|
|
|
displayLink?.frameInterval = 2
|
|
|
-// seekQueue = DispatchQueue(label: "PQ.MovieInput.seeking", qos: .userInteractive, attributes: [], autoreleaseFrequency: .inherit, target: nil)
|
|
|
+
|
|
|
}
|
|
|
// 加入循环 要使用 common 不要让级别高的卡住回调事件
|
|
|
displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
|
|
@@ -337,7 +340,7 @@ public class PQMovieInput: ImageSource {
|
|
|
mIsExport = isExport
|
|
|
do {
|
|
|
try NSObject.catchException { [self] in
|
|
|
- if(mIsExport){
|
|
|
+ if(!isUsedAVPlayer){
|
|
|
guard self.assetReader.startReading() else {
|
|
|
BFLog(2, message: "ERROR: Unable to start reading: \(String(describing: self.assetReader.error))")
|
|
|
return
|
|
@@ -509,8 +512,8 @@ public class PQMovieInput: ImageSource {
|
|
|
|
|
|
func readNextAudioSample(with assetReader: AVAssetReader, from audioTrackOutput: AVAssetReaderOutput) {
|
|
|
|
|
|
- if(!mIsExport){
|
|
|
- BFLog(2, message: "不是导出模式")
|
|
|
+ if(isUsedAVPlayer){
|
|
|
+ BFLog(2, message: "使用的 avplayer 播放模式")
|
|
|
return
|
|
|
}
|
|
|
|