fixed small issues.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5596 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2012-09-24 19:53:53 +00:00
parent 181983be10
commit c5a5c1654f
3 changed files with 27 additions and 15 deletions

View File

@ -67,7 +67,15 @@ AudioInputConfig::~AudioInputConfig()
{
if (inputDevice) {
inputDevice->stop();
delete inputDevice ;
inputDevice = NULL ;
}
if(inputProcessor)
{
delete inputProcessor ;
inputProcessor = NULL ;
}
}
/** Loads the settings for this page */

View File

@ -21,15 +21,15 @@
using namespace QtSpeex;
SpeexInputProcessor::SpeexInputProcessor(QObject *parent) : QIODevice(parent),
preprocessor(0),
iMaxBitRate(16800),
lastEchoFrame(NULL),
enc_state(0),
enc_bits(),
send_timestamp(0),
echo_state(0),
inputBuffer(),
iMaxBitRate(16800),
bResetProcessor(true),
lastEchoFrame(NULL)
preprocessor(0),
echo_state(0),
inputBuffer()
{
enc_bits = new SpeexBits;
speex_bits_init(enc_bits);
@ -105,8 +105,7 @@ SpeexInputProcessor::~SpeexInputProcessor() {
speex_bits_destroy(enc_bits);
delete enc_bits;
free(psClean);
delete[] psClean;
}
QByteArray SpeexInputProcessor::getNetworkPacket() {
@ -125,7 +124,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
inputBuffer += QByteArray(data, maxSize);
while(inputBuffer.size() > FRAME_SIZE * sizeof(qint16)) {
while((size_t)inputBuffer.size() > FRAME_SIZE * sizeof(qint16)) {
QByteArray source_frame = inputBuffer.left(FRAME_SIZE * sizeof(qint16));
short* psMic = (short *)source_frame.data();
@ -398,7 +397,7 @@ qint64 SpeexOutputProcessor::readData(char *data, qint64 maxSize) {
intermediate_frame.resize(FRAME_SIZE * sizeof(qint16));
if (jitter->firsttimecalling_get)
{
int ts = jitter->mostUpdatedTSatPut;
//int ts = jitter->mostUpdatedTSatPut;
jitter->firsttimecalling_get = false;
}
speex_jitter_get(*jitter, (spx_int16_t*)intermediate_frame.data(), &ts);
@ -467,7 +466,7 @@ void SpeexOutputProcessor::speex_jitter_get(SpeexJitter jitter, spx_int16_t *out
int i;
int ret;
spx_int32_t activity;
int bufferCount = 0;
//int bufferCount = 0;
JitterBufferPacket packet;
char data[FRAME_SIZE * ECHOTAILSIZE * 10];
packet.data = data;

View File

@ -5,7 +5,8 @@ AudioDeviceHelper::AudioDeviceHelper()
{
}
QAudioInput* AudioDeviceHelper::getDefaultInputDevice() {
QAudioInput* AudioDeviceHelper::getDefaultInputDevice()
{
QAudioFormat fmt;
fmt.setFrequency(16000);
fmt.setChannels(1);
@ -15,10 +16,11 @@ QAudioInput* AudioDeviceHelper::getDefaultInputDevice() {
fmt.setCodec("audio/pcm");
QAudioDeviceInfo it, dev;
QList<QAudioDeviceInfo> input_list = QAudioDeviceInfo::availableDevices(QAudio::AudioInput) ;
dev = QAudioDeviceInfo::defaultInputDevice();
if (dev.deviceName() != "pulse") {
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) {
foreach(it, input_list) {
if(it.deviceName() == "pulse") {
dev = it;
qDebug("Ok.");
@ -27,7 +29,7 @@ QAudioInput* AudioDeviceHelper::getDefaultInputDevice() {
}
}
if (dev.deviceName() == "null") {
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) {
foreach(it, input_list) {
if(it.deviceName() != "null") {
dev = it;
break;
@ -50,10 +52,13 @@ QAudioOutput* AudioDeviceHelper::getDefaultOutputDevice() {
fmt.setByteOrder(QAudioFormat::LittleEndian);
fmt.setCodec("audio/pcm");
QList<QAudioDeviceInfo> list_output = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput) ;
QAudioDeviceInfo it, dev;
dev = QAudioDeviceInfo::defaultOutputDevice();
if (dev.deviceName() != "pulse") {
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
foreach(it, list_output) {
if(it.deviceName() == "pulse") {
dev = it;
break;
@ -61,7 +66,7 @@ QAudioOutput* AudioDeviceHelper::getDefaultOutputDevice() {
}
}
if (dev.deviceName() == "null") {
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
foreach(it, list_output) {
if(it.deviceName() != "null") {
dev = it;
break;