Renaming all to VOIP in VOIP plugin (patch from Phenom)

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8231 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
electron128 2015-05-11 19:40:07 +00:00
parent a3b32b92d5
commit b5bf3ce130
29 changed files with 860 additions and 686 deletions

View File

@ -33,38 +33,38 @@ win32 {
QMAKE_CXXFLAGS *= -Wall QMAKE_CXXFLAGS *= -Wall
SOURCES = services/p3vors.cc \ SOURCES = VOIPPlugin.cpp \
services/rsvoipitems.cc \ services/p3VOIP.cc \
gui/AudioInputConfig.cpp \ services/rsVOIPItems.cc \
gui/AudioStats.cpp \ gui/AudioInputConfig.cpp \
gui/AudioWizard.cpp \ gui/AudioStats.cpp \
gui/SpeexProcessor.cpp \ gui/AudioWizard.cpp \
gui/audiodevicehelper.cpp \ gui/SpeexProcessor.cpp \
gui/audiodevicehelper.cpp \
gui/VideoProcessor.cpp \
gui/QVideoDevice.cpp \
gui/VOIPChatWidgetHolder.cpp \ gui/VOIPChatWidgetHolder.cpp \
gui/PluginGUIHandler.cpp \ gui/VOIPGUIHandler.cpp \
gui/PluginNotifier.cpp \ gui/VOIPNotify.cpp
gui/VideoProcessor.cpp \
gui/QVideoDevice.cpp \
VOIPPlugin.cpp
HEADERS = services/p3vors.h \ HEADERS = VOIPPlugin.h \
services/rsvoipitems.h \ services/p3VOIP.h \
gui/AudioInputConfig.h \ services/rsVOIPItems.h \
gui/AudioStats.h \ gui/AudioInputConfig.h \
gui/AudioWizard.h \ gui/AudioStats.h \
gui/SpeexProcessor.h \ gui/AudioWizard.h \
gui/audiodevicehelper.h \ gui/SpeexProcessor.h \
gui/VOIPChatWidgetHolder.h \ gui/audiodevicehelper.h \
gui/PluginGUIHandler.h \ gui/VideoProcessor.h \
gui/PluginNotifier.h \ gui/QVideoDevice.h \
gui/VideoProcessor.h \ gui/VOIPChatWidgetHolder.h \
gui/QVideoDevice.h \ gui/VOIPGUIHandler.h \
interface/rsvoip.h \ gui/VOIPNotify.h \
VOIPPlugin.h interface/rsVOIP.h
FORMS = gui/AudioInputConfig.ui \ FORMS = gui/AudioInputConfig.ui \
gui/AudioStats.ui \ gui/AudioStats.ui \
gui/AudioWizard.ui gui/AudioWizard.ui
TARGET = VOIP TARGET = VOIP

View File

@ -1,3 +1,23 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <retroshare/rsplugin.h> #include <retroshare/rsplugin.h>
#include <retroshare/rsversion.h> #include <retroshare/rsversion.h>
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
@ -8,12 +28,12 @@
#include <QMessageBox> #include <QMessageBox>
#include "VOIPPlugin.h" #include "VOIPPlugin.h"
#include "interface/rsvoip.h" #include "interface/rsVOIP.h"
#include "gui/AudioInputConfig.h" #include "gui/AudioInputConfig.h"
#include "gui/VOIPChatWidgetHolder.h" #include "gui/VOIPChatWidgetHolder.h"
#include "gui/PluginGUIHandler.h" #include "gui/VOIPGUIHandler.h"
#include "gui/PluginNotifier.h" #include "gui/VOIPNotify.h"
#include "gui/SoundManager.h" #include "gui/SoundManager.h"
#include "gui/chat/ChatWidget.h" #include "gui/chat/ChatWidget.h"
@ -58,20 +78,20 @@ void VOIPPlugin::getPluginVersion(int& major, int& minor, int& build, int& svn_r
VOIPPlugin::VOIPPlugin() VOIPPlugin::VOIPPlugin()
{ {
mVoip = NULL ; mVOIP = NULL ;
mPlugInHandler = NULL; mPlugInHandler = NULL;
mPeers = NULL; mPeers = NULL;
config_page = NULL ; config_page = NULL ;
mIcon = NULL ; mIcon = NULL ;
mPluginGUIHandler = new PluginGUIHandler ; mVOIPGUIHandler = new VOIPGUIHandler ;
mPluginNotifier = new PluginNotifier ; mVOIPNotify = new VOIPNotify ;
QObject::connect(mPluginNotifier,SIGNAL(voipInvitationReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedInvitation(const QString&)),Qt::QueuedConnection) ; QObject::connect(mVOIPNotify,SIGNAL(voipInvitationReceived(const QString&)),mVOIPGUIHandler,SLOT(ReceivedInvitation(const QString&)),Qt::QueuedConnection) ;
QObject::connect(mPluginNotifier,SIGNAL(voipDataReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipData(const QString&)),Qt::QueuedConnection) ; QObject::connect(mVOIPNotify,SIGNAL(voipDataReceived(const QString&)),mVOIPGUIHandler,SLOT(ReceivedVoipData(const QString&)),Qt::QueuedConnection) ;
QObject::connect(mPluginNotifier,SIGNAL(voipAcceptReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipAccept(const QString&)),Qt::QueuedConnection) ; QObject::connect(mVOIPNotify,SIGNAL(voipAcceptReceived(const QString&)),mVOIPGUIHandler,SLOT(ReceivedVoipAccept(const QString&)),Qt::QueuedConnection) ;
QObject::connect(mPluginNotifier,SIGNAL(voipHangUpReceived(const QString&)),mPluginGUIHandler,SLOT(ReceivedVoipHangUp(const QString&)),Qt::QueuedConnection) ; QObject::connect(mVOIPNotify,SIGNAL(voipHangUpReceived(const QString&)),mVOIPGUIHandler,SLOT(ReceivedVoipHangUp(const QString&)),Qt::QueuedConnection) ;
QObject::connect(mPluginNotifier,SIGNAL(voipBandwidthInfoReceived(const QString&,int)),mPluginGUIHandler,SLOT(ReceivedVoipBandwidthInfo(const QString&,int)),Qt::QueuedConnection) ; QObject::connect(mVOIPNotify,SIGNAL(voipBandwidthInfoReceived(const QString&,int)),mVOIPGUIHandler,SLOT(ReceivedVoipBandwidthInfo(const QString&,int)),Qt::QueuedConnection) ;
} }
void VOIPPlugin::setInterfaces(RsPlugInInterfaces &interfaces) void VOIPPlugin::setInterfaces(RsPlugInInterfaces &interfaces)
@ -127,10 +147,10 @@ ChatWidgetHolder *VOIPPlugin::qt_get_chat_widget_holder(ChatWidget *chatWidget)
p3Service *VOIPPlugin::p3_service() const p3Service *VOIPPlugin::p3_service() const
{ {
if(mVoip == NULL) if(mVOIP == NULL)
rsVoip = mVoip = new p3VoRS(mPlugInHandler,mPluginNotifier) ; // , 3600 * 24 * 30 * 6); // 6 Months rsVOIP = mVOIP = new p3VOIP(mPlugInHandler,mVOIPNotify) ; // , 3600 * 24 * 30 * 6); // 6 Months
return mVoip ; return mVOIP ;
} }
void VOIPPlugin::setPlugInHandler(RsPluginHandler *pgHandler) void VOIPPlugin::setPlugInHandler(RsPluginHandler *pgHandler)

View File

@ -1,10 +1,30 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#pragma once #pragma once
#include <retroshare/rsplugin.h> #include <retroshare/rsplugin.h>
#include "services/p3vors.h" #include "services/p3VOIP.h"
class PluginGUIHandler ; class VOIPGUIHandler ;
class PluginNotifier ; class VOIPNotify ;
class VOIPPlugin: public RsPlugin class VOIPPlugin: public RsPlugin
{ {
@ -32,13 +52,13 @@ class VOIPPlugin: public RsPlugin
virtual void setInterfaces(RsPlugInInterfaces& interfaces); virtual void setInterfaces(RsPlugInInterfaces& interfaces);
private: private:
mutable p3VoRS *mVoip ; mutable p3VOIP *mVOIP ;
mutable RsPluginHandler *mPlugInHandler; mutable RsPluginHandler *mPlugInHandler;
mutable RsPeers* mPeers; mutable RsPeers* mPeers;
mutable ConfigPage *config_page ; mutable ConfigPage *config_page ;
mutable QIcon *mIcon; mutable QIcon *mIcon;
PluginNotifier *mPluginNotifier ; VOIPNotify *mVOIPNotify ;
PluginGUIHandler *mPluginGUIHandler ; VOIPGUIHandler *mVOIPGUIHandler ;
}; };

View File

@ -39,7 +39,7 @@
//#include "NetworkConfig.h" //#include "NetworkConfig.h"
#include "audiodevicehelper.h" #include "audiodevicehelper.h"
#include "AudioWizard.h" #include "AudioWizard.h"
#include <interface/rsvoip.h> #include <interface/rsVOIP.h>
#define iroundf(x) ( static_cast<int>(x) ) #define iroundf(x) ( static_cast<int>(x) )
@ -112,9 +112,9 @@ void AudioInputConfig::load()
} }
qcbSystem->setEnabled(qcbSystem->count() > 1);*/ qcbSystem->setEnabled(qcbSystem->count() > 1);*/
ui.qcbTransmit->addItem(tr("Continuous"), RsVoip::AudioTransmitContinous); ui.qcbTransmit->addItem(tr("Continuous"), RsVOIP::AudioTransmitContinous);
ui.qcbTransmit->addItem(tr("Voice Activity"), RsVoip::AudioTransmitVAD); ui.qcbTransmit->addItem(tr("Voice Activity"), RsVOIP::AudioTransmitVAD);
ui.qcbTransmit->addItem(tr("Push To Talk"), RsVoip::AudioTransmitPushToTalk); ui.qcbTransmit->addItem(tr("Push To Talk"), RsVOIP::AudioTransmitPushToTalk);
abSpeech = new AudioBar(); abSpeech = new AudioBar();
abSpeech->qcBelow = Qt::red; abSpeech->qcBelow = Qt::red;
@ -151,26 +151,26 @@ void AudioInputConfig::loadSettings() {
loadSlider(qsTransmitMax, iroundf(r.fVADmax * 32767.0f + 0.5f)); loadSlider(qsTransmitMax, iroundf(r.fVADmax * 32767.0f + 0.5f));
loadSlider(qsFrames, (r.iFramesPerPacket == 1) ? 1 : (r.iFramesPerPacket/2 + 1)); loadSlider(qsFrames, (r.iFramesPerPacket == 1) ? 1 : (r.iFramesPerPacket/2 + 1));
loadSlider(qsDoublePush, iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f));*/ loadSlider(qsDoublePush, iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f));*/
ui.qcbTransmit->setCurrentIndex(rsVoip->getVoipATransmit()); ui.qcbTransmit->setCurrentIndex(rsVOIP->getVoipATransmit());
on_qcbTransmit_currentIndexChanged(rsVoip->getVoipATransmit()); on_qcbTransmit_currentIndexChanged(rsVOIP->getVoipATransmit());
ui.qsTransmitHold->setValue(rsVoip->getVoipVoiceHold()); ui.qsTransmitHold->setValue(rsVOIP->getVoipVoiceHold());
on_qsTransmitHold_valueChanged(rsVoip->getVoipVoiceHold()); on_qsTransmitHold_valueChanged(rsVOIP->getVoipVoiceHold());
ui.qsTransmitMin->setValue(rsVoip->getVoipfVADmin()); ui.qsTransmitMin->setValue(rsVOIP->getVoipfVADmin());
ui.qsTransmitMax->setValue(rsVoip->getVoipfVADmax()); ui.qsTransmitMax->setValue(rsVOIP->getVoipfVADmax());
ui.qcbEchoCancel->setChecked(rsVoip->getVoipEchoCancel()); ui.qcbEchoCancel->setChecked(rsVOIP->getVoipEchoCancel());
//ui.qsDoublePush->setValue(iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f)); //ui.qsDoublePush->setValue(iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f));
//loadCheckBox(qcbPushClick, r.bPushClick); //loadCheckBox(qcbPushClick, r.bPushClick);
//loadSlider(qsQuality, r.iQuality); //loadSlider(qsQuality, r.iQuality);
if (rsVoip->getVoipiNoiseSuppress() != 0) if (rsVOIP->getVoipiNoiseSuppress() != 0)
ui.qsNoise->setValue(-rsVoip->getVoipiNoiseSuppress()); ui.qsNoise->setValue(-rsVOIP->getVoipiNoiseSuppress());
else else
ui.qsNoise->setValue(14); ui.qsNoise->setValue(14);
on_qsNoise_valueChanged(-rsVoip->getVoipiNoiseSuppress()); on_qsNoise_valueChanged(-rsVOIP->getVoipiNoiseSuppress());
ui.qsAmp->setValue(20000 - rsVoip->getVoipiMinLoudness()); ui.qsAmp->setValue(20000 - rsVOIP->getVoipiMinLoudness());
on_qsAmp_valueChanged(20000 - rsVoip->getVoipiMinLoudness()); on_qsAmp_valueChanged(20000 - rsVOIP->getVoipiMinLoudness());
//loadSlider(qsIdle, r.iIdleTime); //loadSlider(qsIdle, r.iIdleTime);
/*int echo = 0; /*int echo = 0;
@ -190,14 +190,14 @@ void AudioInputConfig::loadSettings() {
bool AudioInputConfig::save(QString &/*errmsg*/) {//mainly useless beacause saving occurs in realtime bool AudioInputConfig::save(QString &/*errmsg*/) {//mainly useless beacause saving occurs in realtime
//s.iQuality = qsQuality->value(); //s.iQuality = qsQuality->value();
rsVoip->setVoipiNoiseSuppress((ui.qsNoise->value() == 14) ? 0 : - ui.qsNoise->value()); rsVOIP->setVoipiNoiseSuppress((ui.qsNoise->value() == 14) ? 0 : - ui.qsNoise->value());
rsVoip->setVoipiMinLoudness(20000 - ui.qsAmp->value()); rsVOIP->setVoipiMinLoudness(20000 - ui.qsAmp->value());
rsVoip->setVoipVoiceHold(ui.qsTransmitHold->value()); rsVOIP->setVoipVoiceHold(ui.qsTransmitHold->value());
rsVoip->setVoipfVADmin(ui.qsTransmitMin->value()); rsVOIP->setVoipfVADmin(ui.qsTransmitMin->value());
rsVoip->setVoipfVADmax(ui.qsTransmitMax->value()); rsVOIP->setVoipfVADmax(ui.qsTransmitMax->value());
/*s.uiDoublePush = qsDoublePush->value() * 1000;*/ /*s.uiDoublePush = qsDoublePush->value() * 1000;*/
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() )); rsVOIP->setVoipATransmit(static_cast<RsVOIP::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
rsVoip->setVoipEchoCancel(ui.qcbEchoCancel->isChecked()); rsVOIP->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
return true; return true;
} }
@ -220,7 +220,7 @@ void AudioInputConfig::on_qsTransmitHold_valueChanged(int v) {
float val = static_cast<float>(v * FRAME_SIZE); float val = static_cast<float>(v * FRAME_SIZE);
val = val / SAMPLING_RATE; val = val / SAMPLING_RATE;
ui.qlTransmitHold->setText(tr("%1 s").arg(val, 0, 'f', 2)); ui.qlTransmitHold->setText(tr("%1 s").arg(val, 0, 'f', 2));
rsVoip->setVoipVoiceHold(v); rsVOIP->setVoipVoiceHold(v);
} }
void AudioInputConfig::on_qsNoise_valueChanged(int v) { void AudioInputConfig::on_qsNoise_valueChanged(int v) {
@ -233,18 +233,18 @@ void AudioInputConfig::on_qsNoise_valueChanged(int v) {
ui.qlNoise->setText(tr("-%1 dB").arg(v)); ui.qlNoise->setText(tr("-%1 dB").arg(v));
} }
ui.qlNoise->setPalette(pal); ui.qlNoise->setPalette(pal);
rsVoip->setVoipiNoiseSuppress(- ui.qsNoise->value()); rsVOIP->setVoipiNoiseSuppress(- ui.qsNoise->value());
} }
void AudioInputConfig::on_qsAmp_valueChanged(int v) { void AudioInputConfig::on_qsAmp_valueChanged(int v) {
v = 20000 - v; v = 20000 - v;
float d = 20000.0f/static_cast<float>(v); float d = 20000.0f/static_cast<float>(v);
ui.qlAmp->setText(QString::fromLatin1("%1").arg(d, 0, 'f', 2)); ui.qlAmp->setText(QString::fromLatin1("%1").arg(d, 0, 'f', 2));
rsVoip->setVoipiMinLoudness(20000 - ui.qsAmp->value()); rsVOIP->setVoipiMinLoudness(20000 - ui.qsAmp->value());
} }
void AudioInputConfig::on_qcbEchoCancel_clicked() { void AudioInputConfig::on_qcbEchoCancel_clicked() {
rsVoip->setVoipEchoCancel(ui.qcbEchoCancel->isChecked()); rsVOIP->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
} }
@ -261,7 +261,7 @@ void AudioInputConfig::on_qcbTransmit_currentIndexChanged(int v) {
break; break;
} }
if (loaded) if (loaded)
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() )); rsVOIP->setVoipATransmit(static_cast<RsVOIP::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
} }
@ -280,8 +280,8 @@ void AudioInputConfig::on_Tick_timeout() {
abSpeech->iBelow = ui.qsTransmitMin->value(); abSpeech->iBelow = ui.qsTransmitMin->value();
abSpeech->iAbove = ui.qsTransmitMax->value(); abSpeech->iAbove = ui.qsTransmitMax->value();
if (loaded) { if (loaded) {
rsVoip->setVoipfVADmin(ui.qsTransmitMin->value()); rsVOIP->setVoipfVADmin(ui.qsTransmitMin->value());
rsVoip->setVoipfVADmax(ui.qsTransmitMax->value()); rsVOIP->setVoipfVADmax(ui.qsTransmitMax->value());
} }
abSpeech->iValue = iroundf(inputAudioProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f); abSpeech->iValue = iroundf(inputAudioProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);

View File

@ -28,8 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _AUDIOINPUTCONFIG_H #pragma once
#define _AUDIOINPUTCONFIG_H
#include <QAudioInput> #include <QAudioInput>
#include <QWidget> #include <QWidget>
@ -88,5 +87,3 @@ class AudioInputConfig : public ConfigPage
void on_qpbAudioWizard_clicked(); void on_qpbAudioWizard_clicked();
void on_qcbEchoCancel_clicked(); void on_qcbEchoCancel_clicked();
}; };
#endif

