Refine customer API guides and consolidate SDK usage examples
- organize customer documentation around public API usage, parameters, ownership, status codes and limits while reducing internal implementation details - move complete dual-slot OSD examples into the Capture guide and consolidate font-list lifetime, visibility, placement and error contracts in the API reference - add a GPU conversion example with dimension overflow checks, allocation failure handling and explicit destination cleanup - simplify playback guidance for timestamps, synchronization, buffering, reset and stop while preserving caller responsibilities and output limitations - update the learning index with customer/internal documentation boundaries and study links, and refresh the bundled API reference PDF Validation: git diff --cached --check passed. Markdown changes were reviewed against the staged scope. No build, PDF rendering, runtime or hardware validation was performed during this documentation-only commit pass.
This commit is contained in:
+11
-19
@@ -140,23 +140,16 @@ bool SubmitOneAudio(gvfg_handle capture, int channel, gvfg_playback player)
|
||||
應用程式可像範例一樣直接 submit 後 release,也可先複製、release,再 submit 自有副本。
|
||||
兩種方式都必須在 release 前完成對 SDK 記憶體的使用。
|
||||
|
||||
## 6. 時間戳、緩衝與落後
|
||||
## 6. 時間戳與播放延遲
|
||||
|
||||
- 直接傳入 SDK 的 `timestamp_ns`;它是同一單調交付時鐘的奈秒值,不是 UTC,也不是已知的硬體曝光/收音時間。
|
||||
- 各路時間必須大於 0、嚴格遞增且不超過 `INT64_MAX`。不要把第一筆音影差值歸零來掩蓋未知延遲。
|
||||
- 第一包 PCM 以交付時間扣除包長估計起點,後續維持連續時間軸,並平滑追蹤與交付時鐘的長期偏差。無法辨認驅動內的未知舊資料或遺失 samples。
|
||||
- 預設共同 preroll 為 100 ms,以已收到的啟用串流時間覆蓋範圍判斷。缺資料時只短暫等待,超時會降級為獨立播放;正常排程的影像保留一張 lookahead。
|
||||
- 正常同步時 External/Audio master 會略過已過播放期限的預覽影格,保留最新到期影格;GPU busy 的略過也會計數。Video master 在正常同步時不啟用這個自動過期退休策略。
|
||||
- `video_dropped` 是預覽略過數,不是 Capture/driver 遺失數,也不是錄影掉格數。
|
||||
- 微幅音訊速率補償有上限;持續缺資料、未知底層延遲或大幅落後,不能保證由補償自動修復。
|
||||
|
||||
預設上限為影像 32 張/256 MiB、音訊 1000 ms。queue 壓力、長時間缺資料或影音偏差過大時,
|
||||
Playback 自動降級:影像持續顯示最新可用影格,音訊以正常速率播放並丟棄積壓的待播資料。
|
||||
沒有音訊資料時保持靜音,不會因為等待音訊而持續凍結影像;資料不足仍可能聽見音訊間斷。
|
||||
來源與輸出穩定後會自動恢復同步,重新對齊時可能短暫保留目前畫面。
|
||||
降級、待播資料丟棄與恢復由 Playback 內部處理,應用程式不需另寫控制邏輯。
|
||||
submit 返回 OK 表示資料已由播放器管理,包含略過顯示或丟棄待播副本的情況;不保證每筆都輸出。
|
||||
單張影像/單包 PCM 超出其設定容量屬於 `EINVAL`,應修正 config 或輸入大小。
|
||||
- 直接傳入 Capture 的 `timestamp_ns`;video 與 audio 必須使用同一單調時間軸,單位為奈秒。
|
||||
各路時間戳必須大於 0、嚴格遞增且不超過 `INT64_MAX`。
|
||||
- 時間戳不是 UTC,也不代表硬體曝光/收音時間;不要各自歸零兩路時間戳來改變原本相對關係。
|
||||
- 同步播放可能增加延遲。需要獨立播放時使用 `gvfg_playback_set_sync_enabled(p, 0)`;
|
||||
應用程式不必自行調整播放速率或實作同步演算法。
|
||||
- 來源不穩定時可能出現靜音、間斷或略過影格;應用程式仍須持續提交可用資料。
|
||||
API 接受資料不保證每張 frame 都顯示,也不能保證恢復未知的底層遺失或延遲。
|
||||
- 依實際需求設定緩衝容量;欄位、預設值與範圍見 API Reference 的 `gvfg_playback_config_t`。
|
||||
|
||||
## 7. 執行緒、重設與停止
|
||||
|
||||
@@ -170,8 +163,7 @@ Playback stop/destroy → Capture stop;最後一個 channel 結束後才 destr
|
||||
|
||||
遇到時間倒退、重連或切格式,先協調 producer,再檢查 `reset_timeline()` 回傳值。
|
||||
reset 會清除待播資料並沿用原 config 重新建立時間軸;音訊格式改變時應 stop/start 新 config。
|
||||
尚未建立呈現表面(swapchain)時,清除空畫面視為成功,reset 後仍會重新啟動原本運行的時間軸。
|
||||
已建立的影像輸出若真的清除失敗,reset 仍可能回報 `EOUTPUT`,不能假設一定成功。
|
||||
reset 失敗仍須依回傳狀態處理,不可假設一定成功。
|
||||
|
||||
stop/reset 都會取消待播資料,沒有無損 EOS/drain 語意;有限檔案的尾幀完整輸出不是目前 API 的保證。
|
||||
影音模式遇到音訊輸出故障時,helper 停用監聽音效並繼續播放影像,
|
||||
@@ -202,7 +194,7 @@ if (gvfg_get_channel_signal_status(capture, channel, &signal) == GVFG_OK) {
|
||||
|
||||
在綁定 HWND 的 UI 執行緒呼叫,與 attach/destroy 序列化。0 顯示固定圖卡,1 隱藏。
|
||||
預設為 1;可先設定再 attach,狀態保留至下次明確設定,stop/start/reset 不改變它。
|
||||
視窗 resize 與圖卡資源由 helper 處理,不需 Qt 圖片資源或應用端繪圖。
|
||||
圖卡會隨視窗縮放,應用程式不必自行繪製。
|
||||
此 API 不讀 Capture、不以 FPS 或黑色像素推測訊號,也不改影格內容、PTS 或錄影。
|
||||
若未使用此 API,維持一般預覽行為。destroy/detach 也應在 HWND 執行緒執行。
|
||||
|
||||
|
||||
Reference in New Issue
Block a user