Stream VBR video streams to clients.
More...
#include <UDPVideoStreamSvr.h>
Stream VBR video streams to clients.
Cooperates with UDPVideoStreamCli. UDPVideoStreamCli requests a stream and UDPVideoStreamSvr starts streaming to them. Capable of handling streaming to multiple clients.
inet::UDPVideoStreamSvr::UDPVideoStreamSvr |
( |
| ) |
|
|
inline |
inet::UDPVideoStreamSvr::~UDPVideoStreamSvr |
( |
| ) |
|
|
virtual |
40 cancelAndDelete(elem.second.timer);
VideoStreamMap streams
Definition: UDPVideoStreamSvr.h:55
void inet::UDPVideoStreamSvr::clearStreams |
( |
| ) |
|
|
protectedvirtual |
void inet::UDPVideoStreamSvr::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
void inet::UDPVideoStreamSvr::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Implements inet::OperationalBase.
67 if (msg->isSelfMessage()) {
76 EV_WARN <<
"Ignoring UDP error report\n";
80 throw cRuntimeError(
"Unrecognized message (%s)%s", msg->getClassName(), msg->getName());
Definition: UDPControlInfo_m.h:83
virtual void processStreamRequest(cMessage *msg)
Definition: UDPVideoStreamSvr.cc:84
virtual void sendStreamData(cMessage *timer)
Definition: UDPVideoStreamSvr.cc:107
Definition: UDPControlInfo_m.h:84
void inet::UDPVideoStreamSvr::handleNodeCrash |
( |
| ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
virtual void clearStreams()
Definition: UDPVideoStreamSvr.cc:141
bool inet::UDPVideoStreamSvr::handleNodeShutdown |
( |
IDoneCallback * |
doneCallback | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
virtual void clearStreams()
Definition: UDPVideoStreamSvr.cc:141
bool inet::UDPVideoStreamSvr::handleNodeStart |
( |
IDoneCallback * |
doneCallback | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
void setOutputGate(cGate *toUdp)
Sets the gate on which to send to UDP.
Definition: UDPSocket.h:110
UDPSocket socket
Definition: UDPVideoStreamSvr.h:56
void bind(int localPort)
Bind the socket to a local port number.
Definition: UDPSocket.cc:53
int localPort
Definition: UDPVideoStreamSvr.h:59
void inet::UDPVideoStreamSvr::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
cPar * packetLen
Definition: UDPVideoStreamSvr.h:61
cPar * sendInterval
Definition: UDPVideoStreamSvr.h:60
Local initializations.
Definition: InitStages.h:35
unsigned long numPkSent
Definition: UDPVideoStreamSvr.h:66
virtual void initialize(int stage) override
Definition: OperationalBase.cc:32
VideoStreamMap streams
Definition: UDPVideoStreamSvr.h:55
unsigned int numStreams
Definition: UDPVideoStreamSvr.h:65
cPar * videoSize
Definition: UDPVideoStreamSvr.h:62
int localPort
Definition: UDPVideoStreamSvr.h:59
virtual int inet::UDPVideoStreamSvr::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
Reimplemented from inet::OperationalBase.
The number of initialization stages.
Definition: InitStages.h:116
void inet::UDPVideoStreamSvr::processStreamRequest |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
Referenced by handleMessageWhenUp().
87 UDPDataIndication *ctrl = check_and_cast<UDPDataIndication *>(msg->getControlInfo());
89 cMessage *timer =
new cMessage(
"VideoStreamTmr");
90 VideoStreamData *d = &
streams[timer->getId()];
92 d->clientAddr = ctrl->getSrcAddr();
93 d->clientPort = ctrl->getSrcPort();
94 d->videoSize = (*videoSize);
95 d->bytesLeft = d->videoSize;
97 ASSERT(d->videoSize > 0);
static simsignal_t reqStreamBytesSignal
Definition: UDPVideoStreamSvr.h:67
virtual void sendStreamData(cMessage *timer)
Definition: UDPVideoStreamSvr.cc:107
VideoStreamMap streams
Definition: UDPVideoStreamSvr.h:55
unsigned int numStreams
Definition: UDPVideoStreamSvr.h:65
void inet::UDPVideoStreamSvr::sendStreamData |
( |
cMessage * |
timer | ) |
|
|
protectedvirtual |
Referenced by handleMessageWhenUp(), and processStreamRequest().
109 auto it =
streams.find(timer->getId());
111 throw cRuntimeError(
"Model error: Stream not found for timer");
113 VideoStreamData *d = &(it->second);
116 cPacket *pkt =
new cPacket(
"VideoStrmPk");
119 if (pktLen > d->bytesLeft)
120 pktLen = d->bytesLeft;
122 pkt->setByteLength(pktLen);
126 d->bytesLeft -= pktLen;
131 if (d->bytesLeft > 0) {
132 simtime_t interval = (*sendInterval);
133 scheduleAt(simTime() + interval, timer);
void sendTo(cPacket *msg, L3Address destAddr, int destPort, const SendOptions *options=nullptr)
Sends a data packet to the given address and port.
Definition: UDPSocket.cc:88
cPar * packetLen
Definition: UDPVideoStreamSvr.h:61
static simsignal_t sentPkSignal
Definition: UDPVideoStreamSvr.h:68
UDPSocket socket
Definition: UDPVideoStreamSvr.h:56
unsigned long numPkSent
Definition: UDPVideoStreamSvr.h:66
VideoStreamMap streams
Definition: UDPVideoStreamSvr.h:55
int inet::UDPVideoStreamSvr::localPort = -1 |
|
protected |
unsigned long inet::UDPVideoStreamSvr::numPkSent = 0 |
|
protected |
unsigned int inet::UDPVideoStreamSvr::numStreams = 0 |
|
protected |
cPar* inet::UDPVideoStreamSvr::packetLen = nullptr |
|
protected |
simsignal_t inet::UDPVideoStreamSvr::reqStreamBytesSignal = registerSignal("reqStreamBytes") |
|
staticprotected |
cPar* inet::UDPVideoStreamSvr::sendInterval = nullptr |
|
protected |
simsignal_t inet::UDPVideoStreamSvr::sentPkSignal = registerSignal("sentPk") |
|
staticprotected |
cPar* inet::UDPVideoStreamSvr::videoSize = nullptr |
|
protected |
The documentation for this class was generated from the following files: