Ignore:
Timestamp:
Aug 5, 2009 5:10:35 PM (15 years ago)
Author:
bennylp
Message:

More ticket #925: added compile time option to enable verbose logging output, and one more fix about samples_per_frame mismatch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/samples/jbsim.c

    r2846 r2854  
    4040/* Defaults settings */ 
    4141#define CODEC           "PCMU" 
    42 #define LOG_FILE        "jbsim.out" 
     42#define LOG_FILE        "jbsim.csv" 
    4343#define WAV_REF         "../../tests/pjsua/wavs/input.8.wav" 
    4444#define WAV_OUT         "jbsim.wav" 
    45 #define DURATION        20 
     45#define DURATION        60 
    4646#define DTX             PJ_TRUE 
    4747#define PLC             PJ_TRUE 
     
    5050#define LOSS_CORR       0 
    5151#define LOSS_EXTRA      2 
     52#define SILENT          1 
    5253 
    5354/* 
     
    122123{ 
    123124    /* General options */ 
     125    pj_bool_t        silent;            /* Write little to stdout   */ 
    124126    const char      *log_file;          /* The output log file      */ 
    125127 
     
    188190 * Logging 
    189191 */ 
    190 static void write_log(struct log_entry *entry) 
     192static void write_log(struct log_entry *entry, pj_bool_t to_stdout) 
    191193{ 
    192194    /* Format (CSV): */ 
     
    209211            pj_file_write(g_app.log_fd, log, &size); 
    210212        } 
     213        if (to_stdout && !g_app.cfg.silent) 
     214            printf("%s", log); 
    211215        header_written = PJ_TRUE; 
    212216    } 
     
    260264        pj_file_write(g_app.log_fd, log, &size); 
    261265    } 
     266 
     267    if (to_stdout && !g_app.cfg.silent) 
     268        printf("%s", log); 
    262269} 
    263270 
     
    275282    entry.log = data; 
    276283    entry.wall_clock = g_app.wall_clock; 
    277     write_log(&entry); 
     284    write_log(&entry, PJ_FALSE); 
    278285} 
    279286 
     
    480487#endif 
    481488#if defined(PJMEDIA_HAS_ILBC_CODEC) && PJMEDIA_HAS_ILBC_CODEC != 0 
    482     pjmedia_codec_ilbc_init(g_app.endpt, 30); 
     489    /* Init ILBC with mode=20 to make the losts occur at the same 
     490     * places as other codecs. 
     491     */ 
     492    pjmedia_codec_ilbc_init(g_app.endpt, 20); 
    483493#endif 
    484494#if defined(PJMEDIA_HAS_INTEL_IPP) && PJMEDIA_HAS_INTEL_IPP != 0 
     
    585595    frame.type = PJMEDIA_FRAME_TYPE_AUDIO; 
    586596    frame.buf = g_app.framebuf; 
    587     frame.size = src->info.samples_per_frame * 2; 
     597    frame.size = dst->info.samples_per_frame * 2; 
    588598     
    589599    status = pjmedia_port_get_frame(src, &frame); 
     
    705715        } 
    706716 
    707         write_log(&entry); 
     717        write_log(&entry, PJ_TRUE); 
    708718 
    709719        ++strm->state.tx.total_tx; 
     
    793803            entry.jb_state = &jstate; 
    794804 
    795             write_log(&entry); 
     805            write_log(&entry, PJ_TRUE); 
    796806 
    797807            /* GET */ 
     
    816826                strcat(msg, "** NULL frame was returned **"); 
    817827 
    818             write_log(&entry); 
     828            write_log(&entry, PJ_TRUE); 
    819829 
    820830        } 
     
    961971    g_app.cfg.codec = pj_str(CODEC); 
    962972    g_app.cfg.duration_msec = DURATION * 1000; 
     973    g_app.cfg.silent = SILENT; 
    963974    g_app.cfg.log_file = LOG_FILE; 
    964975    g_app.cfg.tx_wav_in = WAV_REF; 
Note: See TracChangeset for help on using the changeset viewer.