RTPAVProfilePayload32Receiver Class Reference

#include <RTPAVProfilePayload32Receiver.h>

Inheritance diagram for RTPAVProfilePayload32Receiver:

RTPPayloadReceiver

List of all members.


Detailed Description

This module is used to receive getData(mpeg video) of payload 32 for rtp endsystems working under the rtp av profile. It expects data in the format defined in rfc 2250. Its corresponding sender module is RTPAVProfilePayload32Sender. This implementation doesn't work with real mpeg data, so it doesn't write an mpeg file but a sim file, which can be played with a modified mpeg player.

Protected Member Functions

virtual ~RTPAVProfilePayload32Receiver ()
virtual void initialize ()
virtual void processPacket (RTPPacket *packet)

Protected Attributes

cQueue * _queue
uint32 _lowestAllowedTimeStamp
uint32 _highestSequenceNumber

Constructor & Destructor Documentation

RTPAVProfilePayload32Receiver::~RTPAVProfilePayload32Receiver (  )  [protected, virtual]

Destructor.

00036                                                               {
00037     delete _queue;
00038 };


Member Function Documentation

void RTPAVProfilePayload32Receiver::initialize (  )  [protected, virtual]

Calls the method of the superclass RTPPayloadReceiver and sets the payload type to 32.

Reimplemented from RTPPayloadReceiver.

00041                                                {
00042     RTPPayloadReceiver::initialize();
00043     _payloadType = 32;
00044     _queue = new cQueue("IncomingQueue", &compareRTPPacketsBySequenceNumber);
00045     _lowestAllowedTimeStamp = 0;
00046     _highestSequenceNumber = 0;
00047 };

void RTPAVProfilePayload32Receiver::processPacket ( RTPPacket packet  )  [protected, virtual]

Writes information about received frames into the output file. The only error correction provided is reordering packets of one frame if needed.

Reimplemented from RTPPayloadReceiver.

00051 {
00052     // the first packet sets the lowest allowed time stamp
00053     if (_lowestAllowedTimeStamp == 0) {
00054         _lowestAllowedTimeStamp = rtpPacket->getTimeStamp();
00055         _highestSequenceNumber = rtpPacket->getSequenceNumber();
00056         _outputLogLoss <<"sequenceNumberBase"<< rtpPacket->getSequenceNumber() << endl;
00057     }
00058     else
00059     {
00060         if (rtpPacket->getSequenceNumber() > _highestSequenceNumber+1)
00061         {
00062             for (int i = _highestSequenceNumber+1; i< rtpPacket->getSequenceNumber(); i++ )
00063             {
00064                 //char line[100];
00065                 //sprintf(line, "%i", i);
00066                 _outputLogLoss << i << endl;
00067             }
00068          };
00069          }
00070 
00071     if ((rtpPacket->getTimeStamp() < _lowestAllowedTimeStamp) || (rtpPacket->getSequenceNumber()<= _highestSequenceNumber)) {
00072         delete rtpPacket;
00073     }
00074     else {
00075         // is this packet from the next frame ?
00076         // this can happen when the marked packet has been
00077         // lost or arrives late
00078         bool nextTimeStamp = rtpPacket->getTimeStamp() > _lowestAllowedTimeStamp;
00079 
00080         // is this packet marked, which means that it's
00081         // the last packet of this frame
00082         bool marked = rtpPacket->getMarker();
00083 
00084         // test if end of frame reached
00085 
00086         // check if we received the last (= marked)
00087         // packet of the frame or
00088         // we received a packet of the next frame
00089         _highestSequenceNumber = rtpPacket->getSequenceNumber();
00090 
00091         if (nextTimeStamp || marked) {
00092 
00093             // a marked packet belongs to this frame
00094             if (marked && !nextTimeStamp) {
00095                 _queue->insert(rtpPacket);
00096             }
00097 
00098             int pictureType = 0;
00099             int frameSize = 0;
00100 
00101             // the queue contains all packets for this frame
00102             // we have received
00103             while (!_queue->empty()) {
00104                 RTPPacket *readPacket = (RTPPacket *)(_queue->pop());
00105                 RTPMpegPacket *mpegPacket = (RTPMpegPacket *)(readPacket->decapsulate());
00106                 if (pictureType == 0)
00107                     pictureType = mpegPacket->getPictureType();
00108                 frameSize = frameSize + mpegPacket->getPayloadLength();
00109 
00110                 delete mpegPacket;
00111                 delete readPacket;
00112             };
00113 
00114             // we start the next frame
00115             // set the allowed time stamp
00116             if (nextTimeStamp) {
00117                 _lowestAllowedTimeStamp = rtpPacket->getTimeStamp();
00118                 _queue->insert(rtpPacket);
00119             };
00120 
00121             // we have calculated a frame
00122             if (frameSize > 0) {
00123                 char line[100];
00124                 // what picture type is it
00125                 char picture = ' ';
00126                 if (pictureType == 1)
00127                     picture = 'I';
00128                 else if (pictureType == 2)
00129                     picture = 'P';
00130                 else if (pictureType == 3)
00131                     picture = 'B';
00132                 else if (pictureType == 4)
00133                     picture = 'D';
00134 
00135                 // create sim line
00136                 sprintf(line, "%f %i %c-Frame", simTime(), frameSize * 8, picture);
00137                 // and write it to the file
00138                 _outputFileStream << line << endl;
00139             }
00140         }
00141         // we are not at the end of the frame
00142         // so just insert this packet
00143         else {
00144             _queue->insert(rtpPacket);
00145         }
00146     }
00147 };


Member Data Documentation

A reordering queue for incoming packets.

Referenced by initialize(), processPacket(), and ~RTPAVProfilePayload32Receiver().

Stores the lowest allowed time stamp of rtp data packets. The value is used to throw away packets from mpeg frames already stored in the data file.

Referenced by initialize(), and processPacket().

Referenced by initialize(), and processPacket().


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

Generated on Fri Mar 20 18:51:20 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5