rtpappsession.cpp

来自「利用RTP协议实现的客户端例程」· C++ 代码 · 共 41 行

CPP
41
字号

#pragma comment(lib, "jrtplib.lib")

#pragma comment(lib, "jthread.lib")

#pragma comment(lib, "WS2_32.lib")
#include "stdafx.h"
#include "rtpsession.h"
#include "rtpappsession.h"
#include "rtppacket.h"
#include "rtpudpv4transmitter.h"
#include "rtpipv4address.h"
#include "rtpsessionparams.h"
#include "rtperrors.h"
#ifndef WIN32
	#include <netinet/in.h>
	#include <arpa/inet.h>
#else
	#include <winsock2.h>
#endif // WIN32
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>

/*------------------------------------------*/
/* OnRTPPacket
/*------------------------------------------*/
void RTPAppSession::OnRTPPacket(RTPPacket *pack, const RTPTime &receivetime, const RTPAddress *senderaddress)
{
 //   printf("%d bytes of data received\n", pack->GetPayloadLength());
//	BYTE *pfBuffer;
//	BYTE *pBuffer;
//	int length = pack->GetPayloadLength();
//	printf("%d bytes of data received\n", pack->GetPayloadLength());
//	pfBuffer = (unsigned char*)pack->GetPayloadData();
//	pBuffer = new BYTE[length+1];
//	memcpy(pBuffer,pfBuffer,length);
//	pBuffer[length] = 0;
//	printf("%s",pBuffer);
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?