Ignore:
Timestamp:
Jun 12, 2008 12:48:59 PM (16 years ago)
Author:
nanang
Message:

Ticket #542: added new API and macro for sound device latency settings, also added new param for this in pjsua

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r1990 r2007  
    8686 
    8787    int                     capture_dev, playback_dev; 
     88    unsigned                capture_lat, playback_lat; 
    8889} app_config; 
    8990 
     
    195196    puts  ("  --capture-dev=id    Audio capture device ID (default=-1)"); 
    196197    puts  ("  --playback-dev=id   Audio playback device ID (default=-1)"); 
     198    puts  ("  --capture-lat=N     Audio capture latency, in ms (default=10)"); 
     199    puts  ("  --playback-lat=N    Audio playback latency, in ms (default=100)"); 
    197200 
    198201    puts  (""); 
     
    253256    cfg->capture_dev = PJSUA_INVALID_ID; 
    254257    cfg->playback_dev = PJSUA_INVALID_ID; 
     258    cfg->capture_lat = PJMEDIA_SND_DEFAULT_REC_LATENCY; 
     259    cfg->playback_lat = PJMEDIA_SND_DEFAULT_PLAY_LATENCY; 
    255260 
    256261    for (i=0; i<PJ_ARRAY_SIZE(cfg->acc_cfg); ++i) 
     
    414419           OPT_TLS_NEG_TIMEOUT, 
    415420           OPT_CAPTURE_DEV, OPT_PLAYBACK_DEV, 
     421           OPT_CAPTURE_LAT, OPT_PLAYBACK_LAT, 
    416422           OPT_AUTO_UPDATE_NAT,OPT_USE_COMPACT_FORM,OPT_DIS_CODEC 
    417423    }; 
     
    500506        { "capture-dev",    1, 0, OPT_CAPTURE_DEV}, 
    501507        { "playback-dev",   1, 0, OPT_PLAYBACK_DEV}, 
     508        { "capture-lat",    1, 0, OPT_CAPTURE_LAT}, 
     509        { "playback-lat",   1, 0, OPT_PLAYBACK_LAT}, 
    502510        { NULL, 0, 0, 0} 
    503511    }; 
     
    10761084        case OPT_PLAYBACK_DEV: 
    10771085            cfg->playback_dev = atoi(pj_optarg); 
     1086            break; 
     1087 
     1088        case OPT_CAPTURE_LAT: 
     1089            cfg->capture_lat = atoi(pj_optarg); 
     1090            break; 
     1091 
     1092        case OPT_PLAYBACK_LAT: 
     1093            cfg->playback_lat = atoi(pj_optarg); 
    10781094            break; 
    10791095 
     
    14721488    if (config->playback_dev != PJSUA_INVALID_ID) { 
    14731489        pj_ansi_sprintf(line, "--playback-dev %d\n", config->playback_dev); 
     1490        pj_strcat2(&cfg, line); 
     1491    } 
     1492 
     1493    /* Sound device latency */ 
     1494    if (config->capture_lat != PJMEDIA_SND_DEFAULT_REC_LATENCY) { 
     1495        pj_ansi_sprintf(line, "--capture-lat %d\n", config->capture_lat); 
     1496        pj_strcat2(&cfg, line); 
     1497    } 
     1498    if (config->playback_dev != PJMEDIA_SND_DEFAULT_PLAY_LATENCY) { 
     1499        pj_ansi_sprintf(line, "--playback-lat %d\n", config->playback_lat); 
    14741500        pj_strcat2(&cfg, line); 
    14751501    } 
     
    37143740        goto on_error; 
    37153741 
     3742    /* Set sound device latency */ 
     3743    pjmedia_snd_set_latency(app_config.capture_lat, app_config.playback_lat); 
     3744 
    37163745    /* Use null sound device? */ 
    37173746#ifndef STEREO_DEMO 
Note: See TracChangeset for help on using the changeset viewer.