mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
improved VOIP plugin code. Plugin loads, has a config tab. Next step: merge service with existing p3VoRS service
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4961 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2c6a2b4ee7
commit
4fb02f9f67
@ -83,9 +83,9 @@ void AudioInputConfig::load()
|
||||
}
|
||||
qcbSystem->setEnabled(qcbSystem->count() > 1);*/
|
||||
|
||||
ui.qcbTransmit->addItem(tr("Continuous"), RsVoip::AudioTransmitContinous);
|
||||
ui.qcbTransmit->addItem(tr("Voice Activity"), RsVoip::AudioTransmitVAD);
|
||||
ui.qcbTransmit->addItem(tr("Push To Talk"), RsVoip::AudioTransmitPushToTalk);
|
||||
ui.qcbTransmit->addItem(tr("Continuous"), RsVoipServiceInterface::AudioTransmitContinous);
|
||||
ui.qcbTransmit->addItem(tr("Voice Activity"), RsVoipServiceInterface::AudioTransmitVAD);
|
||||
ui.qcbTransmit->addItem(tr("Push To Talk"), RsVoipServiceInterface::AudioTransmitPushToTalk);
|
||||
|
||||
abSpeech = new AudioBar();
|
||||
abSpeech->qcBelow = Qt::red;
|
||||
@ -125,26 +125,26 @@ void AudioInputConfig::loadSettings() {
|
||||
loadSlider(qsTransmitMax, iroundf(r.fVADmax * 32767.0f + 0.5f));
|
||||
loadSlider(qsFrames, (r.iFramesPerPacket == 1) ? 1 : (r.iFramesPerPacket/2 + 1));
|
||||
loadSlider(qsDoublePush, iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f));*/
|
||||
ui.qcbTransmit->setCurrentIndex(rsVoip->getVoipATransmit()-1);
|
||||
on_qcbTransmit_currentIndexChanged(rsVoip->getVoipATransmit()-1);
|
||||
ui.qsTransmitHold->setValue(rsVoip->getVoipVoiceHold());
|
||||
on_qsTransmitHold_valueChanged(rsVoip->getVoipVoiceHold());
|
||||
ui.qsTransmitMin->setValue(rsVoip->getVoipfVADmin());
|
||||
ui.qsTransmitMax->setValue(rsVoip->getVoipfVADmax());
|
||||
ui.qcbEchoCancel->setChecked(rsVoip->getVoipEchoCancel());
|
||||
ui.qcbTransmit->setCurrentIndex(rsVoipSI->getVoipATransmit()-1);
|
||||
on_qcbTransmit_currentIndexChanged(rsVoipSI->getVoipATransmit()-1);
|
||||
ui.qsTransmitHold->setValue(rsVoipSI->getVoipVoiceHold());
|
||||
on_qsTransmitHold_valueChanged(rsVoipSI->getVoipVoiceHold());
|
||||
ui.qsTransmitMin->setValue(rsVoipSI->getVoipfVADmin());
|
||||
ui.qsTransmitMax->setValue(rsVoipSI->getVoipfVADmax());
|
||||
ui.qcbEchoCancel->setChecked(rsVoipSI->getVoipEchoCancel());
|
||||
//ui.qsDoublePush->setValue(iroundf(static_cast<float>(r.uiDoublePush) / 1000.f + 0.5f));
|
||||
|
||||
//loadCheckBox(qcbPushClick, r.bPushClick);
|
||||
//loadSlider(qsQuality, r.iQuality);
|
||||
if (rsVoip->getVoipiNoiseSuppress() != 0)
|
||||
ui.qsNoise->setValue(-rsVoip->getVoipiNoiseSuppress());
|
||||
if (rsVoipSI->getVoipiNoiseSuppress() != 0)
|
||||
ui.qsNoise->setValue(-rsVoipSI->getVoipiNoiseSuppress());
|
||||
else
|
||||
ui.qsNoise->setValue(14);
|
||||
|
||||
on_qsNoise_valueChanged(-rsVoip->getVoipiNoiseSuppress());
|
||||
on_qsNoise_valueChanged(-rsVoipSI->getVoipiNoiseSuppress());
|
||||
|
||||
ui.qsAmp->setValue(20000 - rsVoip->getVoipiMinLoudness());
|
||||
on_qsAmp_valueChanged(20000 - rsVoip->getVoipiMinLoudness());
|
||||
ui.qsAmp->setValue(20000 - rsVoipSI->getVoipiMinLoudness());
|
||||
on_qsAmp_valueChanged(20000 - rsVoipSI->getVoipiMinLoudness());
|
||||
//loadSlider(qsIdle, r.iIdleTime);
|
||||
|
||||
/*int echo = 0;
|
||||
@ -161,14 +161,14 @@ void AudioInputConfig::loadSettings() {
|
||||
|
||||
bool AudioInputConfig::save(QString &/*errmsg*/) {//mainly useless beacause saving occurs in realtime
|
||||
//s.iQuality = qsQuality->value();
|
||||
rsVoip->setVoipiNoiseSuppress((ui.qsNoise->value() == 14) ? 0 : - ui.qsNoise->value());
|
||||
rsVoip->setVoipiMinLoudness(20000 - ui.qsAmp->value());
|
||||
rsVoip->setVoipVoiceHold(ui.qsTransmitHold->value());
|
||||
rsVoip->setVoipfVADmin(ui.qsTransmitMin->value());
|
||||
rsVoip->setVoipfVADmax(ui.qsTransmitMax->value());
|
||||
rsVoipSI->setVoipiNoiseSuppress((ui.qsNoise->value() == 14) ? 0 : - ui.qsNoise->value());
|
||||
rsVoipSI->setVoipiMinLoudness(20000 - ui.qsAmp->value());
|
||||
rsVoipSI->setVoipVoiceHold(ui.qsTransmitHold->value());
|
||||
rsVoipSI->setVoipfVADmin(ui.qsTransmitMin->value());
|
||||
rsVoipSI->setVoipfVADmax(ui.qsTransmitMax->value());
|
||||
/*s.uiDoublePush = qsDoublePush->value() * 1000;*/
|
||||
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() + 1));
|
||||
rsVoip->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
|
||||
rsVoipSI->setVoipATransmit(static_cast<RsVoipServiceInterface::enumAudioTransmit>(ui.qcbTransmit->currentIndex() + 1));
|
||||
rsVoipSI->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -191,7 +191,7 @@ void AudioInputConfig::on_qsTransmitHold_valueChanged(int v) {
|
||||
float val = static_cast<float>(v * FRAME_SIZE);
|
||||
val = val / SAMPLING_RATE;
|
||||
ui.qlTransmitHold->setText(tr("%1 s").arg(val, 0, 'f', 2));
|
||||
rsVoip->setVoipVoiceHold(v);
|
||||
rsVoipSI->setVoipVoiceHold(v);
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qsNoise_valueChanged(int v) {
|
||||
@ -204,18 +204,18 @@ void AudioInputConfig::on_qsNoise_valueChanged(int v) {
|
||||
ui.qlNoise->setText(tr("-%1 dB").arg(v));
|
||||
}
|
||||
ui.qlNoise->setPalette(pal);
|
||||
rsVoip->setVoipiNoiseSuppress(- ui.qsNoise->value());
|
||||
rsVoipSI->setVoipiNoiseSuppress(- ui.qsNoise->value());
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qsAmp_valueChanged(int v) {
|
||||
v = 20000 - v;
|
||||
float d = 20000.0f/static_cast<float>(v);
|
||||
ui.qlAmp->setText(QString::fromLatin1("%1").arg(d, 0, 'f', 2));
|
||||
rsVoip->setVoipiMinLoudness(20000 - ui.qsAmp->value());
|
||||
rsVoipSI->setVoipiMinLoudness(20000 - ui.qsAmp->value());
|
||||
}
|
||||
|
||||
void AudioInputConfig::on_qcbEchoCancel_clicked() {
|
||||
rsVoip->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
|
||||
rsVoipSI->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
|
||||
}
|
||||
|
||||
|
||||
@ -232,7 +232,7 @@ void AudioInputConfig::on_qcbTransmit_currentIndexChanged(int v) {
|
||||
break;
|
||||
}
|
||||
if (loaded)
|
||||
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() + 1));
|
||||
rsVoipSI->setVoipATransmit(static_cast<RsVoipServiceInterface::enumAudioTransmit>(ui.qcbTransmit->currentIndex() + 1));
|
||||
}
|
||||
|
||||
|
||||
@ -251,8 +251,8 @@ void AudioInputConfig::on_Tick_timeout() {
|
||||
abSpeech->iBelow = ui.qsTransmitMin->value();
|
||||
abSpeech->iAbove = ui.qsTransmitMax->value();
|
||||
if (loaded) {
|
||||
rsVoip->setVoipfVADmin(ui.qsTransmitMin->value());
|
||||
rsVoip->setVoipfVADmax(ui.qsTransmitMax->value());
|
||||
rsVoipSI->setVoipfVADmin(ui.qsTransmitMin->value());
|
||||
rsVoipSI->setVoipfVADmax(ui.qsTransmitMax->value());
|
||||
}
|
||||
|
||||
abSpeech->iValue = iroundf(inputProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);
|
||||
|
@ -70,9 +70,9 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
|
||||
|
||||
verticalLayout_3->addWidget(abAmplify);
|
||||
|
||||
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitPushToTalk)
|
||||
if (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::AudioTransmitPushToTalk)
|
||||
qrPTT->setChecked(true);
|
||||
else if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitVAD)
|
||||
else if (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::AudioTransmitVAD)
|
||||
qrVAD->setChecked(true);
|
||||
else
|
||||
qrContinuous->setChecked(true);
|
||||
@ -82,13 +82,13 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
|
||||
abVAD->qcInside = Qt::yellow;
|
||||
abVAD->qcAbove = Qt::green;
|
||||
|
||||
qsTransmitMin->setValue(rsVoip->getVoipfVADmin());
|
||||
qsTransmitMax->setValue(rsVoip->getVoipfVADmax());
|
||||
qsTransmitMin->setValue(rsVoipSI->getVoipfVADmin());
|
||||
qsTransmitMax->setValue(rsVoipSI->getVoipfVADmax());
|
||||
|
||||
verticalLayout_6->addWidget(abVAD);
|
||||
|
||||
// Volume
|
||||
qsMaxAmp->setValue(rsVoip->getVoipiMinLoudness());
|
||||
qsMaxAmp->setValue(rsVoipSI->getVoipiMinLoudness());
|
||||
|
||||
setOption(QWizard::NoCancelButton, false);
|
||||
resize(700, 500);
|
||||
@ -130,7 +130,7 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
|
||||
|
||||
|
||||
void AudioWizard::on_qsMaxAmp_valueChanged(int v) {
|
||||
rsVoip->setVoipiMinLoudness(qMin(v, 30000));
|
||||
rsVoipSI->setVoipiMinLoudness(qMin(v, 30000));
|
||||
}
|
||||
|
||||
void AudioWizard::on_Ticker_timeout() {
|
||||
@ -158,8 +158,8 @@ void AudioWizard::on_Ticker_timeout() {
|
||||
|
||||
abVAD->iBelow = qsTransmitMin->value();
|
||||
abVAD->iAbove = qsTransmitMax->value();
|
||||
rsVoip->setVoipfVADmin(qsTransmitMin->value());
|
||||
rsVoip->setVoipfVADmax(qsTransmitMax->value());
|
||||
rsVoipSI->setVoipfVADmin(qsTransmitMin->value());
|
||||
rsVoipSI->setVoipfVADmax(qsTransmitMax->value());
|
||||
|
||||
abVAD->iValue = iroundf(inputProcessor->dVoiceAcivityLevel * 32767.0f + 0.5f);
|
||||
|
||||
@ -214,19 +214,19 @@ void AudioWizard::on_playEcho_timeout() {
|
||||
|
||||
void AudioWizard::on_qsTransmitMax_valueChanged(int v) {
|
||||
if (! bInit) {
|
||||
rsVoip->setVoipfVADmax(v);
|
||||
rsVoipSI->setVoipfVADmax(v);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioWizard::on_qsTransmitMin_valueChanged(int v) {
|
||||
if (! bInit) {
|
||||
rsVoip->setVoipfVADmin(v);
|
||||
rsVoipSI->setVoipfVADmin(v);
|
||||
}
|
||||
}
|
||||
|
||||
void AudioWizard::on_qrVAD_clicked(bool on) {
|
||||
if (on) {
|
||||
rsVoip->setVoipATransmit(RsVoip::AudioTransmitVAD);
|
||||
rsVoipSI->setVoipATransmit(RsVoipServiceInterface::AudioTransmitVAD);
|
||||
updateTriggerWidgets(true);
|
||||
bTransmitChanged = true;
|
||||
}
|
||||
@ -234,7 +234,7 @@ void AudioWizard::on_qrVAD_clicked(bool on) {
|
||||
|
||||
void AudioWizard::on_qrPTT_clicked(bool on) {
|
||||
if (on) {
|
||||
rsVoip->setVoipATransmit(RsVoip::AudioTransmitPushToTalk);
|
||||
rsVoipSI->setVoipATransmit(RsVoipServiceInterface::AudioTransmitPushToTalk);
|
||||
updateTriggerWidgets(false);
|
||||
bTransmitChanged = true;
|
||||
}
|
||||
@ -242,7 +242,7 @@ void AudioWizard::on_qrPTT_clicked(bool on) {
|
||||
|
||||
void AudioWizard::on_qrContinuous_clicked(bool on) {
|
||||
if (on) {
|
||||
rsVoip->setVoipATransmit(RsVoip::AudioTransmitContinous);
|
||||
rsVoipSI->setVoipATransmit(RsVoipServiceInterface::AudioTransmitContinous);
|
||||
updateTriggerWidgets(false);
|
||||
bTransmitChanged = true;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
|
||||
iArg = -60;
|
||||
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_DECREMENT, &iArg);
|
||||
|
||||
iArg = rsVoip->getVoipiNoiseSuppress();
|
||||
iArg = rsVoipSI->getVoipiNoiseSuppress();
|
||||
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
|
||||
|
||||
if (echo_state) {
|
||||
@ -175,18 +175,18 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
|
||||
bResetProcessor = false;
|
||||
}
|
||||
|
||||
float v = 30000.0f / static_cast<float>(rsVoip->getVoipiMinLoudness());
|
||||
float v = 30000.0f / static_cast<float>(rsVoipSI->getVoipiMinLoudness());
|
||||
|
||||
iArg = iroundf(floorf(20.0f * log10f(v)));
|
||||
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_AGC_MAX_GAIN, &iArg);
|
||||
|
||||
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_GET_AGC_GAIN, &iArg);
|
||||
float gainValue = static_cast<float>(iArg);
|
||||
iArg = rsVoip->getVoipiNoiseSuppress() - iArg;
|
||||
iArg = rsVoipSI->getVoipiNoiseSuppress() - iArg;
|
||||
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
|
||||
|
||||
short * psSource = psMic;
|
||||
if (echo_state && rsVoip->getVoipEchoCancel()) {
|
||||
if (echo_state && rsVoipSI->getVoipEchoCancel()) {
|
||||
speex_echo_playback(echo_state, (short*)lastEchoFrame->data());
|
||||
speex_echo_capture(echo_state,psMic,psClean);
|
||||
psSource = psClean;
|
||||
@ -210,24 +210,24 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
|
||||
|
||||
bool bIsSpeech = false;
|
||||
|
||||
if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmax()) / 32767))
|
||||
if (dVoiceAcivityLevel > (static_cast<float>(rsVoipSI->getVoipfVADmax()) / 32767))
|
||||
bIsSpeech = true;
|
||||
else if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmin()) / 32767) && bPreviousVoice)
|
||||
else if (dVoiceAcivityLevel > (static_cast<float>(rsVoipSI->getVoipfVADmin()) / 32767) && bPreviousVoice)
|
||||
bIsSpeech = true;
|
||||
|
||||
if (! bIsSpeech) {
|
||||
iHoldFrames++;
|
||||
if (iHoldFrames < rsVoip->getVoipVoiceHold())
|
||||
if (iHoldFrames < rsVoipSI->getVoipVoiceHold())
|
||||
bIsSpeech = true;
|
||||
} else {
|
||||
iHoldFrames = 0;
|
||||
}
|
||||
|
||||
|
||||
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitContinous) {
|
||||
if (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::AudioTransmitContinous) {
|
||||
bIsSpeech = true;
|
||||
}
|
||||
else if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitPushToTalk)
|
||||
else if (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::AudioTransmitPushToTalk)
|
||||
bIsSpeech = false;//g.s.uiDoublePush && ((g.uiDoublePush < g.s.uiDoublePush) || (g.tDoublePush.elapsed() < g.s.uiDoublePush));
|
||||
|
||||
//bIsSpeech = bIsSpeech || (g.iPushToTalk > 0);
|
||||
@ -269,7 +269,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
|
||||
int vbr_on=0;
|
||||
//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.
|
||||
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitVAD) {//maybe we can do fixer bitrate when voice detection is active
|
||||
if (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::AudioTransmitVAD) {//maybe we can do fixer bitrate when voice detection is active
|
||||
vbr_on = 1;//test it on for all modes
|
||||
} else {//maybe we can do vbr for ppt and continuous
|
||||
vbr_on = 1;
|
||||
@ -368,7 +368,7 @@ bool SpeexInputProcessor::isSequential() const {
|
||||
}
|
||||
|
||||
void SpeexInputProcessor::addEchoFrame(QByteArray* echo_frame) {
|
||||
if (rsVoip->getVoipEchoCancel() && echo_frame) {
|
||||
if (rsVoipSI->getVoipEchoCancel() && echo_frame) {
|
||||
QMutexLocker l(&qmSpeex);
|
||||
lastEchoFrame = echo_frame;
|
||||
if (!echo_state) {//init echo_state
|
||||
|
@ -2,11 +2,13 @@
|
||||
|
||||
CONFIG += qt uic qrc resources
|
||||
CONFIG += mobility
|
||||
QT += multimedia
|
||||
#/QT += multimedia
|
||||
MOBILITY = multimedia
|
||||
|
||||
SOURCES = VOIPPlugin.cpp AudioInputConfig.cpp AudioStats.cpp AudioWizard.cpp SpeexProcessor.cpp audiodevicehelper.cpp
|
||||
HEADERS = AudioInputConfig.h AudioStats.h AudioWizard.h SpeexProcessor.h audiodevicehelper.h
|
||||
QMAKE_CXXFLAGS *= -Wall
|
||||
|
||||
SOURCES = p3Voip.cpp VOIPPlugin.cpp AudioInputConfig.cpp AudioStats.cpp AudioWizard.cpp SpeexProcessor.cpp audiodevicehelper.cpp
|
||||
HEADERS = p3Voip.h AudioInputConfig.h AudioStats.h AudioWizard.h SpeexProcessor.h audiodevicehelper.h
|
||||
FORMS = AudioInputConfig.ui AudioStats.ui AudioWizard.ui
|
||||
|
||||
TARGET = VOIP
|
||||
|
@ -5,7 +5,7 @@
|
||||
#include "VOIPPlugin.h"
|
||||
#include "AudioInputConfig.h"
|
||||
|
||||
//static void *inited = new VOIPPlugin() ;
|
||||
static void *inited = new VOIPPlugin() ;
|
||||
|
||||
extern "C" {
|
||||
void *RETROSHARE_PLUGIN_provide()
|
||||
@ -28,6 +28,7 @@ VOIPPlugin::VOIPPlugin()
|
||||
mVoip = NULL ;
|
||||
mPlugInHandler = NULL;
|
||||
mPeers = NULL;
|
||||
config_page = NULL ;
|
||||
}
|
||||
|
||||
void VOIPPlugin::setInterfaces(RsPlugInInterfaces &interfaces)
|
||||
@ -48,7 +49,7 @@ RsPQIService *VOIPPlugin::rs_pqi_service() const
|
||||
if(mVoip == NULL)
|
||||
{
|
||||
mVoip = new p3VoipService(mPlugInHandler) ; // , 3600 * 24 * 30 * 6); // 6 Months
|
||||
rsVoip = mVoip ;
|
||||
rsVoipSI = mVoip ;
|
||||
}
|
||||
|
||||
return mVoip ;
|
||||
|
@ -11,9 +11,7 @@ class VOIPPlugin: public RsPlugin
|
||||
virtual ~VOIPPlugin() {}
|
||||
|
||||
virtual RsPQIService *rs_pqi_service() const ;
|
||||
virtual MainPage *qt_page() const ;
|
||||
virtual QIcon *qt_icon() const ;
|
||||
virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_VOIP ; }
|
||||
virtual uint16_t rs_service_id() const { return RS_SERVICE_TYPE_VOIP_PLUGIN ; }
|
||||
virtual ConfigPage *qt_config_page() const ;
|
||||
|
||||
virtual QTranslator *qt_translator(QApplication *app, const QString& languageCode) const;
|
||||
|
@ -36,11 +36,11 @@
|
||||
|
||||
//!The basic VOIP service.
|
||||
|
||||
class p3VoipService: public RsPQIService, public RsVoip
|
||||
class p3VoipService: public RsPQIService, public RsVoipServiceInterface
|
||||
{
|
||||
public:
|
||||
p3VoipService(RsPluginHandler *handler)
|
||||
: RsPQIService(RS_SERVICE_TYPE_VOIP,CONFIG_TYPE_VOIP,0,handler)
|
||||
: RsPQIService(RS_SERVICE_TYPE_VOIP_PLUGIN,CONFIG_TYPE_VOIP_PLUGIN,0,handler)
|
||||
{}
|
||||
|
||||
/***** overloaded from p3Service *****/
|
||||
@ -51,8 +51,8 @@ class p3VoipService: public RsPQIService, public RsVoip
|
||||
* : notifyCustomState, notifyChatStatus, notifyPeerHasNewAvatar
|
||||
* @see NotifyBase
|
||||
*/
|
||||
virtual int tick();
|
||||
virtual int status();
|
||||
virtual int tick() { return 0 ;}
|
||||
// virtual int status();
|
||||
|
||||
// /*************** pqiMonitor callback ***********************/
|
||||
// virtual void statusChange(const std::list<pqipeer> &plist);
|
||||
@ -60,27 +60,24 @@ class p3VoipService: public RsPQIService, public RsVoip
|
||||
/*!
|
||||
* public chat sent to all peers
|
||||
*/
|
||||
int sendVoipData(const void *data,uint32_t size);
|
||||
int sendVoipData(const void *data,uint32_t size) { return 0 ;}
|
||||
|
||||
// config values
|
||||
|
||||
virtual int getVoipATransmit() const ;
|
||||
virtual void setVoipATransmit(int) const ;
|
||||
|
||||
virtual int getVoipVoiceHold() const ;
|
||||
virtual void setVoipVoiceHold(int) const ;
|
||||
|
||||
virtual int getVoipfVADmin() const ;
|
||||
virtual void setVoipfVADmin(int) const ;
|
||||
|
||||
virtual int getVoipfVADmax() const ;
|
||||
virtual void setVoipfVADmax(int) const ;
|
||||
virtual int getVoipiNoiseSuppress() const ;
|
||||
virtual void setVoipiNoiseSuppress(int) const ;
|
||||
virtual int getVoipiMinLoudness() const ;
|
||||
virtual void setVoipiMinLoudness(int) const ;
|
||||
virtual bool getVoipEchoCancel() const ;
|
||||
virtual void setVoipEchoCancel(bool) const ;
|
||||
virtual int getVoipATransmit() const { return _atransmit ; }
|
||||
virtual void setVoipATransmit(int) ;
|
||||
virtual int getVoipVoiceHold() const { return _voice_hold ; }
|
||||
virtual void setVoipVoiceHold(int) ;
|
||||
virtual int getVoipfVADmin() const { return _vadmin ; }
|
||||
virtual void setVoipfVADmin(int) ;
|
||||
virtual int getVoipfVADmax() const { return _vadmax ; }
|
||||
virtual void setVoipfVADmax(int) ;
|
||||
virtual int getVoipiNoiseSuppress() const { return _noise_suppress ; }
|
||||
virtual void setVoipiNoiseSuppress(int) ;
|
||||
virtual int getVoipiMinLoudness() const { return _min_loudness ; }
|
||||
virtual void setVoipiMinLoudness(int) ;
|
||||
virtual bool getVoipEchoCancel() const { return _echo_cancel ; }
|
||||
virtual void setVoipEchoCancel(bool) ;
|
||||
|
||||
protected:
|
||||
/************* from p3Config *******************/
|
||||
@ -95,6 +92,14 @@ class p3VoipService: public RsPQIService, public RsVoip
|
||||
private:
|
||||
//RsMutex mChatMtx;
|
||||
|
||||
void receiveVoipQueue();
|
||||
void receiveVoipQueue() {}
|
||||
|
||||
int _atransmit ;
|
||||
int _voice_hold ;
|
||||
int _vadmin ;
|
||||
int _vadmax ;
|
||||
int _min_loudness ;
|
||||
int _noise_suppress ;
|
||||
bool _echo_cancel ;
|
||||
};
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
class RsVoip ;
|
||||
extern RsVoip *rsVoip;
|
||||
class RsVoipServiceInterface ;
|
||||
extern RsVoipServiceInterface *rsVoipSI;
|
||||
|
||||
static const uint32_t CONFIG_TYPE_VOIP = 0xe001 ;
|
||||
//static const uint32_t RS_SERVICE_TYPE_VOIP = 0xe001 ;
|
||||
static const uint32_t CONFIG_TYPE_VOIP_PLUGIN = 0xe001 ;
|
||||
static const uint32_t RS_SERVICE_TYPE_VOIP_PLUGIN = 0xe001 ;
|
||||
|
||||
class RsVoip
|
||||
class RsVoipServiceInterface
|
||||
{
|
||||
public:
|
||||
virtual int sendVoipData(const void *data,uint32_t size) = 0;
|
||||
@ -21,20 +21,17 @@ class RsVoip
|
||||
// Config stuff
|
||||
|
||||
virtual int getVoipATransmit() const = 0 ;
|
||||
virtual void setVoipATransmit(int) const = 0 ;
|
||||
|
||||
virtual void setVoipATransmit(int) = 0 ;
|
||||
virtual int getVoipVoiceHold() const = 0 ;
|
||||
virtual void setVoipVoiceHold(int) const = 0 ;
|
||||
|
||||
virtual void setVoipVoiceHold(int) = 0 ;
|
||||
virtual int getVoipfVADmin() const = 0 ;
|
||||
virtual void setVoipfVADmin(int) const = 0 ;
|
||||
|
||||
virtual void setVoipfVADmin(int) = 0 ;
|
||||
virtual int getVoipfVADmax() const = 0 ;
|
||||
virtual void setVoipfVADmax(int) const = 0 ;
|
||||
virtual void setVoipfVADmax(int) = 0 ;
|
||||
virtual int getVoipiNoiseSuppress() const = 0 ;
|
||||
virtual void setVoipiNoiseSuppress(int) const = 0 ;
|
||||
virtual void setVoipiNoiseSuppress(int) = 0 ;
|
||||
virtual int getVoipiMinLoudness() const = 0 ;
|
||||
virtual void setVoipiMinLoudness(int) const = 0 ;
|
||||
virtual void setVoipiMinLoudness(int) = 0 ;
|
||||
virtual bool getVoipEchoCancel() const = 0 ;
|
||||
virtual void setVoipEchoCancel(bool) const = 0 ;
|
||||
virtual void setVoipEchoCancel(bool) = 0 ;
|
||||
};
|
||||
|
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "rsvoip.h"
|
||||
|
||||
const uint8_t RS_VOIP_SUBTYPE_RINGING = 0x01 ;
|
||||
const uint8_t RS_VOIP_SUBTYPE_ACKNOWL = 0x02 ;
|
||||
const uint8_t RS_VOIP_SUBTYPE_DATA = 0x03 ;
|
||||
@ -7,7 +9,7 @@ const uint8_t RS_VOIP_SUBTYPE_DATA = 0x03 ;
|
||||
class RsVoipItem: public RsItem
|
||||
{
|
||||
public:
|
||||
RsVoipItem(uint8_t turtle_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_VOIP,voip_subtype) {}
|
||||
RsVoipItem(uint8_t turtle_subtype) : RsItem(RS_PKT_VERSION_SERVICE,RS_SERVICE_TYPE_VOIP_PLUGIN,voip_subtype) {}
|
||||
|
||||
virtual bool serialize(void *data,uint32_t& size) = 0 ; // Isn't it better that items can serialize themselves ?
|
||||
virtual uint32_t serial_size() = 0 ; // deserialise is handled using a constructor
|
||||
|
Loading…
Reference in New Issue
Block a user