View File

@ -28,8 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _AUDIOSTATS_H #pragma once
#define _AUDIOSTATS_H
#include <QWidget> #include <QWidget>
@ -89,7 +88,3 @@ class AudioStats : public QDialog, public Ui::AudioStats {
void on_Tick_timeout(); void on_Tick_timeout();
}; };
*/ */
#else
class AudioStats;
#endif

View File

@ -37,7 +37,7 @@
//#include "Log.h" //#include "Log.h"
//#include "MainWindow.h" //#include "MainWindow.h"
#include "audiodevicehelper.h" #include "audiodevicehelper.h"
#include "interface/rsvoip.h" #include "interface/rsVOIP.h"
#define iroundf(x) ( static_cast<int>(x) ) #define iroundf(x) ( static_cast<int>(x) )
@ -89,9 +89,9 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
verticalLayout_3->addWidget(abAmplify); verticalLayout_3->addWidget(abAmplify);
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitPushToTalk) if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitPushToTalk)
qrPTT->setChecked(true); qrPTT->setChecked(true);
else if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitVAD) else if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitVAD)
qrVAD->setChecked(true); qrVAD->setChecked(true);
else else
qrContinuous->setChecked(true); qrContinuous->setChecked(true);
@ -101,13 +101,13 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
abVAD->qcInside = Qt::yellow; abVAD->qcInside = Qt::yellow;
abVAD->qcAbove = Qt::green; abVAD->qcAbove = Qt::green;
qsTransmitMin->setValue(rsVoip->getVoipfVADmin()); qsTransmitMin->setValue(rsVOIP->getVoipfVADmin());
qsTransmitMax->setValue(rsVoip->getVoipfVADmax()); qsTransmitMax->setValue(rsVOIP->getVoipfVADmax());
verticalLayout_6->addWidget(abVAD); verticalLayout_6->addWidget(abVAD);
// Volume // Volume
qsMaxAmp->setValue(rsVoip->getVoipiMinLoudness()); qsMaxAmp->setValue(rsVOIP->getVoipiMinLoudness());
setOption(QWizard::NoCancelButton, false); setOption(QWizard::NoCancelButton, false);
resize(700, 500); resize(700, 500);
@ -149,7 +149,7 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
void AudioWizard::on_qsMaxAmp_valueChanged(int v) { void AudioWizard::on_qsMaxAmp_valueChanged(int v) {
rsVoip->setVoipiMinLoudness(qMin(v, 30000)); rsVOIP->setVoipiMinLoudness(qMin(v, 30000));
} }
void AudioWizard::on_Ticker_timeout() { void AudioWizard::on_Ticker_timeout() {
@ -177,8 +177,8 @@ void AudioWizard::on_Ticker_timeout() {
abVAD->iBelow = qsTransmitMin->value(); abVAD->iBelow = qsTransmitMin->value();
abVAD->iAbove = qsTransmitMax->value(); abVAD->iAbove = qsTransmitMax->value();
rsVoip->setVoipfVADmin(qsTransmitMin->value()); rsVOIP->setVoipfVADmin(qsTransmitMin->value());
rsVoip->setVoipfVADmax(qsTransmitMax->value()); rsVOIP->setVoipfVADmax(qsTransmitMax->value());
abVAD->iValue = iroundf(inputProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f); abVAD->iValue = iroundf(inputProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);
@ -233,19 +233,19 @@ void AudioWizard::on_playEcho_timeout() {
void AudioWizard::on_qsTransmitMax_valueChanged(int v) { void AudioWizard::on_qsTransmitMax_valueChanged(int v) {
if (! bInit) { if (! bInit) {
rsVoip->setVoipfVADmax(v); rsVOIP->setVoipfVADmax(v);
} }
} }
void AudioWizard::on_qsTransmitMin_valueChanged(int v) { void AudioWizard::on_qsTransmitMin_valueChanged(int v) {
if (! bInit) { if (! bInit) {
rsVoip->setVoipfVADmin(v); rsVOIP->setVoipfVADmin(v);
} }
} }
void AudioWizard::on_qrVAD_clicked(bool on) { void AudioWizard::on_qrVAD_clicked(bool on) {
if (on) { if (on) {
rsVoip->setVoipATransmit(RsVoip::AudioTransmitVAD); rsVOIP->setVoipATransmit(RsVOIP::AudioTransmitVAD);
updateTriggerWidgets(true); updateTriggerWidgets(true);
bTransmitChanged = true; bTransmitChanged = true;
} }
@ -253,7 +253,7 @@ void AudioWizard::on_qrVAD_clicked(bool on) {
void AudioWizard::on_qrPTT_clicked(bool on) { void AudioWizard::on_qrPTT_clicked(bool on) {
if (on) { if (on) {
rsVoip->setVoipATransmit(RsVoip::AudioTransmitPushToTalk); rsVOIP->setVoipATransmit(RsVOIP::AudioTransmitPushToTalk);
updateTriggerWidgets(false); updateTriggerWidgets(false);
bTransmitChanged = true; bTransmitChanged = true;
} }
@ -261,7 +261,7 @@ void AudioWizard::on_qrPTT_clicked(bool on) {
void AudioWizard::on_qrContinuous_clicked(bool on) { void AudioWizard::on_qrContinuous_clicked(bool on) {
if (on) { if (on) {
rsVoip->setVoipATransmit(RsVoip::AudioTransmitContinous); rsVOIP->setVoipATransmit(RsVOIP::AudioTransmitContinous);
updateTriggerWidgets(false); updateTriggerWidgets(false);
bTransmitChanged = true; bTransmitChanged = true;
} }

View File

@ -28,8 +28,7 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _AUDIOWIZARD_H #pragma once
#define _AUDIOWIZARD_H
#include <QAudioInput> #include <QAudioInput>
#include <QAudioOutput> #include <QAudioOutput>
@ -95,5 +94,3 @@ class AudioWizard: public QWizard, public Ui::AudioWizard {
void loopAudio(); void loopAudio();
}; };
#endif

View File

@ -1,102 +0,0 @@
#include <iostream>
#include <vector>
#include <list>
#include <interface/rsvoip.h>
#include "PluginGUIHandler.h"
#include <gui/chat/ChatDialog.h>
#include <gui/VOIPChatWidgetHolder.h>
#include "gui/chat/ChatWidget.h"
#include "gui/settings/rsharesettings.h"
void PluginGUIHandler::ReceivedInvitation(const QString& /*peer_id*/)
{
std::cerr << "****** Plugin GUI handler: received Invitation!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipHangUp(const QString& /*peer_id*/)
{
std::cerr << "****** Plugin GUI handler: received HangUp!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipAccept(const QString& /*peer_id*/)
{
std::cerr << "****** Plugin GUI handler: received VoipAccept!" << std::endl;
}
void PluginGUIHandler::ReceivedVoipData(const QString& qpeer_id)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
std::vector<RsVoipDataChunk> chunks ;
if(!rsVoip->getIncomingData(peer_id,chunks))
{
std::cerr << "PluginGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
return ;
}
ChatDialog *di = ChatDialog::getChat(ChatId(peer_id), Settings->getChatFlags());
if (di) {
ChatWidget *cw = di->getChatWidget();
if (cw) {
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh) {
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);
if(chunks[chunkIndex].type == RsVoipDataChunk::RS_VOIP_DATA_TYPE_AUDIO)
acwh->addAudioData(QString::fromStdString(peer_id.toStdString()),&qb);
else if(chunks[chunkIndex].type == RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO)
acwh->addVideoData(QString::fromStdString(peer_id.toStdString()),&qb);
else
std::cerr << "Unknown data type received. type=" << chunks[chunkIndex].type << std::endl;
}
}
break;
}
}
}
} else {
std::cerr << "Error: received audio data for a chat dialog that does not stand Audio (Peer id = " << peer_id.toStdString() << "!" << std::endl;
}
for(unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++){
free(chunks[chunkIndex].data);
}
}
void PluginGUIHandler::ReceivedVoipBandwidthInfo(const QString& qpeer_id,int bytes_per_sec)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ;
std::cerr << "PluginGUIHandler::received bw info for peer " << qpeer_id.toStdString() << ": " << bytes_per_sec << " Bps" << std::endl;
if(!di)
{
std::cerr << "Error: received bandwidth info for a chat dialog that does not stand VOIP (Peer id = " << peer_id.toStdString() << "!" << std::endl;
return ;
}
ChatWidget *cw = di->getChatWidget();
if(!cw)
{
return ;
}
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh)
acwh->setAcceptedBandwidth(QString::fromStdString(peer_id.toStdString()),bytes_per_sec);
}
}

View File

@ -1,21 +0,0 @@
// This class receives async-ed signals from the plugin notifier,
// and executes GUI requests.
//
// It is never called directly: it is called by Qt signal-received callback,
// in the main GUI thread.
//
#include <stdint.h>
#include <QObject>
class PluginGUIHandler: public QObject
{
Q_OBJECT
public slots:
void ReceivedInvitation(const QString& peer_id) ;
void ReceivedVoipData(const QString& peer_id) ;
void ReceivedVoipHangUp(const QString& peer_id) ;
void ReceivedVoipAccept(const QString& peer_id) ;
void ReceivedVoipBandwidthInfo(const QString& peer_id,int) ;
};

View File

@ -1,22 +0,0 @@
#include "PluginNotifier.h"
void PluginNotifier::notifyReceivedVoipInvite(const RsPeerId& peer_id)
{
emit voipInvitationReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipData(const RsPeerId &peer_id)
{
emit voipDataReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipAccept(const RsPeerId& peer_id)
{
emit voipAcceptReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipHangUp(const RsPeerId &peer_id)
{
emit voipHangUpReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void PluginNotifier::notifyReceivedVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec)
{
emit voipBandwidthInfoReceived(QString::fromStdString(peer_id.toStdString()),bytes_per_sec) ;
}

View File

@ -7,6 +7,7 @@
#include "VideoProcessor.h" #include "VideoProcessor.h"
QVideoInputDevice::QVideoInputDevice(QWidget *parent) QVideoInputDevice::QVideoInputDevice(QWidget *parent)
:QObject(parent)
{ {
_timer = NULL ; _timer = NULL ;
_capture_device = NULL ; _capture_device = NULL ;
@ -85,7 +86,7 @@ void QVideoInputDevice::grabFrame()
if(_echo_output_device != NULL) _echo_output_device->showFrame(image) ; if(_echo_output_device != NULL) _echo_output_device->showFrame(image) ;
} }
bool QVideoInputDevice::getNextEncodedPacket(RsVoipDataChunk& chunk) bool QVideoInputDevice::getNextEncodedPacket(RsVOIPDataChunk& chunk)
{ {
return _video_encoder->nextPacket(chunk) ; return _video_encoder->nextPacket(chunk) ;
} }

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <QLabel> #include <QLabel>
#include "interface/rsvoip.h" #include "interface/rsVOIP.h"
class VideoEncoder ; class VideoEncoder ;
class CvCapture ; class CvCapture ;
@ -12,7 +12,7 @@ class CvCapture ;
class QVideoOutputDevice: public QLabel class QVideoOutputDevice: public QLabel
{ {
public: public:
QVideoOutputDevice(QWidget *parent) ; QVideoOutputDevice(QWidget *parent = 0) ;
void showFrame(const QImage&) ; void showFrame(const QImage&) ;
void showFrameOff() ; void showFrameOff() ;
@ -26,7 +26,7 @@ class QVideoInputDevice: public QObject
Q_OBJECT Q_OBJECT
public: public:
QVideoInputDevice(QWidget *parent) ; QVideoInputDevice(QWidget *parent = 0) ;
~QVideoInputDevice() ; ~QVideoInputDevice() ;
// Captured images are sent to this encoder. Can be NULL. // Captured images are sent to this encoder. Can be NULL.
@ -40,7 +40,7 @@ class QVideoInputDevice: public QObject
// get the next encoded video data chunk. // get the next encoded video data chunk.
// //
bool getNextEncodedPacket(RsVoipDataChunk&) ; bool getNextEncodedPacket(RsVOIPDataChunk&) ;
void start() ; void start() ;
void stop() ; void stop() ;
@ -58,6 +58,6 @@ class QVideoInputDevice: public QObject
QVideoOutputDevice *_echo_output_device ; QVideoOutputDevice *_echo_output_device ;
std::list<RsVoipDataChunk> _out_queue ; std::list<RsVOIPDataChunk> _out_queue ;
}; };

View File

@ -12,7 +12,7 @@
#include <QDateTime> #include <QDateTime>
#include <limits.h> #include <limits.h>
#include "interface/rsvoip.h" #include "interface/rsVOIP.h"
//#include "gui/settings/rsharesettings.h" //#include "gui/settings/rsharesettings.h"
@ -165,7 +165,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
iArg = -60; iArg = -60;
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_DECREMENT, &iArg); speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_DECREMENT, &iArg);
iArg = rsVoip->getVoipiNoiseSuppress(); iArg = rsVOIP->getVoipiNoiseSuppress();
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg); speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
if (echo_state) { if (echo_state) {
@ -177,18 +177,18 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
bResetProcessor = false; bResetProcessor = false;
} }
float v = 30000.0f / static_cast<float>(rsVoip->getVoipiMinLoudness()); float v = 30000.0f / static_cast<float>(rsVOIP->getVoipiMinLoudness());
iArg = iroundf(floorf(20.0f * log10f(v))); iArg = iroundf(floorf(20.0f * log10f(v)));
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &iArg); speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &iArg);
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_GET_AGC_GAIN, &iArg); speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_GET_AGC_GAIN, &iArg);
float gainValue = static_cast<float>(iArg); float gainValue = static_cast<float>(iArg);
iArg = rsVoip->getVoipiNoiseSuppress() - iArg; iArg = rsVOIP->getVoipiNoiseSuppress() - iArg;
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg); speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
short * psSource = psMic; short * psSource = psMic;
if (echo_state && rsVoip->getVoipEchoCancel()) { if (echo_state && rsVOIP->getVoipEchoCancel()) {
speex_echo_playback(echo_state, (short*)lastEchoFrame->data()); speex_echo_playback(echo_state, (short*)lastEchoFrame->data());
speex_echo_capture(echo_state,psMic,psClean); speex_echo_capture(echo_state,psMic,psClean);
psSource = psClean; psSource = psClean;
@ -212,29 +212,29 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
bool bIsSpeech = false; bool bIsSpeech = false;
if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmax()) / 32767)) if (dVoiceAcivityLevel > (static_cast<float>(rsVOIP->getVoipfVADmax()) / 32767))
bIsSpeech = true; bIsSpeech = true;
else if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmin()) / 32767) && bPreviousVoice) else if (dVoiceAcivityLevel > (static_cast<float>(rsVOIP->getVoipfVADmin()) / 32767) && bPreviousVoice)
bIsSpeech = true; bIsSpeech = true;
if (! bIsSpeech) { if (! bIsSpeech) {
iHoldFrames++; iHoldFrames++;
if (iHoldFrames < rsVoip->getVoipVoiceHold()) if (iHoldFrames < rsVOIP->getVoipVoiceHold())
bIsSpeech = true; bIsSpeech = true;
} else { } else {
iHoldFrames = 0; iHoldFrames = 0;
} }
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitContinous) { if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitContinous) {
bIsSpeech = true; bIsSpeech = true;
} }
else if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitPushToTalk) else if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitPushToTalk)
bIsSpeech = false;//g.s.uiDoublePush && ((g.uiDoublePush < g.s.uiDoublePush) || (g.tDoublePush.elapsed() < g.s.uiDoublePush)); bIsSpeech = false;//g.s.uiDoublePush && ((g.uiDoublePush < g.s.uiDoublePush) || (g.tDoublePush.elapsed() < g.s.uiDoublePush));
//bIsSpeech = bIsSpeech || (g.iPushToTalk > 0); //bIsSpeech = bIsSpeech || (g.iPushToTalk > 0);
/*if (g.s.bMute || ((g.s.lmLoopMode != RsVoip::Local) && p && (p->bMute || p->bSuppress)) || g.bPushToMute || (g.iTarget < 0)) { /*if (g.s.bMute || ((g.s.lmLoopMode != RsVOIP::Local) && p && (p->bMute || p->bSuppress)) || g.bPushToMute || (g.iTarget < 0)) {
bIsSpeech = false; bIsSpeech = false;
}*/ }*/
@ -246,11 +246,11 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
/*if (p) { /*if (p) {
if (! bIsSpeech) if (! bIsSpeech)
p->setTalking(RsVoip::Passive); p->setTalking(RsVOIP::Passive);
else if (g.iTarget == 0) else if (g.iTarget == 0)
p->setTalking(RsVoip::Talking); p->setTalking(RsVOIP::Talking);
else else
p->setTalking(RsVoip::Shouting); p->setTalking(RsVOIP::Shouting);
}*/ }*/
@ -271,7 +271,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
int vbr_on=0; int vbr_on=0;
//just use fixed bitrate for now //just use fixed bitrate for now
//encryption of VBR-encoded speech may not ensure complete privacy, as phrases can still be identified, at least in a controlled setting with a small dictionary of phrases, by analysing the pattern of variation of the bit rate. //encryption of VBR-encoded speech may not ensure complete privacy, as phrases can still be identified, at least in a controlled setting with a small dictionary of phrases, by analysing the pattern of variation of the bit rate.
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitVAD) {//maybe we can do fixer bitrate when voice detection is active if (rsVOIP->getVoipATransmit() == RsVOIP::AudioTransmitVAD) {//maybe we can do fixer bitrate when voice detection is active
vbr_on = 1;//test it on for all modes vbr_on = 1;//test it on for all modes
} else {//maybe we can do vbr for ppt and continuous } else {//maybe we can do vbr for ppt and continuous
vbr_on = 1; vbr_on = 1;
@ -370,7 +370,7 @@ bool SpeexInputProcessor::isSequential() const {
} }
void SpeexInputProcessor::addEchoFrame(QByteArray* echo_frame) { void SpeexInputProcessor::addEchoFrame(QByteArray* echo_frame) {
if (rsVoip->getVoipEchoCancel() && echo_frame) { if (rsVOIP->getVoipEchoCancel() && echo_frame) {
QMutexLocker l(&qmSpeex); QMutexLocker l(&qmSpeex);
lastEchoFrame = echo_frame; lastEchoFrame = echo_frame;
if (!echo_state) {//init echo_state if (!echo_state) {//init echo_state

View File

@ -3,8 +3,7 @@
* Copyright (C) 2010 Peter Zotov * Copyright (C) 2010 Peter Zotov
*/ */
#ifndef SPEEXPROCESSOR_H #pragma once
#define SPEEXPROCESSOR_H
#include <iostream> #include <iostream>
@ -117,5 +116,3 @@ namespace QtSpeex {
int speex_jitter_get_pointer_timestamp(SpeexJitter jitter); int speex_jitter_get_pointer_timestamp(SpeexJitter jitter);
}; };
} }
#endif // SPEEXPROCESSOR_H

View File

@ -1,10 +1,30 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <QToolButton> #include <QToolButton>
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <QIcon> #include <QIcon>
#include <QLayout> #include <QLayout>
#include <gui/audiodevicehelper.h> #include <gui/audiodevicehelper.h>
#include "interface/rsvoip.h" #include "interface/rsVOIP.h"
#include "gui/SoundManager.h" #include "gui/SoundManager.h"
#include "util/HandleRichText.h" #include "util/HandleRichText.h"
#include "gui/common/StatusDefs.h" #include "gui/common/StatusDefs.h"
@ -135,11 +155,11 @@ VOIPChatWidgetHolder::~VOIPChatWidgetHolder()
delete inputVideoDevice ; delete inputVideoDevice ;
delete inputVideoProcessor ; delete inputVideoProcessor ;
delete outputVideoProcessor ; delete outputVideoProcessor ;
button_map::iterator it = buttonMapTakeVideo.begin(); button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) { while (it != buttonMapTakeVideo.end()) {
it = buttonMapTakeVideo.erase(it); it = buttonMapTakeVideo.erase(it);
} }
} }
void VOIPChatWidgetHolder::toggleAudioListen() void VOIPChatWidgetHolder::toggleAudioListen()
@ -209,13 +229,13 @@ void VOIPChatWidgetHolder::toggleAudioCapture()
hangupButton->hide(); hangupButton->hide();
} }
} }
void VOIPChatWidgetHolder::startVideoCapture() void VOIPChatWidgetHolder::startVideoCapture()
{ {
videoCaptureToggleButton->setChecked(true); videoCaptureToggleButton->setChecked(true);
toggleVideoCapture(); toggleVideoCapture();
} }
void VOIPChatWidgetHolder::toggleVideoCapture() void VOIPChatWidgetHolder::toggleVideoCapture()
{ {
if (videoCaptureToggleButton->isChecked()) if (videoCaptureToggleButton->isChecked())
@ -228,15 +248,15 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
videoCaptureToggleButton->setToolTip(tr("Shut camera off")); videoCaptureToggleButton->setToolTip(tr("Shut camera off"));
if (mChatWidget) if (mChatWidget)
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("You're now sending video..."), ChatWidget::MSGTYPE_SYSTEM); , tr("You're now sending video..."), ChatWidget::MSGTYPE_SYSTEM);
button_map::iterator it = buttonMapTakeVideo.begin(); button_map::iterator it = buttonMapTakeVideo.begin();
while (it != buttonMapTakeVideo.end()) { while (it != buttonMapTakeVideo.end()) {
RSButtonOnText *button = it.value(); RSButtonOnText *button = it.value();
delete button; delete button;
it = buttonMapTakeVideo.erase(it); it = buttonMapTakeVideo.erase(it);
} }
} }
else else
{ {
@ -246,69 +266,69 @@ void VOIPChatWidgetHolder::toggleVideoCapture()
videoWidget->hide(); videoWidget->hide();
if (mChatWidget) if (mChatWidget)
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM); , tr("Video call stopped"), ChatWidget::MSGTYPE_SYSTEM);
} }
} }
void VOIPChatWidgetHolder::addVideoData(const QString name, QByteArray* array) void VOIPChatWidgetHolder::addVideoData(const QString name, QByteArray* array)
{ {
outputVideoProcessor->receiveEncodedData((unsigned char *)array->data(),array->size()) ; outputVideoProcessor->receiveEncodedData((unsigned char *)array->data(),array->size()) ;
if (!videoCaptureToggleButton->isChecked()) { if (!videoCaptureToggleButton->isChecked()) {
if (mChatWidget) { if (mChatWidget) {
QString buttonName = name; QString buttonName = name;
if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId if (buttonName.isEmpty()) buttonName = "VoIP";//TODO maybe change all with GxsId
button_map::iterator it = buttonMapTakeVideo.find(buttonName); button_map::iterator it = buttonMapTakeVideo.find(buttonName);
if (it == buttonMapTakeVideo.end()){ if (it == buttonMapTakeVideo.end()){
mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime() mChatWidget->addChatMsg(true, tr("VoIP Status"), QDateTime::currentDateTime(), QDateTime::currentDateTime()
, tr("Video call from: %1").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM); , tr("Video call from: %1").arg(buttonName), ChatWidget::MSGTYPE_SYSTEM);
RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Take Video Call")); RSButtonOnText *button = mChatWidget->getNewButtonOnTextBrowser(tr("Take Video Call"));
button->setToolTip(tr("Activate camera")); button->setToolTip(tr("Activate camera"));
button->setStyleSheet(QString("background-color: green;") button->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;") .append("border-style: outset;")
.append("border-width: 5px;") .append("border-width: 5px;")
.append("border-radius: 5px;") .append("border-radius: 5px;")
.append("border-color: beige;") .append("border-color: beige;")
); );
button->updateImage(); button->updateImage();
connect(button,SIGNAL(clicked()),this,SLOT(startVideoCapture())); connect(button,SIGNAL(clicked()),this,SLOT(startVideoCapture()));
connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter())); connect(button,SIGNAL(mouseEnter()),this,SLOT(botMouseEnter()));
connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave())); connect(button,SIGNAL(mouseLeave()),this,SLOT(botMouseLeave()));
buttonMapTakeVideo.insert(buttonName, button); buttonMapTakeVideo.insert(buttonName, button);
} }
} }
} }
} }
void VOIPChatWidgetHolder::botMouseEnter() void VOIPChatWidgetHolder::botMouseEnter()
{ {
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender()); RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){ if (source){
source->setStyleSheet(QString("background-color: red;") source->setStyleSheet(QString("background-color: red;")
.append("border-style: outset;") .append("border-style: outset;")
.append("border-width: 5px;") .append("border-width: 5px;")
.append("border-radius: 5px;") .append("border-radius: 5px;")
.append("border-color: beige;") .append("border-color: beige;")
); );
//source->setDown(true); //source->setDown(true);
} }
} }
void VOIPChatWidgetHolder::botMouseLeave() void VOIPChatWidgetHolder::botMouseLeave()
{ {
RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender()); RSButtonOnText *source = qobject_cast<RSButtonOnText *>(QObject::sender());
if (source){ if (source){
source->setStyleSheet(QString("background-color: green;") source->setStyleSheet(QString("background-color: green;")
.append("border-style: outset;") .append("border-style: outset;")
.append("border-width: 5px;") .append("border-width: 5px;")
.append("border-radius: 5px;") .append("border-radius: 5px;")
.append("border-color: beige;") .append("border-color: beige;")
); );
//source->setDown(false); //source->setDown(false);
} }
} }
void VOIPChatWidgetHolder::setAcceptedBandwidth(const QString name, uint32_t bytes_per_sec) void VOIPChatWidgetHolder::setAcceptedBandwidth(const QString name, uint32_t bytes_per_sec)
@ -377,21 +397,21 @@ void VOIPChatWidgetHolder::addAudioData(const QString name, QByteArray* array)
void VOIPChatWidgetHolder::sendVideoData() void VOIPChatWidgetHolder::sendVideoData()
{ {
RsVoipDataChunk chunk ; RsVOIPDataChunk chunk ;
while(inputVideoDevice && inputVideoDevice->getNextEncodedPacket(chunk)) while(inputVideoDevice && inputVideoDevice->getNextEncodedPacket(chunk))
rsVoip->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk) ; rsVOIP->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk) ;
} }
void VOIPChatWidgetHolder::sendAudioData() void VOIPChatWidgetHolder::sendAudioData()
{ {
while(inputAudioProcessor && inputAudioProcessor->hasPendingPackets()) { while(inputAudioProcessor && inputAudioProcessor->hasPendingPackets()) {
QByteArray qbarray = inputAudioProcessor->getNetworkPacket(); QByteArray qbarray = inputAudioProcessor->getNetworkPacket();
RsVoipDataChunk chunk; RsVOIPDataChunk chunk;
chunk.size = qbarray.size(); chunk.size = qbarray.size();
chunk.data = (void*)qbarray.constData(); chunk.data = (void*)qbarray.constData();
chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_AUDIO ; chunk.type = RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO ;
rsVoip->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk); rsVOIP->sendVoipData(mChatWidget->getChatId().toPeerId(),chunk);
} }
} }

