我想将 sip 调用添加到 my quiz game .所以,我通过这种方式构建了 SipHome 项目:
http://code.google.com/p/csipsimple/wiki/HowToBuild#Without_building_the_native_library
没关系。应用程序已编译并启动。 现在我想在我的应用程序中添加视频通话功能。结帐后(http://csipsimple.googlecode.com/svn/trunk/)我也有这个 SVN 依赖项:
CSipSimpleBranded
CSipSimpleCodecG729
CSipSimpleCodecPack
CSipSimpleVideoPlugin
我已将 PluginReceiver、CaptureReceiver、PluginReceiverFfmpeg 和 PluginReceiverVpx 从 CSipSimpleVideoPlugin 项目放到 SipHome 项目中。而且我已经将接收器的描述放入 SipHome list 项目:
<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 标志:
prefProviderWrapper.setPreferenceBooleanValue(SipConfigManager.USE_VIDEO, true);
当我调用 InCallActivity 时,我看到了 VideoButton,但按下它后我在 logcat 中看到了这个:
pjsua_vid.c。无法创建重新邀请:媒体行中没有 SDP 负载格式 (PJMEDIA_SDP_ENOFMT) [status=220032]
视频不显示。
谢谢。
最佳答案
您不需要将任何这些 Receiver 添加到主 list 中,它们仅用于检查插件是否已安装。
这是在没有 VideoPLugin 的情况下使用 CSipSimple 进行视频通话的指南 :D
修改 CSipSimpleVideoPlugin 构建脚本,使其将 libpj_video_android.so 复制到 CSipSimple libs 目录。 (或者每次构建时手动复制它)。
最后要包含您需要修改 PjsipService 的视频库,将第 273 行到第 307 行替换为类似内容;
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:
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 目录...)
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"
关于安卓。 cSip简单。如何将视频通话集成到项目中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22069018/
我正在学习如何使用Nokogiri,根据这段代码我遇到了一些问题:require'rubygems'require'mechanize'post_agent=WWW::Mechanize.newpost_page=post_agent.get('http://www.vbulletin.org/forum/showthread.php?t=230708')puts"\nabsolutepathwithtbodygivesnil"putspost_page.parser.xpath('/html/body/div/div/div/div/div/table/tbody/tr/td/div
总的来说,我对ruby还比较陌生,我正在为我正在创建的对象编写一些rspec测试用例。许多测试用例都非常基础,我只是想确保正确填充和返回值。我想知道是否有办法使用循环结构来执行此操作。不必为我要测试的每个方法都设置一个assertEquals。例如:describeitem,"TestingtheItem"doit"willhaveanullvaluetostart"doitem=Item.new#HereIcoulddotheitem.name.shouldbe_nil#thenIcoulddoitem.category.shouldbe_nilendend但我想要一些方法来使用
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。
给定这段代码defcreate@upgrades=User.update_all(["role=?","upgraded"],:id=>params[:upgrade])redirect_toadmin_upgrades_path,:notice=>"Successfullyupgradeduser."end我如何在该操作中实际验证它们是否已保存或未重定向到适当的页面和消息? 最佳答案 在Rails3中,update_all不返回任何有意义的信息,除了已更新的记录数(这可能取决于您的DBMS是否返回该信息)。http://ar.ru
我在我的项目目录中完成了compasscreate.和compassinitrails。几个问题:我已将我的.sass文件放在public/stylesheets中。这是放置它们的正确位置吗?当我运行compasswatch时,它不会自动编译这些.sass文件。我必须手动指定文件:compasswatchpublic/stylesheets/myfile.sass等。如何让它自动运行?文件ie.css、print.css和screen.css已放在stylesheets/compiled。如何在编译后不让它们重新出现的情况下删除它们?我自己编译的.sass文件编译成compiled/t
我正在寻找执行以下操作的正确语法(在Perl、Shell或Ruby中):#variabletoaccessthedatalinesappendedasafileEND_OF_SCRIPT_MARKERrawdatastartshereanditcontinues. 最佳答案 Perl用__DATA__做这个:#!/usr/bin/perlusestrict;usewarnings;while(){print;}__DATA__Texttoprintgoeshere 关于ruby-如何将脚
Rackup通过Rack的默认处理程序成功运行任何Rack应用程序。例如:classRackAppdefcall(environment)['200',{'Content-Type'=>'text/html'},["Helloworld"]]endendrunRackApp.new但是当最后一行更改为使用Rack的内置CGI处理程序时,rackup给出“NoMethodErrorat/undefinedmethod`call'fornil:NilClass”:Rack::Handler::CGI.runRackApp.newRack的其他内置处理程序也提出了同样的反对意见。例如Rack
在选择我想要运行操作的频率时,唯一的选项是“每天”、“每小时”和“每10分钟”。谢谢!我想为我的Rails3.1应用程序运行调度程序。 最佳答案 这不是一个优雅的解决方案,但您可以安排它每天运行,并在实际开始工作之前检查日期是否为当月的第一天。 关于ruby-如何每月在Heroku运行一次Scheduler插件?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/8692687/
我有一个对象has_many应呈现为xml的子对象。这不是问题。我的问题是我创建了一个Hash包含此数据,就像解析器需要它一样。但是rails自动将整个文件包含在.........我需要摆脱type="array"和我该如何处理?我没有在文档中找到任何内容。 最佳答案 我遇到了同样的问题;这是我的XML:我在用这个:entries.to_xml将散列数据转换为XML,但这会将条目的数据包装到中所以我修改了:entries.to_xml(root:"Contacts")但这仍然将转换后的XML包装在“联系人”中,将我的XML代码修改为
我有一大串格式化数据(例如JSON),我想使用Psychinruby同时保留格式转储到YAML。基本上,我希望JSON使用literalstyle出现在YAML中:---json:|{"page":1,"results":["item","another"],"total_pages":0}但是,当我使用YAML.dump时,它不使用文字样式。我得到这样的东西:---json:!"{\n\"page\":1,\n\"results\":[\n\"item\",\"another\"\n],\n\"total_pages\":0\n}\n"我如何告诉Psych以想要的样式转储标量?解