#include <RTPAVProfilePayload32Receiver.h>
Protected Member Functions | |
virtual | ~RTPAVProfilePayload32Receiver () |
virtual void | initialize () |
virtual void | processPacket (RTPPacket *packet) |
Protected Attributes | |
cQueue * | _queue |
uint32 | _lowestAllowedTimeStamp |
uint32 | _highestSequenceNumber |
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.
Definition at line 39 of file RTPAVProfilePayload32Receiver.h.
RTPAVProfilePayload32Receiver::~RTPAVProfilePayload32Receiver | ( | ) | [protected, virtual] |
void RTPAVProfilePayload32Receiver::initialize | ( | ) | [protected, virtual] |
Calls the method of the superclass RTPPayloadReceiver and sets the payload type to 32.
Reimplemented from RTPPayloadReceiver.
Definition at line 42 of file RTPAVProfilePayload32Receiver.cc.
{ RTPPayloadReceiver::initialize(); _payloadType = 32; _queue = new cQueue("IncomingQueue", &compareRTPPacketsBySequenceNumber); _lowestAllowedTimeStamp = 0; _highestSequenceNumber = 0; }
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.
Definition at line 52 of file RTPAVProfilePayload32Receiver.cc.
{ // the first packet sets the lowest allowed time stamp if (_lowestAllowedTimeStamp == 0) { _lowestAllowedTimeStamp = rtpPacket->getTimeStamp(); _highestSequenceNumber = rtpPacket->getSequenceNumber(); _outputLogLoss <<"sequenceNumberBase"<< rtpPacket->getSequenceNumber() << endl; } else { if (rtpPacket->getSequenceNumber() > _highestSequenceNumber+1) { for (int i = _highestSequenceNumber+1; i< rtpPacket->getSequenceNumber(); i++ ) { //char line[100]; //sprintf(line, "%i", i); _outputLogLoss << i << endl; } } } if ((rtpPacket->getTimeStamp() < _lowestAllowedTimeStamp) || (rtpPacket->getSequenceNumber()<= _highestSequenceNumber)) { delete rtpPacket; } else { // is this packet from the next frame ? // this can happen when the marked packet has been // lost or arrives late bool nextTimeStamp = rtpPacket->getTimeStamp() > _lowestAllowedTimeStamp; // is this packet marked, which means that it's // the last packet of this frame bool marked = rtpPacket->getMarker(); // test if end of frame reached // check if we received the last (= marked) // packet of the frame or // we received a packet of the next frame _highestSequenceNumber = rtpPacket->getSequenceNumber(); if (nextTimeStamp || marked) { // a marked packet belongs to this frame if (marked && !nextTimeStamp) { _queue->insert(rtpPacket); } int pictureType = 0; int frameSize = 0; // the queue contains all packets for this frame // we have received while (!_queue->empty()) { RTPPacket *readPacket = (RTPPacket *)(_queue->pop()); RTPMpegPacket *mpegPacket = (RTPMpegPacket *)(readPacket->decapsulate()); if (pictureType == 0) pictureType = mpegPacket->getPictureType(); frameSize = frameSize + mpegPacket->getPayloadLength(); delete mpegPacket; delete readPacket; } // we start the next frame // set the allowed time stamp if (nextTimeStamp) { _lowestAllowedTimeStamp = rtpPacket->getTimeStamp(); _queue->insert(rtpPacket); } // we have calculated a frame if (frameSize > 0) { char line[100]; // what picture type is it char picture = ' '; if (pictureType == 1) picture = 'I'; else if (pictureType == 2) picture = 'P'; else if (pictureType == 3) picture = 'B'; else if (pictureType == 4) picture = 'D'; // create sim line sprintf(line, "%f %i %c-Frame", simTime().dbl(), frameSize * 8, picture); // and write it to the file _outputFileStream << line << endl; } } // we are not at the end of the frame // so just insert this packet else { _queue->insert(rtpPacket); } } }
uint32 RTPAVProfilePayload32Receiver::_highestSequenceNumber [protected] |
Definition at line 67 of file RTPAVProfilePayload32Receiver.h.
Referenced by initialize(), and processPacket().
uint32 RTPAVProfilePayload32Receiver::_lowestAllowedTimeStamp [protected] |
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.
Definition at line 66 of file RTPAVProfilePayload32Receiver.h.
Referenced by initialize(), and processPacket().
cQueue* RTPAVProfilePayload32Receiver::_queue [protected] |
A reordering queue for incoming packets.
Definition at line 59 of file RTPAVProfilePayload32Receiver.h.
Referenced by initialize(), processPacket(), and ~RTPAVProfilePayload32Receiver().