Changeset 2063
- Timestamp:
- Jun 26, 2008 6:52:16 PM (16 years ago)
- Location:
- pjproject/trunk/pjsip-apps/src/test-pjsua
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip-apps/src/test-pjsua/mod_pesq.py
r2057 r2063 16 16 import re 17 17 import subprocess 18 import wave 18 19 import inc_const as const 19 20 … … 26 27 # PESQ_THRESHOLD specifies the minimum acceptable PESQ MOS value, so test can be declared successful 27 28 PESQ = "tools/pesq.exe" 28 PESQ_ THRESHOLD = 3.029 PESQ_DEFAULT_THRESHOLD = 3.4 29 30 30 31 # UserData … … 39 40 # Test body function 40 41 def test_func(t, user_data): 41 42 if len(t.process) == 0:43 return44 42 45 43 ua1 = t.process[0] … … 65 63 user_data.pesq_sample_rate_opt = "+" + clock_rate + "000" 66 64 65 # Get WAV input length, in seconds 66 fin = wave.open(user_data.input_filename, "r") 67 if fin == None: 68 raise TestError("Failed opening input WAV file") 69 inwavlen = fin.getnframes() // fin.getframerate() 70 if (fin.getnframes() % fin.getframerate()) > 0: 71 inwavlen = inwavlen + 1 72 fin.close() 73 67 74 # UA1 making call 68 75 ua1.send("m") 69 76 ua1.send(t.inst_params[1].uri) 70 77 ua1.expect(const.STATE_CALLING) 78 79 # UA2 wait until call established 71 80 ua2.expect(const.STATE_CONFIRMED) 72 81 73 # Disconnect mic -> rec file to avoid echo recorded when using sound device 74 ua2.send("cd 0 1") 82 # Disconnect mic -> rec file, to avoid echo recorded when using sound device 83 # Disconnect stream -> spk, make it silent 84 # Connect stream -> rec file, start recording 85 ua2.send("cd 0 1\ncd 4 0\ncc 4 1") 75 86 76 # Auto answer, auto play, auto hangup 77 # Just wait for call disconnected 78 # Assumed WAV input is no more than 30 secs 79 while 1: 80 line = ua2.proc.stdout.readline() 81 if line == "": 82 raise TestError(ua2.name + ": Premature EOF") 87 # Disconnect mic -> stream, make stream purely sending from file 88 # Disconnect stream -> spk, make it silent 89 # Connect file -> stream, start sending 90 ua1.send("cd 0 4\ncd 4 0\ncc 1 4") 83 91 84 # Search for disconnected text 85 if re.search(const.STATE_DISCONNECTED, line) != None: 86 break 87 92 time.sleep(inwavlen) 93 94 # Disconnect files from bridge 95 ua2.send("cd 4 1") 96 ua2.expect(const.MEDIA_DISCONN_PORT_SUCCESS) 97 ua1.send("cd 1 4") 98 ua1.expect(const.MEDIA_DISCONN_PORT_SUCCESS) 99 88 100 89 101 # Post body function … … 102 114 raise TestError("Failed to fetch PESQ result") 103 115 104 # Evaluate the similarity value 116 # Get threshold 117 if (cfg_file.pesq_threshold != None) | (cfg_file.pesq_threshold > -0.5 ): 118 threshold = cfg_file.pesq_threshold 119 else: 120 threshold = PESQ_DEFAULT_THRESHOLD 121 122 # Evaluate the PESQ MOS value 105 123 pesq_res = mo_pesq_out.group(1) 106 if (float(pesq_res) >= PESQ_THRESHOLD):124 if (float(pesq_res) >= threshold): 107 125 endpt.trace("Success, PESQ result = " + pesq_res) 108 126 else: -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/100_defaults.py
r2057 r2063 12 12 "PESQ defaults pjsua settings", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --play-file wavs/input.16.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null-audio --max-calls=1 --rec-file wavs/tmp.16.wav --clock-rate 16000 --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --play-file wavs/input.16.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --rec-file wavs/tmp.16.wav --clock-rate 16000 --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = None -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/101_defaults.py
r2057 r2063 7 7 "PESQ defaults pjsua settings (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --play-file wavs/input.16.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --rec-file wavs/tmp.16.wav --clock-rate 16000 --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --play-file wavs/input.16.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --rec-file wavs/tmp.16.wav --clock-rate 16000 --auto-answer 200") 11 11 ] 12 12 ) … … 16 16 test_param.skip = True 17 17 18 pesq_threshold = None -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/200_codec_g711a.py
r2057 r2063 12 12 "PESQ codec PCMA", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec pcma --clock-rate 8000 --play-file wavs/input.8.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null-audio --max-calls=1 --add-codec pcma --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec pcma --clock-rate 8000 --play-file wavs/input.8.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --add-codec pcma --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = 3.5 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/200_codec_g711u.py
r2057 r2063 12 12 "PESQ codec PCMU", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec pcmu --clock-rate 8000 --play-file wavs/input.8.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null- sound --max-calls=1 --add-codec pcmu --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec pcmu --clock-rate 8000 --play-file wavs/input.8.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --add-codec pcmu --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = 3.5 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/200_codec_g722.py
r2057 r2063 12 12 "PESQ codec G722", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec g722 --clock-rate 16000 --play-file wavs/input.16.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null- sound --max-calls=1 --add-codec g722 --clock-rate 16000 --rec-file wavs/tmp.16.wav --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec g722 --clock-rate 16000 --play-file wavs/input.16.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --add-codec g722 --clock-rate 16000 --rec-file wavs/tmp.16.wav --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = 3.7 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/200_codec_gsm.py
r2057 r2063 12 12 "PESQ codec GSM", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec gsm --clock-rate 8000 --play-file wavs/input.8.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null- sound --max-calls=1 --add-codec gsm --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec gsm --clock-rate 8000 --play-file wavs/input.8.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --add-codec gsm --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = 3.0 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/200_codec_ilbc.py
r2057 r2063 12 12 "PESQ codec iLBC", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec ilbc --clock-rate 8000 --play-file wavs/input.8.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null- sound --max-calls=1 --add-codec ilbc --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec ilbc --clock-rate 8000 --play-file wavs/input.8.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --add-codec ilbc --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = 3.0 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/200_codec_speex_16000.py
r2057 r2063 12 12 "PESQ codec Speex WB", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --clock-rate 16000 --add-codec speex/16000 --play-file wavs/input.16.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null- sound --max-calls=1 --clock-rate 16000 --add-codec speex/16000 --rec-file wavs/tmp.16.wav --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --clock-rate 16000 --add-codec speex/16000 --play-file wavs/input.16.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --clock-rate 16000 --add-codec speex/16000 --rec-file wavs/tmp.16.wav --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = 3.7 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/200_codec_speex_8000.py
r2057 r2063 12 12 "PESQ codec Speex NB", 13 13 [ 14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec speex/8000 --clock-rate 8000 --play-file wavs/input.8.wav --auto-play-hangup"),15 InstanceParam("UA2", "--null- sound --max-calls=1 --add-codec speex/8000 --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")14 InstanceParam("UA1", ADD_PARAM + " --max-calls=1 --add-codec speex/8000 --clock-rate 8000 --play-file wavs/input.8.wav"), 15 InstanceParam("UA2", "--null-audio --max-calls=1 --add-codec speex/8000 --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 16 16 ] 17 17 ) 18 19 pesq_threshold = 3.0 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/201_codec_g711a.py
r2057 r2063 7 7 "PESQ codec PCMA (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --add-codec pcma --clock-rate 8000 --play-file wavs/input.8.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --add-codec pcma --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --add-codec pcma --clock-rate 8000 --play-file wavs/input.8.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --add-codec pcma --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 11 11 ] 12 12 ) … … 14 14 if (HAS_SND_DEV == 0): 15 15 test_param.skip = True 16 17 pesq_threshold = 3.5 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/201_codec_g711u.py
r2057 r2063 7 7 "PESQ codec PCMU (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --add-codec pcmu --clock-rate 8000 --play-file wavs/input.8.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --add-codec pcmu --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --add-codec pcmu --clock-rate 8000 --play-file wavs/input.8.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --add-codec pcmu --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 11 11 ] 12 12 ) … … 14 14 if (HAS_SND_DEV == 0): 15 15 test_param.skip = True 16 17 pesq_threshold = 3.5 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/201_codec_g722.py
r2057 r2063 7 7 "PESQ codec G722 (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --add-codec g722 --clock-rate 16000 --play-file wavs/input.16.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --add-codec g722 --clock-rate 16000 --rec-file wavs/tmp.16.wav --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --add-codec g722 --clock-rate 16000 --play-file wavs/input.16.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --add-codec g722 --clock-rate 16000 --rec-file wavs/tmp.16.wav --auto-answer 200") 11 11 ] 12 12 ) … … 14 14 if (HAS_SND_DEV == 0): 15 15 test_param.skip = True 16 17 pesq_threshold = 3.7 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/201_codec_gsm.py
r2057 r2063 7 7 "PESQ codec GSM (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --add-codec gsm --clock-rate 8000 --play-file wavs/input.8.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --add-codec gsm --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --add-codec gsm --clock-rate 8000 --play-file wavs/input.8.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --add-codec gsm --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 11 11 ] 12 12 ) … … 14 14 if (HAS_SND_DEV == 0): 15 15 test_param.skip = True 16 17 pesq_threshold = 3.0 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/201_codec_ilbc.py
r2057 r2063 7 7 "PESQ codec iLBC (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --add-codec ilbc --clock-rate 8000 --play-file wavs/input.8.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --add-codec ilbc --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --add-codec ilbc --clock-rate 8000 --play-file wavs/input.8.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --add-codec ilbc --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 11 11 ] 12 12 ) … … 14 14 if (HAS_SND_DEV == 0): 15 15 test_param.skip = True 16 17 pesq_threshold = 3.0 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/201_codec_speex_16000.py
r2057 r2063 7 7 "PESQ codec Speex WB (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --clock-rate 16000 --add-codec speex/16000 --play-file wavs/input.16.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --clock-rate 16000 --add-codec speex/16000 --rec-file wavs/tmp.16.wav --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --clock-rate 16000 --add-codec speex/16000 --play-file wavs/input.16.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --clock-rate 16000 --add-codec speex/16000 --rec-file wavs/tmp.16.wav --auto-answer 200") 11 11 ] 12 12 ) … … 14 14 if (HAS_SND_DEV == 0): 15 15 test_param.skip = True 16 17 pesq_threshold = 3.7 -
pjproject/trunk/pjsip-apps/src/test-pjsua/scripts-pesq/201_codec_speex_8000.py
r2057 r2063 7 7 "PESQ codec Speex NB (RX side uses snd dev)", 8 8 [ 9 InstanceParam("UA1", "--max-calls=1 --add-codec speex/8000 --clock-rate 8000 --play-file wavs/input.8.wav -- auto-play-hangup --null-audio"),10 InstanceParam("UA2", "--max-calls=1 --add-codec speex/8000 --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200 --auto-rec")9 InstanceParam("UA1", "--max-calls=1 --add-codec speex/8000 --clock-rate 8000 --play-file wavs/input.8.wav --null-audio"), 10 InstanceParam("UA2", "--max-calls=1 --add-codec speex/8000 --clock-rate 8000 --rec-file wavs/tmp.8.wav --auto-answer 200") 11 11 ] 12 12 ) … … 14 14 if (HAS_SND_DEV == 0): 15 15 test_param.skip = True 16 17 pesq_threshold = 3.0
Note: See TracChangeset
for help on using the changeset viewer.