我已经通过这种方式建立SipHome项目:
I've built SipHome project by this way:
http://$c$c.google.com/p/csipsimple/wiki/HowToBuild#Without_building_the_native_library
这是确定的。应用编译和发布。现在,我想在我的应用程序添加视频通话功能。结帐后( HTTP://csipsimple.google$c$c.com/svn/trunk/ )我也有这个SVN依赖关系:
It's Ok. Application compiled and launched. Now I want to add video-call ability on my app. After checkout (http://csipsimple.googlecode.com/svn/trunk/) I have also this SVN dependencies:
CSipSimpleBranded
CSipSimpleCodecG729
CSipSimpleCodecPack
CSipSimpleVideoPlugin
我已经把类的 PluginReceiver,CaptureReceiver,PluginReceiverFfmpeg和PluginReceiverVpx 的距离 CSipSimpleVideoPlugin 项目的 SipHome 项目。而且我已经把接收器的描述为 SipHome 清单项目:
I've put classes PluginReceiver, CaptureReceiver, PluginReceiverFfmpeg and PluginReceiverVpx from CSipSimpleVideoPlugin project to SipHome project. And also I've put descriptions of receivers to SipHome manifest project:
<receiver android:name=".plugins.video.PluginReceiver" >
<intent-filter>
<action android:name="com.csipsimple.plugins.action.REGISTER_VIDEO" />
</intent-filter>
<meta-data
android:name="lib_name"
android:value="libpj_video_android.so" />
<!-- For now it does not matter in the future we should have one per device, codec, and converter (if needed) -->
<meta-data
android:name="init_factory"
android:value="pjmedia_webrtc_vid_render_factory" />
</receiver>
<!--
Receiver for video capture
<receiver android:name=".plugins.video.CaptureReceiver" >
<intent-filter>
<action android:name="com.csipsimple.plugins.action.REGISTER_CAPTURE_VIDEO" />
</intent-filter>
<meta-data
android:name="lib_name"
android:value="libpj_screen_capture_android.so" />
<meta-data
android:name="init_factory"
android:value="pjmedia_webrtc_vid_capture_factory" />
</receiver>
-->
<receiver android:name=".plugins.video.PluginReceiverFfmpeg" >
<intent-filter>
<action android:name="com.csipsimple.codecs.action.REGISTER_VIDEO_CODEC" />
</intent-filter>
<meta-data
android:name="lib_name"
android:value="libpj_video_android.so" />
<meta-data
android:name="init_factory"
android:value="pjmedia_codec_ffmpeg_vid_init" />
<meta-data
android:name="deinit_factory"
android:value="pjmedia_codec_ffmpeg_vid_deinit" />
</receiver>
<receiver android:name=".plugins.video.PluginReceiverVpx" >
<intent-filter>
<action android:name="com.csipsimple.codecs.action.REGISTER_VIDEO_CODEC" />
</intent-filter>
<meta-data
android:name="lib_name"
android:value="libpj_vpx.so" />
<meta-data
android:name="init_factory"
android:value="pjmedia_codec_vpx_init" />
<meta-data
android:name="deinit_factory"
android:value="pjmedia_codec_vpx_deinit" />
</receiver>
我已经设置USE_VIDEO = true标志登录后:
I've set USE_VIDEO=true flag after login:
prefProviderWrapper.setPreferenceBooleanValue(SipConfigManager.USE_VIDEO, true);
当我称之为 InCallActivity 我看到VideoButton,但经过preSS它我有这个在logcat中:
When I call in InCallActivity I see VideoButton, but after press it I have this in logcat:
* pjsua_vid.c .Unable创建再邀请:在媒体行(PJMEDIA_SDP_ENOFMT)无SDP有效载荷格式[状态= 220032 *
*pjsua_vid.c .Unable to create re-INVITE: No SDP payload format in the media line (PJMEDIA_SDP_ENOFMT) [status=220032]*
和视频不显示。
感谢。
您不需要任何这些接收器的添加到主清单,他们只用来检查是否安装该插件。
You don't need to add any of those Receivers to the main manifest, they are only used to check if the plugin is installed.
下面是一个使用指南CSipSimple用于视频通话,而不VideoPLugin:D
Here is a guide to using CSipSimple for video calls without the VideoPLugin :D
修改CSipSimpleVideoPlugin构建脚本,所以它复制libpj_video_android.so到CSipSimple libs目录。 (或者只是手工打造你每次都复制过来)。
Modify the CSipSimpleVideoPlugin build script so it copies the libpj_video_android.so to the CSipSimple libs directory. (Or just copy it over manually every time you build).
终于到包括视频库,您需要修改PjsipService,更换线路273至307的东西等;
Finally to include the video library you need to modify the PjsipService, replace lines 273 to 307 with something like;
String videoLibraryPath = NativeLibManager.getLibraryPath(mContext, "libpj_video_android.so");
if (!videoLibraryPath.isEmpty()) {
pj_str_t pjVideoFile = pjsua.pj_str_copy(videoLibraryPath);
// Render
dynamic_factory videoRenderFactory = csipSimpleConfig.getVideo_render_implementation();
videoRenderFactory.setInit_factory_name(pjsua.pj_str_copy("pjmedia_webrtc_vid_render_factory"));
videoRenderFactory.setShared_lib_path(pjVideoFile);
// Capture
dynamic_factory videoCaptureFactory = csipSimpleConfig.getVideo_capture_implementation();
videoCaptureFactory.setInit_factory_name(pjsua.pj_str_copy("pjmedia_webrtc_vid_capture_factory"));
videoCaptureFactory.setShared_lib_path(pjVideoFile);
// Video codecs
List<CodecInfo> availableCodecs = Lists.newArrayList(
new CodecInfo(NativeLibManager.getLibraryPath(mContext, "libpj_video_android.so"),
"pjmedia_codec_ffmpeg_vid_init", "pjmedia_codec_ffmpeg_vid_deinit"),
new CodecInfo(NativeLibManager.getLibraryPath(mContext, "libpj_vpx.so"),
"pjmedia_codec_vpx_init", "pjmedia_codec_vpx_deinit")
);
dynamic_factory[] cssCodecs = csipSimpleConfig.getExtra_vid_codecs();
dynamic_factory[] cssCodecsDestroy = csipSimpleConfig.getExtra_vid_codecs_destroy();
int videoCodecIndex = 0;
for (CodecInfo codecInfo : availableCodecs) {
if (!TextUtils.isEmpty(codecInfo.mLibraryPath)) {
// Create
cssCodecs[videoCodecIndex].setShared_lib_path(pjsua.pj_str_copy(codecInfo.mLibraryPath));
cssCodecs[videoCodecIndex].setInit_factory_name(pjsua.pj_str_copy(codecInfo.mFactoryInitFunction));
// Destroy
cssCodecsDestroy[videoCodecIndex].setShared_lib_path(pjsua.pj_str_copy(codecInfo.mLibraryPath));
cssCodecsDestroy[videoCodecIndex].setInit_factory_name(pjsua.pj_str_copy(codecInfo.mFactoryDeinitFunction));
}
videoCodecIndex++;
}
csipSimpleConfig.setExtra_vid_codecs_cnt(videoCodecIndex);
// Converter
dynamic_factory convertImpl = csipSimpleConfig.getVid_converter();
convertImpl.setShared_lib_path(pjVideoFile);
convertImpl.setInit_factory_name(pjsua.pj_str_copy("pjmedia_libswscale_converter_init"));
NativeLibManager:
NativeLibManager:
public static String getLibraryPath(Context context, String libraryName) {
String libraryPath = "";
PackageManager packageManager = context.getPackageManager();
PackageInfo packageInfo = null;
if (packageManager != null) {
try {
packageInfo = packageManager.getPackageInfo(context.getPackageName(), PackageManager.GET_SHARED_LIBRARY_FILES);
} catch (NameNotFoundException e) {
logger.error(e.getMessage());
}
}
File libFile = getLibFileFromPackage(packageInfo.applicationInfo, libraryName);
if (libFile != null) {
libraryPath = libFile.getAbsolutePath();
}
return libraryPath;
}
要修改,你需要看看dispatch_shared_libs.sh,线沿线的东西可能构建脚本; (其中sipstack是你csipsimple目录...)
To modify the build script you need to look at dispatch_shared_libs.sh, possible something along the lines of; (where "sipstack" is your csipsimple directory...)
move_generic_lib() {
echo -n "Moving $1.so to $2 project ... "
libs_files=$(ls libs/*/${1}.so 2> /dev/null | wc -l | sed -e 's/^[ \t]*//')
if [ "$libs_files" != "0" ]; then
for lib_folder in libs/*; do
if [ -d ${lib_folder} ]; then
mkdir -p ../${2}/${lib_folder};
mv ${lib_folder}/${1}.so ../${2}/${lib_folder}/${1}.so;
fi
done
echo "[OK]";
else
echo "[--] - plugin not built"
fi
}
move_lib() {
move_generic_lib libpj_${1}_codec CSipSimpleCodec${2}
}
move_lib "g7221" "Pack"
move_lib "codec2" "Pack"
move_lib "opus" "Pack"
move_lib "g726" "Pack"
move_lib "aac" "Pack"
move_lib "g729" "G729"
move_generic_lib "libcrypto" "sipstack"
move_generic_lib "libssl" "sipstack"
move_generic_lib "libpj_video_android" "sipstack"
move_generic_lib "libpj_screen_capture_android" "sipstack"
move_generic_lib "libpj_vpx" "sipstack"