- add stun server IP setting + fix problem when processing incoming audio data
This commit is contained in:
parent
93d53957a2
commit
eabc1b5c3d
|
|
@ -190,6 +190,7 @@ void AgentImpl::processConfig(JsonCpp::Value &d, JsonCpp::Value &answer)
|
||||||
mUseNativeAudio = d["nativeaudio"].asBool();
|
mUseNativeAudio = d["nativeaudio"].asBool();
|
||||||
config()[CONFIG_OWN_DNS] = d["dns_servers"].asString();
|
config()[CONFIG_OWN_DNS] = d["dns_servers"].asString();
|
||||||
config()[CONFIG_SIPS] = d["secure"].asBool();
|
config()[CONFIG_SIPS] = d["secure"].asBool();
|
||||||
|
config()[CONFIG_STUNSERVER_IP] = d["stun_server"].asString();
|
||||||
|
|
||||||
answer["status"] = Status_Ok;
|
answer["status"] = Status_Ok;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -185,6 +185,7 @@ void DevicePair::onSpkData(const Format& f, void* buffer, int length)
|
||||||
{
|
{
|
||||||
memset(mOutput10msBuffer.mutableData(), 0, (size_t)mOutput10msBuffer.capacity());
|
memset(mOutput10msBuffer.mutableData(), 0, (size_t)mOutput10msBuffer.capacity());
|
||||||
|
|
||||||
|
// Ask audio data on main AUDIO_SAMPLERATE frequency
|
||||||
if (mDelegate)
|
if (mDelegate)
|
||||||
mDelegate->onSpkData(Format(), mOutput10msBuffer.mutableData(), mOutput10msBuffer.capacity());
|
mDelegate->onSpkData(Format(), mOutput10msBuffer.mutableData(), mOutput10msBuffer.capacity());
|
||||||
|
|
||||||
|
|
@ -197,8 +198,12 @@ void DevicePair::onSpkData(const Format& f, void* buffer, int length)
|
||||||
|
|
||||||
// Resample these 10 milliseconds it to native format
|
// Resample these 10 milliseconds it to native format
|
||||||
size_t wasProcessed = 0;
|
size_t wasProcessed = 0;
|
||||||
size_t wasProduced = mSpkResampler.resample(nativeFormat.mRate, mOutput10msBuffer.data(), mOutput10msBuffer.capacity(), wasProcessed, f.mRate,
|
size_t wasProduced = mSpkResampler.resample(Format().mRate,
|
||||||
mOutputNativeData.mutableData() + mOutputNativeData.filled(), mOutputNativeData.capacity() - mOutputNativeData.filled());
|
mOutput10msBuffer.data(),
|
||||||
|
mOutput10msBuffer.capacity(),
|
||||||
|
wasProcessed, f.mRate,
|
||||||
|
mOutputNativeData.mutableData() + mOutputNativeData.filled(),
|
||||||
|
mOutputNativeData.capacity() - mOutputNativeData.filled());
|
||||||
mOutputNativeData.setFilled(mOutputNativeData.filled() + wasProduced);
|
mOutputNativeData.setFilled(mOutputNativeData.filled() + wasProduced);
|
||||||
#ifdef CONSOLE_LOGGING
|
#ifdef CONSOLE_LOGGING
|
||||||
printf("Resampled %d to %d\n", wasProcessed, wasProduced);
|
printf("Resampled %d to %d\n", wasProcessed, wasProduced);
|
||||||
|
|
|
||||||
|
|
@ -730,7 +730,11 @@ void AudioReceiver::initPvqa()
|
||||||
if (!mPVQA)
|
if (!mPVQA)
|
||||||
{
|
{
|
||||||
mPVQA = std::make_shared<sevana::pvqa>();
|
mPVQA = std::make_shared<sevana::pvqa>();
|
||||||
mPVQA->open(AUDIO_SAMPLERATE, 1, PVQA_INTERVAL);
|
bool is_opened = mPVQA->open(AUDIO_SAMPLERATE, 1, PVQA_INTERVAL);
|
||||||
|
if (!is_opened)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -753,7 +757,11 @@ void AudioReceiver::updatePvqa(const void *data, int size)
|
||||||
int time4pvqa = (int)(frames * PVQA_INTERVAL * 1000);
|
int time4pvqa = (int)(frames * PVQA_INTERVAL * 1000);
|
||||||
int size4pvqa = (int)fmt.sizeFromTime(time4pvqa);
|
int size4pvqa = (int)fmt.sizeFromTime(time4pvqa);
|
||||||
ICELogDebug(<< "PVQA buffer has " << time4pvqa << " milliseconds of audio.");
|
ICELogDebug(<< "PVQA buffer has " << time4pvqa << " milliseconds of audio.");
|
||||||
mPVQA->update(mPvqaBuffer->data(), size4pvqa);
|
bool update_result = mPVQA->update(mPvqaBuffer->data(), size4pvqa);
|
||||||
|
if (!update_result)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
mPvqaBuffer->erase(size4pvqa);
|
mPvqaBuffer->erase(size4pvqa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,7 @@ CodecList::CodecList(const Settings& settings)
|
||||||
:mSettings(settings)
|
:mSettings(settings)
|
||||||
{
|
{
|
||||||
//mFactoryList.push_back(new OpusCodec::OpusFactory(16000, 1));
|
//mFactoryList.push_back(new OpusCodec::OpusFactory(16000, 1));
|
||||||
|
/*
|
||||||
#if defined(USE_OPUS_CODEC)
|
#if defined(USE_OPUS_CODEC)
|
||||||
if (settings.mOpusSpec.empty())
|
if (settings.mOpusSpec.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -145,6 +146,7 @@ CodecList::CodecList(const Settings& settings)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_RPI)
|
#if !defined(TARGET_ANDROID) && !defined(TARGET_OPENWRT) && !defined(TARGET_RPI)
|
||||||
#if defined(USE_AMR_CODEC)
|
#if defined(USE_AMR_CODEC)
|
||||||
|
|
@ -161,14 +163,14 @@ CodecList::CodecList(const Settings& settings)
|
||||||
mFactoryList.push_back(new GsmEfrCodec::GsmEfrFactory(mSettings.mWrapIuUP, mSettings.mGsmEfrPayloadType));
|
mFactoryList.push_back(new GsmEfrCodec::GsmEfrFactory(mSettings.mWrapIuUP, mSettings.mGsmEfrPayloadType));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
mFactoryList.push_back(new IsacCodec::IsacFactory16K(mSettings.mIsac16KPayloadType));
|
// mFactoryList.push_back(new IsacCodec::IsacFactory16K(mSettings.mIsac16KPayloadType));
|
||||||
mFactoryList.push_back(new IlbcCodec::IlbcFactory(mSettings.mIlbc20PayloadType, mSettings.mIlbc30PayloadType));
|
// mFactoryList.push_back(new IlbcCodec::IlbcFactory(mSettings.mIlbc20PayloadType, mSettings.mIlbc30PayloadType));
|
||||||
mFactoryList.push_back(new G711Codec::AlawFactory());
|
mFactoryList.push_back(new G711Codec::AlawFactory());
|
||||||
mFactoryList.push_back(new G711Codec::UlawFactory());
|
mFactoryList.push_back(new G711Codec::UlawFactory());
|
||||||
|
|
||||||
mFactoryList.push_back(new GsmCodec::GsmFactory(mSettings.mGsmFrPayloadLength == 32 ? GsmCodec::Type::Bytes_32 : GsmCodec::Type::Bytes_33, mSettings.mGsmFrPayloadType));
|
mFactoryList.push_back(new GsmCodec::GsmFactory(mSettings.mGsmFrPayloadLength == 32 ? GsmCodec::Type::Bytes_32 : GsmCodec::Type::Bytes_33, mSettings.mGsmFrPayloadType));
|
||||||
mFactoryList.push_back(new G722Codec::G722Factory());
|
// mFactoryList.push_back(new G722Codec::G722Factory());
|
||||||
mFactoryList.push_back(new G729Codec::G729Factory());
|
// mFactoryList.push_back(new G729Codec::G729Factory());
|
||||||
#ifndef TARGET_ANDROID
|
#ifndef TARGET_ANDROID
|
||||||
mFactoryList.push_back(new GsmHrCodec::GsmHrFactory(mSettings.mGsmHrPayloadType));
|
mFactoryList.push_back(new GsmHrCodec::GsmHrFactory(mSettings.mGsmHrPayloadType));
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -453,7 +453,7 @@ BaseSecurity::addCertPEM (PEMType type,
|
||||||
ErrLog(<< name << " is empty. Skipping.");
|
ErrLog(<< name << " is empty. Skipping.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
X509* cert=NULL;
|
X509* cert = NULL;
|
||||||
|
|
||||||
BIO* in = BIO_new_mem_buf(const_cast<char*>(certPEM.c_str()), -1);
|
BIO* in = BIO_new_mem_buf(const_cast<char*>(certPEM.c_str()), -1);
|
||||||
if ( !in )
|
if ( !in )
|
||||||
|
|
@ -466,7 +466,7 @@ BaseSecurity::addCertPEM (PEMType type,
|
||||||
{
|
{
|
||||||
ErrLog( << "Could not load X509 cert from '" << certPEM << "'" );
|
ErrLog( << "Could not load X509 cert from '" << certPEM << "'" );
|
||||||
BIO_free(in);
|
BIO_free(in);
|
||||||
throw Exception("Could not load X509 cert from BIO buffer", __FILE__,__LINE__);
|
// throw Exception("Could not load X509 cert from BIO buffer", __FILE__,__LINE__);
|
||||||
}
|
}
|
||||||
|
|
||||||
addCertX509(type,name,cert,write);
|
addCertX509(type,name,cert,write);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue