[Freeswitch-svn] [commit] r8135 - freeswitch/trunk/src/mod/codecs/mod_amr

Freeswitch SVN mikej at freeswitch.org
Mon Apr 21 15:02:52 EDT 2008


Author: mikej
Date: Mon Apr 21 15:02:51 2008
New Revision: 8135

Modified:
   freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c

Log:
honor disable dtx in fmtp (MODCODEC-3)

Modified: freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c	(original)
+++ freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c	Mon Apr 21 15:02:51 2008
@@ -93,11 +93,17 @@
 	AMR_BITRATE_1220
 } amr_bitrate_t;
 
+typedef enum {
+	AMR_DTX_DISABLED = 0,
+	AMR_DTX_ENABLED
+} amr_dtx_t;
+
 struct amr_context {
 	void *encoder_state;
 	void *decoder_state;
 	switch_byte_t enc_modes;
 	switch_byte_t enc_mode;
+	switch_int_t  dtx_mode;
 	uint32_t change_period;
 	switch_byte_t max_ptime;
 	switch_byte_t ptime;
@@ -133,8 +139,9 @@
 
 	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(struct amr_context))))) {
 		return SWITCH_STATUS_FALSE;
-	} else {
-
+	} else {	
+	
+		context->dtx_mode = AMR_DTX_ENABLED;
 		if (codec->fmtp_in) {
 			argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
 			for (x = 0; x < argc; x++) {
@@ -180,6 +187,8 @@
 						for (y = 0; y < m_argc; y++) {
 							context->enc_modes |= (1 << atoi(m_argv[y]));
 						}
+					} else if (!strcasecmp(data, "dtx")) {
+						context->dtx_mode = if (atoi(arg)) ? AMR_DTX_ENABLED : AMR_DTX_DISABLED;
 					}
 				}
 			}
@@ -206,7 +215,7 @@
 		context->decoder_state = NULL;
 
 		if (encoding) {
-			context->encoder_state = Encoder_Interface_init(1);
+			context->encoder_state = Encoder_Interface_init(context->dtx_mode);
 		}
 
 		if (decoding) {



More information about the Freeswitch-svn mailing list