From 67e162715d4a90ed6cba97986427b7092362c6e8 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Fri, 20 Jan 2012 08:58:27 +0100 Subject: [PATCH] Adding TX-dejitter feature for briged data to mISDN In case there is data bridged to an mISDN port, the TX-dejitter feature is enabled in the kernel, to keep the delay at a minimum. --- mISDN.cpp | 15 +++++++++++++++ mISDN.h | 1 + 2 files changed, 16 insertions(+) diff --git a/mISDN.cpp b/mISDN.cpp index ab08822..ed2b4eb 100644 --- a/mISDN.cpp +++ b/mISDN.cpp @@ -138,6 +138,7 @@ PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_setti p_m_mute = 0; p_m_txdata = 0; p_m_delay = 0; + p_m_tx_dejitter = 0; p_m_echo = 0; p_m_tone = 0; p_m_rxoff = 0; @@ -487,6 +488,8 @@ static void _bchannel_configure(struct mISDNport *mISDNport, int i) ph_control(mISDNport, port, handle, (port->p_m_txdata)?DSP_TXDATA_ON:DSP_TXDATA_OFF, 0, "DSP-TXDATA", port->p_m_txdata); if (port->p_m_delay && mode == B_MODE_TRANSPARENT) ph_control(mISDNport, port, handle, DSP_DELAY, port->p_m_delay, "DSP-DELAY", port->p_m_delay); + if (port->p_m_tx_dejitter && mode == B_MODE_TRANSPARENT) + ph_control(mISDNport, port, handle, DSP_TX_DEJITTER, port->p_m_tx_dejitter, "DSP-TX_DEJITTER", port->p_m_tx_dejitter); if (port->p_m_tx_gain && mode == B_MODE_TRANSPARENT) ph_control(mISDNport, port, handle, DSP_VOL_CHANGE_TX, port->p_m_tx_gain, "DSP-TX_GAIN", port->p_m_tx_gain); if (port->p_m_rx_gain && mode == B_MODE_TRANSPARENT) @@ -1763,6 +1766,8 @@ int PmISDN::message_epoint(unsigned int epoint_id, int message_id, union paramet void PmISDN::update_rxoff(void) { + int tx_dejitter = 0; + /* call bridges in user space OR crypto OR recording */ if (p_bridge || p_m_crypt_msg_loops || p_m_crypt_listen || p_record || p_m_inband_receive_on) { /* rx IS required */ @@ -1807,6 +1812,16 @@ void PmISDN::update_rxoff(void) ph_control(p_m_mISDNport, this, p_m_mISDNport->b_sock[p_m_b_index].fd, DSP_TXDATA_OFF, 0, "DSP-TXDATA", 0); } } + /* dejitter on bridge */ + if (p_bridge) + tx_dejitter = 1; + if (p_m_tx_dejitter != tx_dejitter) { + p_m_tx_dejitter = tx_dejitter; + PDEBUG(DEBUG_BCHANNEL, "we change dejitter mode to delay=%d.\n", p_m_tx_dejitter); + if (p_m_b_index > -1) + if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT) + ph_control(p_m_mISDNport, this, p_m_mISDNport->b_sock[p_m_b_index].fd, DSP_TX_DEJITTER, p_m_tx_dejitter, "DSP-TX_DEJITTER", p_m_tx_dejitter); + } } static int mISDN_upqueue(struct lcr_fd *fd, unsigned int what, void *instance, int i) diff --git a/mISDN.h b/mISDN.h index e3e59a4..90890b3 100644 --- a/mISDN.h +++ b/mISDN.h @@ -119,6 +119,7 @@ class PmISDN : public Port void message_crypt(unsigned int epoint_id, int message_id, union parameter *param); struct mISDNport *p_m_mISDNport; /* pointer to port */ int p_m_delay; /* use delay instead of dejitter */ + int p_m_tx_dejitter; /* use dejitter on transmit data to DSP */ int p_m_tx_gain, p_m_rx_gain; /* volume shift (0 = no change) */ char p_m_pipeline[256]; /* filter pipeline */ int p_m_echo, p_m_conf; /* remote echo, conference number */ -- 2.13.6