提交 0e044481 authored 作者: Brian West's avatar Brian West

small tweaks

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2463 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 fc2cd3c8
...@@ -62,6 +62,7 @@ static const char modname[] = "mod_amr"; ...@@ -62,6 +62,7 @@ static const char modname[] = "mod_amr";
struct amr_context { struct amr_context {
void *encoder_state; void *encoder_state;
void *decoder_state;
int mode; int mode;
}; };
...@@ -105,13 +106,15 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ ...@@ -105,13 +106,15 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
} else { } else {
context->mode = AMR_Mode; /* start in mode 7 */ context->mode = AMR_Mode; /* start in mode 7 */
context->encoder_state = NULL;
context->decoder_state = NULL;
if (encoding) { if (encoding) {
context->encoder_state = Encoder_Interface_init(0); context->encoder_state = Encoder_Interface_init(0);
} }
if (decoding) { if (decoding) {
Decoder_Interface_init(); context->decoder_state = Decoder_Interface_init();
} }
codec->private_info = context; codec->private_info = context;
...@@ -123,8 +126,13 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_ ...@@ -123,8 +126,13 @@ static switch_status_t switch_amr_init(switch_codec_t *codec, switch_codec_flag_
static switch_status_t switch_amr_destroy(switch_codec_t *codec) static switch_status_t switch_amr_destroy(switch_codec_t *codec)
{ {
struct amr_context *context = codec->private_info; 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; codec->private_info = NULL;
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论