资源简介
最简 jrtplib 收发数据实例 详细内容见博客:http://blog.csdn.net/li_wen01/article/details/70045185
代码片段和文件信息
/*=============================================================================
* FileName: jrtplib_receive.cpp
* Desc: receive packet and print out the payloaddata
* Author: licaibiao
* LastChange: 2017-04-10
* =============================================================================*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using namespace jrtplib;
void checkerror(int rtperr)
{
if (rtperr < 0)
{
std::cout << “ERROR: “ << RTPGetErrorString(rtperr) << std::endl;
exit(-1);
}
}
int main(void)
{
RTPSession sess;
uint16_t portbase = 6664;
int status;
bool done = false;
RTPUDPv4TransmissionParams transparams;
RTPSessionParams sessparams;
sessparams.SetOwnTimestampUnit(1.0/10.0);
sessparams.SetAcceptOwnPackets(true);
transparams.SetPortbase(portbase);
status = sess.Create(sessparams&transparams);
checkerror(status);
sess.BeginDataAccess();
RTPTime delay(0.020);
RTPTime starttime = RTPTime::CurrentTime();
while (!done)
{
status = sess.Poll();
checkerror(status);
if (sess.GotoFirstSourceWithData())
{
do
{
RTPPacket *pack;
while ((pack = sess.GetNextPacket()) != NULL)
{
std::cout << pack->GetPayloadData() << std::endl;
sess.DeletePacket(pack);
}
} while (sess.GotoNextSourceWithData());
}
RTPTime::Wait(delay);
RTPTime t = RTPTime::CurrentTime();
t -= starttime;
if (t > RTPTime(60.0))
done = true;
}
sess.EndDataAccess();
delay = RTPTime(10.0);
sess.BYEDestroy(delay00);
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1849 2017-04-10 17:30 simplest_jrtplib\jrtplib_receive.cpp
文件 1881 2017-04-10 17:27 simplest_jrtplib\jrtplib_send.cpp
文件 152 2017-04-10 17:35 simplest_jrtplib\Makefile
目录 0 2017-04-11 09:13 simplest_jrtplib
----------- --------- ---------- ----- ----
3882 4
- 上一篇:YUV422转换为YUV420数据格式
- 下一篇:最简RTSP客户端程序
评论
共有 条评论