ubuntu下基于webrtc native的c++开发--库的使用

简介

        本文旨在掌握如何使用webrtc库来编译我们编写的webrtc相关代码。文中提供一份简单的测试代码,末尾附上我用到的webrtc静态库。本文的开发环境为ubuntu14.04。由于webrtc源码编译太复杂,文中用到静态库是google上下载别人编译的,版本未知。

代码

test1.cpp

#include <iostream>
#include <unistd.h>

#include "webrtc/api/peerconnectioninterface.h"
#include "webrtc/api/jsep.h"
#include "webrtc/api/datachannelinterface.h"
#include "webrtc/api/test/fakeconstraints.h"
#include "webrtc/pc/test/mockpeerconnectionobservers.h"
#include "webrtc/base/logging.h"
#include "webrtc/base/ssladapter.h"
#include "webrtc/base/sslstreamadapter.h"
#include "webrtc/base/thread.h"
#include "webrtc/p2p/base/common.h"
#include "webrtc/base/basictypes.h"
#include "webrtc/base/ssladapter.h"

//using rtc::scoped_ptr;
using rtc::scoped_refptr;
using webrtc::MediaStreamInterface;
using webrtc::CreatePeerConnectionFactory;
using webrtc::DataChannelInterface;
using webrtc::MockDataChannelObserver;
using webrtc::PeerConnectionFactoryInterface;
using webrtc::PeerConnectionInterface;
using webrtc::PeerConnectionObserver;
//using webrtc::PortAllocatorFactoryInterface;
//using webrtc::VideoSourceInterface;
using webrtc::VideoTrackInterface;

int main()
{
    fprintf(stderr,"Hello World\n");
    fprintf(stderr,"Initializing SSL\n");

    rtc::InitializeSSL(NULL);

    fprintf(stderr,"Initialized SSL\n");
    fprintf(stderr,"Closing SSL\n");

    rtc::CleanupSSL();

    fprintf(stderr,"Closed SSL\n");

    return 0;
}

编译

g++ -DWEBRTC_POSIX -std=gnu++11 -o simpleTest test1.cpp -I/opt/webrtc/include /opt/webrtc/lib/x64/Debug/libwebrtc_full.a -lpthread -lX11 -ldl

webrtc库下载

http://download.csdn.net/download/yingyemin/10174267

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值