FreeCalypso > hg > gsm-codec-lib
view libgsmfr2/pp_good.c @ 542:f2d0f2f15d5f
libgsmefr: add wrapper for TW-TS-001 RTP input
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 28 Sep 2024 06:38:08 +0000 |
parents | 96c4ed5529bf |
children |
line wrap: on
line source
/* * In this module we implement preprocessing of received good frames. */ #include <stdint.h> #include <string.h> #include "tw_gsmfr.h" #include "pp_state.h" #include "pp_internal.h" void gsmfr_preproc_good_frame(struct gsmfr_preproc_state *st, uint8_t *frame) { int sid; /* always set correct magic */ frame[0] = 0xD0 | frame[0] & 0x0F; /* now classify by SID */ sid = gsmfr_preproc_sid_classify(frame); switch (sid) { case 0: /* good speech frame */ st->rx_state = SPEECH; st->dtxd_sid_flag = 0; memcpy(&st->speech_frame, frame, GSMFR_RTP_FRAME_LEN); return; case 1: /* invalid SID frame */ /* state-dependent handling, similar to BFI */ gsmfr_preproc_invalid_sid(st, frame); return; case 2: /* valid SID frame */ st->rx_state = COMFORT_NOISE; st->dtxd_sid_flag = 1; gsmfr_preproc_sid2cn(st, frame); return; } }