- work on further AQuA integration - now spectrum information is here

This commit is contained in:
Dmytro Bogovych 2020-06-27 21:50:03 +03:00
parent cb037b5ae0
commit 49fbe2345f
1 changed files with 89 additions and 67 deletions

View File

@ -332,14 +332,35 @@ void AgentImpl::processStartSession(Json::Value& request, Json::Value& answer)
audioProvider->setState(audioProvider->state() | static_cast<int>(StreamState::Grabbing) | static_cast<int>(StreamState::Playing));
#if defined(USE_AQUA_LIBRARY)
std::string temp_path = request["aqua_temp_path"].asString();
std::string config = "-avlp on -smtnrm on -decor off -mprio off -npnt auto -voip off -enorm off -g711 on -spfrcor off -grad off -tmc on -miter 1 -trim a 10 -output json";
std::string path_faults = request["path_faults"].asString();
sevana::aqua::config config = {
{ "avlp", "off" },
{ "decor", "off" },
{ "mprio", "off" },
{ "miter", "1" },
{ "enorm", "off" },
{ "voip", "on" },
{ "g711", "on" },
{ "spfrcor", "on" },
{ "grad", "off" },
{ "ratem", "%%m" },
{ "trim", "a 2" },
{ "output", "json" },
{ "fau", path_faults},
{ "specp", "32"}
};
// std::string config = "-avlp on -smtnrm on -decor off -mprio off -npnt auto -voip off -enorm off -g711 on -spfrcor off -grad off -tmc on -miter 1 -trim a 10 -output json";
/*if (temp_path.size())
config += " -fau " + temp_path; */
auto qc = std::make_shared<sevana::aqua>();
//qc->setTempPath(temp_path);
qc->configure_with(sevana::aqua::parse(config));
if (!qc->is_open())
{
std::cerr << "Problem when initializing AQuA library" << std::endl;
}
qc->configure_with(config);
mAquaMap[sessionIter->first] = qc;
dynamic_cast<AudioProvider*>(audioProvider.get())->configureMediaObserver(this, (void*)qc.get());
@ -559,6 +580,7 @@ void AgentImpl::processGetMediaStats(Json::Value& request, Json::Value& answer)
test.mChannels = AUDIO_CHANNELS; reference.mChannels = AUDIO_CHANNELS;
auto r = sa->compare(reference, test);
std::cout << r.mFaultsText << std::endl;
answer["aqua_mos"] = r.mMos;
answer["aqua_report"] = r.mFaultsText;
}