Commit 02d311ca authored by Simon Morlat's avatar Simon Morlat

vaddtx seems working quite good

parent 89180cd5
......@@ -92,13 +92,20 @@ MS2_PUBLIC void ms_queue_destroy(MSQueue *q);
#define mblk_set_timestamp_info(m,ts) (m)->reserved1=(ts);
#define mblk_get_timestamp_info(m) ((m)->reserved1)
#define mblk_set_marker_info(m,bit) __mblk_set_flag(m,0,bit)
#define mblk_get_marker_info(m) ((m)->reserved2&0x1) /*bit 1*/
#define mblk_set_precious_flag(m,bit) __mblk_set_flag(m,1,bit) /*use to prevent mirroring*/
#define mblk_get_precious_flag(m) (((m)->reserved2)>>1 & 0x1) /*bit 2*/
#define mblk_get_marker_info(m) ((m)->reserved2 & 0x1) /*bit 1*/
#define mblk_set_precious_flag(m,bit) __mblk_set_flag(m,1,bit) /*use to prevent mirroring for video*/
#define mblk_get_precious_flag(m) (((m)->reserved2)>>1 & 0x1) /*bit 2 */
#define mblk_set_plc_flag(m,bit) __mblk_set_flag(m,2,bit) /*use to mark a plc generated block*/
#define mblk_get_plc_flag(m) (((m)->reserved2)>>1 & 0x2) /*bit 2*/
#define mblk_get_plc_flag(m) (((m)->reserved2)>>2 & 0x1) /*bit 3*/
#define mblk_set_cng_flag(m,bit) __mblk_set_flag(m,3,bit) /*use to mark a cng generated block*/
#define mblk_get_cng_flag(m) (((m)->reserved2)>>2 & 0x4) /*bit 3*/
#define mblk_get_cng_flag(m) (((m)->reserved2)>>3 & 0x1) /*bit 4*/
#define mblk_set_user_flag(m,bit) __mblk_set_flag(m,7,bit) /* to be used by extensions to mediastreamer2*/
#define mblk_get_user_flag(m) (((m)->reserved2)>>7 & 0x1) /*bit 8*/
#define mblk_set_cseq(m,value) (m)->reserved2=(m)->reserved2| ((value&0xFFFF)<<16);
#define mblk_get_cseq(m) ((m)->reserved2>>16)
......
......@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static const float max_e = (32768* 0.7); /* 0.7 - is RMS factor */
static const float coef = 0.2; /* floating averaging coeff. for energy */
static const float silence_threshold=0.001;
static const float silence_threshold=0.01;
typedef struct _VadDtxContext{
int silence_mode;/*set to 1 if a silence period is running*/
......@@ -66,6 +66,7 @@ static void update_energy(VadDtxContext *v, int16_t *signal, int numsamples, uin
en = (sqrt(acc / numsamples)+1) / max_e;
v->energy = (en * coef) + v->energy * (1.0 - coef);
ortp_extremum_record_max(&v->max,curtime,v->energy);
//ms_message("Energy=%f, current max=%f",v->energy, ortp_extremum_get_current(&v->max));
}
static void vad_dtx_process(MSFilter *f){
......
......@@ -594,12 +594,12 @@ static void on_silence_detected(void *data, MSFilter *f, unsigned int event_id,
if (as->ms.rtpsend){
switch(event_id){
case MS_VAD_DTX_NO_VOICE:
ms_message("on_silence_detected(): CN packet to be sent !");
/*ms_message("on_silence_detected(): CN packet to be sent !");*/
ms_filter_call_method(as->ms.rtpsend, MS_RTP_SEND_SEND_GENERIC_CN, event_arg);
ms_filter_call_method(as->ms.rtpsend, MS_RTP_SEND_MUTE, event_arg);
break;
case MS_VAD_DTX_VOICE:
ms_message("on_silence_detected(): resuming audio");
/*ms_message("on_silence_detected(): resuming audio");*/
ms_filter_call_method(as->ms.rtpsend, MS_RTP_SEND_UNMUTE, event_arg);
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment