mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed VOIP plugin to work with v0.6
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7288 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
ca6b463a31
commit
160e04fe9a
@ -133,11 +133,8 @@ RsAutoUpdatePage *VOIPPlugin::qt_transfers_tab() const
|
||||
|
||||
RsPQIService *VOIPPlugin::rs_pqi_service() const
|
||||
{
|
||||
if(mVoip == NULL)
|
||||
{
|
||||
mVoip = new p3VoRS(mPlugInHandler,mPluginNotifier) ; // , 3600 * 24 * 30 * 6); // 6 Months
|
||||
rsVoip = mVoip ;
|
||||
}
|
||||
if(mVoip == NULL)
|
||||
rsVoip = mVoip = new p3VoRS(mPlugInHandler,mPluginNotifier) ; // , 3600 * 24 * 30 * 6); // 6 Months
|
||||
|
||||
return mVoip ;
|
||||
}
|
||||
|
@ -22,19 +22,20 @@ void PluginGUIHandler::ReceivedVoipAccept(const QString& /*peer_id*/)
|
||||
std::cerr << "****** Plugin GUI handler: received VoipAccept!" << std::endl;
|
||||
}
|
||||
|
||||
void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
|
||||
void PluginGUIHandler::ReceivedVoipData(const QString& qpeer_id)
|
||||
{
|
||||
std::cerr << "****** Plugin GUI handler: received VoipData!" << std::endl;
|
||||
|
||||
RsPeerId peer_id(qpeer_id.toStdString()) ;
|
||||
std::vector<RsVoipDataChunk> chunks ;
|
||||
|
||||
if(!rsVoip->getIncomingData(peer_id.toStdString(),chunks))
|
||||
if(!rsVoip->getIncomingData(peer_id,chunks))
|
||||
{
|
||||
std::cerr << "PluginGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
|
||||
return ;
|
||||
}
|
||||
|
||||
ChatDialog *di = ChatDialog::getExistingChat(peer_id.toStdString()) ;
|
||||
ChatDialog *di = ChatDialog::getExistingChat(peer_id) ;
|
||||
if (di) {
|
||||
ChatWidget *cw = di->getChatWidget();
|
||||
if (cw) {
|
||||
@ -47,7 +48,7 @@ void PluginGUIHandler::ReceivedVoipData(const QString& peer_id)
|
||||
for (unsigned int i = 0; i < chunks.size(); ++i) {
|
||||
for (unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++){
|
||||
QByteArray qb(reinterpret_cast<const char *>(chunks[chunkIndex].data),chunks[chunkIndex].size);
|
||||
acwh->addAudioData(peer_id,&qb);
|
||||
acwh->addAudioData(QString::fromStdString(peer_id.toStdString()),&qb);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -1,18 +1,18 @@
|
||||
#include "PluginNotifier.h"
|
||||
|
||||
void PluginNotifier::notifyReceivedVoipInvite(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipInvite(const RsPeerId& peer_id)
|
||||
{
|
||||
emit voipInvitationReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipInvitationReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
void PluginNotifier::notifyReceivedVoipData(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipData(const RsPeerId &peer_id)
|
||||
{
|
||||
emit voipDataReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipDataReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
void PluginNotifier::notifyReceivedVoipAccept(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipAccept(const RsPeerId& peer_id)
|
||||
{
|
||||
emit voipAcceptReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipAcceptReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
void PluginNotifier::notifyReceivedVoipHangUp(const std::string& peer_id)
|
||||
void PluginNotifier::notifyReceivedVoipHangUp(const RsPeerId &peer_id)
|
||||
{
|
||||
emit voipHangUpReceived(QString::fromStdString(peer_id)) ;
|
||||
emit voipHangUpReceived(QString::fromStdString(peer_id.toStdString())) ;
|
||||
}
|
||||
|
@ -6,16 +6,17 @@
|
||||
//
|
||||
|
||||
#include <QObject>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
class PluginNotifier: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void notifyReceivedVoipData(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipInvite(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipHangUp(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipAccept(const std::string& peer_id) ;
|
||||
void notifyReceivedVoipData(const RsPeerId& peer_id) ;
|
||||
void notifyReceivedVoipInvite(const RsPeerId &peer_id) ;
|
||||
void notifyReceivedVoipHangUp(const RsPeerId& peer_id) ;
|
||||
void notifyReceivedVoipAccept(const RsPeerId &peer_id) ;
|
||||
|
||||
signals:
|
||||
void voipInvitationReceived(const QString&) ; // signal emitted when an invitation has been received
|
||||
|
@ -56,7 +56,7 @@ double convertRttToPixels(double maxRTT, double rtt)
|
||||
class VoipLagPlot
|
||||
{
|
||||
public:
|
||||
VoipLagPlot(const std::map<std::string, std::list<RsVoipPongResult> > &info,
|
||||
VoipLagPlot(const std::map<RsPeerId, std::list<RsVoipPongResult> > &info,
|
||||
double refTS, double maxRTT, double minTS, double maxTS)
|
||||
:mInfo(info), mRefTS(refTS), mMaxRTT(maxRTT), mMinTS(minTS), mMaxTS(maxTS) {}
|
||||
|
||||
@ -96,7 +96,7 @@ class VoipLagPlot
|
||||
}
|
||||
|
||||
/* draw a different line for each peer */
|
||||
std::map<std::string, std::list<RsVoipPongResult> >::const_iterator mit;
|
||||
std::map<RsPeerId, std::list<RsVoipPongResult> >::const_iterator mit;
|
||||
int i = 0;
|
||||
int nLines = mInfo.size();
|
||||
for(mit = mInfo.begin(); mit != mInfo.end(); mit++, i++)
|
||||
@ -161,14 +161,14 @@ class VoipLagPlot
|
||||
|
||||
painter->setPen(QColor::fromRgb(0,0,0)) ;
|
||||
painter->drawRect(ox,oy,cellx,celly) ;
|
||||
painter->drawText(ox + cellx + 4,oy + celly / 2,VoipStatistics::getPeerName(mit->first));
|
||||
painter->drawText(ox + cellx + 4,oy + celly / 2,VoipStatistics::getPeerName(mit->first));
|
||||
|
||||
oy += 2 * celly;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
const std::map<std::string, std::list<RsVoipPongResult> > &mInfo;
|
||||
const std::map<RsPeerId, std::list<RsVoipPongResult> > &mInfo;
|
||||
double mRefTS;
|
||||
double mMaxRTT;
|
||||
double mMinTS;
|
||||
@ -230,15 +230,15 @@ void VoipStatistics::processSettings(bool bLoad)
|
||||
|
||||
void VoipStatistics::updateDisplay()
|
||||
{
|
||||
std::map<std::string, std::list<RsVoipPongResult> > info;
|
||||
std::map<RsPeerId, std::list<RsVoipPongResult> > info;
|
||||
|
||||
if (!rsVoip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<std::string> idList;
|
||||
std::list<std::string>::iterator it;
|
||||
std::list<RsPeerId> idList;
|
||||
std::list<RsPeerId>::iterator it;
|
||||
|
||||
rsPeers->getOnlineList(idList);
|
||||
|
||||
@ -284,11 +284,11 @@ void VoipStatistics::updateDisplay()
|
||||
_tst_CW->update();
|
||||
}
|
||||
|
||||
QString VoipStatistics::getPeerName(const std::string& peer_id)
|
||||
QString VoipStatistics::getPeerName(const RsPeerId& peer_id)
|
||||
{
|
||||
static std::map<std::string, QString> names ;
|
||||
static std::map<RsPeerId, QString> names ;
|
||||
|
||||
std::map<std::string,QString>::const_iterator it = names.find(peer_id) ;
|
||||
std::map<RsPeerId,QString>::const_iterator it = names.find(peer_id) ;
|
||||
|
||||
if( it != names.end())
|
||||
return it->second ;
|
||||
@ -309,7 +309,7 @@ VoipStatisticsWidget::VoipStatisticsWidget(QWidget *parent)
|
||||
maxHeight = 0 ;
|
||||
}
|
||||
|
||||
void VoipStatisticsWidget::updateVoipStatistics(const std::map<std::string, std::list<RsVoipPongResult> >& info,
|
||||
void VoipStatisticsWidget::updateVoipStatistics(const std::map<RsPeerId, std::list<RsVoipPongResult> >& info,
|
||||
double maxRTT, double minTS, double maxTS)
|
||||
{
|
||||
//static const int cellx = 6 ;
|
||||
|
@ -37,7 +37,7 @@ class VoipStatistics: public RsAutoUpdatePage, public Ui::VoipStatistics
|
||||
~VoipStatistics();
|
||||
|
||||
// Cache for peer names.
|
||||
static QString getPeerName(const std::string& peer_id) ;
|
||||
static QString getPeerName(const RsPeerId &peer_id) ;
|
||||
|
||||
private:
|
||||
|
||||
@ -60,7 +60,7 @@ class VoipStatisticsWidget: public QWidget
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
||||
|
||||
void updateVoipStatistics(const std::map<std::string, std::list<RsVoipPongResult> >& info,
|
||||
void updateVoipStatistics(const std::map<RsPeerId, std::list<RsVoipPongResult> >& info,
|
||||
double maxRTT, double minTS, double maxTS);
|
||||
|
||||
private:
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <retroshare/rstypes.h>
|
||||
|
||||
class RsVoip ;
|
||||
extern RsVoip *rsVoip;
|
||||
@ -36,17 +37,17 @@ struct RsVoipDataChunk
|
||||
class RsVoip
|
||||
{
|
||||
public:
|
||||
virtual int sendVoipHangUpCall(const std::string& peer_id) = 0;
|
||||
virtual int sendVoipRinging(const std::string& peer_id) = 0;
|
||||
virtual int sendVoipAcceptCall(const std::string& peer_id) = 0;
|
||||
virtual int sendVoipHangUpCall(const RsPeerId& peer_id) = 0;
|
||||
virtual int sendVoipRinging(const RsPeerId& peer_id) = 0;
|
||||
virtual int sendVoipAcceptCall(const RsPeerId& peer_id) = 0;
|
||||
|
||||
// Sending data. The client keeps the memory ownership and must delete it after calling this.
|
||||
virtual int sendVoipData(const std::string& peer_id,const RsVoipDataChunk& chunk) = 0;
|
||||
virtual int sendVoipData(const RsPeerId& peer_id,const RsVoipDataChunk& chunk) = 0;
|
||||
|
||||
// The server fill in the data and gives up memory ownership. The client must delete the memory
|
||||
// in each chunk once it has been used.
|
||||
//
|
||||
virtual bool getIncomingData(const std::string& peer_id,std::vector<RsVoipDataChunk>& chunks) = 0;
|
||||
virtual bool getIncomingData(const RsPeerId& peer_id,std::vector<RsVoipDataChunk>& chunks) = 0;
|
||||
|
||||
typedef enum { AudioTransmitContinous = 0, AudioTransmitVAD = 1, AudioTransmitPushToTalk = 2 } enumAudioTransmit ;
|
||||
|
||||
@ -67,7 +68,7 @@ class RsVoip
|
||||
virtual bool getVoipEchoCancel() const = 0 ;
|
||||
virtual void setVoipEchoCancel(bool) = 0 ;
|
||||
|
||||
virtual uint32_t getPongResults(std::string id, int n, std::list<RsVoipPongResult> &results) = 0;
|
||||
virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsVoipPongResult> &results) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -78,33 +78,6 @@ RsVoip *rsVoip = NULL;
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#if 0
|
||||
class RsVorsLagItem: public RsItem
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t seqno;
|
||||
uint32_t type; // REQUEST, RESPONSE.
|
||||
double peerTs;
|
||||
|
||||
};
|
||||
|
||||
class RsVorsDatatem: public RsItem
|
||||
{
|
||||
public:
|
||||
|
||||
uint32_t seqno;
|
||||
uint32_t encoding;
|
||||
uint32_t audiolength; // in 44.1 kbs samples.
|
||||
uint32_t datalength;
|
||||
void *data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WINDOWS_SYS
|
||||
#include <time.h>
|
||||
#include <sys/timeb.h>
|
||||
@ -143,7 +116,7 @@ static double convert64bitsToTs(uint64_t bits)
|
||||
}
|
||||
|
||||
p3VoRS::p3VoRS(RsPluginHandler *handler,PluginNotifier *notifier)
|
||||
: RsPQIService(RS_SERVICE_TYPE_VOIP_PLUGIN,CONFIG_TYPE_VOIP_PLUGIN,0,handler), mVorsMtx("p3VoRS"), mLinkMgr(handler->getLinkMgr()) , mNotify(notifier)
|
||||
: RsPQIService(RS_SERVICE_TYPE_VOIP_PLUGIN,0,handler), mVorsMtx("p3VoRS"), mServiceControl(handler->getServiceControl()) , mNotify(notifier)
|
||||
{
|
||||
addSerialType(new RsVoipSerialiser());
|
||||
|
||||
@ -160,6 +133,21 @@ p3VoRS::p3VoRS(RsPluginHandler *handler,PluginNotifier *notifier)
|
||||
_echo_cancel = true;
|
||||
|
||||
}
|
||||
RsServiceInfo p3VoRS::getServiceInfo()
|
||||
{
|
||||
const std::string TURTLE_APP_NAME = "VOIP";
|
||||
const uint16_t TURTLE_APP_MAJOR_VERSION = 1;
|
||||
const uint16_t TURTLE_APP_MINOR_VERSION = 0;
|
||||
const uint16_t TURTLE_MIN_MAJOR_VERSION = 1;
|
||||
const uint16_t TURTLE_MIN_MINOR_VERSION = 0;
|
||||
|
||||
return RsServiceInfo(RS_SERVICE_TYPE_VOIP_PLUGIN,
|
||||
TURTLE_APP_NAME,
|
||||
TURTLE_APP_MAJOR_VERSION,
|
||||
TURTLE_APP_MINOR_VERSION,
|
||||
TURTLE_MIN_MAJOR_VERSION,
|
||||
TURTLE_MIN_MINOR_VERSION);
|
||||
}
|
||||
|
||||
int p3VoRS::tick()
|
||||
{
|
||||
@ -196,7 +184,7 @@ int p3VoRS::sendPackets()
|
||||
}
|
||||
return true ;
|
||||
}
|
||||
int p3VoRS::sendVoipHangUpCall(const std::string& peer_id)
|
||||
int p3VoRS::sendVoipHangUpCall(const RsPeerId &peer_id)
|
||||
{
|
||||
RsVoipProtocolItem *item = new RsVoipProtocolItem ;
|
||||
|
||||
@ -208,7 +196,7 @@ int p3VoRS::sendVoipHangUpCall(const std::string& peer_id)
|
||||
|
||||
return true ;
|
||||
}
|
||||
int p3VoRS::sendVoipAcceptCall(const std::string& peer_id)
|
||||
int p3VoRS::sendVoipAcceptCall(const RsPeerId& peer_id)
|
||||
{
|
||||
RsVoipProtocolItem *item = new RsVoipProtocolItem ;
|
||||
|
||||
@ -220,7 +208,7 @@ int p3VoRS::sendVoipAcceptCall(const std::string& peer_id)
|
||||
|
||||
return true ;
|
||||
}
|
||||
int p3VoRS::sendVoipRinging(const std::string& peer_id)
|
||||
int p3VoRS::sendVoipRinging(const RsPeerId &peer_id)
|
||||
{
|
||||
RsVoipProtocolItem *item = new RsVoipProtocolItem ;
|
||||
|
||||
@ -233,7 +221,7 @@ int p3VoRS::sendVoipRinging(const std::string& peer_id)
|
||||
return true ;
|
||||
}
|
||||
|
||||
int p3VoRS::sendVoipData(const std::string& peer_id,const RsVoipDataChunk& chunk)
|
||||
int p3VoRS::sendVoipData(const RsPeerId& peer_id,const RsVoipDataChunk& chunk)
|
||||
{
|
||||
#ifdef DEBUG_VORS
|
||||
std::cerr << "Sending " << chunk.size << " bytes of voip data." << std::endl;
|
||||
@ -267,9 +255,11 @@ void p3VoRS::sendPingMeasurements()
|
||||
{
|
||||
/* we ping our peers */
|
||||
/* who is online? */
|
||||
std::list<std::string> idList;
|
||||
if(!mServiceControl)
|
||||
return ;
|
||||
|
||||
mLinkMgr->getOnlineList(idList);
|
||||
std::set<RsPeerId> onlineIds;
|
||||
mServiceControl->getPeersConnected(getServiceInfo().mServiceType, onlineIds);
|
||||
|
||||
double ts = getCurrentTS();
|
||||
|
||||
@ -279,8 +269,8 @@ void p3VoRS::sendPingMeasurements()
|
||||
#endif
|
||||
|
||||
/* prepare packets */
|
||||
std::list<std::string>::iterator it;
|
||||
for(it = idList.begin(); it != idList.end(); it++)
|
||||
std::set<RsPeerId>::iterator it;
|
||||
for(it = onlineIds.begin(); it != onlineIds.end(); it++)
|
||||
{
|
||||
#ifdef DEBUG_VORS
|
||||
std::cerr << "p3VoRS::sendPingMeasurements() Pinging: " << *it;
|
||||
@ -347,7 +337,7 @@ void p3VoRS::handleData(RsVoipDataItem *item)
|
||||
|
||||
// store the data in a queue.
|
||||
|
||||
std::map<std::string,VorsPeerInfo>::iterator it = mPeerInfo.find(item->PeerId()) ;
|
||||
std::map<RsPeerId,VorsPeerInfo>::iterator it = mPeerInfo.find(item->PeerId()) ;
|
||||
|
||||
if(it == mPeerInfo.end())
|
||||
{
|
||||
@ -362,13 +352,13 @@ void p3VoRS::handleData(RsVoipDataItem *item)
|
||||
}
|
||||
}
|
||||
|
||||
bool p3VoRS::getIncomingData(const std::string& peer_id,std::vector<RsVoipDataChunk>& incoming_data_chunks)
|
||||
bool p3VoRS::getIncomingData(const RsPeerId& peer_id,std::vector<RsVoipDataChunk>& incoming_data_chunks)
|
||||
{
|
||||
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
incoming_data_chunks.clear() ;
|
||||
|
||||
std::map<std::string,VorsPeerInfo>::iterator it = mPeerInfo.find(peer_id) ;
|
||||
std::map<RsPeerId,VorsPeerInfo>::iterator it = mPeerInfo.find(peer_id) ;
|
||||
|
||||
if(it == mPeerInfo.end())
|
||||
{
|
||||
@ -505,7 +495,7 @@ int p3VoRS::handlePong(RsVoipPongItem *pong)
|
||||
return true ;
|
||||
}
|
||||
|
||||
int p3VoRS::storePingAttempt(std::string id, double ts, uint32_t seqno)
|
||||
int p3VoRS::storePingAttempt(const RsPeerId& id, double ts, uint32_t seqno)
|
||||
{
|
||||
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
@ -528,7 +518,7 @@ int p3VoRS::storePingAttempt(std::string id, double ts, uint32_t seqno)
|
||||
|
||||
|
||||
|
||||
int p3VoRS::storePongResult(std::string id, uint32_t counter, double ts, double rtt, double offset)
|
||||
int p3VoRS::storePongResult(const RsPeerId &id, uint32_t counter, double ts, double rtt, double offset)
|
||||
{
|
||||
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
@ -559,7 +549,7 @@ int p3VoRS::storePongResult(std::string id, uint32_t counter, double ts, double
|
||||
}
|
||||
|
||||
|
||||
uint32_t p3VoRS::getPongResults(std::string id, int n, std::list<RsVoipPongResult> &results)
|
||||
uint32_t p3VoRS::getPongResults(const RsPeerId& id, int n, std::list<RsVoipPongResult> &results)
|
||||
{
|
||||
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/
|
||||
|
||||
@ -577,9 +567,9 @@ uint32_t p3VoRS::getPongResults(std::string id, int n, std::list<RsVoipPongResul
|
||||
|
||||
|
||||
|
||||
VorsPeerInfo *p3VoRS::locked_GetPeerInfo(std::string id)
|
||||
VorsPeerInfo *p3VoRS::locked_GetPeerInfo(const RsPeerId &id)
|
||||
{
|
||||
std::map<std::string, VorsPeerInfo>::iterator it;
|
||||
std::map<RsPeerId, VorsPeerInfo>::iterator it;
|
||||
it = mPeerInfo.find(id);
|
||||
if (it == mPeerInfo.end())
|
||||
{
|
||||
@ -598,7 +588,7 @@ VorsPeerInfo *p3VoRS::locked_GetPeerInfo(std::string id)
|
||||
return &(it->second);
|
||||
}
|
||||
|
||||
bool VorsPeerInfo::initialisePeerInfo(std::string id)
|
||||
bool VorsPeerInfo::initialisePeerInfo(const RsPeerId& id)
|
||||
{
|
||||
mId = id;
|
||||
|
||||
|
@ -32,6 +32,8 @@
|
||||
|
||||
#include "services/rsvoipitems.h"
|
||||
#include "services/p3service.h"
|
||||
#include "serialiser/rstlvbase.h"
|
||||
#include "serialiser/rsconfigitems.h"
|
||||
#include "plugins/rspqiservice.h"
|
||||
#include <interface/rsvoip.h>
|
||||
|
||||
@ -42,9 +44,9 @@ class VorsPeerInfo
|
||||
{
|
||||
public:
|
||||
|
||||
bool initialisePeerInfo(std::string id);
|
||||
bool initialisePeerInfo(const RsPeerId &id);
|
||||
|
||||
std::string mId;
|
||||
RsPeerId mId;
|
||||
double mCurrentPingTS;
|
||||
double mCurrentPingCounter;
|
||||
bool mCurrentPongRecvd;
|
||||
@ -72,22 +74,22 @@ class p3VoRS: public RsPQIService, public RsVoip
|
||||
|
||||
/***** overloaded from rsVoip *****/
|
||||
|
||||
virtual uint32_t getPongResults(std::string id, int n, std::list<RsVoipPongResult> &results);
|
||||
virtual uint32_t getPongResults(const RsPeerId &id, int n, std::list<RsVoipPongResult> &results);
|
||||
|
||||
// Call stuff.
|
||||
//
|
||||
|
||||
// Sending data. The client keeps the memory ownership and must delete it after calling this.
|
||||
virtual int sendVoipData(const std::string& peer_id,const RsVoipDataChunk& chunk) ;
|
||||
virtual int sendVoipData(const RsPeerId &peer_id,const RsVoipDataChunk& chunk) ;
|
||||
|
||||
// The server fill in the data and gives up memory ownership. The client must delete the memory
|
||||
// in each chunk once it has been used.
|
||||
//
|
||||
virtual bool getIncomingData(const std::string& peer_id,std::vector<RsVoipDataChunk>& chunks) ;
|
||||
virtual bool getIncomingData(const RsPeerId& peer_id,std::vector<RsVoipDataChunk>& chunks) ;
|
||||
|
||||
virtual int sendVoipHangUpCall(const std::string& peer_id) ;
|
||||
virtual int sendVoipRinging(const std::string& peer_id) ;
|
||||
virtual int sendVoipAcceptCall(const std::string& peer_id) ;
|
||||
virtual int sendVoipHangUpCall(const RsPeerId& peer_id) ;
|
||||
virtual int sendVoipRinging(const RsPeerId& peer_id) ;
|
||||
virtual int sendVoipAcceptCall(const RsPeerId &peer_id) ;
|
||||
|
||||
/***** overloaded from p3Service *****/
|
||||
/*!
|
||||
@ -126,7 +128,10 @@ class p3VoRS: public RsPQIService, public RsVoip
|
||||
* chat msg items and custom status are saved
|
||||
*/
|
||||
virtual bool saveList(bool& cleanup, std::list<RsItem*>&) ;
|
||||
virtual bool loadList(std::list<RsItem*>& load) ;
|
||||
virtual bool loadList(std::list<RsItem*>& load) ;
|
||||
virtual std::string configurationFileName() const { return "voip.cfg" ; }
|
||||
|
||||
virtual RsServiceInfo getServiceInfo() ;
|
||||
|
||||
private:
|
||||
int sendPackets();
|
||||
@ -136,24 +141,24 @@ class p3VoRS: public RsPQIService, public RsVoip
|
||||
int handlePing(RsVoipPingItem *item);
|
||||
int handlePong(RsVoipPongItem *item);
|
||||
|
||||
int storePingAttempt(std::string id, double ts, uint32_t mCounter);
|
||||
int storePongResult(std::string id, uint32_t counter, double ts, double rtt, double offset);
|
||||
int storePingAttempt(const RsPeerId &id, double ts, uint32_t mCounter);
|
||||
int storePongResult(const RsPeerId& id, uint32_t counter, double ts, double rtt, double offset);
|
||||
|
||||
void handleProtocol(RsVoipProtocolItem*) ;
|
||||
void handleData(RsVoipDataItem*) ;
|
||||
|
||||
RsMutex mVorsMtx;
|
||||
|
||||
VorsPeerInfo *locked_GetPeerInfo(std::string id);
|
||||
VorsPeerInfo *locked_GetPeerInfo(const RsPeerId& id);
|
||||
|
||||
static RsTlvKeyValue push_int_value(const std::string& key,int value) ;
|
||||
static int pop_int_value(const std::string& s) ;
|
||||
|
||||
std::map<std::string, VorsPeerInfo> mPeerInfo;
|
||||
std::map<RsPeerId, VorsPeerInfo> mPeerInfo;
|
||||
time_t mSentPingTime;
|
||||
uint32_t mCounter;
|
||||
|
||||
p3LinkMgr *mLinkMgr;
|
||||
RsServiceControl *mServiceControl;
|
||||
PluginNotifier *mNotify ;
|
||||
|
||||
int _atransmit ;
|
||||
|
@ -30,7 +30,6 @@
|
||||
|
||||
#include "serialiser/rsserviceids.h"
|
||||
#include "serialiser/rsserial.h"
|
||||
#include "serialiser/rstlvtypes.h"
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user