Previous: Simple Transmitter, Up: ccRTP Overview
The required actions to receive an application data unit over RTP are listed in the following code snippet.
RTPSession s(InetHostAddress("127.0.0.1"),9000); // bind reception socket.
// Initialization.
cout << "Local SSRC identifier: " << s.getLocalSSRC() << endl;
s.setPayloadFormat(staticPayloadFormat(sptPCMU));
s.startRunning(); // start running the packet queue scheduler.
// Receive data.
const AppDataUnit* adu;
adu = s.getData(0); // get data with initial -0- timestamp.
if ( adu != NULL )
// do something with adu.
// adu->getType() provides the payload type.
// adu->getData() provides a const uint8 pointer to a data buffer.
// adu->getSize() provides the number of octets in the buffer.
// see other methods in the class AppDataUnit, such as getSource().
|