基于Android系统PJSIP库植入g729编码
- 前言
- 操作步骤
- 1.从仓库下载最新的 PJSIP。
- 3.将你的PJSIP项目中的所有文件作为给定补丁中的目录。
- 4.按照 pjproject-2.5.diff 的说明应用更改。
- 5.构建。
前言
有时候由于工作的需求,我们需要基于Android系统的PJSIP库支持G.729编码,原来的库在编译的时候并没有支持此编码,通话会听不见声音,下面我就介绍下如何构建支持G.729编码的PJSIP库,希望能够帮助到需要的小伙伴。
操作步骤
1.从仓库下载最新的 PJSIP。
下载地址:https://github.com/pjsip/pjproject/releases
2.下载补丁
下载地址:https://github.com/saravnandm/pjsip2.5-g729codec
3.将你的PJSIP项目中的所有文件作为给定补丁中的目录。
PJSip 2.5 + G729 codec
Steps to integrate g729 codec with the pjsip-2.5 library.
Download g729 patch here
Download pjsip-2.5 library here
Unzip both the downloaded zip files.
Set the permission of the ./pjsip-2.5 folder to 777, By executing the below command in terminal.
$chmod -R 777 /pjproject-2.5
Apply pjproject-2.5.diff patch first.
Copy the source and build files of g729 codec from "./pjsip2.5-g729codec/pjproject-2.5/" to the corresponding location of your pjproject-2.5. Make sure you are moving the files to the same location as the patch(pjproject-2.5). Create the dir structure if not exists.
NOTE
Patch is tested with pjsip2.5 only
g729 codec is not an open source library. So make sure you have the licence to use.
g729 codec source(pj.diff file) taken from linphone opensource project.
COMMON ERRORS
Error 1:
bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory
Fix:
open your script with vi or vim and enter in vi command mode (key ESC), then type this:
:set fileformat=unix
Press return and finally save it
:x! or :wq!
Error 2:
Undefined symbols for architecture armv7s:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [../bin/samples/arm-apple-darwin9/pjsua2_demo] Error 1
make[2]: *** [pjsua2_demo] Error 2
make[1]: *** [samples] Error 2
make: *** [all] Error 1
Fix:
$ make clean
$ rm pjsip-apps/build/output/pjsua2_sample-arm-apple-darwin9/pjsua2_demo.o
Error 3:
No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=armv7s, VALID_ARCHS=armv7)
Fix:
To solve this issue, just turn off the ONLY_ACTIVE_ARCH flag. Open the Build Settings->Build Active Architecutre Only flag-> change from YES to NO.
帮助文档地址