feat:增加初始帧率、缓冲区大小、帧超时时间
This commit is contained in:
parent
5ea20835ec
commit
ca95779043
@ -64,7 +64,7 @@ class VideoDecoder(
|
||||
private val frameSeqSet = Collections.newSetFromMap(ConcurrentHashMap<Int, Boolean>()) // 防止重复帧入队
|
||||
|
||||
// 解码输出缓冲区,容量为100帧
|
||||
private val outputFrameQueue = LinkedBlockingQueue<DecodedFrame>(30)
|
||||
private val outputFrameQueue = LinkedBlockingQueue<DecodedFrame>(17)
|
||||
|
||||
// 渲染线程控制
|
||||
@Volatile private var renderThreadRunning = true
|
||||
@ -74,7 +74,7 @@ class VideoDecoder(
|
||||
private val mainHandler = Handler(Looper.getMainLooper())
|
||||
|
||||
// 渲染帧率(fps),可由外部控制,默认18
|
||||
@Volatile var renderFps: Int = 18
|
||||
@Volatile var renderFps: Int = 15
|
||||
|
||||
// 兜底:记录最近一次I帧的frameSeq,P/B帧依赖校验
|
||||
@Volatile private var lastIFrameSeq: Int? = null
|
||||
@ -84,7 +84,7 @@ class VideoDecoder(
|
||||
private val decodeTimestampLock = ReentrantLock() // 线程安全保护
|
||||
|
||||
// EMA平滑参数
|
||||
@Volatile private var smoothedFps: Double = 18.0 // 平滑后的渲染帧率
|
||||
@Volatile private var smoothedFps: Double = 15.0 // 平滑后的渲染帧率
|
||||
private val alpha = 0.2 // EMA平滑系数,越大响应越快
|
||||
private val minFps = 8 // 渲染帧率下限,防止过低
|
||||
private val maxFps = 30 // 渲染帧率上限,防止过高
|
||||
@ -92,7 +92,7 @@ class VideoDecoder(
|
||||
|
||||
// 1. 新增成员变量
|
||||
@Volatile private var latestRenderedTimestampMs: Long? = null
|
||||
private val MAX_ALLOWED_DELAY_MS = 60 // 最大允许延迟,单位毫秒
|
||||
private val MAX_ALLOWED_DELAY_MS = 350 // 最大允许延迟,单位毫秒
|
||||
@Volatile private var timestampBaseMs: Long? = null
|
||||
@Volatile private var firstFrameRelativeTimestamp: Long? = null
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user