mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 14:02:52 +02:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user