- use time intervals PVQA API
This commit is contained in:
parent
7c753dca40
commit
05689d0984
|
|
@ -649,7 +649,11 @@ void AudioReceiver::initPvqa()
|
|||
if (!mPVQA)
|
||||
{
|
||||
mPVQA = std::make_shared<MT::SevanaPVQA>();
|
||||
#if defined(USE_PVQA_STREAM)
|
||||
mPVQA->open(PVQA_INTERVAL, MT::SevanaPVQA::Model::Stream);
|
||||
#else
|
||||
mPVQA->open(PVQA_INTERVAL, MT::SevanaPVQA::Model::Interval);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -672,8 +676,12 @@ void AudioReceiver::updatePvqa(const void *data, int size)
|
|||
int time4pvqa = (int)(frames * PVQA_INTERVAL * 1000);
|
||||
int size4pvqa = (int)fmt.sizeFromTime(time4pvqa);
|
||||
ICELogInfo(<< "Updating PVQA with " << time4pvqa << " milliseconds of audio.");
|
||||
#if defined(USE_PVQA_STREAM)
|
||||
mPVQA->update(fmt.mRate, fmt.mChannels, mPvqaBuffer->data(), size4pvqa);
|
||||
mPvqaBuffer->erase(size4pvqa);
|
||||
#else
|
||||
// Just wait for getResults() to make analysis
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -682,13 +690,14 @@ float AudioReceiver::calculatePvqaMos(int rate, std::string& report)
|
|||
{
|
||||
if (mPVQA && mPvqaBuffer)
|
||||
{
|
||||
// Flush remaining audio to analyzer
|
||||
/*if (mPvqaBuffer->filled())
|
||||
{
|
||||
mPVQA->update(rate, AUDIO_CHANNELS, mPvqaBuffer->data(), mPvqaBuffer->filled());
|
||||
mPvqaBuffer->clear();
|
||||
}*/
|
||||
return mPVQA->getResults(report, nullptr, rate, MT::SevanaPVQA::Codec::None);
|
||||
if (mPVQA->getModel() == MT::SevanaPVQA::Model::Interval)
|
||||
{
|
||||
Audio::Format fmt;
|
||||
return mPVQA->process(fmt.mRate, fmt.mChannels, mPvqaBuffer->data(), mPvqaBuffer->filled(),
|
||||
report, MT::SevanaPVQA::Codec::None);
|
||||
}
|
||||
else
|
||||
return mPVQA->getResults(report, nullptr, rate, MT::SevanaPVQA::Codec::None);
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -333,6 +333,8 @@ void SevanaPVQA::update(int samplerate, int channels, const void *pcmBuffer, int
|
|||
ICELogError(<< "No PVQA context.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Model is assert here as it can be any if context is not created.
|
||||
assert (mModel == Model::Stream);
|
||||
|
||||
|
|
@ -346,6 +348,8 @@ void SevanaPVQA::update(int samplerate, int channels, const void *pcmBuffer, int
|
|||
{
|
||||
ICELogError(<< "Failed to stream data to PVQA instance. Result code: " << rescode);
|
||||
}
|
||||
|
||||
|
||||
int milliseconds = pcmLength / 2 / channels / (samplerate / 1000);
|
||||
mProcessedMilliseconds += milliseconds;
|
||||
mAllProcessedMilliseconds += milliseconds;
|
||||
|
|
@ -466,7 +470,7 @@ float SevanaPVQA::getResults(std::string& report, EchoData** echo, int samplerat
|
|||
|
||||
// Limit maximal value of MOS depending on codec
|
||||
float result = (float)results.dMOSLike;
|
||||
float mv = 5.0;
|
||||
float mv = 5.0f;
|
||||
switch (codec)
|
||||
{
|
||||
case Codec::G711: mv = 4.1f; break;
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#if defined(USE_AQUA_LIBRARY)
|
||||
# include "aqua.h"
|
||||
# include <json/json.h>
|
||||
#include <helper/HL_ByteBuffer.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
@ -68,6 +70,7 @@ protected:
|
|||
std::string mDumpWavPath;
|
||||
bool mOpenFailed = false;
|
||||
|
||||
ByteBuffer mAudioDump;
|
||||
public:
|
||||
static std::string getVersion();
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue