diff options
Diffstat (limited to 'src/libosmo-legacy-mgcp/mgcp_protocol.c')
-rw-r--r-- | src/libosmo-legacy-mgcp/mgcp_protocol.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libosmo-legacy-mgcp/mgcp_protocol.c b/src/libosmo-legacy-mgcp/mgcp_protocol.c index 4e82233..854b4ba 100644 --- a/src/libosmo-legacy-mgcp/mgcp_protocol.c +++ b/src/libosmo-legacy-mgcp/mgcp_protocol.c @@ -863,6 +863,11 @@ mgcp_header_done: goto error2; } + /* Apply Jiter buffer settings for this endpoint, they can be overriden by CRCX policy later */ + endp->bts_use_jibuf = endp->cfg->bts_use_jibuf; + endp->bts_jitter_delay_min = endp->cfg->bts_jitter_delay_min; + endp->bts_jitter_delay_max = endp->cfg->bts_jitter_delay_max; + endp->allocated = 1; /* set up RTP media parameters */ @@ -898,6 +903,13 @@ mgcp_header_done: case MGCP_POLICY_DEFER: /* stop processing */ create_transcoder(endp); + /* Set up jitter buffer if required after policy has updated jibuf endp values */ + if (endp->bts_use_jibuf) { + endp->bts_jb = osmo_jibuf_alloc(tcfg->endpoints); + osmo_jibuf_set_min_delay(endp->bts_jb, endp->bts_jitter_delay_min); + osmo_jibuf_set_max_delay(endp->bts_jb, endp->bts_jitter_delay_max); + osmo_jibuf_set_dequeue_cb(endp->bts_jb, mgcp_dejitter_udp_send, &endp->net_end); + } return NULL; break; case MGCP_POLICY_CONT: @@ -906,6 +918,14 @@ mgcp_header_done: } } + /* Set up jitter buffer if required after policy has updated jibuf endp values */ + if (endp->bts_use_jibuf) { + endp->bts_jb = osmo_jibuf_alloc(tcfg->endpoints); + osmo_jibuf_set_min_delay(endp->bts_jb, endp->bts_jitter_delay_min); + osmo_jibuf_set_max_delay(endp->bts_jb, endp->bts_jitter_delay_max); + osmo_jibuf_set_dequeue_cb(endp->bts_jb, mgcp_dejitter_udp_send, &endp->net_end); + } + LOGP(DLMGCP, LOGL_DEBUG, "Creating endpoint on: 0x%x CI: %u port: %u/%u\n", ENDPOINT_NUMBER(endp), endp->ci, endp->net_end.local_port, endp->bts_end.local_port); @@ -1373,6 +1393,9 @@ int mgcp_endpoints_allocate(struct mgcp_trunk_config *tcfg) void mgcp_release_endp(struct mgcp_endpoint *endp) { LOGP(DLMGCP, LOGL_DEBUG, "Releasing endpoint on: 0x%x\n", ENDPOINT_NUMBER(endp)); + if (endp->bts_jb) + osmo_jibuf_delete(endp->bts_jb); + endp->bts_jb = NULL; endp->ci = CI_UNUSED; endp->allocated = 0; |