View File

@ -1,8 +1,31 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#pragma once
#include <QObject> #include <QObject>
#include <QGraphicsEffect> #include <QGraphicsEffect>
#include <gui/SpeexProcessor.h> #include <gui/SpeexProcessor.h>
#include <gui/chat/ChatWidget.h> #include <gui/chat/ChatWidget.h>
#include <gui/common/RsButtonOnText.h> #include <gui/common/RsButtonOnText.h>
class QToolButton; class QToolButton;
class QAudioInput; class QAudioInput;
@ -32,10 +55,10 @@ private slots:
void toggleAudioListen(); void toggleAudioListen();
void toggleAudioCapture(); void toggleAudioCapture();
void toggleVideoCapture(); void toggleVideoCapture();
void startVideoCapture(); void startVideoCapture();
void hangupCall() ; void hangupCall() ;
void botMouseEnter(); void botMouseEnter();
void botMouseLeave(); void botMouseLeave();
public slots: public slots:
void sendAudioData(); void sendAudioData();
@ -64,8 +87,8 @@ protected:
QToolButton *audioCaptureToggleButton ; QToolButton *audioCaptureToggleButton ;
QToolButton *videoCaptureToggleButton ; QToolButton *videoCaptureToggleButton ;
QToolButton *hangupButton ; QToolButton *hangupButton ;
typedef QMap<QString, RSButtonOnText*> button_map; typedef QMap<QString, RSButtonOnText*> button_map;
button_map buttonMapTakeVideo; button_map buttonMapTakeVideo;
}; };

