Ignore:
Timestamp:
May 19, 2006 3:58:13 PM (18 years ago)
Author:
bennylp
Message:

Install VAD in g711, gsm, and speex, and add the DTX support in stream.c. Also changed the way the silence detector works, and changed default speex quality/complexity to 10

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjmedia/include/pjmedia/silencedet.h

    r355 r457  
    3737 
    3838/** 
     39 * Suggested or default threshold to be set for fixed silence detection 
     40 * or as starting threshold for adaptive silence detection. The threshold 
     41 * has the range from zero to 255. 
     42 */ 
     43#define PJMEDIA_SILENCE_DET_THRESHOLD   4 
     44 
     45 
     46/** 
    3947 * Create voice activity detector with default settings. The default settings 
    40  * are to perform adaptive silence detection, which adjusts the noise level 
    41  * dynamically based on current input level. 
     48 * are set to adaptive silence detection with the default threshold. 
    4249 * 
    43  * @param pool          Pool for allocating the structure. 
    44  * @param p_sd          Pointer to receive the silence detector instance. 
     50 * @param pool              Pool for allocating the structure. 
     51 * @param clock_rate        Clock rate. 
     52 * @param samples_per_frame Number of samples per frame. The clock_rate and 
     53 *                          samples_per_frame is only used to calculate the 
     54 *                          frame time, from which some timing parameters 
     55 *                          are calculated from. 
     56 * @param p_sd              Pointer to receive the silence detector instance. 
    4557 * 
    46  * @return              PJ_SUCCESS on success. 
     58 * @return                  PJ_SUCCESS on success. 
    4759 */ 
    4860PJ_DECL(pj_status_t) pjmedia_silence_det_create( pj_pool_t *pool, 
     61                                                 unsigned clock_rate, 
     62                                                 unsigned samples_per_frame, 
    4963                                                 pjmedia_silence_det **p_sd ); 
    5064 
    5165 
    5266/** 
    53  * Set the sd to operate in adaptive mode. 
    54  * 
    55  * @param sd            The silence detector 
    56  * @param frame_size    Number of samples per frame. 
    57  * 
    58  * @return              PJ_SUCCESS on success. 
    59  */ 
    60 PJ_DECL(pj_status_t) pjmedia_silence_det_set_adaptive( pjmedia_silence_det *sd, 
    61                                                        unsigned frame_size); 
    62  
    63  
    64 /** 
    65  * Set the sd to operate in fixed threshold mode. 
     67 * Set the sd to operate in fixed threshold mode. With fixed threshold mode, 
     68 * the threshold will not be changed adaptively. 
    6669 * 
    6770 * @param sd                The silence detector 
    68  * @param frame_size Number of samplse per frame. 
    69  * @param threshold         The silence threshold. 
     71 * @param threshold         The silence threshold, or -1 to use default 
     72 *                          threshold. 
    7073 * 
    7174 * @return                  PJ_SUCCESS on success. 
    7275 */ 
    7376PJ_DECL(pj_status_t) pjmedia_silence_det_set_fixed( pjmedia_silence_det *sd, 
    74                                                     unsigned frame_size, 
    75                                                     unsigned threshold ); 
     77                                                    int threshold ); 
     78 
     79/** 
     80 * Set the sd to operate in adaptive mode. This is the default mode 
     81 * when the silence detector is created. 
     82 * 
     83 * @param sd                The silence detector 
     84 * @param threshold         Initial threshold to be set, or -1 to use default 
     85 *                          threshold. 
     86 * 
     87 * @return                  PJ_SUCCESS on success. 
     88 */ 
     89PJ_DECL(pj_status_t) pjmedia_silence_det_set_adaptive(pjmedia_silence_det *sd, 
     90                                                      int threshold); 
     91 
     92/** 
     93 * Set other silence detector parameters. 
     94 * 
     95 * @param sd                The silence detector 
     96 * @param min_silence       Minimum duration of silence (in msec) before  
     97 *                          silence is reported. If -1 is specified, then 
     98 *                          the default value will be used. The default is 
     99 *                          400 msec. 
     100 * @param min_signal        Minimum duration of signal (in msec) before 
     101 *                          signal is reported. If -1 is specified, then 
     102 *                          the default value will be used. The default is 
     103 *                          one frame. 
     104 * @param recalc_time       The interval to recalculate signal and silence 
     105 *                          proportion and to readjust the silence threshold 
     106 *                          when adaptive silence detection is set. If -1 
     107 *                          is specified, then the default value will be used. 
     108 *                          The default value is 5000 (msec). 
     109 * 
     110 * @return                  PJ_SUCCESS on success. 
     111 */ 
     112PJ_DECL(pj_status_t) pjmedia_silence_det_set_params( pjmedia_silence_det *sd, 
     113                                                     int min_silence, 
     114                                                     int min_signal, 
     115                                                     int recalc_time); 
    76116 
    77117/** 
Note: See TracChangeset for help on using the changeset viewer.