Changeset 228


Ignore:
Timestamp:
Feb 25, 2006 2:04:42 AM (18 years ago)
Author:
bennylp
Message:

Synched with documentation

Location:
pjproject/trunk
Files:
8 edited
2 moved

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/os.h

    r106 r228  
    891891 */ 
    892892#if defined(PJ_HAS_HIGH_RES_TIMER) && PJ_HAS_HIGH_RES_TIMER != 0 
    893  
    894 /** 
    895  * This structure represents high resolution (64bit) time value. The time 
    896  * values represent time in cycles, which is retrieved by calling 
    897  * #pj_get_timestamp(). 
    898  */ 
    899 typedef union pj_timestamp 
    900 { 
    901     struct 
    902     { 
    903 #if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN!=0 
    904         pj_uint32_t lo;     /**< Low 32-bit value of the 64-bit value. */ 
    905         pj_uint32_t hi;     /**< high 32-bit value of the 64-bit value. */ 
    906 #else 
    907         pj_uint32_t hi;     /**< high 32-bit value of the 64-bit value. */ 
    908         pj_uint32_t lo;     /**< Low 32-bit value of the 64-bit value. */ 
    909 #endif 
    910     } u32;                  /**< The 64-bit value as two 32-bit values. */ 
    911  
    912 #if PJ_HAS_INT64 
    913     pj_uint64_t u64;        /**< The whole 64-bit value, where available. */ 
    914 #endif 
    915 } pj_timestamp; 
    916  
    917893 
    918894/** 
  • pjproject/trunk/pjlib/include/pj/types.h

    r182 r228  
    121121}; 
    122122 
     123/** 
     124 * This structure represents high resolution (64bit) time value. The time 
     125 * values represent time in cycles, which is retrieved by calling 
     126 * #pj_get_timestamp(). 
     127 */ 
     128typedef union pj_timestamp 
     129{ 
     130    struct 
     131    { 
     132#if defined(PJ_IS_LITTLE_ENDIAN) && PJ_IS_LITTLE_ENDIAN!=0 
     133        pj_uint32_t lo;     /**< Low 32-bit value of the 64-bit value. */ 
     134        pj_uint32_t hi;     /**< high 32-bit value of the 64-bit value. */ 
     135#else 
     136        pj_uint32_t hi;     /**< high 32-bit value of the 64-bit value. */ 
     137        pj_uint32_t lo;     /**< Low 32-bit value of the 64-bit value. */ 
     138#endif 
     139    } u32;                  /**< The 64-bit value as two 32-bit values. */ 
     140 
     141#if PJ_HAS_INT64 
     142    pj_uint64_t u64;        /**< The whole 64-bit value, where available. */ 
     143#endif 
     144} pj_timestamp; 
     145 
     146 
    123147 
    124148/** 
  • pjproject/trunk/pjmedia/build/pjmedia.dsp

    r222 r228  
    162162# Begin Source File 
    163163 
     164SOURCE=..\src\pjmedia\silencedet.c 
     165# End Source File 
     166# Begin Source File 
     167 
    164168SOURCE=..\src\pjmedia\stream.c 
    165 # End Source File 
    166 # Begin Source File 
    167  
    168 SOURCE=..\src\pjmedia\vad.c 
    169169# End Source File 
    170170# End Group 
     
    238238# Begin Source File 
    239239 
     240SOURCE=..\include\pjmedia\silencedet.h 
     241# End Source File 
     242# Begin Source File 
     243 
    240244SOURCE=..\include\pjmedia\sound.h 
    241245# End Source File 
     
    247251 
    248252SOURCE=..\include\pjmedia\types.h 
    249 # End Source File 
    250 # Begin Source File 
    251  
    252 SOURCE=..\include\pjmedia\vad.h 
    253253# End Source File 
    254254# Begin Source File 
  • pjproject/trunk/pjmedia/include/pjmedia/jbuf.h

    r188 r228  
    1616 * along with this program; if not, write to the Free Software 
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
     18 */ 
     19/* 
     20 * Based on implementation kindly contributed by Switchlab, Ltd. 
    1821 */ 
    1922#ifndef __PJMEDIA_JBUF_H__ 
  • pjproject/trunk/pjmedia/include/pjmedia/silencedet.h

    r222 r228  
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1818 */ 
    19 #ifndef __PJMEDIA_VAD_H__ 
    20 #define __PJMEDIA_VAD_H__ 
     19#ifndef __PJMEDIA_SILENCE_DET_H__ 
     20#define __PJMEDIA_SILENCE_DET_H__ 
    2121 
    2222 
    2323/** 
    24  * @file vad.h 
    25  * @brief Simple, adaptive silence detector. 
     24 * @file silencedet.h 
     25 * @brief Adaptive silence detector. 
    2626 */ 
    2727#include <pjmedia/types.h> 
     
    3131 
    3232/** 
    33  * @see pjmedia_vad 
     33 * Opaque declaration for silence detector. 
    3434 */ 
    35 typedef struct pjmedia_vad  pjmedia_vad; 
     35typedef struct pjmedia_silence_det pjmedia_silence_det; 
    3636 
    3737 
     
    4242 * 
    4343 * @param pool          Pool for allocating the structure. 
    44  * @param p_vad         Pointer to receive the VAD instance. 
     44 * @param p_sd          Pointer to receive the silence detector instance. 
    4545 * 
    4646 * @return              PJ_SUCCESS on success. 
    4747 */ 
    48 PJ_DECL(pj_status_t) pjmedia_vad_create( pj_pool_t *pool, 
    49                                          pjmedia_vad **p_vad ); 
     48PJ_DECL(pj_status_t) pjmedia_silence_det_create( pj_pool_t *pool, 
     49                                                 pjmedia_silence_det **p_sd ); 
    5050 
    5151 
    5252/** 
    53  * Set the vad to operate in adaptive mode. 
     53 * Set the sd to operate in adaptive mode. 
    5454 * 
    55  * @param vad               The vad 
    56  * @param frame_size Number of samplse per frame. 
     55 * @param sd            The silence detector 
     56 * @param frame_size    Number of samples per frame. 
    5757 * 
    58  * @return                  PJ_SUCCESS on success. 
     58 * @return              PJ_SUCCESS on success. 
    5959 */ 
    60 PJ_DECL(pj_status_t) pjmedia_vad_set_adaptive( pjmedia_vad *vad, 
    61                                                unsigned frame_size); 
     60PJ_DECL(pj_status_t) pjmedia_silence_det_set_adaptive( pjmedia_silence_det *sd, 
     61                                                       unsigned frame_size); 
    6262 
    6363 
    6464/** 
    65  * Set the vad to operate in fixed threshold mode. 
     65 * Set the sd to operate in fixed threshold mode. 
    6666 * 
    67  * @param vad               The vad 
     67 * @param sd                The silence detector 
    6868 * @param frame_size Number of samplse per frame. 
    6969 * @param threshold         The silence threshold. 
     
    7171 * @return                  PJ_SUCCESS on success. 
    7272 */ 
    73 PJ_DECL(pj_status_t) pjmedia_vad_set_fixed( pjmedia_vad *vad, 
    74                                             unsigned frame_size, 
    75                                             unsigned threshold ); 
     73PJ_DECL(pj_status_t) pjmedia_silence_det_set_fixed( pjmedia_silence_det *sd, 
     74                                                    unsigned frame_size, 
     75                                                    unsigned threshold ); 
    7676 
    7777/** 
    78  * Disable the vad. 
     78 * Disable the silence detector. 
    7979 * 
    80  * @param vad           The vad 
     80 * @param sd            The silence detector 
    8181 * 
    8282 * @return              PJ_SUCCESS on success. 
    8383 */ 
    84 PJ_DECL(pj_status_t) pjmedia_vad_disable( pjmedia_vad *vad ); 
     84PJ_DECL(pj_status_t) pjmedia_silence_det_disable( pjmedia_silence_det *sd ); 
    8585 
    8686 
     
    9494 *                      divided by number of samples. 
    9595 */ 
    96 PJ_DECL(pj_int32_t) pjmedia_vad_calc_avg_signal( const pj_int16_t samples[], 
    97                                                 pj_size_t count ); 
     96PJ_DECL(pj_int32_t) pjmedia_silence_det_calc_avg_signal( const pj_int16_t samples[], 
     97                                                        pj_size_t count ); 
    9898 
    9999 
     
    101101 * Perform voice activity detection on the given input samples. 
    102102 * 
    103  * @param vad           The VAD instance. 
     103 * @param sd            The silence detector instance. 
    104104 * @param samples       Pointer to 16-bit PCM input samples. 
    105105 * @param count         Number of samples in the input. 
     
    109109 * @return              PJ_SUCCESS on success. 
    110110 */ 
    111 PJ_DECL(pj_bool_t) pjmedia_vad_detect_silence( pjmedia_vad *vad, 
    112                                                const pj_int16_t samples[], 
    113                                                pj_size_t count, 
    114                                                pj_int32_t *p_level); 
     111PJ_DECL(pj_bool_t) pjmedia_silence_det_detect_silence( pjmedia_silence_det *sd, 
     112                                                       const pj_int16_t samples[], 
     113                                                       pj_size_t count, 
     114                                                       pj_int32_t *p_level); 
    115115 
    116116 
    117117PJ_END_DECL 
    118118 
    119 #endif  /* __PJMEDIA_VAD_H__ */ 
     119#endif  /* __PJMEDIA_SILENCE_DET_H__ */ 
    120120 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r224 r228  
    1818 */ 
    1919#include <pjmedia/conference.h> 
    20 #include <pjmedia/vad.h> 
     20#include <pjmedia/silencedet.h> 
    2121#include <pjmedia/stream.h> 
    2222#include <pjmedia/sound.h> 
     
    5656    int                  listener_cnt;  /**< Number of listeners.           */ 
    5757    pj_bool_t           *listeners;     /**< Array of listeners.            */ 
    58     pjmedia_vad         *vad;           /**< VAD for this port.             */ 
     58    pjmedia_silence_det *vad;           /**< VAD for this port.             */ 
    5959 
    6060    /* Tx buffer contains the frame to be "transmitted" to this port 
     
    140140 
    141141    /* Create and init vad. */ 
    142     status = pjmedia_vad_create( pool, &conf_port->vad); 
     142    status = pjmedia_silence_det_create( pool, &conf_port->vad); 
    143143    if (status != PJ_SUCCESS) 
    144144        return status; 
    145145 
    146     pjmedia_vad_set_adaptive(conf_port->vad, conf->samples_per_frame); 
     146    pjmedia_silence_det_set_adaptive(conf_port->vad, conf->samples_per_frame); 
    147147 
    148148 
     
    739739 
    740740        /* Do we have signal? */ 
    741         silence = pjmedia_vad_detect_silence(conf_port->vad, 
    742                                              output,  
    743                                              conf->samples_per_frame, 
    744                                              &level); 
     741        silence = pjmedia_silence_det_detect_silence(conf_port->vad, 
     742                                                     output,  
     743                                                     conf->samples_per_frame, 
     744                                                     &level); 
    745745 
    746746        /* Skip if we don't have signal. */ 
     
    790790            frame.buf = NULL; 
    791791            frame.size = 0; 
    792              
     792 
    793793            if (conf_port->port) 
    794794                pjmedia_port_put_frame(conf_port->port, &frame); 
  • pjproject/trunk/pjmedia/src/pjmedia/jbuf.c

    r188 r228  
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1818 */ 
     19/* 
     20 * Based on implementation kindly contributed by Switchlab, Ltd. 
     21 */ 
    1922#include <pjmedia/jbuf.h> 
    2023#include <pjmedia/errno.h> 
  • pjproject/trunk/pjmedia/src/pjmedia/silencedet.c

    r222 r228  
    1717 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
    1818 */ 
    19 #include <pjmedia/vad.h> 
     19#include <pjmedia/silencedet.h> 
    2020#include <pjmedia/errno.h> 
    2121#include <pj/assert.h> 
     
    2424 
    2525 
    26 #define THIS_FILE   "vad.c" 
    27  
    28 typedef enum pjmedia_vad_mode { 
     26#define THIS_FILE   "silencedet.c" 
     27 
     28typedef enum pjmedia_silence_det_mode { 
    2929    VAD_MODE_NONE, 
    3030    VAD_MODE_FIXED, 
    3131    VAD_MODE_ADAPTIVE 
    32 } pjmedia_vad_mode; 
     32} pjmedia_silence_det_mode; 
    3333 
    3434 
    3535/** 
    36  * This structure holds the vad state. 
     36 * This structure holds the silence detector state. 
    3737 */ 
    38 struct pjmedia_vad 
     38struct pjmedia_silence_det 
    3939{ 
    4040    int       mode;             /**< VAD mode.                              */ 
     
    6060 
    6161 
    62 PJ_DEF(pj_status_t) pjmedia_vad_create( pj_pool_t *pool, 
    63                                         pjmedia_vad **p_vad) 
    64 { 
    65     pjmedia_vad *vad; 
    66  
    67     PJ_ASSERT_RETURN(pool && p_vad, PJ_EINVAL); 
    68  
    69     vad = pj_pool_zalloc(pool, sizeof(struct pjmedia_vad)); 
    70  
    71     vad->weakest_signal = 0xFFFFFFFFUL; 
    72     vad->loudest_silence = 0; 
    73     vad->signal_cnt = 0; 
    74     vad->silence_cnt = 0; 
     62PJ_DEF(pj_status_t) pjmedia_silence_det_create( pj_pool_t *pool, 
     63                                                pjmedia_silence_det **p_sd) 
     64{ 
     65    pjmedia_silence_det *sd; 
     66 
     67    PJ_ASSERT_RETURN(pool && p_sd, PJ_EINVAL); 
     68 
     69    sd = pj_pool_zalloc(pool, sizeof(struct pjmedia_silence_det)); 
     70 
     71    sd->weakest_signal = 0xFFFFFFFFUL; 
     72    sd->loudest_silence = 0; 
     73    sd->signal_cnt = 0; 
     74    sd->silence_cnt = 0; 
    7575     
    7676    /* Restart in adaptive, silent mode */ 
    77     vad->in_talk = PJ_FALSE; 
    78     pjmedia_vad_set_adaptive( vad, 160 ); 
    79  
    80     *p_vad = vad; 
    81     return PJ_SUCCESS; 
    82 } 
    83  
    84 PJ_DEF(pj_status_t) pjmedia_vad_set_adaptive( pjmedia_vad *vad, 
    85                                               unsigned frame_size) 
    86 { 
    87     PJ_ASSERT_RETURN(vad && frame_size, PJ_EINVAL); 
    88  
    89     vad->frame_size = frame_size; 
    90     vad->mode = VAD_MODE_ADAPTIVE; 
    91     vad->min_signal_cnt = 10; 
    92     vad->min_silence_cnt = 64; 
    93     vad->recalc_cnt = 250; 
    94     vad->cur_threshold = 20; 
    95  
    96     return PJ_SUCCESS; 
    97 } 
    98  
    99 PJ_DEF(pj_status_t) pjmedia_vad_set_fixed( pjmedia_vad *vad, 
    100                                            unsigned frame_size, 
    101                                            unsigned threshold ) 
    102 { 
    103     PJ_ASSERT_RETURN(vad && frame_size, PJ_EINVAL); 
    104  
    105     vad->mode = VAD_MODE_FIXED; 
    106     vad->frame_size = frame_size; 
    107     vad->cur_threshold = threshold; 
    108  
    109     return PJ_SUCCESS; 
    110 } 
    111  
    112 PJ_DEF(pj_status_t) pjmedia_vad_disable( pjmedia_vad *vad ) 
    113 { 
    114     PJ_ASSERT_RETURN(vad, PJ_EINVAL); 
    115  
    116     vad->mode = VAD_MODE_NONE; 
    117  
    118     return PJ_SUCCESS; 
    119 } 
    120  
    121  
    122 PJ_DEF(pj_int32_t) pjmedia_vad_calc_avg_signal(const pj_int16_t samples[], 
    123                                                pj_size_t count) 
     77    sd->in_talk = PJ_FALSE; 
     78    pjmedia_silence_det_set_adaptive( sd, 160 ); 
     79 
     80    *p_sd = sd; 
     81    return PJ_SUCCESS; 
     82} 
     83 
     84PJ_DEF(pj_status_t) pjmedia_silence_det_set_adaptive( pjmedia_silence_det *sd, 
     85                                                      unsigned frame_size) 
     86{ 
     87    PJ_ASSERT_RETURN(sd && frame_size, PJ_EINVAL); 
     88 
     89    sd->frame_size = frame_size; 
     90    sd->mode = VAD_MODE_ADAPTIVE; 
     91    sd->min_signal_cnt = 10; 
     92    sd->min_silence_cnt = 64; 
     93    sd->recalc_cnt = 250; 
     94    sd->cur_threshold = 20; 
     95 
     96    return PJ_SUCCESS; 
     97} 
     98 
     99PJ_DEF(pj_status_t) pjmedia_silence_det_set_fixed( pjmedia_silence_det *sd, 
     100                                                   unsigned frame_size, 
     101                                                   unsigned threshold ) 
     102{ 
     103    PJ_ASSERT_RETURN(sd && frame_size, PJ_EINVAL); 
     104 
     105    sd->mode = VAD_MODE_FIXED; 
     106    sd->frame_size = frame_size; 
     107    sd->cur_threshold = threshold; 
     108 
     109    return PJ_SUCCESS; 
     110} 
     111 
     112PJ_DEF(pj_status_t) pjmedia_silence_det_disable( pjmedia_silence_det *sd ) 
     113{ 
     114    PJ_ASSERT_RETURN(sd, PJ_EINVAL); 
     115 
     116    sd->mode = VAD_MODE_NONE; 
     117 
     118    return PJ_SUCCESS; 
     119} 
     120 
     121 
     122PJ_DEF(pj_int32_t) pjmedia_silence_det_calc_avg_signal(const pj_int16_t samples[], 
     123                                                       pj_size_t count) 
    124124{ 
    125125    pj_uint32_t sum = 0; 
     
    141141} 
    142142 
    143 PJ_DEF(pj_bool_t) pjmedia_vad_detect_silence( pjmedia_vad *vad, 
    144                                               const pj_int16_t samples[], 
    145                                               pj_size_t count, 
    146                                               pj_int32_t *p_level) 
     143PJ_DEF(pj_bool_t) pjmedia_silence_det_detect_silence( pjmedia_silence_det *sd, 
     144                                                      const pj_int16_t samples[], 
     145                                                      pj_size_t count, 
     146                                                      pj_int32_t *p_level) 
    147147{ 
    148148    pj_uint32_t level; 
     
    150150 
    151151    /* Always return false if VAD is disabled */ 
    152     if (vad->mode == VAD_MODE_NONE) { 
     152    if (sd->mode == VAD_MODE_NONE) { 
    153153        if (p_level) 
    154154            *p_level = -1; 
     
    157157     
    158158    /* Calculate average signal level. */ 
    159     level = pjmedia_vad_calc_avg_signal(samples, count); 
     159    level = pjmedia_silence_det_calc_avg_signal(samples, count); 
    160160     
    161161    /* Report to caller, if required. */ 
     
    167167     
    168168    /* Do we have signal? */ 
    169     have_signal = level > vad->cur_threshold; 
     169    have_signal = level > sd->cur_threshold; 
    170170     
    171171    /* We we're in transition between silence and signel, increment the  
     
    173173     * frames. 
    174174     */ 
    175     if (vad->in_talk != have_signal) { 
     175    if (sd->in_talk != have_signal) { 
    176176        unsigned limit; 
    177177 
    178         vad->cur_cnt++; 
    179  
    180         limit = (vad->in_talk ? vad->min_silence_cnt :  
    181                                 vad->min_signal_cnt); 
    182  
    183         if (vad->cur_cnt > limit) { 
     178        sd->cur_cnt++; 
     179 
     180        limit = (sd->in_talk ? sd->min_silence_cnt :  
     181                                sd->min_signal_cnt); 
     182 
     183        if (sd->cur_cnt > limit) { 
    184184 
    185185            /* Swap mode */ 
    186             vad->in_talk = !vad->in_talk; 
     186            sd->in_talk = !sd->in_talk; 
    187187             
    188188            /* Restart adaptive cur_threshold measurements */ 
    189             vad->weakest_signal = 0xFFFFFFFFUL; 
    190             vad->loudest_silence = 0; 
    191             vad->signal_cnt = 0; 
    192             vad->silence_cnt = 0; 
     189            sd->weakest_signal = 0xFFFFFFFFUL; 
     190            sd->loudest_silence = 0; 
     191            sd->signal_cnt = 0; 
     192            sd->silence_cnt = 0; 
    193193        } 
    194194 
    195195    } else { 
    196196        /* Reset frame count */ 
    197         vad->cur_cnt = 0; 
    198     } 
    199      
    200     /* For fixed threshold vad, everything is done. */ 
    201     if (vad->mode == VAD_MODE_FIXED) { 
    202         return !vad->in_talk; 
     197        sd->cur_cnt = 0; 
     198    } 
     199     
     200    /* For fixed threshold sd, everything is done. */ 
     201    if (sd->mode == VAD_MODE_FIXED) { 
     202        return !sd->in_talk; 
    203203    } 
    204204     
     
    206206    /* Count the number of silent and signal frames and calculate min/max */ 
    207207    if (have_signal) { 
    208         if (level < vad->weakest_signal) 
    209             vad->weakest_signal = level; 
    210         vad->signal_cnt++; 
     208        if (level < sd->weakest_signal) 
     209            sd->weakest_signal = level; 
     210        sd->signal_cnt++; 
    211211    } 
    212212    else { 
    213         if (level > vad->loudest_silence) 
    214             vad->loudest_silence = level; 
    215         vad->silence_cnt++; 
     213        if (level > sd->loudest_silence) 
     214            sd->loudest_silence = level; 
     215        sd->silence_cnt++; 
    216216    } 
    217217 
     
    219219     * silence/signal frames. 
    220220     */ 
    221     if ((vad->signal_cnt + vad->silence_cnt) > vad->recalc_cnt) { 
     221    if ((sd->signal_cnt + sd->silence_cnt) > sd->recalc_cnt) { 
    222222         
    223223        /* Adjust silence threshold by looking at the proportions of 
    224224         * signal and silence frames. 
    225225         */ 
    226         if (vad->signal_cnt >= vad->recalc_cnt) { 
     226        if (sd->signal_cnt >= sd->recalc_cnt) { 
    227227            /* All frames where signal frames. 
    228228             * Increase silence threshold. 
    229229             */ 
    230             vad->cur_threshold += (vad->weakest_signal - vad->cur_threshold)/4; 
     230            sd->cur_threshold += (sd->weakest_signal - sd->cur_threshold)/4; 
    231231            PJ_LOG(6,(THIS_FILE, "Vad cur_threshold increased to %d", 
    232                       vad->cur_threshold)); 
    233         } 
    234         else if (vad->silence_cnt >= vad->recalc_cnt) { 
     232                      sd->cur_threshold)); 
     233        } 
     234        else if (sd->silence_cnt >= sd->recalc_cnt) { 
    235235            /* All frames where silence frames. 
    236236             * Decrease silence threshold. 
    237237             */ 
    238             vad->cur_threshold = (vad->cur_threshold+vad->loudest_silence)/2+1; 
     238            sd->cur_threshold = (sd->cur_threshold+sd->loudest_silence)/2+1; 
    239239            PJ_LOG(6,(THIS_FILE, "Vad cur_threshold decreased to %d", 
    240                       vad->cur_threshold)); 
     240                      sd->cur_threshold)); 
    241241        } 
    242242        else {  
     
    244244 
    245245            /* Adjust according to signal/silence proportions. */ 
    246             if (vad->signal_cnt > vad->silence_cnt * 2) 
    247                 vad->cur_threshold++; 
    248             else if (vad->silence_cnt >  vad->signal_cnt* 2) 
    249                 vad->cur_threshold--; 
     246            if (sd->signal_cnt > sd->silence_cnt * 2) 
     247                sd->cur_threshold++; 
     248            else if (sd->silence_cnt >  sd->signal_cnt* 2) 
     249                sd->cur_threshold--; 
    250250            else 
    251251                updated = PJ_FALSE; 
     
    254254                PJ_LOG(6,(THIS_FILE, 
    255255                          "Vad cur_threshold updated to %d", 
    256                           vad->cur_threshold)); 
     256                          sd->cur_threshold)); 
    257257            } 
    258258        } 
    259259 
    260260        /* Reset. */ 
    261         vad->weakest_signal = 0xFFFFFFFFUL; 
    262         vad->loudest_silence = 0; 
    263         vad->signal_cnt = 0; 
    264         vad->silence_cnt = 0; 
    265     } 
    266      
    267     return !vad->in_talk; 
    268 } 
    269  
     261        sd->weakest_signal = 0xFFFFFFFFUL; 
     262        sd->loudest_silence = 0; 
     263        sd->signal_cnt = 0; 
     264        sd->silence_cnt = 0; 
     265    } 
     266     
     267    return !sd->in_talk; 
     268} 
     269 
  • pjproject/trunk/pjmedia/src/pjmedia/stream.c

    r223 r228  
    117117 
    118118 
     119/* RFC 2833 digit */ 
     120static const char digitmap[16] = { '0', '1', '2', '3',  
     121                                   '4', '5', '6', '7',  
     122                                   '8', '9', '*', '#', 
     123                                   'A', 'B', 'C', 'D'}; 
     124 
    119125/* 
    120126 * Print error. 
     
    231237        stream->tx_dtmf_buf[0].start_ts = cur_ts; 
    232238        pj_mutex_unlock(stream->jb_mutex); 
    233     } 
     239 
     240        if (stream->tx_dtmf_count) 
     241            PJ_LOG(5,(THIS_FILE,"Sending DTMF digit id %c",  
     242                      digitmap[stream->tx_dtmf_buf[0].event])); 
     243 
     244    } else if (duration == 0) { 
     245        PJ_LOG(5,(THIS_FILE,"Sending DTMF digit id %c",  
     246                  digitmap[digit->event])); 
     247    } 
     248 
    234249 
    235250    frame_out->size = 4; 
     
    368383                                  const void *payload, unsigned payloadlen) 
    369384{ 
    370     static const char digitmap[16] = { '0', '1', '2', '3',  
    371                                        '4', '5', '6', '7',  
    372                                        '8', '9', '*', '#', 
    373                                        'A', 'B', 'C', 'D'}; 
    374385    const pjmedia_rtp_dtmf_event *event = payload; 
    375386 
  • pjproject/trunk/pjsip/include/pjsip-simple/evsub.h

    r212 r228  
    174174     * the subscription. 
    175175     * 
    176      * This callback is OPTIONAL. When it is not implemented, the default  
    177      * behavior is to refresh subscription by sending SUBSCRIBE with the 
    178      * interval set to current/last interval. 
     176     * This callback is OPTIONAL when PJSIP package such as presence or  
     177     * refer is used; the event package will refresh subscription by sending 
     178     * SUBSCRIBE with the interval set to current/last interval. 
    179179     * 
    180180     * @param sub       The subscription instance. 
     
    186186     * refresh after the specified subscription interval. 
    187187     * 
    188      * This callback is OPTIONAL. When it is not implemented, the default 
    189      * behavior is to send NOTIFY to terminate the subscription. 
     188     * This callback is OPTIONAL when PJSIP package such as presence or  
     189     * refer is used; the event package send NOTIFY to terminate the  
     190     * subscription. 
    190191     */ 
    191192    void (*on_server_timeout)(pjsip_evsub *sub); 
     
    400401 
    401402/** 
    402  * Get the event subscription instance in the transaction. 
     403 * Get the event subscription instance associated with the specified  
     404 * transaction. 
    403405 * 
    404406 * @param tsx           The transaction. 
Note: See TracChangeset for help on using the changeset viewer.