patch from joss to correct some bugs in VOIP plugin

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4994 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-02-26 16:10:27 +00:00
parent b748f1a3f1
commit af1b90707a
4 changed files with 22 additions and 20 deletions

View File

@ -125,8 +125,8 @@ 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.qcbTransmit->setCurrentIndex(rsVoip->getVoipATransmit());
on_qcbTransmit_currentIndexChanged(rsVoip->getVoipATransmit());
ui.qsTransmitHold->setValue(rsVoip->getVoipVoiceHold());
on_qsTransmitHold_valueChanged(rsVoip->getVoipVoiceHold());
ui.qsTransmitMin->setValue(rsVoip->getVoipfVADmin());
@ -167,7 +167,7 @@ bool AudioInputConfig::save(QString &/*errmsg*/) {//mainly useless beacause savi
rsVoip->setVoipfVADmin(ui.qsTransmitMin->value());
rsVoip->setVoipfVADmax(ui.qsTransmitMax->value());
/*s.uiDoublePush = qsDoublePush->value() * 1000;*/
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() + 1));
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
rsVoip->setVoipEchoCancel(ui.qcbEchoCancel->isChecked());
return true;
@ -232,7 +232,7 @@ void AudioInputConfig::on_qcbTransmit_currentIndexChanged(int v) {
break;
}
if (loaded)
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() + 1));
rsVoip->setVoipATransmit(static_cast<RsVoip::enumAudioTransmit>(ui.qcbTransmit->currentIndex() ));
}

View File

@ -2,6 +2,7 @@
#include <QPropertyAnimation>
#include <QIcon>
#include "AudioPopupChatDialog.h"
#include "interface/rsvoip.h"
AudioPopupChatDialog::AudioPopupChatDialog(QWidget *parent)
{
@ -13,33 +14,35 @@ AudioPopupChatDialog::AudioPopupChatDialog(QWidget *parent)
std::cerr << "****** VOIPLugin: Creating new AudioPopupChatDialog !!" << std::endl;
QIcon icon ;
icon.addPixmap(QPixmap(":/images/deafened_self.svg"),QIcon::Normal,QIcon::Off) ;
icon.addPixmap(QPixmap(":/images/deafened_self.svg")) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Normal,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Disabled,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Active,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/self_undeafened.svg"),QIcon::Selected,QIcon::On) ;
icon.addPixmap(QPixmap(":/images/deafened_self.svg")) ;
//icon.addPixmap(QPixmap(":/images/deafened_self.svg")) ;
audioListenToggleButton->setIcon(icon) ;
audioListenToggleButton->setIconSize(QSize(22,22)) ;
audioListenToggleButton->setFlat(true) ;
audioListenToggleButton->setCheckable(true);
audioMuteCaptureToggleButton = new QPushButton ;
audioMuteCaptureToggleButton->setMinimumSize(QSize(28,28)) ;
audioMuteCaptureToggleButton->setMaximumSize(QSize(28,28)) ;
audioMuteCaptureToggleButton->setText(QString()) ;
audioMuteCaptureToggleButton->setText(QString()) ;
QIcon icon2 ;
icon2.addPixmap(QPixmap(":/images/muted_self.svg"),QIcon::Normal,QIcon::Off) ;
icon2.addPixmap(QPixmap(":/images/muted_self.svg")) ;
icon2.addPixmap(QPixmap(":/images/talking_off.svg"),QIcon::Normal,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/talking_off.svg"),QIcon::Disabled,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/talking_off.svg"),QIcon::Active,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/talking_off.svg"),QIcon::Selected,QIcon::On) ;
icon2.addPixmap(QPixmap(":/images/muted_self.svg")) ;
//icon2.addPixmap(QPixmap(":/images/muted_self.svg")) ;
audioMuteCaptureToggleButton->setIcon(icon2) ;
audioMuteCaptureToggleButton->setIconSize(QSize(22,22)) ;
audioMuteCaptureToggleButton->setFlat(true) ;
audioMuteCaptureToggleButton->setCheckable(true) ;
connect(audioListenToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioListen()));
connect(audioMuteCaptureToggleButton, SIGNAL(clicked()), this , SLOT(toggleAudioMuteCapture()));
@ -60,7 +63,7 @@ void AudioPopupChatDialog::toggleAudioListen()
std::cerr << "******** VOIPLugin: Toggling audio listen!" << std::endl;
if (audioListenToggleButton->isChecked()) {
} else {
audioListenToggleButton->setChecked(false);
//audioListenToggleButton->setChecked(false);
/*if (outputDevice) {
outputDevice->stop();
}*/
@ -154,14 +157,11 @@ void AudioPopupChatDialog::addAudioData(const QString name, QByteArray* array)
void AudioPopupChatDialog::sendAudioData() {
while(inputProcessor && inputProcessor->hasPendingPackets()) {
QByteArray qbarray = inputProcessor->getNetworkPacket();
if (qbarray != NULL) {
std::wstring s2 ( L"" );
char * buff = new char[qbarray.size()];
memcpy(buff,qbarray.constData(),qbarray.size()) ;
#ifdef VOIP_SUSPENDED
rsMsgs->sendPrivateChat(peerId, s2,buff, qbarray.size());
#endif
}
RsVoipDataChunk chunk;
chunk.size = qbarray.size();
chunk.data = malloc(qbarray.size());
memcpy(chunk.data,qbarray.constData(),qbarray.size()) ;
rsVoip->sendVoipData(peerId,chunk);
}
}

View File

@ -244,7 +244,8 @@ int p3VoRS::sendVoipData(const std::string& peer_id,const RsVoipDataChunk& chunk
}
memcpy(item->voip_data,chunk.data,chunk.size) ;
item->flags = 0 ;
item->PeerId(peer_id) ;
item->PeerId(peer_id) ;
item->data_size = chunk.size;
sendItem(item) ;

View File

@ -181,7 +181,8 @@ bool RsVoipDataItem::serialise(void *data, uint32_t& pktsize)
/* add mandatory parts first */
ok &= setRawUInt32(data, tlvsize, &offset, flags);
ok &= setRawUInt32(data, tlvsize, &offset, data_size);
memcpy(data,voip_data,data_size) ;
std::cerr << "data_size : " << data_size << std::endl;
memcpy(data+offset,voip_data,data_size) ;
offset += data_size ;
if (offset != tlvsize)