INET Framework for OMNeT++/OMNEST
inet::rtp::RTPPayloadReceiver Class Reference

The class RTPPayloadReceiver acts as a base class for modules processing incoming RTP data packets. More...

#include <RTPPayloadReceiver.h>

Inheritance diagram for inet::rtp::RTPPayloadReceiver:
inet::rtp::RTPAVProfilePayload32Receiver

Public Member Functions

virtual ~RTPPayloadReceiver ()
 Destructor. More...
 

Protected Member Functions

virtual void initialize () override
 Initializes the receiver module, opens the output file and creates a queue for incoming packets. More...
 
virtual void handleMessage (cMessage *msg) override
 Method for handling incoming packets. More...
 
virtual void processPacket (RTPPacket *packet)
 Writes contents of this RTPPacket into the output file. More...
 
virtual void openOutputFile (const char *fileName)
 This method is called by initialize and opens the output file stream. More...
 
virtual void closeOutputFile ()
 Closes the output file stream. More...
 

Protected Attributes

std::ofstream _outputFileStream
 The output file stream. More...
 
std::ofstream _outputLogLoss
 The output file stream. More...
 
int _payloadType
 The payload type this RTPPayloadReceiver module processes. More...
 

Static Protected Attributes

static simsignal_t _rcvdPkRtpTimestampSignal = registerSignal("rcvdPkRtpTimestamp")
 An output signal used to store arrival of rtp data packets. More...
 

Detailed Description

The class RTPPayloadReceiver acts as a base class for modules processing incoming RTP data packets.

Constructor & Destructor Documentation

inet::rtp::RTPPayloadReceiver::~RTPPayloadReceiver ( )
virtual

Destructor.

Disposes the queue object and closes the output file.

34 {
36 }
virtual void closeOutputFile()
Closes the output file stream.
Definition: RTPPayloadReceiver.cc:76

Member Function Documentation

void inet::rtp::RTPPayloadReceiver::closeOutputFile ( )
protectedvirtual

Closes the output file stream.

Referenced by ~RTPPayloadReceiver().

77 {
78  if (_outputFileStream.is_open())
79  _outputFileStream.close();
80  if (_outputLogLoss.is_open())
81  _outputLogLoss.close();
82 }
std::ofstream _outputLogLoss
The output file stream.
Definition: RTPPayloadReceiver.h:85
std::ofstream _outputFileStream
The output file stream.
Definition: RTPPayloadReceiver.h:80
void inet::rtp::RTPPayloadReceiver::handleMessage ( cMessage *  msg)
overrideprotectedvirtual

Method for handling incoming packets.

At the moment only RTPInnerPackets containing an encapsulated RTPPacket are handled.

53 {
54  RTPInnerPacket *rinp = check_and_cast<RTPInnerPacket *>(msg);
55  if (rinp->getType() == RTP_INP_DATA_IN) {
56  RTPPacket *packet = check_and_cast<RTPPacket *>(rinp->decapsulate());
57  processPacket(packet);
58  delete rinp;
59  }
60  else {
61  //delete rinp;
62  throw cRuntimeError("RTPInnerPacket of wrong type received");
63  }
64 }
virtual void processPacket(RTPPacket *packet)
Writes contents of this RTPPacket into the output file.
Definition: RTPPayloadReceiver.cc:66
Definition: RTPInnerPacket_m.h:89
void inet::rtp::RTPPayloadReceiver::initialize ( )
overrideprotectedvirtual

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 inet::rtp::RTPAVProfilePayload32Receiver.

Referenced by inet::rtp::RTPAVProfilePayload32Receiver::initialize().

39 {
40  const char *fileName = par("outputFileName");
41  const char *logFileName = par("outputLogFileName");
42  if (strcmp(fileName, ""))
43  openOutputFile(fileName);
44  if (strcmp(logFileName, ""))
45  {
46  char logName[200];
47  sprintf(logName, logFileName, getId());
48  _outputLogLoss.open(logName);
49  }
50 }
virtual void openOutputFile(const char *fileName)
This method is called by initialize and opens the output file stream.
Definition: RTPPayloadReceiver.cc:71
std::ofstream _outputLogLoss
The output file stream.
Definition: RTPPayloadReceiver.h:85
void inet::rtp::RTPPayloadReceiver::openOutputFile ( const char *  fileName)
protectedvirtual

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

Referenced by initialize().

72 {
73  _outputFileStream.open(fileName);
74 }
std::ofstream _outputFileStream
The output file stream.
Definition: RTPPayloadReceiver.h:80
void inet::rtp::RTPPayloadReceiver::processPacket ( RTPPacket packet)
protectedvirtual

Writes contents of this RTPPacket into the output file.

Must be overwritten by subclasses.

Reimplemented in inet::rtp::RTPAVProfilePayload32Receiver.

Referenced by handleMessage().

67 {
68  emit(_rcvdPkRtpTimestampSignal, (double)(packet->getTimeStamp()));
69 }
static simsignal_t _rcvdPkRtpTimestampSignal
An output signal used to store arrival of rtp data packets.
Definition: RTPPayloadReceiver.h:95

Member Data Documentation

std::ofstream inet::rtp::RTPPayloadReceiver::_outputFileStream
protected
std::ofstream inet::rtp::RTPPayloadReceiver::_outputLogLoss
protected
int inet::rtp::RTPPayloadReceiver::_payloadType
protected

The payload type this RTPPayloadReceiver module processes.

Referenced by inet::rtp::RTPAVProfilePayload32Receiver::initialize().

simsignal_t inet::rtp::RTPPayloadReceiver::_rcvdPkRtpTimestampSignal = registerSignal("rcvdPkRtpTimestamp")
staticprotected

An output signal used to store arrival of rtp data packets.

Referenced by processPacket().


The documentation for this class was generated from the following files: