mirror of
https://github.com/smittix/intercept.git
synced 2026-07-16 13:28:11 -07:00
Restart audio pipeline for fresh stream header
This commit is contained in:
@@ -936,10 +936,17 @@ def audio_probe() -> Response:
|
|||||||
return jsonify({'status': 'ok', 'bytes': size})
|
return jsonify({'status': 'ok', 'bytes': size})
|
||||||
|
|
||||||
|
|
||||||
@listening_post_bp.route('/audio/stream')
|
@listening_post_bp.route('/audio/stream')
|
||||||
def stream_audio() -> Response:
|
def stream_audio() -> Response:
|
||||||
"""Stream WAV audio."""
|
"""Stream WAV audio."""
|
||||||
# Wait for audio to be ready (up to 2 seconds for modulation/squelch changes)
|
# Optionally restart pipeline so the stream starts with a fresh header
|
||||||
|
if request.args.get('fresh') == '1' and audio_running:
|
||||||
|
try:
|
||||||
|
_start_audio_stream(audio_frequency or 0.0, audio_modulation or 'fm')
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"Audio stream restart failed: {e}")
|
||||||
|
|
||||||
|
# Wait for audio to be ready (up to 2 seconds for modulation/squelch changes)
|
||||||
for _ in range(40):
|
for _ in range(40):
|
||||||
if audio_running and audio_process:
|
if audio_running and audio_process:
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -2121,7 +2121,7 @@ async function _startDirectListenInternal() {
|
|||||||
await new Promise(r => setTimeout(r, 300));
|
await new Promise(r => setTimeout(r, 300));
|
||||||
|
|
||||||
// Connect to new stream
|
// Connect to new stream
|
||||||
const streamUrl = `/listening/audio/stream?t=${Date.now()}`;
|
const streamUrl = `/listening/audio/stream?fresh=1&t=${Date.now()}`;
|
||||||
console.log('[LISTEN] Connecting to stream:', streamUrl);
|
console.log('[LISTEN] Connecting to stream:', streamUrl);
|
||||||
audioPlayer.src = streamUrl;
|
audioPlayer.src = streamUrl;
|
||||||
audioPlayer.preload = 'auto';
|
audioPlayer.preload = 'auto';
|
||||||
|
|||||||
Reference in New Issue
Block a user