spkmodem-decode: fix wrong sample count

in handle audio, i do the number of samples
per frame, and one more. e.g. 241 instead of
240. this bug is in the original GNU version
too. this patch fixes it.

this means that the output could slowly go
out of sync with calculated timings. the
patch fixes that. in practise, the decoder
is not that sensitive, and the code would
adjust anyway (automatic timing adjustment),
but ideally we want to not *cause* such
issues even if we mitigate them.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-13 01:37:02 +00:00
parent 8085de594b
commit 9d24b78340
+6 -5
View File
@@ -336,16 +336,17 @@ handle_audio(struct decoder_state *st)
if (st->sample_count >= (3 * SAMPLES_PER_FRAME))
reset_char(st);
st->sample_count = 0;
/* process exactly one frame */
for (sample = 0; sample < SAMPLES_PER_FRAME; sample++)
decode_pulse(st);
select_separator_tone(st);
decode_pulse(st);
if (set_ascii_bit(st) < 0)
print_char(st);
st->sample_count = 0;
for (sample = 0; sample < SAMPLES_PER_FRAME; sample++)
decode_pulse(st);
/* Detect tone per each frame */
detect_tone(st);
}