mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-17 10:59:38 -04:00
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:
parent
181983be10
commit
c5a5c1654f
3 changed files with 27 additions and 15 deletions
|
@ -67,7 +67,15 @@ AudioInputConfig::~AudioInputConfig()
|
||||||
{
|
{
|
||||||
if (inputDevice) {
|
if (inputDevice) {
|
||||||
inputDevice->stop();
|
inputDevice->stop();
|
||||||
|
delete inputDevice ;
|
||||||
|
inputDevice = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(inputProcessor)
|
||||||
|
{
|
||||||
|
delete inputProcessor ;
|
||||||
|
inputProcessor = NULL ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
|
|
|
@ -21,15 +21,15 @@
|
||||||
using namespace QtSpeex;
|
using namespace QtSpeex;
|
||||||
|
|
||||||
SpeexInputProcessor::SpeexInputProcessor(QObject *parent) : QIODevice(parent),
|
SpeexInputProcessor::SpeexInputProcessor(QObject *parent) : QIODevice(parent),
|
||||||
preprocessor(0),
|
iMaxBitRate(16800),
|
||||||
|
lastEchoFrame(NULL),
|
||||||
enc_state(0),
|
enc_state(0),
|
||||||
enc_bits(),
|
enc_bits(),
|
||||||
send_timestamp(0),
|
send_timestamp(0),
|
||||||
echo_state(0),
|
|
||||||
inputBuffer(),
|
|
||||||
iMaxBitRate(16800),
|
|
||||||
bResetProcessor(true),
|
bResetProcessor(true),
|
||||||
lastEchoFrame(NULL)
|
preprocessor(0),
|
||||||
|
echo_state(0),
|
||||||
|
inputBuffer()
|
||||||
{
|
{
|
||||||
enc_bits = new SpeexBits;
|
enc_bits = new SpeexBits;
|
||||||
speex_bits_init(enc_bits);
|
speex_bits_init(enc_bits);
|
||||||
|
@ -105,8 +105,7 @@ SpeexInputProcessor::~SpeexInputProcessor() {
|
||||||
|
|
||||||
speex_bits_destroy(enc_bits);
|
speex_bits_destroy(enc_bits);
|
||||||
delete enc_bits;
|
delete enc_bits;
|
||||||
|
delete[] psClean;
|
||||||
free(psClean);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray SpeexInputProcessor::getNetworkPacket() {
|
QByteArray SpeexInputProcessor::getNetworkPacket() {
|
||||||
|
@ -125,7 +124,7 @@ qint64 SpeexInputProcessor::writeData(const char *data, qint64 maxSize) {
|
||||||
|
|
||||||
inputBuffer += QByteArray(data, 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));
|
QByteArray source_frame = inputBuffer.left(FRAME_SIZE * sizeof(qint16));
|
||||||
short* psMic = (short *)source_frame.data();
|
short* psMic = (short *)source_frame.data();
|
||||||
|
@ -398,7 +397,7 @@ qint64 SpeexOutputProcessor::readData(char *data, qint64 maxSize) {
|
||||||
intermediate_frame.resize(FRAME_SIZE * sizeof(qint16));
|
intermediate_frame.resize(FRAME_SIZE * sizeof(qint16));
|
||||||
if (jitter->firsttimecalling_get)
|
if (jitter->firsttimecalling_get)
|
||||||
{
|
{
|
||||||
int ts = jitter->mostUpdatedTSatPut;
|
//int ts = jitter->mostUpdatedTSatPut;
|
||||||
jitter->firsttimecalling_get = false;
|
jitter->firsttimecalling_get = false;
|
||||||
}
|
}
|
||||||
speex_jitter_get(*jitter, (spx_int16_t*)intermediate_frame.data(), &ts);
|
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 i;
|
||||||
int ret;
|
int ret;
|
||||||
spx_int32_t activity;
|
spx_int32_t activity;
|
||||||
int bufferCount = 0;
|
//int bufferCount = 0;
|
||||||
JitterBufferPacket packet;
|
JitterBufferPacket packet;
|
||||||
char data[FRAME_SIZE * ECHOTAILSIZE * 10];
|
char data[FRAME_SIZE * ECHOTAILSIZE * 10];
|
||||||
packet.data = data;
|
packet.data = data;
|
||||||
|
|
|
@ -5,7 +5,8 @@ AudioDeviceHelper::AudioDeviceHelper()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QAudioInput* AudioDeviceHelper::getDefaultInputDevice() {
|
QAudioInput* AudioDeviceHelper::getDefaultInputDevice()
|
||||||
|
{
|
||||||
QAudioFormat fmt;
|
QAudioFormat fmt;
|
||||||
fmt.setFrequency(16000);
|
fmt.setFrequency(16000);
|
||||||
fmt.setChannels(1);
|
fmt.setChannels(1);
|
||||||
|
@ -15,10 +16,11 @@ QAudioInput* AudioDeviceHelper::getDefaultInputDevice() {
|
||||||
fmt.setCodec("audio/pcm");
|
fmt.setCodec("audio/pcm");
|
||||||
|
|
||||||
QAudioDeviceInfo it, dev;
|
QAudioDeviceInfo it, dev;
|
||||||
|
QList<QAudioDeviceInfo> input_list = QAudioDeviceInfo::availableDevices(QAudio::AudioInput) ;
|
||||||
|
|
||||||
dev = QAudioDeviceInfo::defaultInputDevice();
|
dev = QAudioDeviceInfo::defaultInputDevice();
|
||||||
if (dev.deviceName() != "pulse") {
|
if (dev.deviceName() != "pulse") {
|
||||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) {
|
foreach(it, input_list) {
|
||||||
if(it.deviceName() == "pulse") {
|
if(it.deviceName() == "pulse") {
|
||||||
dev = it;
|
dev = it;
|
||||||
qDebug("Ok.");
|
qDebug("Ok.");
|
||||||
|
@ -27,7 +29,7 @@ QAudioInput* AudioDeviceHelper::getDefaultInputDevice() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dev.deviceName() == "null") {
|
if (dev.deviceName() == "null") {
|
||||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioInput)) {
|
foreach(it, input_list) {
|
||||||
if(it.deviceName() != "null") {
|
if(it.deviceName() != "null") {
|
||||||
dev = it;
|
dev = it;
|
||||||
break;
|
break;
|
||||||
|
@ -50,10 +52,13 @@ QAudioOutput* AudioDeviceHelper::getDefaultOutputDevice() {
|
||||||
fmt.setByteOrder(QAudioFormat::LittleEndian);
|
fmt.setByteOrder(QAudioFormat::LittleEndian);
|
||||||
fmt.setCodec("audio/pcm");
|
fmt.setCodec("audio/pcm");
|
||||||
|
|
||||||
|
QList<QAudioDeviceInfo> list_output = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput) ;
|
||||||
|
|
||||||
QAudioDeviceInfo it, dev;
|
QAudioDeviceInfo it, dev;
|
||||||
dev = QAudioDeviceInfo::defaultOutputDevice();
|
dev = QAudioDeviceInfo::defaultOutputDevice();
|
||||||
|
|
||||||
if (dev.deviceName() != "pulse") {
|
if (dev.deviceName() != "pulse") {
|
||||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
|
foreach(it, list_output) {
|
||||||
if(it.deviceName() == "pulse") {
|
if(it.deviceName() == "pulse") {
|
||||||
dev = it;
|
dev = it;
|
||||||
break;
|
break;
|
||||||
|
@ -61,7 +66,7 @@ QAudioOutput* AudioDeviceHelper::getDefaultOutputDevice() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dev.deviceName() == "null") {
|
if (dev.deviceName() == "null") {
|
||||||
foreach(it, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) {
|
foreach(it, list_output) {
|
||||||
if(it.deviceName() != "null") {
|
if(it.deviceName() != "null") {
|
||||||
dev = it;
|
dev = it;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue