changeset 168:8c28426abef0

mgw: start using the new libgsmfrp dependency
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 19 Nov 2022 22:57:59 -0800
parents 2ebad02adbe5
children 648a64b2e16b
files mgw/Makefile mgw/dlcx.c mgw/gsm2pstn.c mgw/struct.h
diffstat 4 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mgw/Makefile	Wed Oct 12 18:08:34 2022 -0800
+++ b/mgw/Makefile	Sat Nov 19 22:57:59 2022 -0800
@@ -10,7 +10,7 @@
 all:	${PROG}
 
 ${PROG}: ${OBJS} ${LIBS}
-	${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS} -lgsm -lm
+	${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS} -lgsmfrp -lgsm -lm
 
 install:
 	install -c -o bin -g bin -m 755 ${PROG} ${INSTBIN}
--- a/mgw/dlcx.c	Wed Oct 12 18:08:34 2022 -0800
+++ b/mgw/dlcx.c	Sat Nov 19 22:57:59 2022 -0800
@@ -90,6 +90,8 @@
 			free(ep->gsm_encoder_state);
 		if (ep->gsm_decoder_state)
 			free(ep->gsm_decoder_state);
+		if (ep->gsm_decoder_extra_state)
+			free(ep->gsm_decoder_extra_state);
 		free(ep);
 	}
 	delq = 0;
--- a/mgw/gsm2pstn.c	Wed Oct 12 18:08:34 2022 -0800
+++ b/mgw/gsm2pstn.c	Sat Nov 19 22:57:59 2022 -0800
@@ -15,6 +15,7 @@
 #include <syslog.h>
 #include <unistd.h>
 #include <gsm.h>	/* libgsm dependency */
+#include <gsm_fr_preproc.h>
 #include "../include/tmgw_ctrl.h"
 #include "../include/tmgw_const.h"
 #include "struct.h"
@@ -133,6 +134,8 @@
 	}
 	switch (ep->gsm_payload_msg_type) {
 	case GSM_TCHF_FRAME:
+		gsmfr_preproc_good_frame(ep->gsm_decoder_extra_state,
+					 pkt.payload);
 		gsm_decode(ep->gsm_decoder_state, pkt.payload, pcm_samples);
 		break;
 	}
@@ -156,6 +159,12 @@
 		ep->gsm_decoder_state = gsm_create();
 		if (!ep->gsm_decoder_state)
 			return TMGW_RESP_ERR_RSRC;
+		ep->gsm_decoder_extra_state = gsmfr_preproc_create();
+		if (!ep->gsm_decoder_extra_state) {
+			free(ep->gsm_decoder_state);
+			ep->gsm_decoder_state = 0;
+			return TMGW_RESP_ERR_RSRC;
+		}
 		break;
 	}
 	select_handlers[ep->rtp_gsm.rtp_fd] = gsm2pstn_rtp_in;
--- a/mgw/struct.h	Wed Oct 12 18:08:34 2022 -0800
+++ b/mgw/struct.h	Sat Nov 19 22:57:59 2022 -0800
@@ -30,6 +30,7 @@
 	/* gateway functionality */
 	void		*gsm_encoder_state;
 	void		*gsm_decoder_state;
+	void		*gsm_decoder_extra_state;
 	/* GSM to PSTN forwarding */
 	int		g2p_state;
 	uint32_t	g2p_ssrc;