[Speex-dev] DTX mode using preprocessor?

Thorvald Natvig speex at natvig.com
Fri Sep 2 15:47:17 PDT 2005

Could a method be added to use the VAD from the preprocessor to send the 
packet with the 'dtx_enable' flag in it, so the decoder on the other end 
knows it's in dtx mode? (and SPEEX_GET_DTX_STATUS returns 1)

At the moment, I can hack around it by doing something like:

if (VAD for prev frame && ! VAD for this frame) {
 		iArg = 0;
 		speex_encoder_ctl(m_esEncState,SPEEX_SET_VBR, &iArg);
 		speex_encoder_ctl(m_esEncState,SPEEX_SET_QUALITY, &iArg);

 		SBEncState *sbe = static_cast<SBEncState *>(m_esEncState);
 		EncState *es = static_cast<EncState *>(sbe->st_low);
 		es->dtx_count = 1;

(in wideband)

.. which forces speex to send the DTX packet and the remote side knows it 
can safely ignore that stream for the time being -- the lack of packets is 
completely intentional.

While this works, it's an incredibly ugly hack, and I have to include a 
lot of the internal speex header files to compile.

I've pondered adding a forced_vad flag to the encoder states, so you can 
speex_encoder_ctl(state, SPEEX_SET_FORCED_VAD, <whatever>)
but I'm not sure that's the right way to proceed.

Any ideas?

More information about the Speex-dev mailing list