#include <RTPPayloadReceiver.h>
Protected Member Functions | |
| virtual | ~RTPPayloadReceiver () |
| virtual void | initialize () |
| virtual void | handleMessage (cMessage *msg) |
| virtual void | processPacket (RTPPacket *packet) |
| virtual void | openOutputFile (const char *fileName) |
| virtual void | closeOutputFile () |
Protected Attributes | |
| std::ofstream | _outputFileStream |
| std::ofstream | _outputLogLoss |
| int | _payloadType |
| cOutVector * | _packetArrival |
The class RTPPayloadReceiver acts as a base class for modules processing incoming rtp data packets.
Definition at line 36 of file RTPPayloadReceiver.h.
| RTPPayloadReceiver::~RTPPayloadReceiver | ( | ) | [protected, virtual] |
Destructor. Disposes the queue object and closes the output file.
Definition at line 32 of file RTPPayloadReceiver.cc.
{
closeOutputFile();
delete _packetArrival;
}
| void RTPPayloadReceiver::closeOutputFile | ( | ) | [protected, virtual] |
Closes the output file stream.
Definition at line 77 of file RTPPayloadReceiver.cc.
Referenced by ~RTPPayloadReceiver().
{
_outputFileStream.close();
_outputLogLoss.close();
}
| void RTPPayloadReceiver::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Method for handling incoming packets. At the moment only RTPInnerPackets containing an encapsulated RTPPacket are handled.
Definition at line 50 of file RTPPayloadReceiver.cc.
{
RTPInnerPacket *rinp = check_and_cast<RTPInnerPacket *>(msg);
if (rinp->getType() == RTPInnerPacket::RTP_INP_DATA_IN) {
RTPPacket *packet = check_and_cast<RTPPacket *>(rinp->decapsulate());
processPacket(packet);
delete rinp;
}
else {
error("RTPInnerPacket of wrong type received");
delete rinp;
}
}
| void RTPPayloadReceiver::initialize | ( | ) | [protected, virtual] |
Initializes the receiver module, opens the output file and creates a queue for incoming packets. Subclasses must overwrite it (but should call this method too)
Reimplemented in RTPAVProfilePayload32Receiver.
Definition at line 39 of file RTPPayloadReceiver.cc.
{
const char *fileName = par("outputFileName");
openOutputFile(fileName);
char logName[100];
sprintf (logName, "outputLogLoss%d.log", getId());
_outputLogLoss.open(logName);
_packetArrival = new cOutVector("packet arrival");
}
| void RTPPayloadReceiver::openOutputFile | ( | const char * | fileName | ) | [protected, virtual] |
This method is called by initialize and opens the output file stream. For most payload receivers this method works well, only when using a library for a payload type which provides an own open method it must
Definition at line 71 of file RTPPayloadReceiver.cc.
Referenced by initialize().
{
_outputFileStream.open(fileName);
}
| void RTPPayloadReceiver::processPacket | ( | RTPPacket * | packet | ) | [protected, virtual] |
Writes contents of this RTPPacket into the output file. Must be overwritten by subclasses.
Reimplemented in RTPAVProfilePayload32Receiver.
Definition at line 65 of file RTPPayloadReceiver.cc.
Referenced by handleMessage().
{
_packetArrival->record((double)(packet->getTimeStamp()));
}
std::ofstream RTPPayloadReceiver::_outputFileStream [protected] |
The output file stream.
Definition at line 64 of file RTPPayloadReceiver.h.
Referenced by closeOutputFile(), openOutputFile(), and RTPAVProfilePayload32Receiver::processPacket().
std::ofstream RTPPayloadReceiver::_outputLogLoss [protected] |
The output file stream.
Definition at line 69 of file RTPPayloadReceiver.h.
Referenced by closeOutputFile(), initialize(), and RTPAVProfilePayload32Receiver::processPacket().
cOutVector* RTPPayloadReceiver::_packetArrival [protected] |
An output vector used to store arrival of rtp data packets.
Definition at line 79 of file RTPPayloadReceiver.h.
Referenced by initialize(), processPacket(), and ~RTPPayloadReceiver().
int RTPPayloadReceiver::_payloadType [protected] |
The payload type this RTPPayloadReceiver module processes.
Definition at line 74 of file RTPPayloadReceiver.h.
Referenced by RTPAVProfilePayload32Receiver::initialize().
1.7.1