|
INET Framework for OMNeT++/OMNEST
|
Stream VBR video streams to clients.
More...
#include <UdpVideoStreamServer.h>
Stream VBR video streams to clients.
Cooperates with UdpVideoStreamClient. UdpVideoStreamClient requests a stream and UdpVideoStreamServer starts streaming to them. Capable of handling streaming to multiple clients.
◆ VideoStreamMap
◆ UdpVideoStreamServer()
| inet::UdpVideoStreamServer::UdpVideoStreamServer |
( |
| ) |
|
|
inline |
◆ ~UdpVideoStreamServer()
| inet::UdpVideoStreamServer::~UdpVideoStreamServer |
( |
| ) |
|
|
virtual |
36 cancelAndDelete(elem.second.timer);
◆ clearStreams()
| void inet::UdpVideoStreamServer::clearStreams |
( |
| ) |
|
|
protectedvirtual |
◆ finish()
| void inet::UdpVideoStreamServer::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ handleCrashOperation()
◆ handleMessageWhenUp()
| void inet::UdpVideoStreamServer::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
◆ handleStartOperation()
◆ handleStopOperation()
◆ initialize()
| void inet::UdpVideoStreamServer::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ numInitStages()
| virtual int inet::UdpVideoStreamServer::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ processStreamRequest()
| void inet::UdpVideoStreamServer::processStreamRequest |
( |
Packet * |
msg | ) |
|
|
protectedvirtual |
92 cMessage *timer =
new cMessage(
"VideoStreamTmr");
93 VideoStreamData *d = &
streams[timer->getId()];
95 d->clientAddr = msg->getTag<
L3AddressInd>()->getSrcAddress();
96 d->clientPort = msg->getTag<
L4PortInd>()->getSrcPort();
97 d->videoSize = (*videoSize);
98 d->bytesLeft = d->videoSize;
100 ASSERT(d->videoSize > 0);
Referenced by socketDataArrived().
◆ sendStreamData()
| void inet::UdpVideoStreamServer::sendStreamData |
( |
cMessage * |
timer | ) |
|
|
protectedvirtual |
112 auto it =
streams.find(timer->getId());
114 throw cRuntimeError(
"Model error: Stream not found for timer");
116 VideoStreamData *d = &(it->second);
119 Packet *pkt =
new Packet(
"VideoStrmPk");
122 if (pktLen > d->bytesLeft)
123 pktLen = d->bytesLeft;
124 const auto& payload = makeShared<ByteCountChunk>(
B(pktLen));
125 payload->addTag<CreationTimeTag>()->setCreationTime(simTime());
126 pkt->insertAtBack(payload);
131 d->bytesLeft -= pktLen;
136 if (d->bytesLeft > 0) {
137 simtime_t interval = (*sendInterval);
138 scheduleAfter(interval, timer);
Referenced by handleMessageWhenUp(), and processStreamRequest().
◆ socketClosed()
| void inet::UdpVideoStreamServer::socketClosed |
( |
UdpSocket * |
socket | ) |
|
|
overrideprotectedvirtual |
◆ socketDataArrived()
| void inet::UdpVideoStreamServer::socketDataArrived |
( |
UdpSocket * |
socket, |
|
|
Packet * |
packet |
|
) |
| |
|
overrideprotectedvirtual |
◆ socketErrorArrived()
| void inet::UdpVideoStreamServer::socketErrorArrived |
( |
UdpSocket * |
socket, |
|
|
Indication * |
indication |
|
) |
| |
|
overrideprotectedvirtual |
Notifies about error indication arrival, indication ownership is transferred to the callee.
Implements inet::UdpSocket::ICallback.
79 EV_WARN <<
"Ignoring UDP error report " << indication->getName() << endl;
◆ localPort
| int inet::UdpVideoStreamServer::localPort = -1 |
|
protected |
◆ numPkSent
| unsigned long inet::UdpVideoStreamServer::numPkSent = 0 |
|
protected |
◆ numStreams
| unsigned int inet::UdpVideoStreamServer::numStreams = 0 |
|
protected |
◆ packetLen
| cPar* inet::UdpVideoStreamServer::packetLen = nullptr |
|
protected |
◆ reqStreamBytesSignal
| simsignal_t inet::UdpVideoStreamServer::reqStreamBytesSignal = registerSignal("reqStreamBytes") |
|
staticprotected |
◆ sendInterval
| cPar* inet::UdpVideoStreamServer::sendInterval = nullptr |
|
protected |
◆ socket
◆ streams
◆ videoSize
| cPar* inet::UdpVideoStreamServer::videoSize = nullptr |
|
protected |
The documentation for this class was generated from the following files:
void setOutputGate(cGate *toUdp)
Sets the gate on which to send to UDP.
Definition: UdpSocket.h:117
void setDscp(short dscp)
Sets the Ipv4 / Ipv6 dscp fields of packets sent from the UDP socket.
Definition: UdpSocket.cc:121
void setTimeToLive(int ttl)
Set the TTL (Ipv6: Hop Limit) field on sent packets.
Definition: UdpSocket.cc:112
virtual void sendStreamData(cMessage *timer)
Definition: UdpVideoStreamServer.cc:110
State operationalState
Definition: OperationalMixin.h:23
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
void sendTo(Packet *msg, L3Address destAddr, int destPort)
Sends a data packet to the given address and port.
Definition: UdpSocket.cc:69
VideoStreamMap streams
Definition: UdpVideoStreamServer.h:44
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
virtual void destroy() override
Notify the protocol that the owner of ISocket has destroyed the socket.
Definition: UdpSocket.cc:98
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd L3AddressInd
Definition: IUdp-gates.txt:20
simsignal_t packetSentSignal
Definition: Simsignals.cc:96
virtual void processStreamRequest(Packet *msg)
Definition: UdpVideoStreamServer.cc:89
static simsignal_t reqStreamBytesSignal
Definition: UdpVideoStreamServer.h:56
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: UdpSocket.cc:338
intscale< b, 1, 8 > B
Definition: Units.h:1168
unsigned int numStreams
Definition: UdpVideoStreamServer.h:54
cPar * videoSize
Definition: UdpVideoStreamServer.h:51
cPar * packetLen
Definition: UdpVideoStreamServer.h:50
virtual void processMessage(cMessage *msg) override
Examines the message, takes ownership, and updates socket state.
Definition: UdpSocket.cc:343
cPar * sendInterval
Definition: UdpVideoStreamServer.h:49
UdpSocket socket
Definition: UdpVideoStreamServer.h:45
int localPort
Definition: UdpVideoStreamServer.h:48
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
virtual void close() override
Unbinds the socket.
Definition: UdpSocket.cc:87
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
unsigned long numPkSent
Definition: UdpVideoStreamServer.h:55
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd L4PortInd
Definition: IUdp-gates.txt:20
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
virtual void clearStreams()
Definition: UdpVideoStreamServer.cc:146
void setTos(short tos)
Sets the Ipv4 Type of Service / Ipv6 Traffic Class fields of packets sent from the UDP socket.
Definition: UdpSocket.cc:130