|
INET Framework for OMNeT++/OMNEST
|
#include <VoipStreamReceiver.h>
◆ VoipStreamReceiver()
| inet::VoipStreamReceiver::VoipStreamReceiver |
( |
| ) |
|
|
inline |
◆ ~VoipStreamReceiver()
| inet::VoipStreamReceiver::~VoipStreamReceiver |
( |
| ) |
|
◆ checkSourceAndParameters()
| void inet::VoipStreamReceiver::checkSourceAndParameters |
( |
Packet * |
vp | ) |
|
|
protectedvirtual |
197 const auto& vp = pk->peekAtFront<VoipStreamPacket>();
200 L3Address srcAddr = l3Addresses->getSrcAddress();
201 L3Address destAddr = l3Addresses->getDestAddress();
208 throw cRuntimeError(
"Voice packet received from third party during a voice session (concurrent voice sessions not supported)");
215 throw cRuntimeError(
"Cannot change voice encoding parameters a during session");
Referenced by socketDataArrived().
◆ closeConnection()
| void inet::VoipStreamReceiver::closeConnection |
( |
| ) |
|
|
protectedvirtual |
◆ createConnection()
| void inet::VoipStreamReceiver::createConnection |
( |
Packet * |
vp | ) |
|
|
protectedvirtual |
◆ decodePacket()
| void inet::VoipStreamReceiver::decodePacket |
( |
Packet * |
vp | ) |
|
|
protectedvirtual |
231 const auto& vp = pk->popAtFront<VoipStreamPacket>();
232 uint16_t newSeqNo = vp->getSeqNo();
238 ASSERT(lostSamples > 0);
239 EV_INFO <<
"Lost " << lostSamples <<
" samples\n";
248 if (vp->getType() == VOICE) {
250 uint16_t len = vp->getDataLength();
251 auto bb = pk->peekDataAt<BytesChunk>(
b(0),
B(len));
252 auto buff = bb->getBytes();
256 else if (vp->getType() == SILENCE) {
258 int silenceSamples = vp->getSamplesPerPacket();
264 throw cRuntimeError(
"The received VoipStreamPacket has unknown type %d", vp->getType());
Referenced by socketDataArrived().
◆ finish()
| void inet::VoipStreamReceiver::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
269 EV_TRACE <<
"Sink finish()" << endl;
◆ handleMessage()
| void inet::VoipStreamReceiver::handleMessage |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
71 if (msg->arrivedOn(
"socketIn")) {
75 throw cRuntimeError(
"Unknown incoming gate: '%s'", msg->getArrivalGate()->getFullName());
◆ initialize()
| void inet::VoipStreamReceiver::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
39 cSimpleModule::initialize(stage);
43 recordScalar(
"hackForCreateResultsFolder", 0);
46 EV_TRACE <<
"VoIPSinkApp initialize()" << endl;
58 NodeStatus *nodeStatus = node ? check_and_cast_nullable<NodeStatus *>(node->getSubmodule(
"status")) : nullptr;
59 bool isOperational = (!nodeStatus) || nodeStatus->getState() ==
NodeStatus::UP;
61 throw cRuntimeError(
"This module doesn't support starting in node DOWN state");
◆ numInitStages()
| virtual int inet::VoipStreamReceiver::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ socketClosed()
| virtual void inet::VoipStreamReceiver::socketClosed |
( |
UdpSocket * |
socket | ) |
|
|
inlineoverrideprotectedvirtual |
◆ socketDataArrived()
| void inet::VoipStreamReceiver::socketDataArrived |
( |
UdpSocket * |
socket, |
|
|
Packet * |
packet |
|
) |
| |
|
overrideprotectedvirtual |
Notifies about data arrival, packet ownership is transferred to the callee.
Implements inet::UdpSocket::ICallback.
82 const auto& vp = pk->peekAtFront<VoipStreamPacket>();
96 PacketDropDetails details;
◆ socketErrorArrived()
| void inet::VoipStreamReceiver::socketErrorArrived |
( |
UdpSocket * |
socket, |
|
|
Indication * |
indication |
|
) |
| |
|
overrideprotectedvirtual |
Notifies about error indication arrival, indication ownership is transferred to the callee.
Implements inet::UdpSocket::ICallback.
106 EV_WARN <<
"Unknown message '" << indication->getName() <<
"', kind = " << indication->getKind() <<
", discarding it." << endl;
◆ connStateSignal
| simsignal_t inet::VoipStreamReceiver::connStateSignal = registerSignal("connState") |
|
staticprotected |
◆ curConn
◆ delaySignal
| simsignal_t inet::VoipStreamReceiver::delaySignal = registerSignal("delay") |
|
staticprotected |
◆ localPort
| int inet::VoipStreamReceiver::localPort = -1 |
|
protected |
◆ lostPacketsSignal
| simsignal_t inet::VoipStreamReceiver::lostPacketsSignal = registerSignal("lostPackets") |
|
staticprotected |
◆ lostSamplesSignal
| simsignal_t inet::VoipStreamReceiver::lostSamplesSignal = registerSignal("lostSamples") |
|
staticprotected |
◆ packetHasVoiceSignal
| simsignal_t inet::VoipStreamReceiver::packetHasVoiceSignal = registerSignal("packetHasVoice") |
|
staticprotected |
◆ playoutDelay
| simtime_t inet::VoipStreamReceiver::playoutDelay |
|
protected |
◆ resultFile
| const char* inet::VoipStreamReceiver::resultFile = nullptr |
|
protected |
◆ socket
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
int samplesPerPacket
Definition: VoipStreamReceiver.h:76
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:31
AVCodec * pCodecDec
Definition: VoipStreamReceiver.h:83
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
int transmitBitrate
Definition: VoipStreamReceiver.h:77
void writeLostSamples(int sampleCount)
Definition: VoipStreamReceiver.cc:115
const char * resultFile
Definition: VoipStreamReceiver.h:94
void openAudio(const char *fileName)
Definition: VoipStreamReceiver.cc:110
short sampleBits
Definition: VoipStreamReceiver.h:74
bool offline
Definition: VoipStreamReceiver.h:69
uint32_t ssrc
Definition: VoipStreamReceiver.h:72
int destPort
Definition: VoipStreamReceiver.h:88
uint32_t timeStamp
Definition: VoipStreamReceiver.h:71
void writeAudioFrame(uint8_t *buf, int len)
Definition: VoipStreamReceiver.cc:125
Connection curConn
Definition: VoipStreamReceiver.h:98
uint16_t seqNo
Definition: VoipStreamReceiver.h:70
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd L3AddressInd
Definition: IUdp-gates.txt:20
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: UdpSocket.cc:338
simsignal_t packetDroppedSignal
Definition: Simsignals.cc:85
virtual void closeConnection()
Definition: VoipStreamReceiver.cc:218
enum AVCodecID codec
Definition: VoipStreamReceiver.h:73
static simsignal_t delaySignal
Definition: VoipStreamReceiver.h:104
int sampleRate
Definition: VoipStreamReceiver.h:75
static simsignal_t lostPacketsSignal
Definition: VoipStreamReceiver.h:101
intscale< b, 1, 8 > B
Definition: Units.h:1168
AVCodecContext * decCtx
Definition: VoipStreamReceiver.h:82
virtual void checkSourceAndParameters(Packet *vp)
Definition: VoipStreamReceiver.cc:193
simsignal_t packetReceivedSignal
Definition: Simsignals.cc:97
simtime_t lastPacketFinish
Definition: VoipStreamReceiver.h:78
virtual void processMessage(cMessage *msg) override
Examines the message, takes ownership, and updates socket state.
Definition: UdpSocket.cc:343
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
simtime_t playoutDelay
Definition: VoipStreamReceiver.h:93
value< int64_t, units::b > b
Definition: Units.h:1241
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
UdpSocket socket
Definition: VoipStreamReceiver.h:96
virtual void createConnection(Packet *vp)
Definition: VoipStreamReceiver.cc:152
bool close()
Definition: AudioOutFile.cc:139
static simsignal_t connStateSignal
Definition: VoipStreamReceiver.h:103
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd L4PortInd
Definition: IUdp-gates.txt:20
INET_API InitStage INITSTAGE_APPLICATION_LAYER
Initialization of applications.
#define FINGERPRINT_ADD_EXTRA_DATA2(x, y)
Definition: INETDefs.h:85
@ UP
Definition: NodeStatus.h:28
L3Address destAddr
Definition: VoipStreamReceiver.h:87
#define FINGERPRINT_ADD_EXTRA_DATA(x)
Definition: INETDefs.h:84
@ CONGESTION
Definition: Simsignals_m.h:80
virtual void decodePacket(Packet *vp)
Definition: VoipStreamReceiver.cc:229
int localPort
Definition: VoipStreamReceiver.h:92
static simsignal_t packetHasVoiceSignal
Definition: VoipStreamReceiver.h:102
int srcPort
Definition: VoipStreamReceiver.h:86
AudioOutFile outFile
Definition: VoipStreamReceiver.h:84
static simsignal_t lostSamplesSignal
Definition: VoipStreamReceiver.h:100
L3Address srcAddr
Definition: VoipStreamReceiver.h:85