feat:调整缓冲区大小
This commit is contained in:
parent
73afceeedc
commit
a8bb1f12f4
@ -48,7 +48,7 @@ class VideoDecoder(
|
|||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "VideoDecoder"
|
private const val TAG = "VideoDecoder"
|
||||||
private const val TIMEOUT_US = 10000L
|
private const val TIMEOUT_US = 10000L
|
||||||
private const val INPUT_BUFFER_QUEUE_CAPACITY = 30 // 输入缓冲区容量
|
private const val INPUT_BUFFER_QUEUE_CAPACITY = 7 // 输入缓冲区容量
|
||||||
}
|
}
|
||||||
|
|
||||||
// region 成员变量定义
|
// region 成员变量定义
|
||||||
@ -64,7 +64,7 @@ class VideoDecoder(
|
|||||||
private val frameSeqSet = Collections.newSetFromMap(ConcurrentHashMap<Int, Boolean>()) // 防止重复帧入队
|
private val frameSeqSet = Collections.newSetFromMap(ConcurrentHashMap<Int, Boolean>()) // 防止重复帧入队
|
||||||
|
|
||||||
// 解码输出缓冲区,容量为100帧
|
// 解码输出缓冲区,容量为100帧
|
||||||
private val outputFrameQueue = LinkedBlockingQueue<DecodedFrame>(17)
|
private val outputFrameQueue = LinkedBlockingQueue<DecodedFrame>(7)
|
||||||
|
|
||||||
// 渲染线程控制
|
// 渲染线程控制
|
||||||
@Volatile private var renderThreadRunning = true
|
@Volatile private var renderThreadRunning = true
|
||||||
|
|||||||
@ -46,12 +46,12 @@ class VideoDecoder {
|
|||||||
private let inputQueue = DispatchQueue(label: "video_decode_plugin.input.queue", attributes: .concurrent)
|
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 var inputBuffer: [(frameData: Data, frameType: Int, timestamp: Int64, frameSeq: Int, refIFrameSeq: Int?, sps: Data?, pps: Data?)] = []
|
||||||
private let inputBufferSemaphore = DispatchSemaphore(value: 1)
|
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 let outputQueue = DispatchQueue(label: "video_decode_plugin.output.queue", attributes: .concurrent)
|
||||||
private var outputBuffer: [(pixelBuffer: CVPixelBuffer, timestamp: Int64)] = []
|
private var outputBuffer: [(pixelBuffer: CVPixelBuffer, timestamp: Int64)] = []
|
||||||
private let outputBufferSemaphore = DispatchSemaphore(value: 1)
|
private let outputBufferSemaphore = DispatchSemaphore(value: 1)
|
||||||
private let outputBufferMaxCount = 20
|
private let outputBufferMaxCount = 7
|
||||||
/// 渲染线程
|
/// 渲染线程
|
||||||
private var renderThread: Thread?
|
private var renderThread: Thread?
|
||||||
/// 渲染线程运行标志
|
/// 渲染线程运行标志
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user