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

Freeswitch SVN brian at freeswitch.org
Wed Aug 30 20:15:32 EDT 2006


Author: brian
Date: Wed Aug 30 20:15:31 2006
New Revision: 2463

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

Log:
small tweaks

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	Wed Aug 30 20:15:31 2006
@@ -62,6 +62,7 @@
 
 struct amr_context {
 	void *encoder_state;
+	void *decoder_state;
 	int mode;
 };
 
@@ -105,13 +106,15 @@
 	} else {
 
 		context->mode = AMR_Mode; /* start in mode 7 */
+		context->encoder_state = NULL;
+		context->decoder_state = NULL;
 
 		if (encoding) {
 			context->encoder_state = Encoder_Interface_init(0);
 		}
 
 		if (decoding) {
-			Decoder_Interface_init();
+			context->decoder_state = Decoder_Interface_init();
 		}
 
 		codec->private_info = context;
@@ -123,8 +126,13 @@
 static switch_status_t switch_amr_destroy(switch_codec_t *codec) 
 {
 	struct amr_context *context = codec->private_info;
-	Encoder_Interface_exit(context->encoder_state);
-	Decoder_Interface_exit(context->encoder_state);
+
+	if (context->encoder_state) {
+		Encoder_Interface_exit(context->encoder_state);
+	}
+	if (context->decoder_state) {
+		Decoder_Interface_exit(context->decoder_state);
+	}
 	codec->private_info = NULL;
 	return SWITCH_STATUS_SUCCESS;
 }



More information about the Freeswitch-svn mailing list