您的位置:首页 > 编程语言 > C语言/C++

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

2017-12-26 16:32 1261 查看

简介

        本文旨在掌握如何使用wenrtc库来编译我们编写的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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  webrtc