Changes between Version 3 and Version 4 of MeasuringSoundLatency


Ignore:
Timestamp:
Jul 28, 2008 12:11:30 PM (16 years ago)
Author:
bennylp
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • MeasuringSoundLatency

    v3 v4  
    3636Run pjsua: 
    3737 
    38  {{{ 
    39  pjsua --no-tones --ec-tail 0 --rec-file rec1.wav --clock-rate 8000 --snd-clock-rate 8000 --play-file tock8.wav 
    40  }}} 
     38{{{ 
     39pjsua --no-tones --ec-tail 0 --clock-rate 8000 --snd-clock-rate 8000 --rec-file rec1.wav --play-file tock8.wav 
     40}}} 
    4141 
    4242Run this script all at once (i.e. copy these and paste it to pjsua): 
     
    8282 
    8383 {{{ 
    84  C:\> latency.exe rec1.wav 
     84C:\> latency.exe rec1.wav 
    8585Latency average = 197 
    8686Latency minimum = 173 
     
    8989 }}} 
    9090 
     91As you can see above, measuring the latency this way has several advantages: 
     92 * it's more automatic than manually measuring the latency with WAV analyzer. 
     93 * it should measure the latency more precisely 
     94 * it can measure the changes in the latency (as min, max, and average) as the buffers are adapting 
    9195 
     96 
     97== Measuring Overall/End-to-end Latency == 
     98 
     99The objective of this test is to measure the overall latency of: 
     100 * microphone and speaker device buffering (both in application layer, driver layer, and hardware itself) 
     101 * conference bridge buffering 
     102 * jitter buffering 
     103 * codec buffering 
     104 * and everything else 
     105 
     106Note that in order to measure the latency, we use loopback call for this test (meaning, the pjsua application is making call to itself), so this test method cannot be used to measure end-to-end latency of two pjsua instances. 
     107 
     108Test method: 
     109 * make loopback call (i.e. pjsua is calling itself, so we have both caller and callee in the same pjsua instance) 
     110 * arrange the conference bridge connection so that audio flow is one way (i.e. microphone -> call1 --> local network/OS --> call2 --> speaker) 
     111 * play a special WAV file to caller, and simultaneously record WAV file 
     112 * audio/RTP is received by callee, which will play the received the audio to speaker 
     113 * as the audio is played in the speaker, capture the signal in the microphone (i.e. similar to how sound echo is captured) 
     114 * record the microphone capture to WAV file. 
     115 
     116By looking in the recorded WAV file we should be able to know the sound device latency by measuring the interval between the recording of original signal and recording of the echo signal. 
     117 
     118=== Running the Test === 
     119 
     120Run pjsua with the following command line arguments: 
     121 
     122{{{ 
     123pjsua --no-tones --ec-tail 0 --no-vad --clock-rate 8000 --snd-clock-rate 8000 --rec-file rec2.wav --play-file tock8.wav --add-codec pcmu 
     124}}} 
     125 
     126Then copy/paste the script below to pjsua: 
     127 
     128{{{ 
     129m 
     130sip:localhost 
     131sleep 100 
     132] 
     133a 
     134200 
     135sleep 1000 
     136cd 0 4 
     137cd 3 0 
     138cd 0 3 
     139cc 1 3 
     140cc 1 2 
     141cc 0 2 
     142sleep 10000 
     143cd 0 2 
     144cd 1 2 
     145q 
     146}}} 
     147 
     148The command above will make pjsua calls itself, answer the call, setup the conference bridge interconnection to record the WAV file, and do recording to 10 seconds. Once it's done, the recorded WAV file is in {{{rec2.wav}}} file. 
     149 
     150=== Analyzing the result with WAV analyzer === 
     151 
     152Measuring the latency in the recorded WAV file is the same as in the previous test. Here's my {{{rec2.wav}}} looks like in the WAV analyzer: 
     153 
     154[[Image(rec2.png, 50%)]]] 
     155 
     156And in my measurement, I measured the delay is about 200 milliseconds. 
     157 
     158 
     159=== Analyzing the result with latency analyzer === 
     160 
     161Again, similar like previous test, and here's my result: 
     162 
     163 {{{ 
     164C:\> latency.exe rec2.wav 
     165Latency average = 213 
     166Latency minimum = 183 
     167Latency maximum = 227 
     168Number of data  = 9 
     169 }}} 
     170