From 0e0be1069bb42dbdb3f6331d53dd4205b166815c Mon Sep 17 00:00:00 2001 From: ComputerTech Date: Sat, 4 Apr 2026 14:08:34 +0100 Subject: [PATCH] fix: remove publisher_ip NameError; replace eventlet.tpool with direct IO --- server.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/server.py b/server.py index f9c1ee9..f198562 100644 --- a/server.py +++ b/server.py @@ -202,9 +202,8 @@ def _start_transcoder_if_needed(is_mp3_input=False): if chunk is None: break if proc.stdin: - # Run blocking pipe-write in a real thread via tpool - eventlet.tpool.execute(proc.stdin.write, chunk) - eventlet.tpool.execute(proc.stdin.flush) + proc.stdin.write(chunk) + proc.stdin.flush() except queue.Empty: continue except (BrokenPipeError, ConnectionResetError): @@ -226,9 +225,7 @@ def _start_transcoder_if_needed(is_mp3_input=False): print(f"[THREAD] Transcoder reader started (PID: {proc.pid})") while proc.poll() is None: try: - # Run blocking pipe-read in a real thread via tpool (1 KB chunks - # for smooth delivery; prevents buffering delays at lower bitrates) - data = eventlet.tpool.execute(proc.stdout.read, 1024) + data = proc.stdout.read(1024) if not data: break _transcoder_bytes_out += len(data) @@ -340,7 +337,7 @@ def _start_srt_transcoder(): print(f'[THREAD] SRT reader started (PID: {proc.pid})') while proc.poll() is None: try: - data = eventlet.tpool.execute(proc.stdout.read, 4096) + data = proc.stdout.read(4096) if not data: break _transcoder_bytes_out += len(data) @@ -1131,7 +1128,7 @@ def mediamtx_webhook(): broadcast_state['is_mp3_input'] = False _mp3_broadcast_announced = True # SRT audio starts flowing immediately - print(f"SRT: Stream PUBLISHED — path='{path}' source='{source_id}' ip='{publisher_ip or "unknown"}'") + print(f"SRT: Stream PUBLISHED — path='{path}' source='{source_id}'") with _mp3_lock: _preroll_clear()