Skip to content

The agent that grows with you

refactor(plugins/google_meet): AudioBridge — drop redundant _torn_down flag (module id list already encodes it)

Tekniume1f145538e18
diff --git a/plugins/google_meet/audio_bridge.py b/plugins/google_meet/audio_bridge.py
index c69513e94ae..9ba3483fe41 100644
--- a/plugins/google_meet/audio_bridge.py
+++ b/plugins/google_meet/audio_bridge.py
@@ -30,7 +30,6 @@ class AudioBridge:
self._device_name: Optional[str] = None
self._write_target: Optional[str] = None
self._module_ids: list[int] = []
- self._torn_down = False
def _ready(self, value: Optional[str]) -> str:
if not value:
@@ -47,27 +46,20 @@ class AudioBridge:
return self._setup_linux()
if system == "Darwin":
return self._setup_darwin()
- if system == "Windows":
- raise RuntimeError("windows not supported in v2")
- raise RuntimeError(f"unsupported platform: {system}")
+ raise RuntimeError("windows not supported in v2" if system == "Windows" else f"unsupported platform: {system}")
def teardown(self) -> None:
"""Release the virtual audio device. Idempotent; never raises."""
- if self._torn_down:
- return
- if self._platform == "linux":
- for mod_id in reversed(self._module_ids): # virtual-source before null-sink
- with contextlib.suppress(Exception):
- _pactl("unload-module", str(mod_id), check=False)
- self._module_ids = []
- self._torn_down = True
+ for mod_id in reversed(self._module_ids): # linux only; virtual-source before null-sink
+ with contextlib.suppress(Exception):
+ _pactl("unload-module", str(mod_id), check=False)
+ self._module_ids = []
def _finish(self, tag: str, device: str, write_target: str, module_ids: list[int]) -> dict:
self._platform = tag
self._device_name = device
self._write_target = write_target
self._module_ids = module_ids
- self._torn_down = False
return {"platform": tag, "device_name": device, "sample_rate": 48000, "channels": 2,
"module_ids": list(module_ids), "write_target": write_target}