概述
在Linux下用gcc编译pjsip并不是一件太困难的事情,但是如果要用Intel所提供的IPP开发包进行g729的流压缩处理,则可能会有一定问题。http://trac.pjsip.org/repos/wiki/Intel_IPP_Codecs提供了大致指导,但是它是基于IPP5的,而且对static linking的描述在IPP6下是行不通的,需要做一定的更改。
本人正好有一个项目:在linux下开发softphone和frontdesk,支持g729流压缩以提高语音通话质量。下面是staticlinking编译处理的步骤。
1,下载IPP和IPP Samples并且按照说明安装它们(这个步骤应该比较简单)。
2,
更改IPPSamples(_bin->binlibspeech.a->libusc.a)
mv./ipp-samples/speech-codecs/_bin./ipp-samples/speech-codecs/bin
mv ./ipp-samples/speech-codecs/bin/linux32_gcc4/lib/libspeech.a./ipp-samples/speech-codecs/bin/linux32_gcc4/lib/libusc.a
3,设置环境变量
export IPPROOT=/opt/intel/ipp/6.1.2.051/ia32
export IPPSAMPLES=/home/admin0/ipp-samples
4,修改pjsip的相应源代码
4.1)在pjlibincludepjconfig_site.h 头文件中添加IPP,g729支持:
#definePJMEDIA_HAS_INTEL_IPP
#definePJMEDIA_HAS_INTEL_IPP_CODEC_AMR
#definePJMEDIA_HAS_INTEL_IPP_CODEC_AMRWB
#definePJMEDIA_HAS_INTEL_IPP_CODEC_G729
#define PJMEDIA_HAS_INTEL_IPP_CODEC_G723_1
#definePJMEDIA_HAS_INTEL_IPP_CODEC_G726
#definePJMEDIA_HAS_INTEL_IPP_CODEC_G728
#define PJMEDIA_HAS_INTEL_IPP_CODEC_G722_1
#define PJMEDIA_AUTO_LINK_IPP_LIBS
以下步骤是基于项目实际情况的修改,你可能并不需要。
4.2)pjmediasrcpjmedia-codecipp_codec.c 在头文件 #include<usc.h>前添加
----------------
#if defined(_MSC_VER) &&PJMEDIA_AUTO_LINK_IPP_STATIC_LIBS
#include <ipp_w7.h>
#endif
---------------
"ipp_w7.h" 还有其他选项,根据操作系统,CPU类型选择不同的头文件
4.3)pjsip-appssrcpjsuapjsua_app.c
4.3.1) include ippcore.h to call initial static linking.
#include <ippcore.h>
4.3.2) Add
-------------
ippStaticInit();
-------------
before
4.3.3) set priority of g927
in app_init function.
------------------
define pj_str_t tmp;
-----------------
take out the original priority setting and replace by
--------------------
pjsua_codec_set_priority(pj_cstr(&tmp, "g729"),240);
pjsua_codec_set_priority(pj_cstr(&tmp, "gsm"),239);
pjsua_codec_set_priority(pj_cstr(&tmp, "pcma"),238);
pjsua_codec_set_priority(pj_cstr(&tmp, "pcmu"),237);
pjsua_codec_set_priority(pj_cstr(&tmp,"speex/8000"), 190);
pjsua_codec_set_priority(pj_cstr(&tmp, "ilbc"),189);
pjsua_codec_set_priority(pj_cstr(&tmp,"speex/16000"), 180);
pjsua_codec_set_priority(pj_cstr(&tmp,"speex/32000"), 0);
------------------
以上步骤是主要的pjsip修改。项目不同,修改的方式也不同
5,go to /pjsip-apps/build/Makefile
change $(CC_INC)../../pjmedia/include ->$(CC_INC)../../pjmedia/include
and add one line $(CC_INC)/opt/intel/ipp/6.1.2.051/ia32/include
6,cp user.mak.sample user.mak
# export CFLAGS += -Wno-unused-label -Werror
export LDFLAGS +=
7,./configure --disable-oss --enable-ipp --with-ipp=$IPPROOT--with-ipp-samples=$IPPSAMPLES
--disable-oss选项是为了解决Linux下音频Device的冲突。
注:我在项目中用的是java调用pjsua,javax.sound.sampledAPI遇到了设备占用的问题。这是JDK的一个bug,可能在JDK7中这个问题会得以解决。为了避开JDK的这个问题,改用了openJDK6.
8,go to config.status
change
------------
s,@ac_build_mak_vars@,
export IPP_CFLAGS=-I/opt/intel/ipp/6.1.2.051/ia32/include-I/home/admin0/ipp-samples/speech-codecs/core/usc/include
export IPP_LDFLAGS=-L/opt/intel/ipp/6.1.2.051/ia32/sharedlib-L/home/admin0/ipp-samples/speech-codecs/bin/linux32_gcc4/lib
-------------
to
---------
s,@ac_build_mak_vars@,
export IPP_CFLAGS=-I/opt/intel/ipp/6.1.2.051/ia32/include-I/home/admin0/ipp-samples/speech-codecs/core/usc/include
export IPP_LDFLAGS=-L/opt/intel/ipp/6.1.2.051/ia32/lib-L/home/admin0/ipp-samples/speech-codecs/bin/linux32_gcc4/lib
--------
9, ./config.status
10,build.mak
change
export IPP_LIBS=-lusc -lippsc -lipps -lippsr -lippcore-lguide
to
export IPP_LIBS=-lusc -lippscemerged -lippscmerged -lippsremerged-lippsrmerged -lippsemerged -lippsmerged -lippcore
注:IPP6的选项和5是不同的
11,make dep
12, make
通过以上步骤,可以在 pjsip-apps/bin的目录下看到经过static linking的可执行文件pjsua.
最后
以上就是凶狠小甜瓜为你收集整理的集成IPP的pjsip在Linux下的static linking编译的全部内容,希望文章能够帮你解决集成IPP的pjsip在Linux下的static linking编译所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复