织梦CMS - 轻松建站从此开始!

罗索

最近研究libjingle的经验总结

落鹤生 发布于 2013-02-28 10:14 点击:次 
最近有一个语言项目方面的调研,需要评估一下libjingle,所以研究了半个月的libjingle,现在把经验总结如下(如有不对,请不吝赐教)
TAG:

最近有一个语言项目方面的调研,需要评估一下libjingle,所以研究了半个月的libjingle,现在把经验总结如下(如有不对,请不吝赐教):
1、libjingle库所带例子只支持rtpdump文件传递语音,不支持实时语音通话;
2、最新的几个版本的libjingle库去掉了GIPS voiceEngine的相关部分(可能是因为google收购了GIPS);
3、那么在windows下要支持实时语音通话,可以用linphone media engine,不过这个库是linux下的,所以迁移过来会费不少精力(不知有没有更好的方法):
要想在windows下用linphone media engine, 首先,按照README的说明添加如下代码:

Add the following lines into the libjingle.scons file.
    In the "talk.Library(env, name = "libjingle",..." section, you need to add:
      "HAVE_LINPHONE",
      "HAVE_SPEEX",
      "HAVE_ILBC",
    to the "cppdefines = [".
    add:
     "session/phone/linphonemediaengine.cc",
    to the "srcs = [ ..."

    add:     
      "third_party/mediastreamer/include",
      "third_party/ortp/include"
    to the "includedirs = [ ..."

    In the "talk.App(env, name = "call",..." section, you need to add:
      "ortp"
      "mediastreamer",
    to the "libs = [".
 
然后,
访问http://download.savannah.gnu.org/releases-noredirect/linphone/ortp/sources/下载ortp代码,
访问http://download.savannah.gnu.org/releases-noredirect/linphone/mediastreamer/下载mediastreamer,
并复制到libjingle库的third_party中,文件夹名需与上一步添加的路径名一致。

在windows下需要dll,所以还得编译两个库的dll,方法转自:
http://www.rosoo.net/a/201302/16518.html Mingw&msys的手动安装;
http://www.rosoo.net/a/201302/16519.html Mingw&msys环境中编译mediastreamer2和ortp。
接着,
copy .lib文件到talk\build\dbg\lib目录,
copy .dll到talk\build\dbg\staging目录。

然后,修改libjingle库的socketaddress.cc里的一个bug,参考http://www.rosoo.net/a/201302/16517.html
增加红色,解决域名转IP的问题:
bool SocketAddress::StringToIP(const std::string& hostname, uint32* ip) {
  in_addr addr;
  struct hostent *host;
  if (isalpha(hostname.c_str()[0]))
  {
            host = gethostbyname(hostname.c_str());
            if (host == NULL)
            {
                printf("gethostbyname error\n");
                return false;
            }
            memcpy(&addr.s_addr,   host->h_addr_list[0],host->h_length);
  }
  else if (inet_aton(hostname.c_str(), &addr) == 0)
  {  
      return false;
  }
  *ip = NetworkToHost32(addr.s_addr);
  return true;
}

按照README的方法,编译。

通过后运行call.exe,与Gtalk通话。

如果音质不好,断断续续,可以在mingw&msys下,
移除 winsnd2.c 添加winsnd3.c 重新编译ortp库。

还有就是关于receiving RTCP packet: Connection reset by peer. 参考:http://www.rosoo.net/a/201302/16515.html
这篇文章,也没有解决,不过不影响音质。
(FandyM)
本站文章除注明转载外,均为本站原创或编译欢迎任何形式的转载,但请务必注明出处,尊重他人劳动,同学习共成长。转载请注明:文章转载自:罗索实验室 [http://www.rosoo.net/a/201302/16516.html]
本文出处:博客园 作者:FandyM 原文
顶一下
(0)
0%
踩一下
(1)
100%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:点击我更换图片
栏目列表
将本文分享到微信
织梦二维码生成器
推荐内容