From 43f0f1cbfca7e92cd5c863fe17563a3870305755 Mon Sep 17 00:00:00 2001 From: Smittix Date: Thu, 15 Jan 2026 16:54:13 +0000 Subject: [PATCH] Add rtl_fm raw output capture for diagnostics - Use tee to capture rtl_fm raw output to /tmp/rtl_fm_raw.bin - Log raw file size during stream timeouts - Helps determine if rtl_fm is producing any data at all Co-Authored-By: Claude Opus 4.5 --- routes/listening_post.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/routes/listening_post.py b/routes/listening_post.py index c0dff08..4bb7980 100644 --- a/routes/listening_post.py +++ b/routes/listening_post.py @@ -442,7 +442,9 @@ def _start_audio_stream(frequency: float, modulation: str): # Log stderr to temp files so we can see any errors from rtl_fm and ffmpeg rtl_stderr_log = '/tmp/rtl_fm_stderr.log' ffmpeg_stderr_log = '/tmp/ffmpeg_stderr.log' - shell_cmd = f"{' '.join(sdr_cmd)} 2>{rtl_stderr_log} | {' '.join(encoder_cmd)} 2>{ffmpeg_stderr_log}" + rtl_raw_output = '/tmp/rtl_fm_raw.bin' + # Use tee to capture rtl_fm raw output for diagnostics while also piping to ffmpeg + shell_cmd = f"{' '.join(sdr_cmd)} 2>{rtl_stderr_log} | tee {rtl_raw_output} | {' '.join(encoder_cmd)} 2>{ffmpeg_stderr_log}" logger.info(f"Starting audio pipeline: {shell_cmd}") audio_rtl_process = None # Not used in shell mode @@ -943,7 +945,13 @@ def stream_audio() -> Response: logger.warning(f"Audio stream: empty chunk after {bytes_sent} bytes, iterations={iterations}") break else: - logger.warning(f"Audio stream: select timeout after {bytes_sent} bytes, iterations={iterations}, poll={audio_process.poll()}") + # Check raw rtl_fm output file size + raw_size = 0 + try: + raw_size = os.path.getsize('/tmp/rtl_fm_raw.bin') + except: + pass + logger.warning(f"Audio stream: select timeout after {bytes_sent} bytes, iterations={iterations}, poll={audio_process.poll()}, rtl_raw_size={raw_size}") # Check for errors on timeout try: with open('/tmp/ffmpeg_stderr.log', 'r') as f: