Ignore:
Timestamp:
Apr 6, 2006 7:29:03 PM (18 years ago)
Author:
bennylp
Message:

Integrate (stream) quality monitoring into RTCP framework, and update all RTCP clients accordingly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_settings.c

    r360 r390  
    648648 
    649649    for (i=0; i<info.stream_cnt; ++i) { 
    650         pjmedia_stream_stat strm_stat; 
     650        pjmedia_rtcp_stat stat; 
    651651        const char *rem_addr; 
    652652        int rem_port; 
    653653        const char *dir; 
    654         char stxpkt[10], stxoct[10], srxpkt[10], srxoct[10]; 
    655  
    656         pjmedia_session_get_stream_stat(session, i, &strm_stat); 
     654        char last_update[40]; 
     655        char packets[16], bytes[16], ipbytes[16]; 
     656        pj_time_val now; 
     657 
     658        pjmedia_session_get_stream_stat(session, i, &stat); 
    657659        rem_addr = pj_inet_ntoa(info.stream_info[i].rem_addr.sin_addr); 
    658660        rem_port = pj_ntohs(info.stream_info[i].rem_addr.sin_port); 
     
    677679                  dir, 
    678680                  rem_addr, rem_port)); 
     681 
     682        if (stat.rx.update_cnt == 0) 
     683            strcpy(last_update, "never"); 
     684        else { 
     685            pj_gettimeofday(&now); 
     686            PJ_TIME_VAL_SUB(now, stat.rx.update); 
     687            sprintf(last_update, "%02dh:%02dm:%02d.%03ds ago", 
     688                    now.sec / 3600, 
     689                    (now.sec % 3600) / 60, 
     690                    now.sec % 60, 
     691                    now.msec); 
     692        } 
     693 
    679694        PJ_LOG(3,(THIS_FILE,  
    680                   "%s tx{pt=%d,pkt=%s,oct=%s} rx{pt=%d,pkt=%s,oct=%s}", 
    681                   "                 ", 
    682                   info.stream_info[i].tx_pt, 
    683                   good_number(stxpkt, strm_stat.enc.pkt),  
    684                   good_number(stxoct, strm_stat.enc.bytes), 
    685                   info.stream_info[i].fmt.pt, 
    686                   good_number(srxpkt, strm_stat.dec.pkt),  
    687                   good_number(srxoct, strm_stat.dec.bytes))); 
     695               "                  RX pt=%d, stat last update: %s\n" 
     696               "                     total %s packets %sB received (%sB +IP hdr)%s\n" 
     697               "                     pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 
     698               "                           (msec)    min     avg     max     last\n" 
     699               "                     loss period: %7.3f %7.3f %7.3f %7.3f%s\n" 
     700               "                     jitter     : %7.3f %7.3f %7.3f %7.3f%s", 
     701               info.stream_info[i].fmt.pt, 
     702               last_update, 
     703               good_number(packets, stat.rx.pkt), 
     704               good_number(bytes, stat.rx.bytes), 
     705               good_number(ipbytes, stat.rx.bytes + stat.rx.pkt * 32), 
     706               "", 
     707               stat.rx.loss, 
     708               stat.rx.loss * 100.0 / stat.rx.pkt, 
     709               stat.rx.dup,  
     710               stat.rx.dup * 100.0 / stat.rx.pkt, 
     711               stat.rx.reorder,  
     712               stat.rx.reorder * 100.0 / stat.rx.pkt, 
     713               "", 
     714               stat.rx.loss_period.min / 1000.0,  
     715               stat.rx.loss_period.avg / 1000.0,  
     716               stat.rx.loss_period.max / 1000.0, 
     717               stat.rx.loss_period.last / 1000.0, 
     718               "", 
     719               stat.rx.jitter.min / 1000.0, 
     720               stat.rx.jitter.avg / 1000.0, 
     721               stat.rx.jitter.max / 1000.0, 
     722               stat.rx.jitter.last / 1000.0, 
     723               "" 
     724               )); 
     725 
     726 
     727        if (stat.tx.update_cnt == 0) 
     728            strcpy(last_update, "never"); 
     729        else { 
     730            pj_gettimeofday(&now); 
     731            PJ_TIME_VAL_SUB(now, stat.tx.update); 
     732            sprintf(last_update, "%02dh:%02dm:%02d.%03ds ago", 
     733                    now.sec / 3600, 
     734                    (now.sec % 3600) / 60, 
     735                    now.sec % 60, 
     736                    now.msec); 
     737        } 
     738 
     739        PJ_LOG(3,(THIS_FILE, 
     740               "                  TX pt=%d, stat last update: %s\n" 
     741               "                     total %s packets %sB received (%sB +IP hdr)%s\n" 
     742               "                     pkt loss=%d (%3.1f%%), dup=%d (%3.1f%%), reorder=%d (%3.1f%%)%s\n" 
     743               "                           (msec)    min     avg     max     last\n" 
     744               "                     loss period: %7.3f %7.3f %7.3f %7.3f%s\n" 
     745               "                     jitter     : %7.3f %7.3f %7.3f %7.3f%s", 
     746               info.stream_info[i].tx_pt, 
     747               last_update, 
     748               good_number(packets, stat.tx.pkt), 
     749               good_number(bytes, stat.tx.bytes), 
     750               good_number(ipbytes, stat.tx.bytes + stat.tx.pkt * 32), 
     751               "", 
     752               stat.tx.loss, 
     753               stat.tx.loss * 100.0 / stat.tx.pkt, 
     754               stat.tx.dup,  
     755               stat.tx.dup * 100.0 / stat.tx.pkt, 
     756               stat.tx.reorder,  
     757               stat.tx.reorder * 100.0 / stat.tx.pkt, 
     758               "", 
     759               stat.tx.loss_period.min / 1000.0,  
     760               stat.tx.loss_period.avg / 1000.0,  
     761               stat.tx.loss_period.max / 1000.0, 
     762               stat.tx.loss_period.last / 1000.0, 
     763               "", 
     764               stat.tx.jitter.min / 1000.0, 
     765               stat.tx.jitter.avg / 1000.0, 
     766               stat.tx.jitter.max / 1000.0, 
     767               stat.tx.jitter.last / 1000.0, 
     768               "" 
     769               )); 
     770 
     771 
     772        PJ_LOG(3,(THIS_FILE, 
     773               "                 RTT msec       : %7.3f %7.3f %7.3f %7.3f%s",  
     774               stat.rtt.min / 1000.0, 
     775               stat.rtt.avg / 1000.0, 
     776               stat.rtt.max / 1000.0, 
     777               stat.rtt.last / 1000.0, 
     778               "" 
     779               )); 
    688780 
    689781    } 
     
    713805 
    714806    /* Dump all invite sessions: */ 
    715     if (detail) { 
    716         PJ_LOG(3,(THIS_FILE, "Dumping invite sessions:")); 
    717  
    718         if (pjsua.call_cnt == 0) { 
    719  
    720             PJ_LOG(3,(THIS_FILE, "  - no sessions -")); 
    721  
    722         } else { 
    723             int i; 
    724  
    725             for (i=0; i<pjsua.max_calls; ++i) { 
    726  
    727                 if (pjsua.calls[i].inv == NULL) 
    728                     continue; 
    729  
    730                 print_call("  ", i, buf, sizeof(buf)); 
    731                 PJ_LOG(3,(THIS_FILE, "%s", buf)); 
    732  
    733                 if (pjsua.calls[i].session) 
    734                     dump_media_session(pjsua.calls[i].session); 
    735             } 
     807    PJ_LOG(3,(THIS_FILE, "Dumping invite sessions:")); 
     808 
     809    if (pjsua.call_cnt == 0) { 
     810 
     811        PJ_LOG(3,(THIS_FILE, "  - no sessions -")); 
     812 
     813    } else { 
     814        int i; 
     815 
     816        for (i=0; i<pjsua.max_calls; ++i) { 
     817 
     818            if (pjsua.calls[i].inv == NULL) 
     819                continue; 
     820 
     821            print_call("  ", i, buf, sizeof(buf)); 
     822            PJ_LOG(3,(THIS_FILE, "%s", buf)); 
     823 
     824            if (pjsua.calls[i].session) 
     825                dump_media_session(pjsua.calls[i].session); 
    736826        } 
    737827    } 
Note: See TracChangeset for help on using the changeset viewer.