Classified ads
|
Network-related logic for handling voice channel between nodes. More...
#include <voicecallengine.h>
Classes | |
class | VoiceCallExtension |
Public Slots | |
void | nodeConnectionAttemptStatus (Connection::ConnectionState aStatus, const Hash aHashOfAttemptedNode) |
void | audioFrameEncoded (quint32 aCallId, quint32 aSeqNo, const QByteArray &aEncodedVoice, Hash aForNode) |
void | frameReady (quint32 aCallId, quint32 aSeqNo, const QByteArray &aRawAudio, Hash aForNode) |
void | processCallData () |
void | setInputLevel (float aInputLevel) |
void | setOutputLevel (float aOutputLevel) |
Signals | |
void | error (QTcpSocket::SocketError socketError) |
void | callStateChanged (quint32 aCallId, VoiceCallEngine::CallState aState) |
void | startProcessCallData () |
void | inputLevel (float aInputLevel) |
void | outputLevel (float aOutputLevel) |
Public Member Functions | |
VoiceCallEngine (MController &aController, Model &aModel) | |
~VoiceCallEngine () | |
virtual void | installObserver (MCallStatusObserver *aObserver) |
virtual void | removeObserver (MCallStatusObserver *aObserver) |
virtual void | insertCallData (quint32 aCallId, quint32 aSeqNo, PayloadType aPayloadType, const QByteArray &aPayload, Hash &aSendingNode) |
virtual void | insertCallStatusData (const VoiceCall &aCallStatus, const Hash &aSendingNode) |
virtual QList< quint32 > | onGoingCalls () const |
virtual CallState | callStatus (quint32 aCallId) const |
virtual void | closeCall (quint32 aCallId) |
virtual void | acceptCall (quint32 aCallId) |
QString | excuseForCallCreation (const Hash &aOperator, const Hash &aNode=KNullHash) const |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
Private Member Functions | |
bool | setupNewOutgoingCall (VoiceCallExtension &aCall) |
bool | setupNewIncomingCall (VoiceCallExtension &aCall) |
void | sendCallStatusUpdates (quint32 aCallId, CallState aState) |
Hash | callPeerFingerPrint (const VoiceCall &aCall) const |
void | removeCallFromArray (VoiceCallExtension &aCall) |
void | addCallToArray (VoiceCallExtension &aCall) |
void | sendCallStatusUpdateToRemote (const VoiceCall &aCall, bool aDoSign=true) |
QString | callStatusString (const VoiceCallExtension &aCall) const |
bool | checkForNodeValidity (const VoiceCall &aCallStatus, const Hash &aSendingNode) const |
bool | setupLocalAudioCapture (VoiceCallExtension &aCall) |
bool | setupAudioOutput (VoiceCallExtension &aCall) |
bool | addCallToMixer (const VoiceCallExtension &aCall) |
bool | removeCallFromMixer (const VoiceCallExtension &aCall) |
Private Attributes | |
MController & | iController |
Model & | iModel |
QList< MCallStatusObserver * > | iCallObservers |
QList< VoiceCallExtension > | iOnGoingCalls |
AudioMixer * | iMixer |
AudioSource * | iAudioSource |
AudioPlayer * | iAudioPlayer |
QList< QPair< VoiceCall, Hash > > | iCallDataPendingProcessing |
Additional Inherited Members | |
Public Types inherited from MVoiceCallEngine | |
enum | CallState { Initial, Incoming, Open, Closing, Closed, Error, NoCall } |
enum | PayloadType { Audio =1, Control =2 } |
Network-related logic for handling voice channel between nodes.
"Voice call" is a bit different from persisted content handling: It happens between, nodes, not between operators. It has realtime- requirements and does not directly store anything on data storage.
This class contains networking-related logic and audio stream handling. Separate UI must be built on top of this. This inherits QAbstractTableModel to provide easy access for UI-components to calldata.
For actual call data handling see AudioMixer and other classes in the same directory.
VoiceCallEngine::VoiceCallEngine | ( | MController & | aController, |
Model & | aModel | ||
) |
Constructor
aController | application controller. not owned |
aModel | persistent storage. |
VoiceCallEngine::~VoiceCallEngine | ( | ) |
Destructor
|
virtual |
Method called as result UI-action. This accepts an incoming call.
Implements MVoiceCallEngine.
|
private |
|
private |
method for conditioanally adding voice streams to mixer module
|
slot |
Voice data captured from microphone and mixed with other possible streams is delivered to over-the-network recipients using this slot. In practice input into this method comes from audio encoder and this method is responsible for distributing the encoded audio frame to all call participants.
Method that returns the call peer node address: either destination or originating.
|
signal |
Signal for communicating call state changes
|
virtual |
method for getting status of a call
Implements MVoiceCallEngine.
|
private |
|
private |
Method that checks that aCallStatus can be from aSendingNode
|
virtual |
Method called as result UI-action. This terminates ongoing call.
Implements MVoiceCallEngine.
|
virtual |
re-implemented from QAbstractTableModel
|
virtual |
re-implemented from QAbstractListModel
|
signal |
QString VoiceCallEngine::excuseForCallCreation | ( | const Hash & | aOperator, |
const Hash & | aNode = KNullHash |
||
) | const |
Method for querying for an excuse why a call can (not) be made to particular operator or node
aOperator | identifier of operator whose call-creation status is queried. |
aNode | node of the operator, if known |
|
slot |
This slot is called when mixer when audio frame is ready to be sent. In practice audio mixer emits a singal to this slot once for each node that is connected to same call.
aCallId | is identifier of the call where this frame belongs to |
aSeqNo | sequence number of packets in stream |
aRawAudio | is non-encoded audio frame, as array of floats |
aForNode | specifies the node that will receive this particular audio frame. |
|
virtual |
re-implemented from QAbstractListModel
|
signal |
signal for communicating audio input (microphone) level
|
virtual |
Method for reception of call real-time data. This is called from network-parts that receive the data packet over some protocol and then feed it here to make it heard.
Called from protocol parser. Parser does not lock datamodel prior to call.
aCallId | is call ( stream ) identifier |
aSeqNo | is sequence number of rt data in stream |
aPayloadType | tells what kind of payload it is |
aPayload | actual bytes |
aSendingNode | node what sent the data package |
Implements MVoiceCallEngine.
|
virtual |
Method for reception of call status data. This is called from network-parts that receive the data packet over some protocol and then feed it here to move the call engine to some direction
Note that the call data inserted via this method may be call that this node originally made and at the receiving end this same method is used to inject the new incoming call into the engine.
Another note to take into consideration is the handling if node-data in aCallStatus. Call status is passed as reference so the ownership of the call data object instance is not tranferred into voice call engine. Inside call data there are 2 pointers to originating and destination nodes. Ownership of content of those pointers is not tranferred either. VoiceCallEngine will make local copies (if it sees that necessary) of the node-pointer contents and caller of this method will be responsible for deleting the node-objects in call-data if they were created only for the purpose of making a voice call.
DataModel.lock() should be called before calling this method
aCallStatus | contains information about a call. |
aSendingNode | is fingerprint of the node where the DTO is coming from. May be local node also. |
Implements MVoiceCallEngine.
|
virtual |
Method for installing call state observer
Implements MVoiceCallEngine.
|
slot |
This signal is about node-connection status and closed connections will be communicated using this same signal:
|
virtual |
method for getting identifiers of ongoing calls
Implements MVoiceCallEngine.
|
signal |
signal for communicating audio output (spekar) level
|
slot |
slot that is called for call status data processing. reason for this slot is that we want to process status data in UI thread because we create QObjects there and want to delete them also in same thread, this easier to handle in Qt this way.
In practice, the call data is put into iCallDataPendingProcessing and this slot is called in queued manner
|
private |
|
private |
method for conditioanally removing voice streams from mixer module
|
virtual |
Method for removing call state observer
Implements MVoiceCallEngine.
|
virtual |
Methods inherited from QAbstractTableModel: rowCount
|
private |
call status gossip method
|
private |
|
slot |
slot for setting audio input (microphone) level
|
slot |
slot for setting audio output (spekar) level
|
private |
Method for setting up local audio output. If call has VoiceCall::iOkToProceed set to false, then output will be torn down.
|
private |
Method for setting up local audio capture. If call has VoiceCall::iOkToProceed set to false, then capture will be torn down.
|
private |
Called when a new call is initiated from remote node
|
private |
Called when a new call is initiated from local node
|
signal |
signal for starting processCallData
|
private |
|
private |
|
private |
|
private |
application controller
|
private |
Exactly one audio mixer: has list of streams to mix. Idea is that list of mixed streams does not need to be same as list of ongoing calls. At least the local microphone input is additional stream
|
private |
persistent storage
|
private |
data about calls currently handled