=纯PCM输入和输出= 我们目前只针对输入做,输出目前是单一输出,但是是多路输入。目前,opus支持(8000/12000/16000/24000/48000), webrtc echo支持(8000/16000/32000),所以他们的交集在8000/16000上面。但是,针对非对讲设备,我们可以使用48000的采样率。根据计算,目前最大估计只支持同时3路pcm输入打开。 以下的测试中均为单声道,其中8000Hz与16000Hz采样率使用无符号8位采样,24000Hz与48000Hz使用有符号小端16位采样,录音使用arecord进行测试,输出写入空设备(/dev/null)中,回放使用aplay进行测试,输入使用/dev/zero。ALSA的录音回放均已开启软件混音,统一使用48000Hz采样率进行混音,采样率转换模块为"samplerate_linear",所使用的命令如下:
arecord -f S16 -r 48000 > /dev/null
aplay -f S16 -r 48000 < /dev/zero
#若使用无符号8位采样,将S16替换为U8,使用其它采样率时将48000替换为相应的值
==一路PCM输入== {| class="wikitable" ! Sample rate ! Format ! CPU (%) ! CPU (w/o mixer %) |- | 8000 | Unsigned 8 bit, Mono | 4.0 | 0.7 |- | 16000 | Unsigned 8 bit, Mono | 5.0 | 1.3 |- | 24000 | Signed 16 bit, Mono | 6.0 | 12.9 |- | 48000 | Signed 16 bit, Mono | 3.0 | 4.4 |} ===t-6005 board=== turn on alsa soft mixer
channel: 1
'''date''': Wed Jun 19 20:42:17 CST 2013
'''OS:'''Linux arm 3.2.0-luna_itc+ #136 Wed Jun 5 19:56:32 CST 2013 armv7l armv7l armv7l GNU/Linux
'''time to measure:'''10s
'''Source:'''linphone/scripts/do_alsa_test.sh {| class=wikitable |- ! Sample rate ! CPU (%) |- | 8000 | max cpu: 4.4, avg cpu: 4.20 |- | 16000 | max cpu: 5.9, avg cpu: 5.65 |- | 24000 | max cpu: 6.0, avg cpu: 6.00 |- | 32000 | max cpu: 7.8, avg cpu: 7.50 |- | 48000 | max cpu: 4.0, avg cpu: 2.55 |} '''Notice: It includes file read/write time'''

turn on alsa soft mixer
channel = 2
'''date''': Wed Jun 19 20:49:35 CST 2013
'''OS:'''Linux arm 3.2.0-luna_itc+ #136 Wed Jun 5 19:56:32 CST 2013 armv7l armv7l armv7l GNU/Linux
'''time to measure:'''10s
'''Source:'''linphone/scripts/do_alsa_test.sh {| class=wikitable |- ! Sample rate ! CPU (%) |- | 8000 | max cpu: 3.0, avg cpu: 2.50 |- | 16000 | max cpu: 5.9, avg cpu: 5.25 |- | 24000 | max cpu: 5.9, avg cpu: 5.65 |- | 32000 | max cpu: 7.9, avg cpu: 7.25 |- | 48000 | max cpu: 1.2, avg cpu: .60 |} '''Notice: It includes file read/write time'''

turn off alsa soft mixer
channel = 1
'''date''': Wed Jun 19 20:45:02 CST 2013
'''OS:'''Linux arm 3.2.0-luna_itc+ #136 Wed Jun 5 19:56:32 CST 2013 armv7l armv7l armv7l GNU/Linux
'''time to measure:'''10s
'''Source:'''linphone/scripts/do_alsa_test.sh {| class=wikitable |- ! Sample rate ! CPU (%) |- | 8000 | max cpu: 1.0, avg cpu: .50 |- | 16000 | max cpu: 1.4, avg cpu: .70 |- | 24000 | max cpu: 13.6, avg cpu: 13.40 |- | 32000 | max cpu: 3.9, avg cpu: 3.45 |- | 48000 | max cpu: 4.4, avg cpu: 4.15 |} '''Notice: It includes file read/write time'''

turn off alsa soft mixer
channel = 2
'''date''': Wed Jun 19 20:47:07 CST 2013
'''OS:'''Linux arm 3.2.0-luna_itc+ #136 Wed Jun 5 19:56:32 CST 2013 armv7l armv7l armv7l GNU/Linux
'''time to measure:'''10s
'''Source:'''linphone/scripts/do_alsa_test.sh {| class=wikitable |- ! Sample rate ! CPU (%) |- | 8000 | max cpu: 2.0, avg cpu: 1.10 |- | 16000 | max cpu: 0.4, avg cpu: .20 |- | 24000 | max cpu: 19.6, avg cpu: 19.55 |- | 32000 | max cpu: 0.8, avg cpu: .40 |- | 48000 | max cpu: 2.0, avg cpu: 1.50 |} '''Notice: It includes file read/write time''' ~ ==一路PCM输入,一路PCM输出== {| class="wikitable" ! Sample rate ! CPU (%) |- | 8000,8000 | 4.3, 8.3 |- | 8000,16000 | 4.3, 8.5 |- | 8000,24000 | 4.3, 8.9 |- | 8000,48000 | 4.3, 3.6 |- | 16000,8000 | 5.0, 8.3 |- | 16000,16000 | 5.0, 8.6 |- | 16000,24000 | 5.0, 9.0 |- | 16000,48000 | 5.0, 4.0 |- | 24000,8000 | 6.0, 8.3 |- | 24000,16000 | 6.0, 8.6 |- | 24000,24000 | 6.0, 8.9 |- | 24000,48000 | 6.0, 4.0 |- | 48000,8000 | 3.0, 8.3 |- | 48000,16000 | 3.0, 8.6 |- | 48000,24000 | 3.0, 8.9 |- | 48000,48000 | 3.0, 3.6 |}