View File

@ -0,0 +1,122 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include <iostream>
#include <vector>
#include <list>
#include <interface/rsVOIP.h>
#include "VOIPGUIHandler.h"
#include <gui/chat/ChatDialog.h>
#include <gui/VOIPChatWidgetHolder.h>
#include "gui/chat/ChatWidget.h"
#include "gui/settings/rsharesettings.h"
void VOIPGUIHandler::ReceivedInvitation(const QString& /*peer_id*/)
{
std::cerr << "****** VOIPGUIHandler: received Invitation!" << std::endl;
}
void VOIPGUIHandler::ReceivedVoipHangUp(const QString& /*peer_id*/)
{
std::cerr << "****** VOIPGUIHandler: received HangUp!" << std::endl;
}
void VOIPGUIHandler::ReceivedVoipAccept(const QString& /*peer_id*/)
{
std::cerr << "****** VOIPGUIHandler: received VoipAccept!" << std::endl;
}
void VOIPGUIHandler::ReceivedVoipData(const QString& qpeer_id)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
std::vector<RsVOIPDataChunk> chunks ;
if(!rsVOIP->getIncomingData(peer_id,chunks))
{
std::cerr << "VOIPGUIHandler::ReceivedVoipData(): No data chunks to get. Weird!" << std::endl;
return ;
}
ChatDialog *di = ChatDialog::getChat(ChatId(peer_id), Settings->getChatFlags());
if (di) {
ChatWidget *cw = di->getChatWidget();
if (cw) {
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh) {
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);
if(chunks[chunkIndex].type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO)
acwh->addAudioData(QString::fromStdString(peer_id.toStdString()),&qb);
else if(chunks[chunkIndex].type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_VIDEO)
acwh->addVideoData(QString::fromStdString(peer_id.toStdString()),&qb);
else
std::cerr << "VOIPGUIHandler: Unknown data type received. type=" << chunks[chunkIndex].type << std::endl;
}
}
break;
}
}
}
} else {
std::cerr << "VOIPGUIHandler Error: received audio data for a chat dialog that does not stand Audio (Peer id = " << peer_id.toStdString() << "!" << std::endl;
}
for(unsigned int chunkIndex=0; chunkIndex<chunks.size(); chunkIndex++){
free(chunks[chunkIndex].data);
}
}
void VOIPGUIHandler::ReceivedVoipBandwidthInfo(const QString& qpeer_id,int bytes_per_sec)
{
RsPeerId peer_id(qpeer_id.toStdString()) ;
ChatDialog *di = ChatDialog::getExistingChat(ChatId(peer_id)) ;
std::cerr << "VOIPGUIHandler::received bw info for peer " << qpeer_id.toStdString() << ": " << bytes_per_sec << " Bps" << std::endl;
if(!di)
{
std::cerr << "VOIPGUIHandler Error: received bandwidth info for a chat dialog that does not stand VOIP (Peer id = " << peer_id.toStdString() << "!" << std::endl;
return ;
}
ChatWidget *cw = di->getChatWidget();
if(!cw)
{
return ;
}
const QList<ChatWidgetHolder*> &chatWidgetHolderList = cw->chatWidgetHolderList();
foreach (ChatWidgetHolder *chatWidgetHolder, chatWidgetHolderList)
{
VOIPChatWidgetHolder *acwh = dynamic_cast<VOIPChatWidgetHolder*>(chatWidgetHolder) ;
if (acwh)
acwh->setAcceptedBandwidth(QString::fromStdString(peer_id.toStdString()),bytes_per_sec);
}
}

View File

@ -0,0 +1,44 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
// This class receives async-ed signals from the plugin notifier,
// and executes GUI requests.
//
// It is never called directly: it is called by Qt signal-received callback,
// in the main GUI thread.
//
#pragma once
#include <stdint.h>
#include <QObject>
class VOIPGUIHandler: public QObject
{
Q_OBJECT
public slots:
void ReceivedInvitation(const QString& peer_id) ;
void ReceivedVoipData(const QString& peer_id) ;
void ReceivedVoipHangUp(const QString& peer_id) ;
void ReceivedVoipAccept(const QString& peer_id) ;
void ReceivedVoipBandwidthInfo(const QString& peer_id,int) ;
};

View File

