35 #ifdef CCXX_NAMESPACES
73 InetHostAddress local_ip;
74 local_ip =
"127.0.0.1";
79 cerr <<
": IP address is not correct!" << endl;
83 cout << local_ip.getHostname() <<
84 " is going to talk to perself through " <<
85 local_ip <<
"..." << endl;
91 const int A_BASE = 22222;
92 const int B_BASE = 33334;
94 duplexA =
new RTPDuplex(local_ip,A_BASE,B_BASE);
96 duplexB =
new RTPDuplex(local_ip,B_BASE,A_BASE);
99 duplexA->setSchedulingTimeout(90000);
100 duplexA->setExpireTimeout(2500000);
101 if( duplexA->connect(local_ip,B_BASE) < 0 )
102 cerr <<
"Duplex A could not connect.";
105 duplexB->setSchedulingTimeout(160000);
106 duplexB->setExpireTimeout(3500000);
107 if( duplexB->connect(local_ip,A_BASE) < 0 )
108 cerr <<
"Duplex B could not connect.";
113 if( duplexA->RTPDataQueue::isActive() )
114 cout <<
"The queue A is active." << endl;
116 cerr <<
"The queue A is not active." << endl;
118 if( duplexB->RTPDataQueue::isActive() )
119 cout <<
"The queue B is active." << endl;
121 cerr <<
"The queue B is not active." << endl;
124 cout <<
"Transmitting..." << endl;
128 unsigned char helloA[] =
"Hello, brave gnu world from A!";
129 unsigned char helloB[] =
"Hello, brave gnu world from B!";
133 time_t receiving_time;
137 duplexA->setPayloadFormat(pf);
138 duplexB->setPayloadFormat(pf);
142 for(
int i = 0 ; true ; i++ ) {
149 sending_time = time(NULL);
150 duplexA->putData(2*(i)*90000,helloA,
151 strlen((
char *)helloA));
153 strftime(tmstring,30,
"%X",localtime(&sending_time));
154 cout <<
"A: sending message at " << tmstring <<
"..."
158 receiving_time = time(NULL);
160 duplexA->
getData(duplexA->getFirstTimestamp());
163 strftime(tmstring,30,
"%X",localtime(&receiving_time));
164 cout <<
"A:[receiving at " << tmstring <<
"]: " <<
171 sending_time = time(NULL);
172 duplexB->putData(2*(i)*90000,helloB,
173 strlen((
char *)helloB));
175 strftime(tmstring,30,
"%X",localtime(&sending_time));
176 cout <<
"B: sending message at " << tmstring <<
"..."
180 receiving_time = time(NULL);
182 duplexB->
getData(duplexB->getFirstTimestamp());
185 strftime(tmstring,30,
"%X",localtime(&receiving_time));
186 cout <<
"B:[receiving at " << tmstring <<
"]: " <<
196 int main(
int argc,
char *argv[])
201 cout <<
"This is rtpduphello, a very simple test program for ccRTP."
202 << endl <<
"Strike [Enter] when you are fed up." << endl;
209 cout << endl <<
"That's all" << endl;
int main(int argc, char *argv[])
Interface (envelope) to data received over RTP packets.
A peer associated RTP socket pair for physically connected peer hosts.
const uint8 *const getData() const
Get data as it is received in RTP packets (i.e.
MPEG 2 Transport stream (RFCs 1890, 2250)
This is the class that will do almost everything.