aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-09-01 10:40:19 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-09-02 08:25:49 +0200
commitfa80d07de0975fe3b00daeadd5d9f685abf62653 (patch)
tree140b7ce6994df96648bc253dd1d1ce08dedda8d9 /openbsc/src/libmgcp
parentcac2438b0c33f54a6dcac55b55e8cfc33de197b2 (diff)
mgcp: Group codec reset and put it to a separate method.
Diffstat (limited to 'openbsc/src/libmgcp')
-rw-r--r--openbsc/src/libmgcp/mgcp_protocol.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c
index d2a9f093e..fff2ece5c 100644
--- a/openbsc/src/libmgcp/mgcp_protocol.c
+++ b/openbsc/src/libmgcp/mgcp_protocol.c
@@ -1449,6 +1449,19 @@ struct mgcp_trunk_config *mgcp_trunk_num(struct mgcp_config *cfg, int index)
return NULL;
}
+static void mgcp_rtp_codec_reset(struct mgcp_rtp_codec *codec)
+{
+ codec->payload_type = -1;
+ talloc_free(codec->subtype_name);
+ codec->subtype_name = NULL;
+ talloc_free(codec->audio_name);
+ codec->audio_name = NULL;
+ codec->frame_duration_num = DEFAULT_RTP_AUDIO_FRAME_DUR_NUM;
+ codec->frame_duration_den = DEFAULT_RTP_AUDIO_FRAME_DUR_DEN;
+ codec->rate = DEFAULT_RTP_AUDIO_DEFAULT_RATE;
+ codec->channels = DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS;
+}
+
static void mgcp_rtp_end_reset(struct mgcp_rtp_end *end)
{
if (end->local_alloc == PORT_ALLOC_DYNAMIC) {
@@ -1461,25 +1474,18 @@ static void mgcp_rtp_end_reset(struct mgcp_rtp_end *end)
end->dropped_packets = 0;
memset(&end->addr, 0, sizeof(end->addr));
end->rtp_port = end->rtcp_port = 0;
- end->codec.payload_type = -1;
end->local_alloc = -1;
talloc_free(end->fmtp_extra);
end->fmtp_extra = NULL;
- talloc_free(end->codec.subtype_name);
- end->codec.subtype_name = NULL;
- talloc_free(end->codec.audio_name);
- end->codec.audio_name = NULL;
talloc_free(end->rtp_process_data);
end->rtp_process_data = NULL;
/* Set default values */
- end->codec.frame_duration_num = DEFAULT_RTP_AUDIO_FRAME_DUR_NUM;
- end->codec.frame_duration_den = DEFAULT_RTP_AUDIO_FRAME_DUR_DEN;
end->frames_per_packet = 0; /* unknown */
end->packet_duration_ms = DEFAULT_RTP_AUDIO_PACKET_DURATION_MS;
- end->codec.rate = DEFAULT_RTP_AUDIO_DEFAULT_RATE;
- end->codec.channels = DEFAULT_RTP_AUDIO_DEFAULT_CHANNELS;
end->output_enabled = 0;
+
+ mgcp_rtp_codec_reset(&end->codec);
}
static void mgcp_rtp_end_init(struct mgcp_rtp_end *end)