Harden GVFG signal recovery and preview lifecycle

Compared with d03f064:

- Pause the sample video and audio readers after signal disconnect events and resume them only after reconnect or stream-ready notification.

- Serialize plug, unplug, and format transitions against active reads and held zero-copy frames while keeping stop and close able to interrupt lifecycle waits.

- Treat ERROR_BAD_COMMAND as unplug-revoked zero-copy ownership only after the backend has confirmed signal loss, while preserving all other release failures for retry and diagnosis.

- Stop submitting frames when the user closes an independent preview window, account those frames as intentionally skipped, and resume submission when preview is reopened.

- Emit UTF-16 Windows debug output so localized Win32 error messages remain readable in Qt and debugger output.

- Add startup and first-frame timing diagnostics, reduce routine stream-ready logging, and update public and internal documentation for the new disconnect and ownership behavior.

Validation: git diff --check and focused symbol/document consistency searches passed; no build or hardware validation was run.
This commit is contained in:
Mark.lin
2026-09-08 12:20:39 +08:00
parent d03f064b4f
commit 8cde31feaf
11 changed files with 244 additions and 29 deletions
+6 -1
View File
@@ -291,7 +291,12 @@ DXGI 成功接受的 Present;swapchain busy 而略過者記在 `skipped_presen
## 9. 錯誤處理建議
- `GVFG_ETIMEOUT`:通常可重試,並檢查 signal status/event。
- `GVFG_ETIMEOUT`:連線期間通常可重試,並檢查 signal status/event。收到
`GVFG_EVENT_SIGNAL_DISCONNECTED` 後,不應高速輪詢 read API;應等待
`GVFG_EVENT_SIGNAL_CONNECTED`(或 application stop)再恢復 video/audio read。
- 每次成功取得的 frame 仍必須恰好 release 一次。若 release 與實體拔線競爭,
SDK 會處理 driver 已撤銷 zero-copy ownership 的情況,application 不應特判
`ERROR_BAD_COMMAND (22)`。
- `GVFG_EVENT_FORMAT_CHANGE_BEGIN`:先停用舊格式資源;等 stream ready 後重建。
- `GVFG_ESTATE`:檢查 lifecycle、是否重複 read、或是否已 stop。
- `GVFG_EIO`/`GVFG_ENODEV`:停止 session,記錄 `gvfg_strerror()`,再由應用程式