WebRTC的native层语音处理
来源:互联网 发布:v字仇杀队黑页源码 编辑:程序博客网 时间:2024/06/05 20:52
跨平台WebRTC
WebRTC是google开源的一个免插件实时视频通信技术,其分为web开发和native开发;目前支持chrome,firefox,android,ios,opera,edge。是一个真正意义上的跨平台免插件实时视频通信技术。
如果是视频应用的开发一般是基于web的,需要HTML5,javascript,json,websocket等这些基本编程基础,此外还需要掌握一些网络通信协议。
如果是将webRTC移植到浏览器则需要native层的开发,当然也可以对native层代码进行二次开发。
native层的安装编译
http://blog.csdn.net/shichaog/article/details/50246155
native层语音算法测试程序
请务必完成上述连接中的内容
如果像使用native层的aec,aecm,agc,ns,vad等之类的语音处理模块,则在完成上述连接中的步骤后,即可找到一个可执行的测试文件audioproc,该而进行文件可以完成上述相关算法的测试。该文件的位置是:
webrtc-checkout/src/out/Debug$ ./audioproc
使用help选项该文件的输出如下:
gsc@gsc-250:~/webrtc-checkout/src/out/Debug$ ./audioproc --helpUsage: process_test [options] [-pb PROTOBUF_FILE] [-ir REVERSE_FILE] [-i PRIMARY_FILE] [-o OUT_FILE]process_test is a test application for AudioProcessing.When a protobuf debug file is available, specify it with -pb. Alternately,when -ir or -i is used, the specified files will be processed directly ina simulation mode. Otherwise the full set of legacy test files is expectedto be present in the working directory. OUT_FILE should be specifiedwithout extension to support both raw and wav output.OptionsGeneral configuration (only used for the simulation mode): -fs SAMPLE_RATE_HZ -ch CHANNELS_IN CHANNELS_OUT -rch REVERSE_CHANNELSComponent configuration:All components are disabled by default. Each block below begins with aflag to enable the component with default settings. The subsequent flagsin the block are used to provide configuration settings. -aec Echo cancellation --drift_compensation --no_drift_compensation --no_echo_metrics --no_delay_logging --aec_suppression_level LEVEL [0 - 2] --extended_filter --no_reported_delay -aecm Echo control mobile --aecm_echo_path_in_file FILE --aecm_echo_path_out_file FILE --no_comfort_noise --routing_mode MODE [0 - 4] -agc Gain control --analog --adaptive_digital --fixed_digital --target_level LEVEL --compression_gain GAIN --limiter --no_limiter -hpf High pass filter -ns Noise suppression --ns_low --ns_moderate --ns_high --ns_very_high --ns_prob_file FILE -vad Voice activity detection --vad_out_file FILE -expns Experimental noise suppression Level metrics (enabled by default) --no_level_metricsModifiers: --noasm Disable SSE optimization. --add_delay DELAY Add DELAY ms to input value. --delay DELAY Override input delay with DELAY ms. --perf Measure performance. --quiet Suppress text output. --no_progress Suppress progress. --raw_output Raw output instead of WAV file. --debug_file FILE Dump a debug recording.
为什么是该audioproc?
这可以从ninja这个编译器的编译过程可以看出来。
gsc@gsc-250:~/webrtc-checkout/src/out/Debug/obj/webrtc/modules$ pwd/home/gsc/webrtc-checkout/src/out/Debug/obj/webrtc/modulesgsc@gsc-250:~/webrtc-checkout/src/out/Debug/obj/webrtc/modules$ grep -nR "audioproc.process_test.o"audioproc.ninja:87:build obj/webrtc/modules/audio_processing/test/audioproc.process_test.o: $audioproc.ninja:97: obj/webrtc/modules/audio_processing/test/audioproc.process_test.o $
首先找到上面grep出现文件。打开该文件可见下面的内容:
87 build obj/webrtc/modules/audio_processing/test/audioproc.process_test.o: $ 88 cxx ../../webrtc/modules/audio_processing/test/process_test.cc || $ 89 obj/webrtc/modules/audioproc.compile_depends.stamp 90 91 ldflags = -Wl,-z,now -Wl,-z,relro -Wl,--fatal-warnings -Wl,-z,defs -pthread $ 92 -Wl,-z,noexecstack -fPIC -fuse-ld=gold $ 93 -B/home/gsc/webrtc-checkout/src/third_party/binutils/Linux_x64/Release/bin $ 94 -Wl,--disable-new-dtags -m64 -Wl,--detect-odr-violations -Wl,--icf=all 95 libs = -lrt -lm 96 build audioproc: link $ 97 obj/webrtc/modules/audio_processing/test/audioproc.process_test.o $ 98 obj/webrtc/modules/libaudio_processing.a $ 99 obj/webrtc/modules/libaudioproc_debug_proto.a $100 obj/webrtc/modules/libaudioproc_test_utils.a $101 obj/webrtc/modules/libaudioproc_protobuf_utils.a $102 obj/chromium/src/testing/libgtest.a $103 obj/webrtc/system_wrappers/libsystem_wrappers.a $104 obj/webrtc/test/libtest_support.a $105 obj/webrtc/base/librtc_base_approved.a obj/webrtc/libwebrtc_common.a $106 obj/webrtc/common_audio/libcommon_audio.a $107 obj/chromium/src/third_party/openmax_dl/dl/libopenmax_dl.a $108 obj/webrtc/common_audio/libcommon_audio_sse2.a $109 obj/webrtc/modules/libisac.a $110 obj/webrtc/modules/libaudio_decoder_interface.a $111 obj/webrtc/modules/libaudio_encoder_interface.a $112 obj/webrtc/modules/libisac_common.a $113 obj/chromium/src/third_party/protobuf/libprotobuf_lite.a $114 obj/webrtc/modules/libaudio_processing_sse2.a $115 obj/webrtc/system_wrappers/libfield_trial_default.a $116 obj/webrtc/system_wrappers/libmetrics_default.a $117 obj/chromium/src/testing/libgmock.a118 ld = $ldxx
第87行指示该.o文件编译来源于process_test.cc,再根据96,97行可知包含编译生成的文件audioproc.process_test.o 经过连接后会生成audioproc这个文件,这个文件的作用见前一节。这时再来看那个cc文件。
1141 } // namespace1142 } // namespace webrtc1143 1144 int main(int argc, char* argv[]) {1145 webrtc::void_main(argc, argv);1146 1147 // Optional, but removes memory leak noise from Valgrind.1148 google::protobuf::ShutdownProtobufLibrary();1149 return 0;1150 } 136 // void function for gtest. 137 void void_main(int argc, char* argv[]) { 138 if (argc > 1 && strcmp(argv[1], "--help") == 0) { 139 usage(); 140 return; 141 } 142 143 if (argc < 2) { 144 printf("Did you mean to run without arguments?\n"); 145 printf("Try `process_test --help' for more information.\n\n"); 146 } 147 148 rtc::scoped_ptr<AudioProcessing> apm(AudioProcessing::Create()); 149 ASSERT_TRUE(apm.get() != NULL); 150 151 const char* pb_filename = NULL; 152 const char* far_filename = NULL; 153 const char* near_filename = NULL; 154 std::string out_filename; 155 const char* vad_out_filename = NULL; 156 const char* ns_prob_filename = NULL; 157 const char* aecm_echo_path_in_filename = NULL; 158 const char* aecm_echo_path_out_filename = NULL; 159 160 int32_t sample_rate_hz = 16000; 161 162 int num_capture_input_channels = 1; 163 int num_capture_output_channels = 1;
文件的内容就不叙述了,该main函数就是整个测试的入口。
这里又引出来一个目录
gsc@gsc-250:~/webrtc-checkout/src/webrtc/modules/audio_processing/test$
audio_processing就是这个目录,而test就是测试文件所在的目录
总结如下:编译,测试python webrtc/build/gyp_webrtcninja -C out/Debug ./nonlinear_beamformer_test -i out2.wav -mic_positions "1.0 1.0 1.0 2.0 2.2 2.2 1.1 1.2 0" out.wav
0 1
- WebRTC的native层语音处理
- WebRTC的native层语音处理
- webrtc实现即时语音通讯开发小结(native)
- 打开 WebRTC 的日志(native api)
- WebRTC的模块处理机制
- WebRtc语音整体框架
- Android Native层异步消息处理框架
- 基于webrtc的gips 语音引擎库及测试程序
- WebRTC学习之四:最简单的语音聊天
- python的webrtc库实现语音端点检测
- WebRTC Native APIs
- WebRTC Native APIs[翻译]
- WebRTC Native APIs[翻译]
- Webrtc Intro - Native APIs
- WebRTC Native APIs
- WebRTC Native APIs
- WebRTC Native APIs
- Android NDK (学习笔记五) —— java层和native层进行字符串的交互处理
- sqoop把hive数据导入mysql时,map卡在100%
- 【南理oj】106 - 背包问题(贪心,经典)
- How to batch export PDFs to other filetypes in Adobe Acrobat
- Windows7取消文件夹中文件图标自动排列的方法
- python调用Shell脚本:os.system(cmd)或os.popen(cmd)
- WebRTC的native层语音处理
- Spring定时任务的几种实现--推荐spring task
- 搭建struts2环境
- 在linux下重启oracle数据库及监听器:
- Lucene Steming分词(包含单复数 snowball)
- Computer Vision Codes
- Strings And Characters Of Swift 2.1
- 存两个图论模板
- 邮件开发:Base64