updated VoIP to use new Fast packet sending.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.6-initdev@6792 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2013-10-03 13:15:10 +00:00
parent 2466c01e35
commit 90b4a20e5d
3 changed files with 34 additions and 31 deletions

View File

@ -22,7 +22,7 @@
#define SAMPLING_RATE 16000 //must be the same as the speex setted mode (speex_wb_mode)
#define FRAME_SIZE 320 //must be the same as the speex setted mode (speex_wb_mode)
#define ECHOTAILSIZE 25
#define ECHOTAILSIZE 10
class SpeexBits;

View File

@ -168,7 +168,7 @@ int p3VoRS::tick()
std::cerr << "ticking p3VoRS" << std::endl;
#endif
processIncoming();
//processIncoming();
sendPackets();
return 0;
@ -393,34 +393,37 @@ bool p3VoRS::getIncomingData(const std::string& peer_id,std::vector<RsVoipDataCh
return true ;
}
int p3VoRS::processIncoming()
{
/* for each packet - pass to specific handler */
RsItem *item = NULL;
while(NULL != (item = recvItem()))
bool p3VoRS::recvItem(RsItem *item)
{
/* pass to specific handler */
bool keep = false ;
switch(item->PacketSubType())
{
case RS_PKT_SUBTYPE_VOIP_PING: handlePing(dynamic_cast<RsVoipPingItem*>(item));
case RS_PKT_SUBTYPE_VOIP_PING:
handlePing(dynamic_cast<RsVoipPingItem*>(item));
break;
case RS_PKT_SUBTYPE_VOIP_PONG: handlePong(dynamic_cast<RsVoipPongItem*>(item));
case RS_PKT_SUBTYPE_VOIP_PONG:
handlePong(dynamic_cast<RsVoipPongItem*>(item));
break;
case RS_PKT_SUBTYPE_VOIP_PROTOCOL: handleProtocol(dynamic_cast<RsVoipProtocolItem*>(item)) ;
case RS_PKT_SUBTYPE_VOIP_PROTOCOL:
handleProtocol(dynamic_cast<RsVoipProtocolItem*>(item)) ;
break ;
case RS_PKT_SUBTYPE_VOIP_DATA: handleData(dynamic_cast<RsVoipDataItem*>(item));
case RS_PKT_SUBTYPE_VOIP_DATA:
handleData(dynamic_cast<RsVoipDataItem*>(item));
keep = true ;
break;
#if 0
/* THESE ARE ALL FUTURISTIC DATA TYPES */
case RS_BANDWIDTH_PING_ITEM: handleBandwidthPing(item);
case RS_BANDWIDTH_PING_ITEM:
handleBandwidthPing(item);
break;
case RS_BANDWIDTH_PONG_ITEM: handleBandwidthPong(item);
case RS_BANDWIDTH_PONG_ITEM:
handleBandwidthPong(item);
break;
#endif
default:
@ -430,7 +433,6 @@ int p3VoRS::processIncoming()
/* clean up */
if(!keep)
delete item;
}
return true ;
}

View File

@ -99,6 +99,7 @@ class p3VoRS: public RsPQIService, public RsVoip
*/
virtual int tick();
virtual int status();
virtual bool recvItem(RsItem *item);
/*************** pqiMonitor callback ***********************/
//virtual void statusChange(const std::list<pqipeer> &plist);
@ -130,7 +131,7 @@ class p3VoRS: public RsPQIService, public RsVoip
private:
int sendPackets();
void sendPingMeasurements();
int processIncoming();
//int processIncoming();
int handlePing(RsVoipPingItem *item);
int handlePong(RsVoipPongItem *item);