最近研究libjingle的经验总结

文章转载自:罗索实验室 [http://www.rosoo.net/a/201302/16516.html] 

最近有一个语言项目方面的调研,需要评估一下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)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值