Repository navigation
fix(source): fallbackToSoftware 保留 Seek 旗標並略過硬解已送出的幀 - #193
Closed
purplecofe wants to merge 1 commit into
Closed
purplecofe wants to merge 1 commit into
purplecofe wants to merge 1 commit into
Conversation
fallbackToSoftware 在 seek 回上一個位置後設 pendingSeekFlag_=true,函式結尾又 無條件設回 false;lastPtsUs_ 也被清掉,倒退檢查失效。從關鍵幀到 resumeUs 之間 的幀會再送一次、PTS 倒退卻沒有任何重設旗標,時間濾波把新舊畫面混在一起。註解 提到的「呼叫端 discardBefore」並不處理這條路徑。 - 刪除結尾的 pendingSeekFlag_ = false,第一個重送後的幀帶 Seek 讓歷史重設 - seek 回去成功時記下 resumeAfterUs_,readBase 在解碼器輸出處略過 PTS 不大於 它的幀,第一個新幀後清除;使用者 seek 與重新開啟也清除 - 把 frame 時間戳計算抽成 framePts,讓略過判斷與 out.pts 用同一個算法
purplecofe
pushed a commit
to purplecofe/Veyra-NRVideo
that referenced
this pull request
Nov 20, 2026
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.
Why
目標:硬解中途失敗、退回軟解之後,畫面不能倒退重播,時間濾波也不能把新舊畫面混在一起。
fallbackToSoftware在 seek 回resumeUs(最後送出的 PTS)後設pendingSeekFlag_ = true,函式結尾又無條件設回false。lastPtsUs_ = INT64_MIN也讓倒退檢查失效。所以從關鍵幀到resumeUs的幀會再送一次,PTS 倒退卻沒有任何重設旗標。註解說這些幀由「呼叫端的 discardBefore」丟棄,但EngineController的discardBefore只在使用者 seek 時設定,不處理這條路徑。What changed
src/source/MediaFileSource.cpppendingSeekFlag_ = false。退回軟解後第一個送出的幀帶Seek,歷史重設一次。這是函式開頭註解寫的原意(sweep B5)。resumeAfterUs_ = resumeUs。readBase在解碼器輸出處(去隔行與 P7 配對之前)略過 PTS 不大於它的幀,遇到第一個新幀或未知 PTS 就清除。framePts(),out.pts與略過判斷共用同一個算法,結果逐位元相同。resumeAfterUs_。include/veyra/source/MediaFileSource.h:新增resumeAfterUs_。Scope
Seek旗標重設歷史。Blast Radius
framesRead_ == 0),行為都和修正前相同。framePts()是原本程式碼原樣搬出,out.pts的值不變。Verification
framePts與rationalToUs,連結 FFmpeg,用 libx264 產生 open GOP、3 個 B 幀、GOP 60 的 MP4。送出 75 幀後模擬退回:flush、seek 回resumeUs,再看接下來 40 幀。pts_us=2000000(關鍵幀),seekFlag=0,replayed=15。pts_us=2500000(正是2466667的下一幀),seekFlag=1,replayed=0。Seek。fallbackToSoftware與readBase的流程,不是實際類別。MediaFileSource.cpp需要 D3D12,沒有在任何平台編譯。沒有在 Windows 上觸發真的硬解失敗。