controller: UI-toggle audio output + astreamselect decouple (Phase 7 Вариант 2)
Web UI checkbox в Audio source карточке: «вывод аудио в стрим». Off →
TV получает silence + downstream audio chain isolated от live-audio RTSP
(нестабильный sidecar поток больше не блокирует video pipeline).
Изменения:
state.InstanceState: + audio_output_enabled (default True)
config.InstanceCfg:
+ audio_output_volume_target (default volume@output_audio)
+ audio_input_select_target (default astreamselect@audio_input)
dispatch.set_audio_output_enabled(enabled):
enabled=False → astreamselect map=1 (anullsrc) + volume=0
enabled=True → astreamselect map=0 (live-audio) + volume=1
Двойная команда: select decouples upstream, volume гарантирует тишину
на случай если в anullsrc что-то не так.
http_api: + GET /audio-output/{instance}, POST /audio-output/{instance}
static/index.html: + checkbox в Audio source header + loadAudioOut/toggleAudioOut
ZMQ smoke test OK. HTTP roundtrip OK.
Сопутствующий pipeline change: docker-compose.phase7.yml — amix заменён
на astreamselect@audio_input (см. localhost-infra commit).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,10 @@ class AutoLayoutReq(BaseModel):
|
||||
enabled: bool
|
||||
|
||||
|
||||
class AudioOutputReq(BaseModel):
|
||||
enabled: bool
|
||||
|
||||
|
||||
def create_app(
|
||||
cfg: Config, state: ControllerState, dispatcher: CommandDispatcher,
|
||||
snapshot_history: SnapshotHistory | None = None,
|
||||
@@ -80,6 +84,22 @@ def create_app(
|
||||
}
|
||||
return {"instances": out}
|
||||
|
||||
@app.get("/audio-output/{instance}")
|
||||
async def audio_output_get(instance: str) -> dict[str, Any]:
|
||||
_check_instance(instance)
|
||||
return {
|
||||
"instance": instance,
|
||||
"enabled": await state.get_audio_output_enabled(instance),
|
||||
}
|
||||
|
||||
@app.post("/audio-output/{instance}")
|
||||
async def audio_output_set(instance: str, req: AudioOutputReq) -> dict[str, Any]:
|
||||
_check_instance(instance)
|
||||
ok = await dispatcher.set_audio_output_enabled(instance, req.enabled)
|
||||
if not ok:
|
||||
raise HTTPException(500, "audio output ZMQ command failed (см. logs)")
|
||||
return {"ok": True, "instance": instance, "enabled": req.enabled}
|
||||
|
||||
@app.post("/layout/{instance}/set")
|
||||
async def set_layout(instance: str, req: LayoutSetReq) -> dict[str, Any]:
|
||||
_check_instance(instance)
|
||||
|
||||
Reference in New Issue
Block a user