mirror of
https://github.com/smittix/intercept.git
synced 2026-05-30 00:09:26 -07:00
Fix SSTV decoder thread lifecycle and VIS detection reliability
Three bugs preventing the live SSTV pipeline from working: 1. Race condition: self._running was set AFTER starting the decode thread, so the thread checked the flag, found it False, and exited immediately without ever processing audio. 2. Ghost running state: when the decode thread exited (e.g. rtl_fm died), self._running stayed True. The decoder reported as running but was dead, and subsequent start() calls returned without doing anything - permanently stuck until app restart. 3. VIS detection fragility: unclassifiable windows at tone transition boundaries (mixed energy from two tones) caused the state machine to reset from LEADER/BREAK states back to IDLE, dropping valid VIS headers on real signals. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -193,6 +193,8 @@ class VISDetector:
|
||||
# Transition to BREAK; this window counts as break window 1
|
||||
self._tone_counter = 1
|
||||
self._state = VISState.BREAK
|
||||
elif tone is None:
|
||||
pass # Ambiguous window at tone boundary — stay in state
|
||||
else:
|
||||
self._tone_counter = 0
|
||||
self._state = VISState.IDLE
|
||||
@@ -207,6 +209,8 @@ class VISDetector:
|
||||
# Transition to LEADER_2; this window counts
|
||||
self._tone_counter = 1
|
||||
self._state = VISState.LEADER_2
|
||||
elif tone is None:
|
||||
pass # Ambiguous window at tone boundary — stay in state
|
||||
else:
|
||||
self._tone_counter = 0
|
||||
self._state = VISState.IDLE
|
||||
@@ -227,6 +231,8 @@ class VISDetector:
|
||||
self._data_bits = []
|
||||
self._bit_accumulator = []
|
||||
self._state = VISState.DATA_BITS
|
||||
elif tone is None:
|
||||
pass # Ambiguous window at tone boundary — stay in state
|
||||
else:
|
||||
self._tone_counter = 0
|
||||
self._state = VISState.IDLE
|
||||
|
||||
Reference in New Issue
Block a user