turn off ALSA soft mixer, run record and play at the same time
channel=2
'''date''': Thu Jun 20 10:27:30 CST 2013
'''OS:'''Linux arm 3.2.0-luna_itc+ #136 Wed Jun 5 19:56:32 CST 2013 armv7l armv7l armv7l GNU/Linux
'''time to measure:'''10s
'''Source:'''linphone/scripts/do_alsa_test.sh {| class=wikitable |- ! Sample rate ! CPU (%) |- | 8000 | max cpu: 0.2, avg cpu: .10 |- | 16000 | max cpu: 0.2, avg cpu: .10 |- | 24000 | max cpu: 19.9, avg cpu: 19.45 |- | 48000 | max cpu: 1.0, avg cpu: .50 |} '''Notice: It includes file read/write time'''

'''date''': Thu Jun 20 10:27:29 CST 2013
'''OS:'''Linux arm 3.2.0-luna_itc+ #136 Wed Jun 5 19:56:32 CST 2013 armv7l armv7l armv7l GNU/Linux
'''time to measure:'''10s
'''Source:'''linphone/scripts/do_alsa_output_test.sh {| class=wikitable |- ! Sample rate ! CPU (%) |- | 8000 | max cpu: 0, avg cpu: 0 |- | 16000 | max cpu: 0, avg cpu: 0 |- | 24000 | max cpu: 17.9, avg cpu: 17.25 |- | 48000 | max cpu: 2.0, avg cpu: 1.00 |} '''Notice: It includes file read/write time''' ==两路PCM输入== {| class="wikitable" ! Sample rate ! CPU (%) |- | 8000,8000 | 9.3 |- | 8000,16000 | 10.0 |- | 8000,24000 | 11.0 |- | 8000,48000 | 8.0 |- | 16000,16000 | 10.0 |- | 16000,24000 | 11.0 |- | 16000,48000 | 8.0 |- | 24000,24000 | 12.0 |- | 24000,48000 | 9.0 |- | 48000,48000 | 6.0 |} ==二路PCM输入,一路PCM输出== {| class="wikitable" ! Sample rate (2 in, 1 out) ! CPU (%) |- | 8000,8000,8000 | 8.6, 8.3 |- | 8000,8000,16000 | 8.6, 8.3 |- | 8000,8000,24000 | 8.6, 8.6 |- | 8000,8000,48000 | 8.6, 4.0 |- | 8000,16000,8000 | 9.0, 8.3 |- | 8000,16000,16000 | 9.0, 8.6 |- | 8000,16000,24000 | 9.0, 8.9 |- | 8000,16000,48000 | 9.0, 3.6 |- | 8000,24000,8000 | 10.2, 8.3 |- | 8000,24000,16000 | 10.2, 8.6 |- | 8000,24000,24000 | 10.2, 8.6 |- | 8000,24000,48000 | 10.2, 3.6 |- | 8000,48000,8000 | 7.3, 8.3 |- | 8000,48000,16000 | 7.3, 8.6 |- | 8000,48000,24000 | 7.3, 8.6 |- | 8000,48000,48000 | 7.3, 3.6 |- | 16000,16000,8000 | 10.6, 8.3 |- | 16000,16000,16000 | 10.6, 8.6 |- | 16000,16000,24000 | 10.6, 8.6 |- | 16000,16000,48000 | 10.6, 3.6 |- | 16000,24000,8000 | 11.0, 8.3 |- | 16000,24000,16000 | 11.0, 8.6 |- | 16000,24000,24000 | 11.0, 8.9 |- | 16000,24000,48000 | 11.0, 3.6 |- | 16000,48000,8000 | 8.0, 8.3 |- | 16000,48000,16000 | 8.0, 8.6 |- | 16000,48000,24000 | 8.0, 8.9 |- | 16000,48000,48000 | 8.0, 3.6 |- | 24000,24000,8000 | 12.0, 8.3 |- | 24000,24000,16000 | 12.0, 8.6 |- | 24000,24000,24000 | 12.0, 8.9 |- | 24000,24000,48000 | 12.0, 3.6 |- | 24000,48000,8000 | 9.0, 8.3 |- | 24000,48000,16000 | 9.0, 8.6 |- | 24000,48000,24000 | 9.0, 8.9 |- | 24000,48000,48000 | 9.0, 3.6 |- | 48000,48000,8000 | 6.0, 8.3 |- | 48000,48000,16000 | 6.0, 8.6 |- | 48000,48000,24000 | 6.0, 8.9 |- | 48000,48000,48000 | 6.0, 3.6 |} ==三路PCM输入== {| class="wikitable" ! Sample rate ! CPU (%) |- | 8000,8000,8000 | 12.6 |- | 8000,8000,16000 | 13.6 |- | 8000,8000,24000 | 14.2 |- | 8000,8000,48000 | 11.6 |- | 8000,16000,16000 | 14.3 |- | 8000,16000,24000 | 15.3 |- | 8000,16000,48000 | 12.3 |- | 8000,24000,24000 | 16.3 |- | 8000,24000,48000 | 12.6 |- | 8000,48000,48000 | 10.3 |- | 16000,16000,16000 | 15.0 |- | 16000,16000,24000 | 15.6 |- | 16000,16000,48000 | 13.0 |- | 16000,24000,24000 | 17.0 |- | 16000,24000,48000 | 14.1 |- | 16000,48000,48000 | 16.0 |- | 24000,24000,24000 | 18.0 |- | 24000,24000,48000 | 15.0 |- | 24000,48000,48000 | 12.0 |- | 48000,48000,48000 | 9.0 |} =avahi-daemon= 他可能不是一直在占用,可能需要长时间看,并且针对发布,需要测试在有发现这个service的时候的cpu. {| class="wikitable" ! 功能 ! CPU (%) |- |发现一个service的时候 | |- |发布一个service的时候 | |} =echo= 目前,针对opus,pcma codec,和echo的属性,我们只能支持8000,16000在不resampling的情况下,所以下面的测试主要针对这两个sample rate进行。 == auto script results == * [[ Arm red board ]] * [[ small development machine ]] =codec= ==opus== 属性相关: # sample rate: 8000/12000/16000/24000/48000. 我们只真多8000,16000和48000 # opus mode: OPUS_APPLICATION_VOIP/OPUS_APPLICATION_AUDIO/OPUS_APPLICATION_RESTRICTED_LOWDELAY # opus complexity: 1 - 10. currently, 2. 可以尝试使用1 # bandwidth: ## OPUS_BANDWIDTH_NARROWBAND 1101 /**< 4 kHz bandpass ## OPUS_BANDWIDTH_MEDIUMBAND 1102 /**< 6 kHz bandpass ## OPUS_BANDWIDTH_WIDEBAND 1103 /**< 8 kHz bandpas ## OPUS_BANDWIDTH_SUPERWIDEBAND 1104 /**<12 kHz bandpass ## OPUS_BANDWIDTH_FULLBAND 1105 /**<20 kHz bandpass # signal: ## OPUS_SIGNAL_VOICE ## OPUS_SIGNAL_MUSIC # bitrate: ## 8 ## 16 ## 32 ## 64 ## 128 ## 256 ## 512 ## 768 系统改用了自动测试script,生成的结果在这里 * [[virtual box linphone opus result]] * [[Arm machine with dev board(red)]] * [[xijing small dev machine ]] =background detection= 主要根据sample rate: 8000, 16000, 32000, 48000和多少路输入有关,目前只针对算法本身进行测量。 == test 1 on arm red board == 我们直接从pcm file里面读取pcm数据,然后做数字运算。cpu使用包括file operation.
'''date''': Wed Jun 19 18:46:12 CST 2013
'''OS:'''Linux arm 3.2.0-luna_itc+ #136 Wed Jun 5 19:56:32 CST 2013 armv7l armv7l armv7l GNU/Linux
'''time to measure:'''30s
'''Source:'''linphone/scripts/do_vol_detect_test.sh {| class=wikitable |- ! Sample rate ! CPU (%) |- | 8000 | max cpu: 2.2, avg cpu: .66 |- | 16000 | max cpu: 2.0, avg cpu: .73 |- | 32000 | max cpu: 0.6, avg cpu: .46 |- | 48000 | max cpu: 1.0, avg cpu: .56 |} '''Notice: It includes file read/write time''' =mpg123编译= 使用最新版的mpg123,开启NEON支持
export CFLAGS="-O2 -march=armv7-a -marm -mfpu=neon -funsafe-math-optimizations -pipe -ffast-math -fomit-frame-pointer -mtune=cortex-a8 -mfloat-abi=hard"
./configure --with-optimization=3 --with-cpu=neon --with-audio=alsa --with-default-audio=alsa
make && make install
开启软件混音时,测试后可使用接近100%的CPU 关闭软件混音时,测试中使用10% CPU =Ruby客户端优先级调整= 将Ruby客户端的优先级调整至19(最低)可稍提升linphone端的响应速度 =pcma and webrtc quality test=