V45.45: fix GUI embed VST den tren box (Nectar/iZotope) - first-paint kick real click + BitBlt black-frame fallback + on-screen parking MAC DINH (SF_FXGUI_EMBED_ONSCREEN=0 de tat) + plugins.py log TAT CA stdout bridge (khong nuot dong truoc SF_FXGUI_PORT=) + auto-open GUI khi add VST FX vao Mastering slot. Rebuild daw_vst_bridge+fx_vst_bridge+installer NSIS.
This commit is contained in:
+24
-20
@@ -1,4 +1,4 @@
|
||||
import os, sys, uuid, json, tempfile, subprocess, time as _time, threading, asyncio, logging
|
||||
import os, sys, uuid, json, tempfile, subprocess, time as _time, threading, asyncio, logging, queue
|
||||
from fastapi import APIRouter, HTTPException, Depends, UploadFile, File, BackgroundTasks, Query, WebSocket, WebSocketDisconnect
|
||||
from fastapi.responses import FileResponse
|
||||
from pydantic import BaseModel
|
||||
@@ -744,15 +744,31 @@ async def open_fx_gui(req: FxGuiRequest, current_user: dict = Depends(get_curren
|
||||
close_fds=os.name != "nt",
|
||||
env=dict(os.environ, SF_PARENT_PID=str(os.getpid())),
|
||||
creationflags=_gui_creationflags)
|
||||
# Bridge prints SF_FXGUI_PORT=<port> after binding its HTTP server.
|
||||
# Drain stdout NGAY TU DAU (daemon thread) và log TẤT CẢ các dòng
|
||||
# bridge in — gồm cả các dòng in TRƯỚC SF_FXGUI_PORT= ("[FxGui]
|
||||
# env ..." của RenderFxJob.cpp) mà cách đọc-tới-port cũ nuốt mất,
|
||||
# làm log engine không chứng minh được binary/env nào đang chạy.
|
||||
# Port được chuyển về qua queue (thread này không đọc stdout).
|
||||
port_q = queue.Queue(maxsize=1)
|
||||
|
||||
def _drain_fx_gui_stdout(pp):
|
||||
try:
|
||||
for ln in pp.stdout:
|
||||
ln = (ln or "").strip()
|
||||
if ln:
|
||||
logger.info("[fx-gui] %s", ln)
|
||||
if ln.startswith("SF_FXGUI_PORT="):
|
||||
try:
|
||||
port_q.put_nowait(int(ln.split("=", 1)[1]))
|
||||
except Exception:
|
||||
pass
|
||||
except Exception:
|
||||
pass
|
||||
threading.Thread(target=_drain_fx_gui_stdout, args=(proc,), daemon=True).start()
|
||||
embed_url = None
|
||||
try:
|
||||
for line in proc.stdout:
|
||||
line = (line or "").strip()
|
||||
if line.startswith("SF_FXGUI_PORT="):
|
||||
port = int(line.split("=", 1)[1])
|
||||
embed_url = f"http://127.0.0.1:{port}"
|
||||
break
|
||||
port = port_q.get(timeout=60)
|
||||
embed_url = f"http://127.0.0.1:{port}"
|
||||
except Exception:
|
||||
pass
|
||||
if not embed_url:
|
||||
@@ -762,18 +778,6 @@ async def open_fx_gui(req: FxGuiRequest, current_user: dict = Depends(get_curren
|
||||
except Exception:
|
||||
proc.kill()
|
||||
raise HTTPException(status_code=500, detail="Bridge không báo port fx-gui (mở GUI thất bại).")
|
||||
# Keep draining stdout in a daemon thread: the bridge logs to
|
||||
# stdout/stderr while running; if the pipe fills (64KB) the bridge
|
||||
# blocks on any later write -> GUI freezes/breaks.
|
||||
def _drain_fx_gui_stdout(pp):
|
||||
try:
|
||||
for ln in pp.stdout:
|
||||
ln = (ln or "").strip()
|
||||
if ln:
|
||||
logger.info("[fx-gui] %s", ln)
|
||||
except Exception:
|
||||
pass
|
||||
threading.Thread(target=_drain_fx_gui_stdout, args=(proc,), daemon=True).start()
|
||||
proc._sf_plugin_path = plugin_path
|
||||
proc._sf_embed_url = embed_url
|
||||
_register_fx_gui_process(proc)
|
||||
|
||||
Reference in New Issue
Block a user