Ignore:
Timestamp:
Feb 4, 2014 10:13:56 AM (10 years ago)
Author:
bennylp
Message:

Misc (re #1630): Fixing warnings about variable set but not used with recent gcc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsystest/systest.c

    r4537 r4728  
    11/* $Id$ */ 
    2 /*  
     2/* 
    33 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com) 
    44 * 
     
    1515 * You should have received a copy of the GNU General Public License 
    1616 * along with this program; if not, write to the Free Software 
    17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  
     17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
    1818 */ 
    1919#include "systest.h" 
     
    5757static gui_menu menu_getsets = { "View Settings", &systest_display_settings }; 
    5858 
    59 static gui_menu menu_tests = {  
    60     "Tests", NULL,  
    61     10,  
     59static gui_menu menu_tests = { 
     60    "Tests", NULL, 
     61    10, 
    6262    { 
    6363        &menu_wizard, 
    64         &menu_audtest,  
     64        &menu_audtest, 
    6565        &menu_playtn, 
    6666        &menu_playwv1, 
     
    6969        &menu_calclat, 
    7070        &menu_sndaec, 
    71         NULL,  
     71        NULL, 
    7272        &menu_exit 
    7373    } 
    7474}; 
    7575 
    76 static gui_menu menu_options = {  
    77     "Options", NULL,  
    78     2,  
     76static gui_menu menu_options = { 
     77    "Options", NULL, 
     78    2, 
    7979    { 
    8080        &menu_listdev, 
     
    8383}; 
    8484 
    85 static gui_menu root_menu = {  
    86     "Root", NULL, 2, {&menu_tests, &menu_options}  
     85static gui_menu root_menu = { 
     86    "Root", NULL, 2, {&menu_tests, &menu_options} 
    8787}; 
    8888 
     
    134134    else 
    135135        errmsg[0] = '\0'; 
    136      
     136 
    137137    strcpy(themsg, title); 
    138138    strncat(themsg, errmsg, sizeof(themsg)-1); 
     
    159159 
    160160/***************************************************************************** 
    161  * test: play simple ringback tone and hear it  
     161 * test: play simple ringback tone and hear it 
    162162 */ 
    163163static void systest_play_tone(void) 
     
    202202 
    203203    pool = pjsua_pool_create("ringback", 512, 512); 
    204     samples_per_frame = systest.media_cfg.audio_frame_ptime *  
     204    samples_per_frame = systest.media_cfg.audio_frame_ptime * 
    205205                        systest.media_cfg.clock_rate * 
    206206                        systest.media_cfg.channel_count / 1000; 
     
    208208    /* Ringback tone (call is ringing) */ 
    209209    name = pj_str("ringback"); 
    210     status = pjmedia_tonegen_create2(pool, &name,  
     210    status = pjmedia_tonegen_create2(pool, &name, 
    211211                                     systest.media_cfg.clock_rate, 
    212                                      systest.media_cfg.channel_count,  
     212                                     systest.media_cfg.channel_count, 
    213213                                     samples_per_frame, 
    214                                      16, PJMEDIA_TONEGEN_LOOP,  
     214                                     16, PJMEDIA_TONEGEN_LOOP, 
    215215                                     &ringback_port); 
    216216    if (status != PJ_SUCCESS) 
     
    270270 * the file. 
    271271 */ 
    272 static pj_status_t create_player(unsigned path_cnt, const char *paths[],  
     272static pj_status_t create_player(unsigned path_cnt, const char *paths[], 
    273273                                 pjsua_player_id *p_id) 
    274274{ 
     
    365365 
    366366/***************************************************************************** 
    367  * test: record audio  
     367 * test: record audio 
    368368 */ 
    369369static void systest_rec_audio(void) 
     
    388388                     "from the microphone, and playback the " 
    389389                     "audio to the speaker. Press OK to start recording, " 
    390                      "CANCEL to skip.",  
     390                     "CANCEL to skip.", 
    391391                     WITH_OKCANCEL); 
    392392    if (key != KEY_OK) { 
     
    433433                     "The recorded audio is being played now to " 
    434434                     "the speaker device, in a loop. Listen for " 
    435                      "any audio impairments. Press OK to stop.",  
     435                     "any audio impairments. Press OK to stop.", 
    436436                     WITH_OK); 
    437437 
     
    526526    param.clock_rate = systest.media_cfg.snd_clock_rate; 
    527527    param.channel_count = systest.media_cfg.channel_count; 
    528     param.samples_per_frame = param.clock_rate * param.channel_count *  
     528    param.samples_per_frame = param.clock_rate * param.channel_count * 
    529529                              systest.media_cfg.audio_frame_ptime / 1000; 
    530530 
    531531    /* Latency settings */ 
    532     param.flags |= (PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY |  
     532    param.flags |= (PJMEDIA_AUD_DEV_CAP_INPUT_LATENCY | 
    533533                    PJMEDIA_AUD_DEV_CAP_OUTPUT_LATENCY); 
    534534    param.input_latency_ms = systest.media_cfg.snd_rec_latency; 
     
    554554 
    555555    if (result.rec.frame_cnt==0) { 
    556         problems[problem_count++] =  
     556        problems[problem_count++] = 
    557557            "No audio frames were captured from the microphone. " 
    558558            "This means the audio device is not working properly."; 
    559559    } else { 
    560         pj_ansi_snprintf(textbuf+textbufpos,  
     560        pj_ansi_snprintf(textbuf+textbufpos, 
    561561                         sizeof(textbuf)-textbufpos, 
    562562                         "Rec : interval (min/max/avg/dev)=\r\n" 
     
    571571 
    572572        if (result.rec.max_burst > GOOD_MAX_INTERVAL) { 
    573             problems[problem_count++] =  
     573            problems[problem_count++] = 
    574574                "Recording max burst is quite high"; 
    575575        } 
     
    577577 
    578578    if (result.play.frame_cnt==0) { 
    579         problems[problem_count++] =  
     579        problems[problem_count++] = 
    580580            "No audio frames were played to the speaker. " 
    581581            "This means the audio device is not working properly."; 
    582582    } else { 
    583         pj_ansi_snprintf(textbuf+textbufpos,  
     583        pj_ansi_snprintf(textbuf+textbufpos, 
    584584                         sizeof(textbuf)-textbufpos, 
    585585                         "Play: interval (min/max/avg/dev)=\r\n" 
     
    594594 
    595595        if (result.play.max_burst > GOOD_MAX_INTERVAL) { 
    596             problems[problem_count++] =  
     596            problems[problem_count++] = 
    597597                "Playback max burst is quite high"; 
    598598        } 
     
    601601    if (result.rec_drift_per_sec) { 
    602602        const char *which = result.rec_drift_per_sec>=0 ? "faster" : "slower"; 
    603         unsigned drift = result.rec_drift_per_sec>=0 ?  
     603        unsigned drift = result.rec_drift_per_sec>=0 ? 
    604604                            result.rec_drift_per_sec : 
    605605                            -result.rec_drift_per_sec; 
     
    614614 
    615615    if (problem_count == 0) { 
    616         pj_ansi_snprintf(textbuf+textbufpos,  
     616        pj_ansi_snprintf(textbuf+textbufpos, 
    617617                         sizeof(textbuf)-textbufpos, 
    618618                         "\r\nThe sound device seems to be okay!"); 
     
    624624 
    625625        pj_ansi_snprintf(textbuf+textbufpos, 
    626                          sizeof(textbuf)-textbufpos,  
     626                         sizeof(textbuf)-textbufpos, 
    627627                         "There could be %d problem(s) with the " 
    628628                         "sound device:\r\n", 
     
    632632        for (i=0; i<problem_count; ++i) { 
    633633            pj_ansi_snprintf(textbuf+textbufpos, 
    634                              sizeof(textbuf)-textbufpos,  
     634                             sizeof(textbuf)-textbufpos, 
    635635                             " %d: %s\r\n", i+1, problems[i]); 
    636636            textbufpos = strlen(textbuf); 
     
    650650 */ 
    651651static int calculate_latency(pj_pool_t *pool, pjmedia_port *wav, 
    652                              unsigned *lat_sum, unsigned *lat_cnt,  
     652                             unsigned *lat_sum, unsigned *lat_cnt, 
    653653                             unsigned *lat_min, unsigned *lat_max) 
    654654{ 
     
    689689    } 
    690690 
    691     /* Zero the first 500ms to remove loud click noises  
     691    /* Zero the first 500ms to remove loud click noises 
    692692     * (keypad press, etc.) 
    693693     */ 
     
    784784        return; 
    785785    } 
    786     key = gui_msgbox(title,  
     786    key = gui_msgbox(title, 
    787787                     "For this test to work, we must be able to capture " 
    788788                     "the audio played in the speaker (the echo), and only" 
     
    798798    PJ_LOG(3,(THIS_FILE, "Running %s", title)); 
    799799 
    800     status = create_player(PJ_ARRAY_SIZE(ref_wav_paths), ref_wav_paths,  
     800    status = create_player(PJ_ARRAY_SIZE(ref_wav_paths), ref_wav_paths, 
    801801                           &play_id); 
    802802    if (status != PJ_SUCCESS) 
     
    817817    status = pjsua_conf_connect(0, rec_slot); 
    818818    status = pjsua_conf_connect(play_slot, rec_slot); 
    819      
     819 
    820820 
    821821    /* We're running */ 
     
    870870        goto on_return; 
    871871 
    872     status = calculate_latency(pool, wav_port, &lat_sum, &lat_cnt,  
     872    status = calculate_latency(pool, wav_port, &lat_sum, &lat_cnt, 
    873873                               &lat_min, &lat_max); 
    874874    if (status != PJ_SUCCESS) 
     
    913913            msglen = strlen(msg); 
    914914        } 
    915          
     915 
    916916        key = gui_msgbox(title, msg, WITH_OK); 
    917917 
     
    965965     * Create player and recorder 
    966966     */ 
    967     status = create_player(PJ_ARRAY_SIZE(ref_wav_paths), ref_wav_paths,  
     967    status = create_player(PJ_ARRAY_SIZE(ref_wav_paths), ref_wav_paths, 
    968968                           &player_id); 
    969969    if (status != PJ_SUCCESS) { 
     
    10181018    gui_msgbox(title, "We are now playing the captured audio from the mic. " 
    10191019                      "Check if echo (of the audio played back previously) is " 
    1020                       "present in the audio. The recording is stored in "  
     1020                      "present in the audio. The recording is stored in " 
    10211021                      AEC_REC_PATH " for offline analysis. " 
    10221022                      "Press OK to stop.", 
     
    10741074    enum gui_key key; 
    10751075    const char *title = "Audio Device List"; 
    1076      
     1076 
    10771077    ti = systest_alloc_test_item(title); 
    10781078    if (!ti) 
     
    10831083    dev_count = pjmedia_aud_dev_count(); 
    10841084    if (dev_count == 0) { 
    1085         key = gui_msgbox(title,  
     1085        key = gui_msgbox(title, 
    10861086                         "No audio devices are found", WITH_OK); 
    10871087        ti->success = PJ_FALSE; 
     
    11071107        pj_ansi_snprintf(ti->reason+len, sizeof(ti->reason)-len, 
    11081108                         " %2d: %s [%s] (%d/%d)\r\n", 
    1109                           i, info.driver, info.name,  
     1109                          i, info.driver, info.name, 
    11101110                          info.input_count, info.output_count); 
    11111111        len = strlen(ti->reason); 
     
    11141114    ti->reason[len] = '\0'; 
    11151115    key = gui_msgbox(title, ti->reason, WITH_OK); 
     1116    PJ_UNUSED_ARG(key); 
    11161117 
    11171118    ti->success = PJ_TRUE; 
     
    12051206    ti->reason[sizeof(ti->reason)-1] = '\0'; 
    12061207    key = gui_msgbox(title, textbuf, WITH_OK); 
    1207  
     1208    PJ_UNUSED_ARG(key); /* Warning about unused var */ 
    12081209} 
    12091210 
     
    12431244    systest.media_cfg.snd_rec_latency = OVERRIDE_AUDDEV_REC_LAT; 
    12441245#endif 
    1245          
     1246 
    12461247    status = pjsua_init(&systest.ua_cfg, &log_cfg, &systest.media_cfg); 
    12471248    if (status != PJ_SUCCESS) { 
Note: See TracChangeset for help on using the changeset viewer.