merged existing p3VoRS service with VOIP plugin

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4965 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-02-19 15:07:47 +00:00
parent 08d57e1681
commit 2f38506763
14 changed files with 730 additions and 102 deletions

View file

@ -11,7 +11,7 @@
#include <cstdlib>
#include <QDateTime>
#include "rsvoip.h"
#include "interface/rsvoip.h"
//#include "gui/settings/rsharesettings.h"
@ -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 = rsVoipSI->getVoipiNoiseSuppress();
iArg = rsVoip->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>(rsVoipSI->getVoipiMinLoudness());
float v = 30000.0f / static_cast<float>(rsVoip->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 = rsVoipSI->getVoipiNoiseSuppress() - iArg;
iArg = rsVoip->getVoipiNoiseSuppress() - iArg;
speex_preprocess_ctl(preprocessor, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &iArg);
short * psSource = psMic;
if (echo_state && rsVoipSI->getVoipEchoCancel()) {
if (echo_state && rsVoip->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>(rsVoipSI->getVoipfVADmax()) / 32767))
if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmax()) / 32767))
bIsSpeech = true;
else if (dVoiceAcivityLevel > (static_cast<float>(rsVoipSI->getVoipfVADmin()) / 32767) && bPreviousVoice)
else if (dVoiceAcivityLevel > (static_cast<float>(rsVoip->getVoipfVADmin()) / 32767) && bPreviousVoice)
bIsSpeech = true;
if (! bIsSpeech) {
iHoldFrames++;
if (iHoldFrames < rsVoipSI->getVoipVoiceHold())
if (iHoldFrames < rsVoip->getVoipVoiceHold())
bIsSpeech = true;
} else {
iHoldFrames = 0;
}
if (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::AudioTransmitContinous) {
if (rsVoip->getVoipATransmit() == RsVoip::AudioTransmitContinous) {
bIsSpeech = true;
}
else if (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::AudioTransmitPushToTalk)
else if (rsVoip->getVoipATransmit() == RsVoip::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 (rsVoipSI->getVoipATransmit() == RsVoipServiceInterface::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
} 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 (rsVoipSI->getVoipEchoCancel() && echo_frame) {
if (rsVoip->getVoipEchoCancel() && echo_frame) {
QMutexLocker l(&qmSpeex);
lastEchoFrame = echo_frame;
if (!echo_state) {//init echo_state