diff --git a/android/src/main/kotlin/top/skychip/video_decode_plugin/VideoDecoder.kt b/android/src/main/kotlin/top/skychip/video_decode_plugin/VideoDecoder.kt index 3c0bdbf..fba1a8a 100644 --- a/android/src/main/kotlin/top/skychip/video_decode_plugin/VideoDecoder.kt +++ b/android/src/main/kotlin/top/skychip/video_decode_plugin/VideoDecoder.kt @@ -48,7 +48,7 @@ class VideoDecoder( companion object { private const val TAG = "VideoDecoder" private const val TIMEOUT_US = 10000L - private const val INPUT_BUFFER_QUEUE_CAPACITY = 30 // 输入缓冲区容量 + private const val INPUT_BUFFER_QUEUE_CAPACITY = 7 // 输入缓冲区容量 } // region 成员变量定义 @@ -64,7 +64,7 @@ class VideoDecoder( private val frameSeqSet = Collections.newSetFromMap(ConcurrentHashMap()) // 防止重复帧入队 // 解码输出缓冲区,容量为100帧 - private val outputFrameQueue = LinkedBlockingQueue(17) + private val outputFrameQueue = LinkedBlockingQueue(7) // 渲染线程控制 @Volatile private var renderThreadRunning = true diff --git a/ios/Classes/VideoDecoder.swift b/ios/Classes/VideoDecoder.swift index cb2fec0..b12d275 100644 --- a/ios/Classes/VideoDecoder.swift +++ b/ios/Classes/VideoDecoder.swift @@ -46,12 +46,12 @@ class VideoDecoder { private let inputQueue = DispatchQueue(label: "video_decode_plugin.input.queue", attributes: .concurrent) private var inputBuffer: [(frameData: Data, frameType: Int, timestamp: Int64, frameSeq: Int, refIFrameSeq: Int?, sps: Data?, pps: Data?)] = [] private let inputBufferSemaphore = DispatchSemaphore(value: 1) - private let inputBufferMaxCount = 30 + private let inputBufferMaxCount = 7 /// 输出缓冲区(解码后帧队列),线程安全 private let outputQueue = DispatchQueue(label: "video_decode_plugin.output.queue", attributes: .concurrent) private var outputBuffer: [(pixelBuffer: CVPixelBuffer, timestamp: Int64)] = [] private let outputBufferSemaphore = DispatchSemaphore(value: 1) - private let outputBufferMaxCount = 20 + private let outputBufferMaxCount = 7 /// 渲染线程 private var renderThread: Thread? /// 渲染线程运行标志