Changeset 1715 for pjproject/trunk


Ignore:
Timestamp:
Jan 19, 2008 9:39:52 AM (17 years ago)
Author:
bennylp
Message:

More work on ticket #438: Workaround for frame bursts from audio devices. See the ticket for more information

Location:
pjproject/trunk/pjmedia
Files:
6 edited

Legend:

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

    r1664 r1715  
    9898 * for the sound device, and will try to limit the delay caused 
    9999 * by uneven callback calls to this delay. 
     100 * 
     101 * When this setting is enabled, the PJMEDIA_SOUND_BUFFER_COUNT 
     102 * macro will specify the maximum size of the delay buffer. 
    100103 */ 
    101104#ifndef PJMEDIA_SOUND_USE_DELAYBUF 
    102105#   define PJMEDIA_SOUND_USE_DELAYBUF       0 
    103 #endif 
    104  
    105  
    106 /** 
    107  * Whenever delay buffer is enabled for sound device, 
    108  * PJMEDIA_SOUND_BUFFER_COUNT is better to be set to 1, 
    109  * because sound callbacks will be called evenly thus  
    110  * there's no need to have this buffer. 
    111  */ 
    112 #if defined(PJMEDIA_SOUND_USE_DELAYBUF) && PJMEDIA_SOUND_USE_DELAYBUF!=0 
    113 #   define PJMEDIA_SOUND_BUFFER_COUNT       1 
    114106#endif 
    115107 
     
    125117 * combiner port, and dsound.c. 
    126118 * 
    127  * Note that when PJMEDIA_SOUND_USE_DELAYBUF is enabled, it's best to 
    128  * set PJMEDIA_SOUND_BUFFER_COUNT to 1 to reduce voice latency. 
    129  *  
    130119 * Default: 6 
    131120 */ 
  • pjproject/trunk/pjmedia/src/pjmedia/conference.c

    r1692 r1715  
    5656 
    5757#define THIS_FILE       "conference.c" 
    58 #define RX_BUF_COUNT    PJMEDIA_SOUND_BUFFER_COUNT 
     58 
     59/* When delay buffer is used, we only need 1 frame buffering */ 
     60#if defined(PJMEDIA_SOUND_USE_DELAYBUF) && PJMEDIA_SOUND_USE_DELAYBUF!=0 
     61#   define RX_BUF_COUNT     1 
     62#else 
     63#   define RX_BUF_COUNT     PJMEDIA_SOUND_BUFFER_COUNT 
     64#endif 
    5965 
    6066#define BYTES_PER_SAMPLE    2 
  • pjproject/trunk/pjmedia/src/pjmedia/delaybuf.c

    r1669 r1715  
    4141/* Since there are two operations performed (get & put), */ 
    4242/* these macros value must be minimum 2 and should be even number */ 
    43 #define WAITING_COUNT   8 
    44 #define LEARN_COUNT     8 
     43#define WAITING_COUNT   4 
     44#define LEARN_COUNT     16 
     45 
     46/* Number of buffers to add to learnt level for additional stability */ 
     47#define SAFE_MARGIN     2 
     48 
     49/* 
     50 * Some experimental data (with SAFE_MARGIN=1): 
     51 * 
     52 * System 1: 
     53 *  - XP, WMME, 10ms ptime,  
     54 *  - Sennheiser Headset+USB sound card 
     55 *  - Stable delaybuf level: 6, on WAITING_COUNT=4 and LEARNING_COUNT=48 
     56 * 
     57 * System 2: 
     58 *  - XP, WMME, 10ms ptime 
     59 *  - Onboard SoundMAX Digital Audio 
     60 *  - Stable delaybuf level: 6, on WAITING_COUNT=4 and LEARNING_COUNT=48 
     61 */ 
    4562 
    4663struct pjmedia_delay_buf 
     
    134151            b->state_count++; 
    135152            if (b->state_count == LEARN_COUNT) { 
    136                 /* give ONE frame compensation */ 
    137                 b->max_level += 1; 
     153                /* give SAFE_MARGIN compensation for added stability */ 
     154                b->max_level += SAFE_MARGIN; 
    138155                 
    139156                PJ_LOG(5,(b->obj_name,"Delay buffer start running, level=%u", 
  • pjproject/trunk/pjmedia/src/pjmedia/echo_speex.c

    r1417 r1715  
    3232 
    3333#define THIS_FILE       "echo_speex.c" 
    34 #define BUF_COUNT       16 
     34#define BUF_COUNT       PJMEDIA_SOUND_BUFFER_COUNT 
    3535#define MIN_PREFETCH    2 
    3636#define MAX_PREFETCH    (BUF_COUNT*2/3) 
  • pjproject/trunk/pjmedia/src/pjmedia/sound_port.c

    r1665 r1715  
    364364#if PJMEDIA_SOUND_USE_DELAYBUF 
    365365    status = pjmedia_delay_buf_create(pool, "snd_buff", samples_per_frame,  
    366                                       16, -1, &snd_port->delay_buf); 
     366                                      PJMEDIA_SOUND_BUFFER_COUNT, -1,  
     367                                      &snd_port->delay_buf); 
    367368    PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 
    368369#else 
  • pjproject/trunk/pjmedia/src/pjmedia/splitcomb.c

    r1417 r1715  
    2828#define THIS_FILE           "splitcomb.c" 
    2929#define TMP_SAMP_TYPE       pj_int16_t 
    30 #define MAX_BUF_CNT         PJMEDIA_SOUND_BUFFER_COUNT 
     30 
     31/* When delay buffer is used, we only need 1 frame buffering */ 
     32#if defined(PJMEDIA_SOUND_USE_DELAYBUF) && PJMEDIA_SOUND_USE_DELAYBUF!=0 
     33#   define MAX_BUF_CNT      1 
     34#else 
     35#   define MAX_BUF_CNT      PJMEDIA_SOUND_BUFFER_COUNT 
     36#endif 
    3137 
    3238#if 0 
Note: See TracChangeset for help on using the changeset viewer.