G3: 1 clock - PDC latency that + playhead engine-derived
This commit is contained in:
+10
-1
@@ -1134,18 +1134,27 @@ async def ws_fx_realtime(websocket: WebSocket, session_id: str):
|
||||
if _pf is not None:
|
||||
_pf.write("%d pump_start\n" % int(_time.time() * 1000))
|
||||
_last_lat = None
|
||||
_last_proc = None
|
||||
try:
|
||||
while True:
|
||||
try:
|
||||
sess.flush_input_stale() # input lẻ kẹt trong pending → publish
|
||||
_lats = sess.get_latencies()
|
||||
_total = sum(_lats.values()) if _lats else 0
|
||||
if _total != _last_lat:
|
||||
# G3: processed samples (playhead engine-derived) — bridge
|
||||
# bao moi block; gui kem latency message khi doi (khong gate
|
||||
# theo total nua — total chi doi khi chain doi, processed
|
||||
# doi lien tuc). App: position = (processed - anchor - lat)/sr.
|
||||
_proc = sess.get_processed()
|
||||
_proc_changed = (_proc is not None and _proc != _last_proc)
|
||||
if _total != _last_lat or _proc_changed:
|
||||
_last_lat = _total
|
||||
_last_proc = _proc
|
||||
await websocket.send_text(json.dumps({
|
||||
"cmd": "latency",
|
||||
"total": _total,
|
||||
"latencies": _lats,
|
||||
"processed": _proc,
|
||||
"stats": sess.stats,
|
||||
}))
|
||||
except Exception:
|
||||
|
||||
Reference in New Issue
Block a user