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.
This commit is contained in:
Andreas Eversberg 2012-01-20 08:58:27 +01:00
parent 5b3a112115
commit 67e162715d
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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 */