- Replace non-blocking Present retries with Present(0, 0), allowing DXGI to wait for presentation dependencies on the dedicated preview worker. - Change preview admission from newest-frame replacement to bounded FIFO delivery with three pending/upload reservations and one presenting slot. - Expire queued preview frames after 50 ms before GPU processing and skip new preview submissions only when the bounded slot capacity is full. - Track queue order and queue age without retaining SDK-owned frame memory; capture continues releasing each SDK frame after the synchronous upload. - Service only synchronous Windows sent messages while waiting for preview mutexes, worker shutdown, idle drain, and capture-thread join to avoid an HWND-owner/DXGI deadlock without dispatching queued application callbacks. - Preserve internal preview pacing and audio queue counters while removing expected busy, expired, and audio-eviction reports from the normal UI log. - Reserve delivery error logs for preview/render failures, video or audio frame-ID anomalies, audio write failures, and final accounting mismatches. - Remove the normal stop summary and the audio queue-drop field from the status display so expected pacing adjustments are not presented as faults. - Update the public preview comments and diagnostic documentation for the FIFO capacity, queue-age boundary, blocking Present behavior, and log policy. - Keep the capture SDK, driver interfaces, frame ownership, GPU conversion precision, and public delivery-statistics structure unchanged. Validation: - User testing reported approximately 18% GPU utilization for one 1920x1080 Y210 10-bit preview channel. This was not independently benchmarked. - A user-provided long-run log contained 13,715,695 received video frames with no preview render failures; periodic preview skips matched the confirmed 60.000 FPS versus 59.94 Hz pacing difference. - The same log showed periodic audio playback-queue eviction without audio frame-ID gaps or write failures; this is retained as internal diagnostic accounting rather than reported as a source-delivery error. - Static source review and git diff --check passed. No application, shader, or driver build was performed by the agent, and runtime deadlock behavior has not been independently reproduced or validated.
24 lines
2.8 KiB
Markdown
24 lines
2.8 KiB
Markdown
# 關鍵交付 Log
|
|
|
|
畫面保留原本狀態,不顯示完整交付統計,也不增加設定控制。正常的預覽與音訊佇列取捨不輸出 Log。
|
|
|
|
- 預覽排隊逾時或容量不足是顯示節拍取捨,不輸出 Log。只有提交/渲染失敗或序號異常增加時,才記錄 `ERROR preview delivery`。
|
|
- Audio 播放佇列滿而淘汰舊 PCM 區塊不輸出 Log。只有序號異常或寫入失敗時,才記錄 `ERROR audio delivery`。
|
|
- 序號缺口、倒退/重複、音訊失敗位元組僅在有異常時附上。
|
|
- 錯誤最多每 5 秒彙整一次;Stop 會補記尚未輸出的錯誤。
|
|
- Stop 不列印正常統計摘要。只有資料去向核對不一致時才印 `ERROR delivery accounting mismatch`。正常停止清掉的待處理資料不算運行錯誤。
|
|
|
|
## 拿到 Log 後怎麼處理
|
|
|
|
`ERROR preview delivery` 表示提交/渲染失敗或 frame ID 異常,需查 Preview API、GPU 與來源序號。APP 持續讀取並釋放每張影像,沒有新增預覽降頻行為。
|
|
|
|
預覽使用 Present(0, 0),讓 DXGI 等待呈現相依條件,不做外部重試。SyncInterval 仍為 0,並非每張都保證顯示。預覽改成 FIFO,最多保留 3 張待處理影像(包含正在上傳的容量保留),另有 1 個處理中槽位,共 4 個 GPU 槽。60 FPS 下 3 張約 50 ms;這不是刻意等滿 50 ms 才顯示。從上傳完成入列開始計時,等待超過 50 ms 的影像才丟棄(expired);容量滿時跳過新影像(busy),不替換仍在期限內的舊影像。50 ms 是開始處理前的等待期限,不含 GPU 執行/DXGI Present 等待,不保證端到端延遲或實體螢幕逐張呈現。Stop/關閉/鎖等待只處理 Windows 同步送達的視窗訊息,避免 DXGI 等待 UI 而 UI 又等待 worker;不處理一般排隊輸入或 Qt callbacks。
|
|
|
|
Audio 保留原本最多 10 個 PCM 區塊的播放佇列(`kMaxQueuedAudioFrames`);滿時丟掉最舊區塊,再加入新區塊。丟棄區塊、停滯與收音間隔仍保留為內部診斷計數,但不顯示在一般 Log;audio frame 不保證與 video frame 等長。
|
|
|
|
播放 write 失敗,或持續回傳 0、兩秒沒有進展,會記錄原因並停止通道;檢查音效裝置後重新 Start。此檢查無法中斷本身永不返回的 write 呼叫。
|
|
|
|
統計從 APP 成功取得 SDK frame 開始。SDK ID 連續不能證明更上游沒有丟失;DXGI 接受 Present 不代表實體螢幕已顯示,QAudioSink 接受 PCM 也不代表已實際發聲。已丟掉的原始資料無法靠這些處理補回。
|
|
|
|
擷取 API/驅動不修改。新版 APP 需配套的新版 gvfg_preview.dll。後續 GPU 優化修改了共用的轉換原始碼;若要發佈包含該優化的 SDK GPU buffer converter,也需重建其 DLL。尚待 build、播放/預覽異常測試與硬體長測;靜態檢查不能證明零丟失。
|