FreeCalypso > hg > gsm-codec-lib
diff libgsmfrp/bad_frame.c @ 248:6ac547f0b903
libgsmfrp: yet another invalid SID logic change, for 1.0.2
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 12 May 2023 03:48:19 +0000 |
parents | f081a6850fb5 |
children |
line wrap: on
line diff
--- a/libgsmfrp/bad_frame.c Fri May 12 02:04:42 2023 +0000 +++ b/libgsmfrp/bad_frame.c Fri May 12 03:48:19 2023 +0000 @@ -94,6 +94,8 @@ void gsmfr_preproc_invalid_sid(struct gsmfr_preproc_state *st, gsm_byte *frame) { + int mute; + switch (st->rx_state) { case NO_DATA: memcpy(frame, &gsmfr_preproc_silence_frame, sizeof(gsm_frame)); @@ -105,17 +107,16 @@ */ st->rx_state = COMFORT_NOISE; memcpy(st->sid_prefix, &st->speech_frame, 5); - st->sid_xmaxc = ((st->speech_frame[27] & 0x1F) << 1) | - (st->speech_frame[28] >> 7); + st->sid_xmaxc = gsmfr_preproc_xmaxc_mean(st->speech_frame); gsmfr_preproc_gen_cn(st, frame); return; case SPEECH_MUTING: - /* same as above, but set the state to CN_MUTING */ - st->rx_state = CN_MUTING; - memcpy(st->sid_prefix, &st->speech_frame, 5); - st->sid_xmaxc = ((st->speech_frame[27] & 0x1F) << 1) | - (st->speech_frame[28] >> 7); - gsmfr_preproc_gen_cn(st, frame); + /* ignore invalid SID in this state and act as if we got BFI */ + mute = reduce_xmaxc(st->speech_frame); + memcpy(frame, &st->speech_frame, sizeof(gsm_frame)); + random_grid_pos(st, frame); + if (mute) + st->rx_state = NO_DATA; return; case COMFORT_NOISE: case LOST_SID: