feat:调整缓冲区大小
This commit is contained in:
parent
38df1883f5
commit
8cdcab24b2
@ -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 = 7 // 输入缓冲区容量
|
||||
private const val INPUT_BUFFER_QUEUE_CAPACITY = 15 // 输入缓冲区容量
|
||||
}
|
||||
|
||||
// region 成员变量定义
|
||||
@ -64,7 +64,7 @@ class VideoDecoder(
|
||||
private val frameSeqSet = Collections.newSetFromMap(ConcurrentHashMap<Int, Boolean>()) // 防止重复帧入队
|
||||
|
||||
// 解码输出缓冲区,容量为100帧
|
||||
private val outputFrameQueue = LinkedBlockingQueue<DecodedFrame>(7)
|
||||
private val outputFrameQueue = LinkedBlockingQueue<DecodedFrame>(15)
|
||||
|
||||
// 渲染线程控制
|
||||
@Volatile private var renderThreadRunning = true
|
||||
|
||||
@ -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 = 7
|
||||
private let inputBufferMaxCount = 15
|
||||
/// 输出缓冲区(解码后帧队列),线程安全
|
||||
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 = 7
|
||||
private let outputBufferMaxCount = 15
|
||||
/// 渲染线程
|
||||
private var renderThread: Thread?
|
||||
/// 渲染线程运行标志
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user