rtp streaming
Hi,
I am suppose to use rtp to stream jpeg images from one computer to another.! The receiving end is already implememted for me( in JAVA ) and creates the rtp session, IT has as an message "Waiting for RTP data". I am having problems to send the jpeg image from the sender computer, it must be written in C++ so i attempted something like this:
#include <rtpsession.h>
#include <rtppacket.h>
#include <rtpudpv4transmitter.h>
#include <rtpipv4address.h>
#include <rtpsessionparams.h>
#include <rtperrors
RTPSession sess;
u_int16_t portbase,destport;
u_int32_t destip;
std::string ipstr;
int status,i,num;
portbase = 5002;
ipstr = "127.0.0.1";
destip = inet_addr(ipstr.c_str());
if (destip == INADDR_NONE)
{Std::cerr << "Bad IP address specified" << std::endl;
return -1;}
destip = ntohl(destip);
destport = 3002;
num = 1000;
RTPUDPv4TransmissionParams transparams;
RTPSessionParams sessparams;
sessparams.SetOwnTimestampUnit(1.0/10.0);
sessparams.SetAcceptOwnPackets(true);
transparams.SetPortbase(portbase);
status = sess.Create(sessparams,&transparams);
sess.BeginDataAccess();
// check incoming packets
if (sess.GotoFirstSourceWithData())
{
do
{
RTPPacket *pack;
while ((pack = sess.GetNextPacket()) != NULL)
{
// You can examine the data here
printf("Got packet !\n");
......
By running this code, nothing hapens to the end computer,,, the message remains "waiting for rtp data" I know i am not sending the image as expected.... However is this the right way of doing an rtp transfer.
maldini1010
|