@ -0,0 +1,43 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#include "VOIPNotify.h"
void VOIPNotify::notifyReceivedVoipInvite(const RsPeerId& peer_id)
{
emit voipInvitationReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipData(const RsPeerId &peer_id)
{
emit voipDataReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipAccept(const RsPeerId& peer_id)
{
emit voipAcceptReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipHangUp(const RsPeerId &peer_id)
{
emit voipHangUpReceived(QString::fromStdString(peer_id.toStdString())) ;
}
void VOIPNotify::notifyReceivedVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec)
{
emit voipBandwidthInfoReceived(QString::fromStdString(peer_id.toStdString()),bytes_per_sec) ;
}

View File

@ -1,3 +1,24 @@
/****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
// This class is a Qt object to get notification from the plugin's service threads, // This class is a Qt object to get notification from the plugin's service threads,
// and responsible to pass the info the the GUI part. // and responsible to pass the info the the GUI part.
// //
@ -5,10 +26,12 @@
// QObject connect system to communicate between the p3Service and the gui part (handled by Qt) // QObject connect system to communicate between the p3Service and the gui part (handled by Qt)
// //
#pragma once
#include <QObject> #include <QObject>
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
class PluginNotifier: public QObject class VOIPNotify: public QObject
{ {
Q_OBJECT Q_OBJECT

View File

@ -19,7 +19,7 @@ bool VideoEncoder::addImage(const QImage& img)
return true ; return true ;
} }
bool VideoEncoder::nextPacket(RsVoipDataChunk& chunk) bool VideoEncoder::nextPacket(RsVOIPDataChunk& chunk)
{ {
if(_out_queue.empty()) if(_out_queue.empty())
return false ; return false ;
@ -62,11 +62,11 @@ void JPEGVideoEncoder::encodeData(const QImage& image)
buffer.open(QIODevice::WriteOnly) ; buffer.open(QIODevice::WriteOnly) ;
image.save(&buffer,"JPEG") ; image.save(&buffer,"JPEG") ;
RsVoipDataChunk voip_chunk ; RsVOIPDataChunk voip_chunk ;
voip_chunk.data = malloc(qb.size()); voip_chunk.data = malloc(qb.size());
memcpy(voip_chunk.data,qb.data(),qb.size()) ; memcpy(voip_chunk.data,qb.data(),qb.size()) ;
voip_chunk.size = qb.size() ; voip_chunk.size = qb.size() ;
voip_chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO ; voip_chunk.type = RsVOIPDataChunk::RS_VOIP_DATA_TYPE_VIDEO ;
_out_queue.push_back(voip_chunk) ; _out_queue.push_back(voip_chunk) ;
} }

View File

@ -2,7 +2,7 @@
#include <stdint.h> #include <stdint.h>
#include <QImage> #include <QImage>
#include "interface/rsvoip.h" #include "interface/rsVOIP.h"
class QVideoOutputDevice ; class QVideoOutputDevice ;
@ -43,7 +43,7 @@ class VideoDecoder
}; };
// This class encodes video using a video codec (possibly homemade, or based on existing codecs) // This class encodes video using a video codec (possibly homemade, or based on existing codecs)
// and produces a data stream that is sent to the network transfer service (e.g. p3VoRs). // and produces a data stream that is sent to the network transfer service (e.g. p3VOIP).
// //
class VideoEncoder class VideoEncoder
{ {
@ -55,7 +55,7 @@ class VideoEncoder
bool addImage(const QImage& Image) ; bool addImage(const QImage& Image) ;
bool packetReady() const { return !_out_queue.empty() ; } bool packetReady() const { return !_out_queue.empty() ; }
bool nextPacket(RsVoipDataChunk& ) ; bool nextPacket(RsVOIPDataChunk& ) ;
// Used to tweak the compression ratio so that the video can stream ok. // Used to tweak the compression ratio so that the video can stream ok.
// //
@ -65,7 +65,7 @@ class VideoEncoder
//virtual bool sendEncodedData(unsigned char *mem,uint32_t size) = 0 ; //virtual bool sendEncodedData(unsigned char *mem,uint32_t size) = 0 ;
virtual void encodeData(const QImage& image) = 0 ; virtual void encodeData(const QImage& image) = 0 ;
std::list<RsVoipDataChunk> _out_queue ; std::list<RsVOIPDataChunk> _out_queue ;
}; };
// Now derive various image encoding/decoding algorithms. // Now derive various image encoding/decoding algorithms.

View File

@ -1,5 +1,5 @@
#ifndef AUDIODEVICEHELPER_H #pragma once
#define AUDIODEVICEHELPER_H
#include <QAudioInput> #include <QAudioInput>
#include <QAudioOutput> #include <QAudioOutput>
@ -15,5 +15,3 @@ public:
static QAudioOutput* getPreferedOutputDevice(); static QAudioOutput* getPreferedOutputDevice();
//static list getOutputDeviceList(); //static list getOutputDeviceList();
}; };
#endif // AUDIODEVICEHELPER_H

View File

@ -1,4 +1,25 @@
// interface class for p3Voip service /****************************************************************
* RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
// interface class for p3VOIP service
// //
#pragma once #pragma once
@ -9,18 +30,18 @@
#include <vector> #include <vector>
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
class RsVoip ; class RsVOIP ;
extern RsVoip *rsVoip; extern RsVOIP *rsVOIP;
static const uint32_t CONFIG_TYPE_VOIP_PLUGIN = 0xe001 ; static const uint32_t CONFIG_TYPE_VOIP_PLUGIN = 0xe001 ;
class RsVoipPongResult class RsVOIPPongResult
{ {
public: public:
RsVoipPongResult() RsVOIPPongResult()
:mTS(0), mRTT(0), mOffset(0) { return; } :mTS(0), mRTT(0), mOffset(0) { return; }
RsVoipPongResult(double ts, double rtt, double offset) RsVOIPPongResult(double ts, double rtt, double offset)
:mTS(ts), mRTT(rtt), mOffset(offset) { return; } :mTS(ts), mRTT(rtt), mOffset(offset) { return; }
double mTS; double mTS;
@ -28,16 +49,16 @@ class RsVoipPongResult
double mOffset; double mOffset;
}; };
struct RsVoipDataChunk struct RsVOIPDataChunk
{ {
typedef enum { RS_VOIP_DATA_TYPE_AUDIO, RS_VOIP_DATA_TYPE_VIDEO } RsVoipDataType ; typedef enum { RS_VOIP_DATA_TYPE_AUDIO, RS_VOIP_DATA_TYPE_VIDEO } RsVOIPDataType ;
void *data ; // create/delete using malloc/free. void *data ; // create/delete using malloc/free.
uint32_t size ; uint32_t size ;
RsVoipDataType type ; // video or audio RsVOIPDataType type ; // video or audio
}; };
class RsVoip class RsVOIP
{ {
public: public:
virtual int sendVoipHangUpCall(const RsPeerId& peer_id) = 0; virtual int sendVoipHangUpCall(const RsPeerId& peer_id) = 0;
@ -45,12 +66,12 @@ class RsVoip
virtual int sendVoipAcceptCall(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. // Sending data. The client keeps the memory ownership and must delete it after calling this.
virtual int sendVoipData(const RsPeerId& 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 // 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. // in each chunk once it has been used.
// //
virtual bool getIncomingData(const RsPeerId& 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 ; typedef enum { AudioTransmitContinous = 0, AudioTransmitVAD = 1, AudioTransmitPushToTalk = 2 } enumAudioTransmit ;
@ -71,7 +92,7 @@ class RsVoip
virtual bool getVoipEchoCancel() const = 0 ; virtual bool getVoipEchoCancel() const = 0 ;
virtual void setVoipEchoCancel(bool) = 0 ; virtual void setVoipEchoCancel(bool) = 0 ;
virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsVoipPongResult> &results) = 0; virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsVOIPPongResult> &results) = 0;
}; };

View File

@ -1,27 +1,23 @@
/* /****************************************************************
* libretroshare/src/services p3vors.cc * RetroShare is distributed under the following license:
* *
* Voice Over Retroshare Service for RetroShare. * Copyright (C) 2015
* *
* Copyright 2011-2011 by Robert Fernie. * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* This library is free software; you can redistribute it and/or * This program is distributed in the hope that it will be useful,
* modify it under the terms of the GNU Library General Public * but WITHOUT ANY WARRANTY; without even the implied warranty of
* License Version 2 as published by the Free Software Foundation. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* This library is distributed in the hope that it will be useful, * You should have received a copy of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of * along with this program; if not, write to the Free Software
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Library General Public License for more details. * Boston, MA 02110-1301, USA.
* ****************************************************************/
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include "util/rsdir.h" #include "util/rsdir.h"
#include "retroshare/rsiface.h" #include "retroshare/rsiface.h"
@ -33,23 +29,23 @@
#include <sstream> // for std::istringstream #include <sstream> // for std::istringstream
#include "services/p3vors.h" #include "services/p3VOIP.h"
#include "services/rsvoipitems.h" #include "services/rsVOIPItems.h"
#include "gui/PluginNotifier.h" #include "gui/VOIPNotify.h"
#include <sys/time.h> #include <sys/time.h>
/**** /****
* #define DEBUG_VORS 1 * #define DEBUG_VOIP 1
****/ ****/
/* DEFINE INTERFACE POINTER! */ /* DEFINE INTERFACE POINTER! */
RsVoip *rsVoip = NULL; RsVOIP *rsVOIP = NULL;
#define MAX_PONG_RESULTS 150 #define MAX_PONG_RESULTS 150
#define VORS_PING_PERIOD 10 #define VOIP_PING_PERIOD 10
#define VORS_BANDWIDTH_PERIOD 5 #define VOIP_BANDWIDTH_PERIOD 5
/************ IMPLEMENTATION NOTES ********************************* /************ IMPLEMENTATION NOTES *********************************
* *
@ -116,10 +112,10 @@ static double convert64bitsToTs(uint64_t bits)
return ts; return ts;
} }
p3VoRS::p3VoRS(RsPluginHandler *handler,PluginNotifier *notifier) p3VOIP::p3VOIP(RsPluginHandler *handler,VOIPNotify *notifier)
: RsPQIService(RS_SERVICE_TYPE_VOIP_PLUGIN,0,handler), mVorsMtx("p3VoRS"), mServiceControl(handler->getServiceControl()) , mNotify(notifier) : RsPQIService(RS_SERVICE_TYPE_VOIP_PLUGIN,0,handler), mVOIPMtx("p3VOIP"), mServiceControl(handler->getServiceControl()) , mNotify(notifier)
{ {
addSerialType(new RsVoipSerialiser()); addSerialType(new RsVOIPSerialiser());
mSentPingTime = 0; mSentPingTime = 0;
mSentBandwidthInfoTime = 0; mSentBandwidthInfoTime = 0;
@ -135,7 +131,7 @@ p3VoRS::p3VoRS(RsPluginHandler *handler,PluginNotifier *notifier)
_echo_cancel = true; _echo_cancel = true;
} }
RsServiceInfo p3VoRS::getServiceInfo() RsServiceInfo p3VOIP::getServiceInfo()
{ {
const std::string TURTLE_APP_NAME = "VOIP"; const std::string TURTLE_APP_NAME = "VOIP";
const uint16_t TURTLE_APP_MAJOR_VERSION = 1; const uint16_t TURTLE_APP_MAJOR_VERSION = 1;
@ -151,10 +147,10 @@ RsServiceInfo p3VoRS::getServiceInfo()
TURTLE_MIN_MINOR_VERSION); TURTLE_MIN_MINOR_VERSION);
} }
int p3VoRS::tick() int p3VOIP::tick()
{ {
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "ticking p3VoRS" << std::endl; std::cerr << "ticking p3VOIP" << std::endl;
#endif #endif
//processIncoming(); //processIncoming();
@ -163,48 +159,48 @@ int p3VoRS::tick()
return 0; return 0;
} }
int p3VoRS::status() int p3VOIP::status()
{ {
return 1; return 1;
} }
int p3VoRS::sendPackets() int p3VOIP::sendPackets()
{ {
time_t now = time(NULL); time_t now = time(NULL);
time_t pt; time_t pt;
time_t pt2; time_t pt2;
{ {
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
pt = mSentPingTime; pt = mSentPingTime;
pt2 = mSentBandwidthInfoTime; pt2 = mSentBandwidthInfoTime;
} }
if (now > pt + VORS_PING_PERIOD) if (now > pt + VOIP_PING_PERIOD)
{ {
sendPingMeasurements(); sendPingMeasurements();
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
mSentPingTime = now; mSentPingTime = now;
} }
if (now > pt2 + VORS_BANDWIDTH_PERIOD) if (now > pt2 + VOIP_BANDWIDTH_PERIOD)
{ {
sendBandwidthInfo(); sendBandwidthInfo();
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
mSentBandwidthInfoTime = now; mSentBandwidthInfoTime = now;
} }
return true ; return true ;
} }
void p3VoRS::sendBandwidthInfo() void p3VOIP::sendBandwidthInfo()
{ {
std::set<RsPeerId> onlineIds; std::set<RsPeerId> onlineIds;
mServiceControl->getPeersConnected(getServiceInfo().mServiceType, onlineIds); mServiceControl->getPeersConnected(getServiceInfo().mServiceType, onlineIds);
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
for(std::map<RsPeerId,VorsPeerInfo>::iterator it(mPeerInfo.begin());it!=mPeerInfo.end();++it) for(std::map<RsPeerId,VOIPPeerInfo>::iterator it(mPeerInfo.begin());it!=mPeerInfo.end();++it)
{ {
it->second.average_incoming_bandwidth = 0.75 * it->second.average_incoming_bandwidth + 0.25 * it->second.total_bytes_received / VORS_BANDWIDTH_PERIOD ; it->second.average_incoming_bandwidth = 0.75 * it->second.average_incoming_bandwidth + 0.25 * it->second.total_bytes_received / VOIP_BANDWIDTH_PERIOD ;
it->second.total_bytes_received = 0 ; it->second.total_bytes_received = 0 ;
if(onlineIds.find(it->first) == onlineIds.end() || it->second.average_incoming_bandwidth == 0) if(onlineIds.find(it->first) == onlineIds.end() || it->second.average_incoming_bandwidth == 0)
@ -215,11 +211,11 @@ void p3VoRS::sendBandwidthInfo()
} }
} }
int p3VoRS::sendVoipHangUpCall(const RsPeerId &peer_id) int p3VOIP::sendVoipHangUpCall(const RsPeerId &peer_id)
{ {
RsVoipProtocolItem *item = new RsVoipProtocolItem ; RsVOIPProtocolItem *item = new RsVOIPProtocolItem ;
item->protocol = RsVoipProtocolItem::VoipProtocol_Close; item->protocol = RsVOIPProtocolItem::VoipProtocol_Close;
item->flags = 0 ; item->flags = 0 ;
item->PeerId(peer_id) ; item->PeerId(peer_id) ;
@ -227,11 +223,11 @@ int p3VoRS::sendVoipHangUpCall(const RsPeerId &peer_id)
return true ; return true ;
} }
int p3VoRS::sendVoipAcceptCall(const RsPeerId& peer_id) int p3VOIP::sendVoipAcceptCall(const RsPeerId& peer_id)
{ {
RsVoipProtocolItem *item = new RsVoipProtocolItem ; RsVOIPProtocolItem *item = new RsVOIPProtocolItem ;
item->protocol = RsVoipProtocolItem::VoipProtocol_Ackn ; item->protocol = RsVOIPProtocolItem::VoipProtocol_Ackn ;
item->flags = 0 ; item->flags = 0 ;
item->PeerId(peer_id) ; item->PeerId(peer_id) ;
@ -239,11 +235,11 @@ int p3VoRS::sendVoipAcceptCall(const RsPeerId& peer_id)
return true ; return true ;
} }
int p3VoRS::sendVoipRinging(const RsPeerId &peer_id) int p3VOIP::sendVoipRinging(const RsPeerId &peer_id)
{ {
RsVoipProtocolItem *item = new RsVoipProtocolItem ; RsVOIPProtocolItem *item = new RsVOIPProtocolItem ;
item->protocol = RsVoipProtocolItem::VoipProtocol_Ring ; item->protocol = RsVOIPProtocolItem::VoipProtocol_Ring ;
item->flags = 0 ; item->flags = 0 ;
item->PeerId(peer_id) ; item->PeerId(peer_id) ;
@ -251,11 +247,11 @@ int p3VoRS::sendVoipRinging(const RsPeerId &peer_id)
return true ; return true ;
} }
int p3VoRS::sendVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec) int p3VOIP::sendVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec)
{ {
RsVoipProtocolItem *item = new RsVoipProtocolItem ; RsVOIPProtocolItem *item = new RsVOIPProtocolItem ;
item->protocol = RsVoipProtocolItem::VoipProtocol_Bandwidth ; item->protocol = RsVOIPProtocolItem::VoipProtocol_Bandwidth ;
item->flags = bytes_per_sec ; item->flags = bytes_per_sec ;
item->PeerId(peer_id) ; item->PeerId(peer_id) ;
@ -263,24 +259,24 @@ int p3VoRS::sendVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec)
return true ; return true ;
} }
int p3VoRS::sendVoipData(const RsPeerId& peer_id,const RsVoipDataChunk& chunk) int p3VOIP::sendVoipData(const RsPeerId& peer_id,const RsVOIPDataChunk& chunk)
{ {
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "Sending " << chunk.size << " bytes of voip data." << std::endl; std::cerr << "Sending " << chunk.size << " bytes of voip data." << std::endl;
#endif #endif
RsVoipDataItem *item = new RsVoipDataItem ; RsVOIPDataItem *item = new RsVOIPDataItem ;
if(!item) if(!item)
{ {
std::cerr << "Cannot allocate RsVoipDataItem !" << std::endl; std::cerr << "Cannot allocate RsVOIPDataItem !" << std::endl;
return false ; return false ;
} }
item->voip_data = malloc(chunk.size) ; item->voip_data = malloc(chunk.size) ;
if(item->voip_data == NULL) if(item->voip_data == NULL)
{ {
std::cerr << "Cannot allocate RsVoipDataItem.voip_data of size " << chunk.size << " !" << std::endl; std::cerr << "Cannot allocate RsVOIPDataItem.voip_data of size " << chunk.size << " !" << std::endl;
delete item ; delete item ;
return false ; return false ;
} }
@ -288,13 +284,13 @@ int p3VoRS::sendVoipData(const RsPeerId& peer_id,const RsVoipDataChunk& chunk)
item->PeerId(peer_id) ; item->PeerId(peer_id) ;
item->data_size = chunk.size; item->data_size = chunk.size;
if(chunk.type == RsVoipDataChunk::RS_VOIP_DATA_TYPE_AUDIO) if(chunk.type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO)
item->flags = RS_VOIP_FLAGS_AUDIO_DATA ; item->flags = RS_VOIP_FLAGS_AUDIO_DATA ;
else if(chunk.type == RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO) else if(chunk.type == RsVOIPDataChunk::RS_VOIP_DATA_TYPE_VIDEO)
item->flags = RS_VOIP_FLAGS_VIDEO_DATA ; item->flags = RS_VOIP_FLAGS_VIDEO_DATA ;
else else
{ {
std::cerr << "(EE) p3VoRs: cannot send chunk data. Unknown data type = " << chunk.type << std::endl; std::cerr << "(EE) p3VOIP: cannot send chunk data. Unknown data type = " << chunk.type << std::endl;
delete item ; delete item ;
return false ; return false ;
} }
@ -304,7 +300,7 @@ int p3VoRS::sendVoipData(const RsPeerId& peer_id,const RsVoipDataChunk& chunk)
return true ; return true ;
} }
void p3VoRS::sendPingMeasurements() void p3VOIP::sendPingMeasurements()
{ {
/* we ping our peers */ /* we ping our peers */
/* who is online? */ /* who is online? */
@ -316,8 +312,8 @@ void p3VoRS::sendPingMeasurements()
double ts = getCurrentTS(); double ts = getCurrentTS();
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::sendPingMeasurements() @ts: " << ts; std::cerr << "p3VOIP::sendPingMeasurements() @ts: " << ts;
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
@ -325,21 +321,21 @@ void p3VoRS::sendPingMeasurements()
std::set<RsPeerId>::iterator it; std::set<RsPeerId>::iterator it;
for(it = onlineIds.begin(); it != onlineIds.end(); it++) for(it = onlineIds.begin(); it != onlineIds.end(); it++)
{ {
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::sendPingMeasurements() Pinging: " << *it; std::cerr << "p3VOIP::sendPingMeasurements() Pinging: " << *it;
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
/* create the packet */ /* create the packet */
RsVoipPingItem *pingPkt = new RsVoipPingItem(); RsVOIPPingItem *pingPkt = new RsVOIPPingItem();
pingPkt->PeerId(*it); pingPkt->PeerId(*it);
pingPkt->mSeqNo = mCounter; pingPkt->mSeqNo = mCounter;
pingPkt->mPingTS = convertTsTo64bits(ts); pingPkt->mPingTS = convertTsTo64bits(ts);
storePingAttempt(*it, ts, mCounter); storePingAttempt(*it, ts, mCounter);
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::sendPingMeasurements() With Packet:"; std::cerr << "p3VOIP::sendPingMeasurements() With Packet:";
std::cerr << std::endl; std::cerr << std::endl;
pingPkt->print(std::cerr, 10); pingPkt->print(std::cerr, 10);
#endif #endif
@ -347,55 +343,55 @@ void p3VoRS::sendPingMeasurements()
sendItem(pingPkt); sendItem(pingPkt);
} }
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
mCounter++; mCounter++;
} }
void p3VoRS::handleProtocol(RsVoipProtocolItem *item) void p3VOIP::handleProtocol(RsVOIPProtocolItem *item)
{ {
// should we keep a list of received requests? // should we keep a list of received requests?
switch(item->protocol) switch(item->protocol)
{ {
case RsVoipProtocolItem::VoipProtocol_Ring: mNotify->notifyReceivedVoipInvite(item->PeerId()); case RsVOIPProtocolItem::VoipProtocol_Ring: mNotify->notifyReceivedVoipInvite(item->PeerId());
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handleProtocol(): Received protocol ring item." << std::endl; std::cerr << "p3VOIP::handleProtocol(): Received protocol ring item." << std::endl;
#endif #endif
break ; break ;
case RsVoipProtocolItem::VoipProtocol_Ackn: mNotify->notifyReceivedVoipAccept(item->PeerId()); case RsVOIPProtocolItem::VoipProtocol_Ackn: mNotify->notifyReceivedVoipAccept(item->PeerId());
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handleProtocol(): Received protocol accept call" << std::endl; std::cerr << "p3VOIP::handleProtocol(): Received protocol accept call" << std::endl;
#endif #endif
break ; break ;
case RsVoipProtocolItem::VoipProtocol_Close: mNotify->notifyReceivedVoipHangUp(item->PeerId()); case RsVOIPProtocolItem::VoipProtocol_Close: mNotify->notifyReceivedVoipHangUp(item->PeerId());
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handleProtocol(): Received protocol Close call." << std::endl; std::cerr << "p3VOIP::handleProtocol(): Received protocol Close call." << std::endl;
#endif #endif
break ; break ;
case RsVoipProtocolItem::VoipProtocol_Bandwidth: mNotify->notifyReceivedVoipBandwidth(item->PeerId(),(uint32_t)item->flags); case RsVOIPProtocolItem::VoipProtocol_Bandwidth: mNotify->notifyReceivedVoipBandwidth(item->PeerId(),(uint32_t)item->flags);
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handleProtocol(): Received protocol bandwidth. Value=" << item->flags << std::endl; std::cerr << "p3VOIP::handleProtocol(): Received protocol bandwidth. Value=" << item->flags << std::endl;
#endif #endif
break ; break ;
default: default:
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handleProtocol(): Received protocol item # " << item->protocol << ": not handled yet ! Sorry" << std::endl; std::cerr << "p3VOIP::handleProtocol(): Received protocol item # " << item->protocol << ": not handled yet ! Sorry" << std::endl;
#endif #endif
break ; break ;
} }
} }
void p3VoRS::handleData(RsVoipDataItem *item) void p3VOIP::handleData(RsVOIPDataItem *item)
{ {
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
// store the data in a queue. // store the data in a queue.
std::map<RsPeerId,VorsPeerInfo>::iterator it = mPeerInfo.find(item->PeerId()) ; std::map<RsPeerId,VOIPPeerInfo>::iterator it = mPeerInfo.find(item->PeerId()) ;
if(it == mPeerInfo.end()) if(it == mPeerInfo.end())
{ {
@ -413,33 +409,33 @@ void p3VoRS::handleData(RsVoipDataItem *item)
mNotify->notifyReceivedVoipData(item->PeerId()); mNotify->notifyReceivedVoipData(item->PeerId());
} }
bool p3VoRS::getIncomingData(const RsPeerId& peer_id,std::vector<RsVoipDataChunk>& incoming_data_chunks) bool p3VOIP::getIncomingData(const RsPeerId& peer_id,std::vector<RsVOIPDataChunk>& incoming_data_chunks)
{ {
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
incoming_data_chunks.clear() ; incoming_data_chunks.clear() ;
std::map<RsPeerId,VorsPeerInfo>::iterator it = mPeerInfo.find(peer_id) ; std::map<RsPeerId,VOIPPeerInfo>::iterator it = mPeerInfo.find(peer_id) ;
if(it == mPeerInfo.end()) if(it == mPeerInfo.end())
{ {
std::cerr << "Peer unknown to VOIP process. No data returned. Probably a bug !" << std::endl; std::cerr << "Peer unknown to VOIP process. No data returned. Probably a bug !" << std::endl;
return false ; return false ;
} }
for(std::list<RsVoipDataItem*>::const_iterator it2(it->second.incoming_queue.begin());it2!=it->second.incoming_queue.end();++it2) for(std::list<RsVOIPDataItem*>::const_iterator it2(it->second.incoming_queue.begin());it2!=it->second.incoming_queue.end();++it2)
{ {
RsVoipDataChunk chunk ; RsVOIPDataChunk chunk ;
chunk.size = (*it2)->data_size ; chunk.size = (*it2)->data_size ;
chunk.data = malloc((*it2)->data_size) ; chunk.data = malloc((*it2)->data_size) ;
uint32_t type_flags = (*it2)->flags & (RS_VOIP_FLAGS_AUDIO_DATA | RS_VOIP_FLAGS_VIDEO_DATA) ; uint32_t type_flags = (*it2)->flags & (RS_VOIP_FLAGS_AUDIO_DATA | RS_VOIP_FLAGS_VIDEO_DATA) ;
if(type_flags == RS_VOIP_FLAGS_AUDIO_DATA) if(type_flags == RS_VOIP_FLAGS_AUDIO_DATA)
chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_AUDIO ; chunk.type = RsVOIPDataChunk::RS_VOIP_DATA_TYPE_AUDIO ;
else if(type_flags == RS_VOIP_FLAGS_VIDEO_DATA) else if(type_flags == RS_VOIP_FLAGS_VIDEO_DATA)
chunk.type = RsVoipDataChunk::RS_VOIP_DATA_TYPE_VIDEO ; chunk.type = RsVOIPDataChunk::RS_VOIP_DATA_TYPE_VIDEO ;
else else
{ {
std::cerr << "(EE) p3VoRS::getIncomingData(): error. Cannot handle item with unknown type " << type_flags << std::endl; std::cerr << "(EE) p3VOIP::getIncomingData(): error. Cannot handle item with unknown type " << type_flags << std::endl;
delete *it2 ; delete *it2 ;
free(chunk.data) ; free(chunk.data) ;
continue ; continue ;
@ -457,7 +453,7 @@ bool p3VoRS::getIncomingData(const RsPeerId& peer_id,std::vector<RsVoipDataChunk
return true ; return true ;
} }
bool p3VoRS::recvItem(RsItem *item) bool p3VOIP::recvItem(RsItem *item)
{ {
/* pass to specific handler */ /* pass to specific handler */
bool keep = false ; bool keep = false ;
@ -465,19 +461,19 @@ bool p3VoRS::recvItem(RsItem *item)
switch(item->PacketSubType()) switch(item->PacketSubType())
{ {
case RS_PKT_SUBTYPE_VOIP_PING: case RS_PKT_SUBTYPE_VOIP_PING:
handlePing(dynamic_cast<RsVoipPingItem*>(item)); handlePing(dynamic_cast<RsVOIPPingItem*>(item));
break; break;
case RS_PKT_SUBTYPE_VOIP_PONG: case RS_PKT_SUBTYPE_VOIP_PONG:
handlePong(dynamic_cast<RsVoipPongItem*>(item)); handlePong(dynamic_cast<RsVOIPPongItem*>(item));
break; break;
case RS_PKT_SUBTYPE_VOIP_PROTOCOL: case RS_PKT_SUBTYPE_VOIP_PROTOCOL:
handleProtocol(dynamic_cast<RsVoipProtocolItem*>(item)) ; handleProtocol(dynamic_cast<RsVOIPProtocolItem*>(item)) ;
break ; break ;
case RS_PKT_SUBTYPE_VOIP_DATA: case RS_PKT_SUBTYPE_VOIP_DATA:
handleData(dynamic_cast<RsVoipDataItem*>(item)); handleData(dynamic_cast<RsVOIPDataItem*>(item));
keep = true ; keep = true ;
break; break;
#if 0 #if 0
@ -500,17 +496,17 @@ bool p3VoRS::recvItem(RsItem *item)
return true ; return true ;
} }
int p3VoRS::handlePing(RsVoipPingItem *ping) int p3VOIP::handlePing(RsVOIPPingItem *ping)
{ {
/* cast to right type */ /* cast to right type */
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handlePing() Recvd Packet from: " << ping->PeerId(); std::cerr << "p3VOIP::handlePing() Recvd Packet from: " << ping->PeerId();
std::cerr << std::endl; std::cerr << std::endl;
#endif #endif
/* with a ping, we just respond as quickly as possible - they do all the analysis */ /* with a ping, we just respond as quickly as possible - they do all the analysis */
RsVoipPongItem *pong = new RsVoipPongItem(); RsVOIPPongItem *pong = new RsVOIPPongItem();
pong->PeerId(ping->PeerId()); pong->PeerId(ping->PeerId());
@ -522,8 +518,8 @@ int p3VoRS::handlePing(RsVoipPingItem *ping)
pong->mPongTS = convertTsTo64bits(ts); pong->mPongTS = convertTsTo64bits(ts);
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handlePing() With Packet:"; std::cerr << "p3VOIP::handlePing() With Packet:";
std::cerr << std::endl; std::cerr << std::endl;
pong->print(std::cerr, 10); pong->print(std::cerr, 10);
#endif #endif
@ -533,12 +529,12 @@ int p3VoRS::handlePing(RsVoipPingItem *ping)
} }
int p3VoRS::handlePong(RsVoipPongItem *pong) int p3VOIP::handlePong(RsVOIPPongItem *pong)
{ {
/* cast to right type */ /* cast to right type */
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handlePong() Recvd Packet from: " << pong->PeerId(); std::cerr << "p3VOIP::handlePong() Recvd Packet from: " << pong->PeerId();
std::cerr << std::endl; std::cerr << std::endl;
pong->print(std::cerr, 10); pong->print(std::cerr, 10);
#endif #endif
@ -551,8 +547,8 @@ int p3VoRS::handlePong(RsVoipPongItem *pong)
double rtt = recvTS - pingTS; double rtt = recvTS - pingTS;
double offset = pongTS - (recvTS - rtt / 2.0); // so to get to their time, we go ourTS + offset. double offset = pongTS - (recvTS - rtt / 2.0); // so to get to their time, we go ourTS + offset.
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::handlePong() Timing:"; std::cerr << "p3VOIP::handlePong() Timing:";
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "\tpingTS: " << pingTS; std::cerr << "\tpingTS: " << pingTS;
std::cerr << std::endl; std::cerr << std::endl;
@ -570,12 +566,12 @@ int p3VoRS::handlePong(RsVoipPongItem *pong)
return true ; return true ;
} }
int p3VoRS::storePingAttempt(const RsPeerId& id, double ts, uint32_t seqno) int p3VOIP::storePingAttempt(const RsPeerId& id, double ts, uint32_t seqno)
{ {
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
/* find corresponding local data */ /* find corresponding local data */
VorsPeerInfo *peerInfo = locked_GetPeerInfo(id); VOIPPeerInfo *peerInfo = locked_GetPeerInfo(id);
peerInfo->mCurrentPingTS = ts; peerInfo->mCurrentPingTS = ts;
peerInfo->mCurrentPingCounter = seqno; peerInfo->mCurrentPingCounter = seqno;
@ -593,17 +589,17 @@ int p3VoRS::storePingAttempt(const RsPeerId& id, double ts, uint32_t seqno)
int p3VoRS::storePongResult(const RsPeerId &id, uint32_t counter, double ts, double rtt, double offset) int p3VOIP::storePongResult(const RsPeerId &id, uint32_t counter, double ts, double rtt, double offset)
{ {
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
/* find corresponding local data */ /* find corresponding local data */
VorsPeerInfo *peerInfo = locked_GetPeerInfo(id); VOIPPeerInfo *peerInfo = locked_GetPeerInfo(id);
if (peerInfo->mCurrentPingCounter != counter) if (peerInfo->mCurrentPingCounter != counter)
{ {
#ifdef DEBUG_VORS #ifdef DEBUG_VOIP
std::cerr << "p3VoRS::storePongResult() ERROR Severly Delayed Measurements!" << std::endl; std::cerr << "p3VOIP::storePongResult() ERROR Severly Delayed Measurements!" << std::endl;
#endif #endif
} }
else else
@ -611,7 +607,7 @@ int p3VoRS::storePongResult(const RsPeerId &id, uint32_t counter, double ts, dou
peerInfo->mCurrentPongRecvd = true; peerInfo->mCurrentPongRecvd = true;
} }
peerInfo->mPongResults.push_back(RsVoipPongResult(ts, rtt, offset)); peerInfo->mPongResults.push_back(RsVOIPPongResult(ts, rtt, offset));
while(peerInfo->mPongResults.size() > MAX_PONG_RESULTS) while(peerInfo->mPongResults.size() > MAX_PONG_RESULTS)
@ -624,13 +620,13 @@ int p3VoRS::storePongResult(const RsPeerId &id, uint32_t counter, double ts, dou
} }
uint32_t p3VoRS::getPongResults(const RsPeerId& id, int n, std::list<RsVoipPongResult> &results) uint32_t p3VOIP::getPongResults(const RsPeerId& id, int n, std::list<RsVOIPPongResult> &results)
{ {
RsStackMutex stack(mVorsMtx); /****** LOCKED MUTEX *******/ RsStackMutex stack(mVOIPMtx); /****** LOCKED MUTEX *******/
VorsPeerInfo *peer = locked_GetPeerInfo(id); VOIPPeerInfo *peer = locked_GetPeerInfo(id);
std::list<RsVoipPongResult>::reverse_iterator it; std::list<RsVOIPPongResult>::reverse_iterator it;
int i = 0; int i = 0;
for(it = peer->mPongResults.rbegin(); (it != peer->mPongResults.rend()) && (i < n); it++, i++) for(it = peer->mPongResults.rbegin(); (it != peer->mPongResults.rend()) && (i < n); it++, i++)
{ {
@ -642,14 +638,14 @@ uint32_t p3VoRS::getPongResults(const RsPeerId& id, int n, std::list<RsVoipPongR
VorsPeerInfo *p3VoRS::locked_GetPeerInfo(const RsPeerId &id) VOIPPeerInfo *p3VOIP::locked_GetPeerInfo(const RsPeerId &id)
{ {
std::map<RsPeerId, VorsPeerInfo>::iterator it; std::map<RsPeerId, VOIPPeerInfo>::iterator it;
it = mPeerInfo.find(id); it = mPeerInfo.find(id);
if (it == mPeerInfo.end()) if (it == mPeerInfo.end())
{ {
/* add it in */ /* add it in */
VorsPeerInfo pinfo; VOIPPeerInfo pinfo;
/* initialise entry */ /* initialise entry */
pinfo.initialisePeerInfo(id); pinfo.initialisePeerInfo(id);
@ -662,7 +658,7 @@ VorsPeerInfo *p3VoRS::locked_GetPeerInfo(const RsPeerId &id)
return &(it->second); return &(it->second);
} }
bool VorsPeerInfo::initialisePeerInfo(const RsPeerId& id) bool VOIPPeerInfo::initialisePeerInfo(const RsPeerId& id)
{ {
mId = id; mId = id;
@ -681,43 +677,43 @@ bool VorsPeerInfo::initialisePeerInfo(const RsPeerId& id)
return true; return true;
} }
void p3VoRS::setVoipATransmit(int t) void p3VOIP::setVoipATransmit(int t)
{ {
_atransmit = t ; _atransmit = t ;
IndicateConfigChanged() ; IndicateConfigChanged() ;
} }
void p3VoRS::setVoipVoiceHold(int vh) void p3VOIP::setVoipVoiceHold(int vh)
{ {
_voice_hold = vh ; _voice_hold = vh ;
IndicateConfigChanged() ; IndicateConfigChanged() ;
} }
void p3VoRS::setVoipfVADmin(int vad) void p3VOIP::setVoipfVADmin(int vad)
{ {
_vadmin = vad ; _vadmin = vad ;
IndicateConfigChanged() ; IndicateConfigChanged() ;
} }
void p3VoRS::setVoipfVADmax(int vad) void p3VOIP::setVoipfVADmax(int vad)
{ {
_vadmax = vad ; _vadmax = vad ;
IndicateConfigChanged() ; IndicateConfigChanged() ;
} }
void p3VoRS::setVoipiNoiseSuppress(int n) void p3VOIP::setVoipiNoiseSuppress(int n)
{ {
_noise_suppress = n ; _noise_suppress = n ;
IndicateConfigChanged() ; IndicateConfigChanged() ;
} }
void p3VoRS::setVoipiMinLoudness(int ml) void p3VOIP::setVoipiMinLoudness(int ml)
{ {
_min_loudness = ml ; _min_loudness = ml ;
IndicateConfigChanged() ; IndicateConfigChanged() ;
} }
void p3VoRS::setVoipEchoCancel(bool b) void p3VOIP::setVoipEchoCancel(bool b)
{ {
_echo_cancel = b ; _echo_cancel = b ;
IndicateConfigChanged() ; IndicateConfigChanged() ;
} }
RsTlvKeyValue p3VoRS::push_int_value(const std::string& key,int value) RsTlvKeyValue p3VOIP::push_int_value(const std::string& key,int value)
{ {
RsTlvKeyValue kv ; RsTlvKeyValue kv ;
kv.key = key ; kv.key = key ;
@ -725,7 +721,7 @@ RsTlvKeyValue p3VoRS::push_int_value(const std::string& key,int value)
return kv ; return kv ;
} }
int p3VoRS::pop_int_value(const std::string& s) int p3VOIP::pop_int_value(const std::string& s)
{ {
std::istringstream is(s) ; std::istringstream is(s) ;
@ -735,7 +731,7 @@ int p3VoRS::pop_int_value(const std::string& s)
return val ; return val ;
} }
bool p3VoRS::saveList(bool& cleanup, std::list<RsItem*>& lst) bool p3VOIP::saveList(bool& cleanup, std::list<RsItem*>& lst)
{ {
cleanup = true ; cleanup = true ;
@ -753,7 +749,7 @@ bool p3VoRS::saveList(bool& cleanup, std::list<RsItem*>& lst)
return true ; return true ;
} }
bool p3VoRS::loadList(std::list<RsItem*>& load) bool p3VOIP::loadList(std::list<RsItem*>& load)
{ {
for(std::list<RsItem*>::const_iterator it(load.begin());it!=load.end();++it) for(std::list<RsItem*>::const_iterator it(load.begin());it!=load.end();++it)
{ {
@ -785,10 +781,10 @@ bool p3VoRS::loadList(std::list<RsItem*>& load)
return true ; return true ;
} }
RsSerialiser *p3VoRS::setupSerialiser() RsSerialiser *p3VOIP::setupSerialiser()
{ {
RsSerialiser *rsSerialiser = new RsSerialiser(); RsSerialiser *rsSerialiser = new RsSerialiser();
rsSerialiser->addSerialType(new RsVoipSerialiser()); rsSerialiser->addSerialType(new RsVOIPSerialiser());
rsSerialiser->addSerialType(new RsGeneralConfigSerialiser()); rsSerialiser->addSerialType(new RsGeneralConfigSerialiser());
return rsSerialiser ; return rsSerialiser ;

View File

@ -1,46 +1,40 @@
/* /****************************************************************
* libretroshare/src/services/p3vors.h * RetroShare is distributed under the following license:
* *
* Tests for VoIP for RetroShare. * Copyright (C) 2015
* *
* Copyright 2011 by Robert Fernie. * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* This library is free software; you can redistribute it and/or * This program is distributed in the hope that it will be useful,
* modify it under the terms of the GNU Library General Public * but WITHOUT ANY WARRANTY; without even the implied warranty of
* License Version 2 as published by the Free Software Foundation. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* This library is distributed in the hope that it will be useful, * You should have received a copy of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of * along with this program; if not, write to the Free Software
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Library General Public License for more details. * Boston, MA 02110-1301, USA.
* ****************************************************************/
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#pragma once
#ifndef SERVICE_RSVOIP_HEADER
#define SERVICE_RSVOIP_HEADER
#include <list> #include <list>
#include <string> #include <string>
#include "services/rsvoipitems.h" #include "services/rsVOIPItems.h"
#include "services/p3service.h" #include "services/p3service.h"
#include "serialiser/rstlvbase.h" #include "serialiser/rstlvbase.h"
#include "serialiser/rsconfigitems.h" #include "serialiser/rsconfigitems.h"
#include "plugins/rspqiservice.h" #include "plugins/rspqiservice.h"
#include <interface/rsvoip.h> #include <interface/rsVOIP.h>
class p3LinkMgr; class p3LinkMgr;
class PluginNotifier ; class VOIPNotify ;
class VorsPeerInfo class VOIPPeerInfo
{ {
public: public:
@ -56,8 +50,8 @@ class VorsPeerInfo
uint32_t total_bytes_received ; uint32_t total_bytes_received ;
uint32_t average_incoming_bandwidth ; uint32_t average_incoming_bandwidth ;
std::list<RsVoipPongResult> mPongResults; std::list<RsVOIPPongResult> mPongResults;
std::list<RsVoipDataItem*> incoming_queue ; std::list<RsVOIPDataItem*> incoming_queue ;
}; };
@ -67,27 +61,27 @@ class VorsPeerInfo
* This is only used to test Latency for the moment. * This is only used to test Latency for the moment.
*/ */
class p3VoRS: public RsPQIService, public RsVoip class p3VOIP: public RsPQIService, public RsVOIP
// Maybe we inherit from these later - but not needed for now. // Maybe we inherit from these later - but not needed for now.
//, public p3Config, public pqiMonitor //, public p3Config, public pqiMonitor
{ {
public: public:
p3VoRS(RsPluginHandler *cm,PluginNotifier *); p3VOIP(RsPluginHandler *cm,VOIPNotify *);
/***** overloaded from rsVoip *****/ /***** overloaded from rsVOIP *****/
virtual uint32_t getPongResults(const RsPeerId &id, int n, std::list<RsVoipPongResult> &results); virtual uint32_t getPongResults(const RsPeerId &id, int n, std::list<RsVOIPPongResult> &results);
// Call stuff. // Call stuff.
// //
// Sending data. The client keeps the memory ownership and must delete it after calling this. // Sending data. The client keeps the memory ownership and must delete it after calling this.
virtual int sendVoipData(const RsPeerId &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 // 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. // in each chunk once it has been used.
// //
virtual bool getIncomingData(const RsPeerId& peer_id,std::vector<RsVoipDataChunk>& chunks) ; virtual bool getIncomingData(const RsPeerId& peer_id,std::vector<RsVOIPDataChunk>& chunks) ;
virtual int sendVoipHangUpCall(const RsPeerId& peer_id) ; virtual int sendVoipHangUpCall(const RsPeerId& peer_id) ;
virtual int sendVoipRinging(const RsPeerId& peer_id) ; virtual int sendVoipRinging(const RsPeerId& peer_id) ;
@ -142,29 +136,29 @@ class p3VoRS: public RsPQIService, public RsVoip
int sendVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec) ; int sendVoipBandwidth(const RsPeerId &peer_id,uint32_t bytes_per_sec) ;
int handlePing(RsVoipPingItem *item); int handlePing(RsVOIPPingItem *item);
int handlePong(RsVoipPongItem *item); int handlePong(RsVOIPPongItem *item);
int storePingAttempt(const RsPeerId &id, double ts, uint32_t mCounter); int storePingAttempt(const RsPeerId &id, double ts, uint32_t mCounter);
int storePongResult(const RsPeerId& id, uint32_t counter, double ts, double rtt, double offset); int storePongResult(const RsPeerId& id, uint32_t counter, double ts, double rtt, double offset);
void handleProtocol(RsVoipProtocolItem*) ; void handleProtocol(RsVOIPProtocolItem*) ;
void handleData(RsVoipDataItem*) ; void handleData(RsVOIPDataItem*) ;
RsMutex mVorsMtx; RsMutex mVOIPMtx;
VorsPeerInfo *locked_GetPeerInfo(const RsPeerId& id); VOIPPeerInfo *locked_GetPeerInfo(const RsPeerId& id);
static RsTlvKeyValue push_int_value(const std::string& key,int value) ; static RsTlvKeyValue push_int_value(const std::string& key,int value) ;
static int pop_int_value(const std::string& s) ; static int pop_int_value(const std::string& s) ;
std::map<RsPeerId, VorsPeerInfo> mPeerInfo; std::map<RsPeerId, VOIPPeerInfo> mPeerInfo;
time_t mSentPingTime; time_t mSentPingTime;
time_t mSentBandwidthInfoTime; time_t mSentBandwidthInfoTime;
uint32_t mCounter; uint32_t mCounter;
RsServiceControl *mServiceControl; RsServiceControl *mServiceControl;
PluginNotifier *mNotify ; VOIPNotify *mNotify ;
int _atransmit ; int _atransmit ;
int _voice_hold ; int _voice_hold ;
@ -174,6 +168,3 @@ class p3VoRS: public RsPQIService, public RsVoip
int _noise_suppress ; int _noise_suppress ;
bool _echo_cancel ; bool _echo_cancel ;
}; };
#endif // SERVICE_RSVOIP_HEADER

View File

@ -1,34 +1,29 @@
/****************************************************************
/* * RetroShare is distributed under the following license:
* libretroshare/src/serialiser: rsvoipitems.cc
* *
* RetroShare Serialiser. * Copyright (C) 2015
* *
* Copyright 2011 by Robert Fernie. * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* *
* This library is free software; you can redistribute it and/or * This program is distributed in the hope that it will be useful,
* modify it under the terms of the GNU Library General Public * but WITHOUT ANY WARRANTY; without even the implied warranty of
* License Version 2 as published by the Free Software Foundation. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* *
* This library is distributed in the hope that it will be useful, * You should have received a copy of the GNU General Public License
* but WITHOUT ANY WARRANTY; without even the implied warranty of * along with this program; if not, write to the Free Software
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Library General Public License for more details. * Boston, MA 02110-1301, USA.
* ****************************************************************/
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*
* Please report all bugs and problems to "retroshare@lunamutt.com".
*
*/
#include <stdexcept> #include <stdexcept>
#include "serialiser/rsbaseserial.h" #include "serialiser/rsbaseserial.h"
#include "serialiser/rstlvbase.h" #include "serialiser/rstlvbase.h"
#include "services/rsvoipitems.h" #include "services/rsVOIPItems.h"
/*** /***
#define RSSERIAL_DEBUG 1 #define RSSERIAL_DEBUG 1
@ -38,9 +33,9 @@
/*************************************************************************/ /*************************************************************************/
std::ostream& RsVoipPingItem::print(std::ostream &out, uint16_t indent) std::ostream& RsVOIPPingItem::print(std::ostream &out, uint16_t indent)
{ {
printRsItemBase(out, "RsVoipPingItem", indent); printRsItemBase(out, "RsVOIPPingItem", indent);
uint16_t int_Indent = indent + 2; uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "SeqNo: " << mSeqNo << std::endl; out << "SeqNo: " << mSeqNo << std::endl;
@ -48,13 +43,13 @@ std::ostream& RsVoipPingItem::print(std::ostream &out, uint16_t indent)
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "PingTS: " << std::hex << mPingTS << std::dec << std::endl; out << "PingTS: " << std::hex << mPingTS << std::dec << std::endl;
printRsItemEnd(out, "RsVoipPingItem", indent); printRsItemEnd(out, "RsVOIPPingItem", indent);
return out; return out;
} }
std::ostream& RsVoipPongItem::print(std::ostream &out, uint16_t indent) std::ostream& RsVOIPPongItem::print(std::ostream &out, uint16_t indent)
{ {
printRsItemBase(out, "RsVoipPongItem", indent); printRsItemBase(out, "RsVOIPPongItem", indent);
uint16_t int_Indent = indent + 2; uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "SeqNo: " << mSeqNo << std::endl; out << "SeqNo: " << mSeqNo << std::endl;
@ -65,12 +60,12 @@ std::ostream& RsVoipPongItem::print(std::ostream &out, uint16_t indent)
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "PongTS: " << std::hex << mPongTS << std::dec << std::endl; out << "PongTS: " << std::hex << mPongTS << std::dec << std::endl;
printRsItemEnd(out, "RsVoipPongItem", indent); printRsItemEnd(out, "RsVOIPPongItem", indent);
return out; return out;
} }
std::ostream& RsVoipProtocolItem::print(std::ostream &out, uint16_t indent) std::ostream& RsVOIPProtocolItem::print(std::ostream &out, uint16_t indent)
{ {
printRsItemBase(out, "RsVoipProtocolItem", indent); printRsItemBase(out, "RsVOIPProtocolItem", indent);
uint16_t int_Indent = indent + 2; uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "flags: " << flags << std::endl; out << "flags: " << flags << std::endl;
@ -78,12 +73,12 @@ std::ostream& RsVoipProtocolItem::print(std::ostream &out, uint16_t indent)
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "protocol: " << std::hex << protocol << std::dec << std::endl; out << "protocol: " << std::hex << protocol << std::dec << std::endl;
printRsItemEnd(out, "RsVoipProtocolItem", indent); printRsItemEnd(out, "RsVOIPProtocolItem", indent);
return out; return out;
} }
std::ostream& RsVoipDataItem::print(std::ostream &out, uint16_t indent) std::ostream& RsVOIPDataItem::print(std::ostream &out, uint16_t indent)
{ {
printRsItemBase(out, "RsVoipDataItem", indent); printRsItemBase(out, "RsVOIPDataItem", indent);
uint16_t int_Indent = indent + 2; uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "flags: " << flags << std::endl; out << "flags: " << flags << std::endl;
@ -91,12 +86,12 @@ std::ostream& RsVoipDataItem::print(std::ostream &out, uint16_t indent)
printIndent(out, int_Indent); printIndent(out, int_Indent);
out << "data size: " << std::hex << data_size << std::dec << std::endl; out << "data size: " << std::hex << data_size << std::dec << std::endl;
printRsItemEnd(out, "RsVoipDataItem", indent); printRsItemEnd(out, "RsVOIPDataItem", indent);
return out; return out;
} }
/*************************************************************************/ /*************************************************************************/
uint32_t RsVoipDataItem::serial_size() const uint32_t RsVOIPDataItem::serial_size() const
{ {
uint32_t s = 8; /* header */ uint32_t s = 8; /* header */
s += 4; /* flags */ s += 4; /* flags */
@ -105,7 +100,7 @@ uint32_t RsVoipDataItem::serial_size() const
return s; return s;
} }
uint32_t RsVoipProtocolItem::serial_size() const uint32_t RsVOIPProtocolItem::serial_size() const
{ {
uint32_t s = 8; /* header */ uint32_t s = 8; /* header */
s += 4; /* flags */ s += 4; /* flags */
@ -113,7 +108,7 @@ uint32_t RsVoipProtocolItem::serial_size() const
return s; return s;
} }
uint32_t RsVoipPingItem::serial_size() const uint32_t RsVOIPPingItem::serial_size() const
{ {
uint32_t s = 8; /* header */ uint32_t s = 8; /* header */
s += 4; /* seqno */ s += 4; /* seqno */
@ -121,7 +116,7 @@ uint32_t RsVoipPingItem::serial_size() const
return s; return s;
} }
bool RsVoipProtocolItem::serialise(void *data, uint32_t& pktsize) bool RsVOIPProtocolItem::serialise(void *data, uint32_t& pktsize)
{ {
uint32_t tlvsize = serial_size() ; uint32_t tlvsize = serial_size() ;
uint32_t offset = 0; uint32_t offset = 0;
@ -136,8 +131,8 @@ bool RsVoipProtocolItem::serialise(void *data, uint32_t& pktsize)
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize);
#ifdef RSSERIAL_DEBUG #ifdef RSSERIAL_DEBUG
std::cerr << "RsVoipSerialiser::serialiseVoipDataItem() Header: " << ok << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPDataItem() Header: " << ok << std::endl;
std::cerr << "RsVoipSerialiser::serialiseVoipDataItem() Size: " << tlvsize << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPDataItem() Size: " << tlvsize << std::endl;
#endif #endif
/* skip the header */ /* skip the header */
@ -150,13 +145,13 @@ bool RsVoipProtocolItem::serialise(void *data, uint32_t& pktsize)
if (offset != tlvsize) if (offset != tlvsize)
{ {
ok = false; ok = false;
std::cerr << "RsVoipSerialiser::serialiseVoipPingItem() Size Error! " << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPingItem() Size Error! " << std::endl;
} }
return ok; return ok;
} }
/* serialise the data to the buffer */ /* serialise the data to the buffer */
bool RsVoipDataItem::serialise(void *data, uint32_t& pktsize) bool RsVOIPDataItem::serialise(void *data, uint32_t& pktsize)
{ {
uint32_t tlvsize = serial_size() ; uint32_t tlvsize = serial_size() ;
uint32_t offset = 0; uint32_t offset = 0;
@ -171,8 +166,8 @@ bool RsVoipDataItem::serialise(void *data, uint32_t& pktsize)
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize);
#ifdef RSSERIAL_DEBUG #ifdef RSSERIAL_DEBUG
std::cerr << "RsVoipSerialiser::serialiseVoipDataItem() Header: " << ok << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPDataItem() Header: " << ok << std::endl;
std::cerr << "RsVoipSerialiser::serialiseVoipDataItem() Size: " << tlvsize << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPDataItem() Size: " << tlvsize << std::endl;
#endif #endif
/* skip the header */ /* skip the header */
@ -188,13 +183,13 @@ bool RsVoipDataItem::serialise(void *data, uint32_t& pktsize)
if (offset != tlvsize) if (offset != tlvsize)
{ {
ok = false; ok = false;
std::cerr << "RsVoipSerialiser::serialiseVoipPingItem() Size Error! " << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPingItem() Size Error! " << std::endl;
} }
return ok; return ok;
} }
/* serialise the data to the buffer */ /* serialise the data to the buffer */
bool RsVoipPingItem::serialise(void *data, uint32_t& pktsize) bool RsVOIPPingItem::serialise(void *data, uint32_t& pktsize)
{ {
uint32_t tlvsize = serial_size() ; uint32_t tlvsize = serial_size() ;
uint32_t offset = 0; uint32_t offset = 0;
@ -209,8 +204,8 @@ bool RsVoipPingItem::serialise(void *data, uint32_t& pktsize)
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize);
#ifdef RSSERIAL_DEBUG #ifdef RSSERIAL_DEBUG
std::cerr << "RsVoipSerialiser::serialiseVoipPingItem() Header: " << ok << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPingItem() Header: " << ok << std::endl;
std::cerr << "RsVoipSerialiser::serialiseVoipPingItem() Size: " << tlvsize << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPingItem() Size: " << tlvsize << std::endl;
#endif #endif
/* skip the header */ /* skip the header */
@ -223,14 +218,14 @@ bool RsVoipPingItem::serialise(void *data, uint32_t& pktsize)
if (offset != tlvsize) if (offset != tlvsize)
{ {
ok = false; ok = false;
std::cerr << "RsVoipSerialiser::serialiseVoipPingItem() Size Error! " << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPingItem() Size Error! " << std::endl;
} }
return ok; return ok;
} }
RsVoipProtocolItem::RsVoipProtocolItem(void *data, uint32_t pktsize) RsVOIPProtocolItem::RsVOIPProtocolItem(void *data, uint32_t pktsize)
: RsVoipItem(RS_PKT_SUBTYPE_VOIP_PROTOCOL) : RsVOIPItem(RS_PKT_SUBTYPE_VOIP_PROTOCOL)
{ {
/* get the type and size */ /* get the type and size */
uint32_t rstype = getRsItemId(data); uint32_t rstype = getRsItemId(data);
@ -259,8 +254,8 @@ RsVoipProtocolItem::RsVoipProtocolItem(void *data, uint32_t pktsize)
if (!ok) if (!ok)
throw std::runtime_error("Deserialisation error!") ; throw std::runtime_error("Deserialisation error!") ;
} }
RsVoipPingItem::RsVoipPingItem(void *data, uint32_t pktsize) RsVOIPPingItem::RsVOIPPingItem(void *data, uint32_t pktsize)
: RsVoipItem(RS_PKT_SUBTYPE_VOIP_PING) : RsVOIPItem(RS_PKT_SUBTYPE_VOIP_PING)
{ {
/* get the type and size */ /* get the type and size */
uint32_t rstype = getRsItemId(data); uint32_t rstype = getRsItemId(data);
@ -295,7 +290,7 @@ RsVoipPingItem::RsVoipPingItem(void *data, uint32_t pktsize)
/*************************************************************************/ /*************************************************************************/
uint32_t RsVoipPongItem::serial_size() const uint32_t RsVOIPPongItem::serial_size() const
{ {
uint32_t s = 8; /* header */ uint32_t s = 8; /* header */
s += 4; /* seqno */ s += 4; /* seqno */
@ -306,7 +301,7 @@ uint32_t RsVoipPongItem::serial_size() const
} }
/* serialise the data to the buffer */ /* serialise the data to the buffer */
bool RsVoipPongItem::serialise(void *data, uint32_t& pktsize) bool RsVOIPPongItem::serialise(void *data, uint32_t& pktsize)
{ {
uint32_t tlvsize = serial_size() ; uint32_t tlvsize = serial_size() ;
uint32_t offset = 0; uint32_t offset = 0;
@ -321,8 +316,8 @@ bool RsVoipPongItem::serialise(void *data, uint32_t& pktsize)
ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize); ok &= setRsItemHeader(data, tlvsize, PacketId(), tlvsize);
#ifdef RSSERIAL_DEBUG #ifdef RSSERIAL_DEBUG
std::cerr << "RsVoipSerialiser::serialiseVoipPongItem() Header: " << ok << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPongItem() Header: " << ok << std::endl;
std::cerr << "RsVoipSerialiser::serialiseVoipPongItem() Size: " << tlvsize << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPongItem() Size: " << tlvsize << std::endl;
#endif #endif
/* skip the header */ /* skip the header */
@ -336,13 +331,13 @@ bool RsVoipPongItem::serialise(void *data, uint32_t& pktsize)
if (offset != tlvsize) if (offset != tlvsize)
{ {
ok = false; ok = false;
std::cerr << "RsVoipSerialiser::serialiseVoipPongItem() Size Error! " << std::endl; std::cerr << "RsVOIPSerialiser::serialiseVOIPPongItem() Size Error! " << std::endl;
} }
return ok; return ok;
} }
RsVoipDataItem::RsVoipDataItem(void *data, uint32_t pktsize) RsVOIPDataItem::RsVOIPDataItem(void *data, uint32_t pktsize)
: RsVoipItem(RS_PKT_SUBTYPE_VOIP_DATA) : RsVOIPItem(RS_PKT_SUBTYPE_VOIP_DATA)
{ {
/* get the type and size */ /* get the type and size */
uint32_t rstype = getRsItemId(data); uint32_t rstype = getRsItemId(data);
@ -375,8 +370,8 @@ RsVoipDataItem::RsVoipDataItem(void *data, uint32_t pktsize)
if (!ok) if (!ok)
throw std::runtime_error("Serialization error.") ; throw std::runtime_error("Serialization error.") ;
} }
RsVoipPongItem::RsVoipPongItem(void *data, uint32_t pktsize) RsVOIPPongItem::RsVOIPPongItem(void *data, uint32_t pktsize)
: RsVoipItem(RS_PKT_SUBTYPE_VOIP_PONG) : RsVOIPItem(RS_PKT_SUBTYPE_VOIP_PONG)
{ {
/* get the type and size */ /* get the type and size */
uint32_t rstype = getRsItemId(data); uint32_t rstype = getRsItemId(data);
@ -409,10 +404,10 @@ RsVoipPongItem::RsVoipPongItem(void *data, uint32_t pktsize)
/*************************************************************************/ /*************************************************************************/
RsItem* RsVoipSerialiser::deserialise(void *data, uint32_t *pktsize) RsItem* RsVOIPSerialiser::deserialise(void *data, uint32_t *pktsize)
{ {
#ifdef RSSERIAL_DEBUG #ifdef RSSERIAL_DEBUG
std::cerr << "RsVoipSerialiser::deserialise()" << std::endl; std::cerr << "RsVOIPSerialiser::deserialise()" << std::endl;
#endif #endif
/* get the type and size */ /* get the type and size */
@ -425,10 +420,10 @@ RsItem* RsVoipSerialiser::deserialise(void *data, uint32_t *pktsize)
{ {
switch(getRsItemSubType(rstype)) switch(getRsItemSubType(rstype))
{ {
case RS_PKT_SUBTYPE_VOIP_PING: return new RsVoipPingItem(data, *pktsize); case RS_PKT_SUBTYPE_VOIP_PING: return new RsVOIPPingItem(data, *pktsize);
case RS_PKT_SUBTYPE_VOIP_PONG: return new RsVoipPongItem(data, *pktsize); case RS_PKT_SUBTYPE_VOIP_PONG: return new RsVOIPPongItem(data, *pktsize);
case RS_PKT_SUBTYPE_VOIP_PROTOCOL: return new RsVoipProtocolItem(data, *pktsize); case RS_PKT_SUBTYPE_VOIP_PROTOCOL: return new RsVOIPProtocolItem(data, *pktsize);
case RS_PKT_SUBTYPE_VOIP_DATA: return new RsVoipDataItem(data, *pktsize); case RS_PKT_SUBTYPE_VOIP_DATA: return new RsVOIPDataItem(data, *pktsize);
default: default:
return NULL; return NULL;
@ -436,7 +431,7 @@ RsItem* RsVoipSerialiser::deserialise(void *data, uint32_t *pktsize)
} }
catch(std::exception& e) catch(std::exception& e)
{ {
std::cerr << "RsVoipSerialiser: deserialization error: " << e.what() << std::endl; std::cerr << "RsVOIPSerialiser: deserialization error: " << e.what() << std::endl;
return NULL; return NULL;
} }
} }

View File

@ -1,8 +1,28 @@
#ifndef RS_VOIP_ITEMS_H /****************************************************************
#define RS_VOIP_ITEMS_H * RetroShare is distributed under the following license:
*
* Copyright (C) 2015
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
#pragma once
/* /*
* libretroshare/src/serialiser: rsvoipitems.h * libretroshare/src/serialiser: rsVOIPItems.h
* *
* RetroShare Serialiser. * RetroShare Serialiser.
* *
@ -46,16 +66,16 @@ const uint8_t QOS_PRIORITY_RS_VOIP = 9 ;
const uint32_t RS_VOIP_FLAGS_VIDEO_DATA = 0x0001 ; const uint32_t RS_VOIP_FLAGS_VIDEO_DATA = 0x0001 ;
const uint32_t RS_VOIP_FLAGS_AUDIO_DATA = 0x0002 ; const uint32_t RS_VOIP_FLAGS_AUDIO_DATA = 0x0002 ;
class RsVoipItem: public RsItem class RsVOIPItem: public RsItem
{ {
public: public:
RsVoipItem(uint8_t voip_subtype) RsVOIPItem(uint8_t voip_subtype)
: RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_VOIP_PLUGIN,voip_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_VOIP_PLUGIN,voip_subtype)
{ {
setPriorityLevel(QOS_PRIORITY_RS_VOIP) ; setPriorityLevel(QOS_PRIORITY_RS_VOIP) ;
} }
virtual ~RsVoipItem() {}; virtual ~RsVOIPItem() {};
virtual void clear() {}; virtual void clear() {};
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) = 0 ; virtual std::ostream& print(std::ostream &out, uint16_t indent = 0) = 0 ;
@ -63,32 +83,32 @@ class RsVoipItem: public RsItem
virtual uint32_t serial_size() const = 0 ; // deserialise is handled using a constructor virtual uint32_t serial_size() const = 0 ; // deserialise is handled using a constructor
}; };
class RsVoipPingItem: public RsVoipItem class RsVOIPPingItem: public RsVOIPItem
{ {
public: public:
RsVoipPingItem() :RsVoipItem(RS_PKT_SUBTYPE_VOIP_PING) {} RsVOIPPingItem() :RsVOIPItem(RS_PKT_SUBTYPE_VOIP_PING) {}
RsVoipPingItem(void *data,uint32_t size) ; RsVOIPPingItem(void *data,uint32_t size) ;
virtual bool serialise(void *data,uint32_t& size) ; virtual bool serialise(void *data,uint32_t& size) ;
virtual uint32_t serial_size() const ; virtual uint32_t serial_size() const ;
virtual ~RsVoipPingItem() {} virtual ~RsVOIPPingItem() {}
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0); virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
uint32_t mSeqNo; uint32_t mSeqNo;
uint64_t mPingTS; uint64_t mPingTS;
}; };
class RsVoipDataItem: public RsVoipItem class RsVOIPDataItem: public RsVOIPItem
{ {
public: public:
RsVoipDataItem() :RsVoipItem(RS_PKT_SUBTYPE_VOIP_DATA) {} RsVOIPDataItem() :RsVOIPItem(RS_PKT_SUBTYPE_VOIP_DATA) {}
RsVoipDataItem(void *data,uint32_t size) ; // de-serialization RsVOIPDataItem(void *data,uint32_t size) ; // de-serialization
virtual bool serialise(void *data,uint32_t& size) ; virtual bool serialise(void *data,uint32_t& size) ;
virtual uint32_t serial_size() const ; virtual uint32_t serial_size() const ;
virtual ~RsVoipDataItem() virtual ~RsVOIPDataItem()
{ {
free(voip_data) ; free(voip_data) ;
voip_data = NULL ; voip_data = NULL ;
@ -100,34 +120,34 @@ class RsVoipDataItem: public RsVoipItem
void *voip_data ; void *voip_data ;
}; };
class RsVoipProtocolItem: public RsVoipItem class RsVOIPProtocolItem: public RsVOIPItem
{ {
public: public:
RsVoipProtocolItem() :RsVoipItem(RS_PKT_SUBTYPE_VOIP_PROTOCOL) {} RsVOIPProtocolItem() :RsVOIPItem(RS_PKT_SUBTYPE_VOIP_PROTOCOL) {}
RsVoipProtocolItem(void *data,uint32_t size) ; RsVOIPProtocolItem(void *data,uint32_t size) ;
enum { VoipProtocol_Ring = 1, VoipProtocol_Ackn = 2, VoipProtocol_Close = 3, VoipProtocol_Bandwidth = 4 } ; enum { VoipProtocol_Ring = 1, VoipProtocol_Ackn = 2, VoipProtocol_Close = 3, VoipProtocol_Bandwidth = 4 } ;
virtual bool serialise(void *data,uint32_t& size) ; virtual bool serialise(void *data,uint32_t& size) ;
virtual uint32_t serial_size() const ; virtual uint32_t serial_size() const ;
virtual ~RsVoipProtocolItem() {} virtual ~RsVOIPProtocolItem() {}
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0); virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
uint32_t protocol ; uint32_t protocol ;
uint32_t flags ; uint32_t flags ;
}; };
class RsVoipPongItem: public RsVoipItem class RsVOIPPongItem: public RsVOIPItem
{ {
public: public:
RsVoipPongItem() :RsVoipItem(RS_PKT_SUBTYPE_VOIP_PONG) {} RsVOIPPongItem() :RsVOIPItem(RS_PKT_SUBTYPE_VOIP_PONG) {}
RsVoipPongItem(void *data,uint32_t size) ; RsVOIPPongItem(void *data,uint32_t size) ;
virtual bool serialise(void *data,uint32_t& size) ; virtual bool serialise(void *data,uint32_t& size) ;
virtual uint32_t serial_size() const ; virtual uint32_t serial_size() const ;
virtual ~RsVoipPongItem() {} virtual ~RsVOIPPongItem() {}
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0); virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
uint32_t mSeqNo; uint32_t mSeqNo;
@ -135,29 +155,25 @@ class RsVoipPongItem: public RsVoipItem
uint64_t mPongTS; uint64_t mPongTS;
}; };
class RsVoipSerialiser: public RsSerialType class RsVOIPSerialiser: public RsSerialType
{ {
public: public:
RsVoipSerialiser() RsVOIPSerialiser()
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_VOIP_PLUGIN) :RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_VOIP_PLUGIN)
{ {
} }
virtual ~RsVoipSerialiser() {} virtual ~RsVOIPSerialiser() {}
virtual uint32_t size (RsItem *item) virtual uint32_t size (RsItem *item)
{ {
return dynamic_cast<RsVoipItem *>(item)->serial_size() ; return dynamic_cast<RsVOIPItem *>(item)->serial_size() ;
} }
virtual bool serialise (RsItem *item, void *data, uint32_t *size) virtual bool serialise (RsItem *item, void *data, uint32_t *size)
{ {
return dynamic_cast<RsVoipItem *>(item)->serialise(data,*size) ; return dynamic_cast<RsVOIPItem *>(item)->serialise(data,*size) ;
} }
virtual RsItem *deserialise(void *data, uint32_t *size); virtual RsItem *deserialise(void *data, uint32_t *size);
}; };
/**************************************************************************/ /**************************************************************************/
#endif /* RS_VOIP_ITEMS_H */