Add loopRange option for seamless region looping#910
Open
iossocket wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:加 KSOptions.loopRange: ClosedRange?,复用现有 loopPacketQueue 双缓冲机制做"区间无缝循环",避开 isAccurateSeek = true 时每圈 decode-forward 的 CPU 重活
Why:句子级循环当前需要每圈 mePlayer.seek 回起点,accurate seek 在 mkv H.264/HEVC(GOP 5-10s)上每圈静默解码 + 丢帧 ~150ms,肉眼可见卡顿;并且越界检测不固定 50-300ms
Mechanism:MEPlayerItem.reading() 在 packet PTS > upperBound 时设 isLoopModel=true + av_seek_frame 回 lowerBound;codecDidFinished() 在 swap 时不调 delegate?.sourceDidFinished()、设 track.seekTime 让 decoder 丢掉关键帧到 lowerBound 的预滚帧
Backward compat:默认 loopRange = nil,旧行为完全不变;与 isLoopPlay 互斥(同时设置以 isLoopPlay 为准)