[DEBUG] rmove some logs and correct timestamp in resampler
This commit is contained in:
parent
b401602ea4
commit
609049531a
@ -57,7 +57,7 @@ void drain::Algo::configurationChange() {
|
|||||||
m_formatSize = sizeof(double);
|
m_formatSize = sizeof(double);
|
||||||
break;
|
break;
|
||||||
case audio::format_unknow:
|
case audio::format_unknow:
|
||||||
DRAIN_ERROR("format not configured...");
|
DRAIN_VERBOSE("format not configured...");
|
||||||
m_formatSize = 8;
|
m_formatSize = 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -144,27 +144,27 @@ template<typename T> std::vector<T> getUnion(const std::vector<T>& _out, const s
|
|||||||
|
|
||||||
|
|
||||||
void drain::Process::displayAlgo() {
|
void drain::Process::displayAlgo() {
|
||||||
DRAIN_DEBUG(" Input : " << m_inputConfig);
|
DRAIN_VERBOSE(" Input : " << m_inputConfig);
|
||||||
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
|
for (size_t iii=0; iii<m_listAlgo.size(); ++iii) {
|
||||||
DRAIN_DEBUG(" [" << m_listAlgo[iii]->getType() << "] '" << m_listAlgo[iii]->getName() << "'");
|
DRAIN_VERBOSE(" [" << m_listAlgo[iii]->getType() << "] '" << m_listAlgo[iii]->getName() << "'");
|
||||||
if (m_listAlgo[iii]->getInputFormat().getConfigured() == true) {
|
if (m_listAlgo[iii]->getInputFormat().getConfigured() == true) {
|
||||||
DRAIN_DEBUG(" Input : " << m_listAlgo[iii]->getInputFormat());
|
DRAIN_VERBOSE(" Input : " << m_listAlgo[iii]->getInputFormat());
|
||||||
} else {
|
} else {
|
||||||
DRAIN_DEBUG(" Input : Not configured");
|
DRAIN_VERBOSE(" Input : Not configured");
|
||||||
DRAIN_DEBUG(" format : " << m_listAlgo[iii]->getFormatSupportedInput());
|
DRAIN_VERBOSE(" format : " << m_listAlgo[iii]->getFormatSupportedInput());
|
||||||
DRAIN_DEBUG(" frequency : " << m_listAlgo[iii]->getFrequencySupportedInput());
|
DRAIN_VERBOSE(" frequency : " << m_listAlgo[iii]->getFrequencySupportedInput());
|
||||||
DRAIN_DEBUG(" map : " << m_listAlgo[iii]->getMapSupportedInput());
|
DRAIN_VERBOSE(" map : " << m_listAlgo[iii]->getMapSupportedInput());
|
||||||
}
|
}
|
||||||
if (m_listAlgo[iii]->getOutputFormat().getConfigured() == true) {
|
if (m_listAlgo[iii]->getOutputFormat().getConfigured() == true) {
|
||||||
DRAIN_DEBUG(" Output: " << m_listAlgo[iii]->getOutputFormat());
|
DRAIN_VERBOSE(" Output: " << m_listAlgo[iii]->getOutputFormat());
|
||||||
} else {
|
} else {
|
||||||
DRAIN_DEBUG(" Output : Not configured");
|
DRAIN_VERBOSE(" Output : Not configured");
|
||||||
DRAIN_DEBUG(" format : " << m_listAlgo[iii]->getFormatSupportedOutput());
|
DRAIN_VERBOSE(" format : " << m_listAlgo[iii]->getFormatSupportedOutput());
|
||||||
DRAIN_DEBUG(" frequency : " << m_listAlgo[iii]->getFrequencySupportedOutput());
|
DRAIN_VERBOSE(" frequency : " << m_listAlgo[iii]->getFrequencySupportedOutput());
|
||||||
DRAIN_DEBUG(" map : " << m_listAlgo[iii]->getMapSupportedOutput());
|
DRAIN_VERBOSE(" map : " << m_listAlgo[iii]->getMapSupportedOutput());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DRAIN_DEBUG(" Output : " << m_outputConfig);
|
DRAIN_VERBOSE(" Output : " << m_outputConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
void drain::Process::updateAlgo(size_t _position) {
|
void drain::Process::updateAlgo(size_t _position) {
|
||||||
@ -196,7 +196,7 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
std::vector<float> freq = getUnion<float>(freqOut, freqIn);
|
std::vector<float> freq = getUnion<float>(freqOut, freqIn);
|
||||||
DRAIN_VERBOSE(" freq out :" << freqOut);
|
DRAIN_VERBOSE(" freq out :" << freqOut);
|
||||||
DRAIN_VERBOSE(" freq in :" << freqIn);
|
DRAIN_VERBOSE(" freq in :" << freqIn);
|
||||||
DRAIN_DEBUG(" freq union :" << freq);
|
DRAIN_VERBOSE(" freq union :" << freq);
|
||||||
|
|
||||||
// step 2 : Check map:
|
// step 2 : Check map:
|
||||||
std::vector<std::vector<audio::channel> > mapOut;
|
std::vector<std::vector<audio::channel> > mapOut;
|
||||||
@ -214,7 +214,7 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
std::vector<std::vector<audio::channel> > map = getUnion<std::vector<audio::channel> >(mapOut, mapIn);
|
std::vector<std::vector<audio::channel> > map = getUnion<std::vector<audio::channel> >(mapOut, mapIn);
|
||||||
DRAIN_VERBOSE(" map out :" << mapOut);
|
DRAIN_VERBOSE(" map out :" << mapOut);
|
||||||
DRAIN_VERBOSE(" map in :" << mapIn);
|
DRAIN_VERBOSE(" map in :" << mapIn);
|
||||||
DRAIN_DEBUG(" map union :" << map);
|
DRAIN_VERBOSE(" map union :" << map);
|
||||||
// step 3 : Check Format:
|
// step 3 : Check Format:
|
||||||
std::vector<audio::format> formatOut;
|
std::vector<audio::format> formatOut;
|
||||||
std::vector<audio::format> formatIn;
|
std::vector<audio::format> formatIn;
|
||||||
@ -231,12 +231,12 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
std::vector<audio::format> format = getUnion<audio::format>(formatOut, formatIn);
|
std::vector<audio::format> format = getUnion<audio::format>(formatOut, formatIn);
|
||||||
DRAIN_VERBOSE(" format out :" << formatOut);
|
DRAIN_VERBOSE(" format out :" << formatOut);
|
||||||
DRAIN_VERBOSE(" format in :" << formatIn);
|
DRAIN_VERBOSE(" format in :" << formatIn);
|
||||||
DRAIN_DEBUG(" format union :" << format);
|
DRAIN_VERBOSE(" format union :" << format);
|
||||||
|
|
||||||
if ( freq.size() >= 1
|
if ( freq.size() >= 1
|
||||||
&& map.size() >= 1
|
&& map.size() >= 1
|
||||||
&& format.size() >= 1) {
|
&& format.size() >= 1) {
|
||||||
DRAIN_DEBUG(" find 1 compatibility :{format=" << format << ",frequency=" << freq << ",map=" << map << "}");
|
DRAIN_VERBOSE(" find 1 compatibility :{format=" << format << ",frequency=" << freq << ",map=" << map << "}");
|
||||||
drain::IOFormatInterface tmp(map[0], format[0], freq[0]);
|
drain::IOFormatInterface tmp(map[0], format[0], freq[0]);
|
||||||
if (_position > 0) {
|
if (_position > 0) {
|
||||||
m_listAlgo[_position-1]->setOutputFormat(tmp);
|
m_listAlgo[_position-1]->setOutputFormat(tmp);
|
||||||
@ -327,8 +327,8 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DRAIN_DEBUG(" update: out=" << out);
|
DRAIN_VERBOSE(" update: out=" << out);
|
||||||
DRAIN_DEBUG(" in=" << in);
|
DRAIN_VERBOSE(" in=" << in);
|
||||||
if (_position > 0) {
|
if (_position > 0) {
|
||||||
m_listAlgo[_position-1]->setOutputFormat(out);
|
m_listAlgo[_position-1]->setOutputFormat(out);
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
out.setFormat(audio::format_int16);
|
out.setFormat(audio::format_int16);
|
||||||
algo->setOutputFormat(out);
|
algo->setOutputFormat(out);
|
||||||
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_DEBUG("convert " << out.getFormat() << " -> " << in.getFormat());
|
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
|
||||||
_position++;
|
_position++;
|
||||||
}
|
}
|
||||||
// need add a resampler
|
// need add a resampler
|
||||||
@ -358,7 +358,7 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
out.setFrequency(in.getFrequency());
|
out.setFrequency(in.getFrequency());
|
||||||
algo->setOutputFormat(out);
|
algo->setOutputFormat(out);
|
||||||
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_DEBUG("convert " << out.getFrequency() << " -> " << in.getFrequency());
|
DRAIN_VERBOSE("convert " << out.getFrequency() << " -> " << in.getFrequency());
|
||||||
out.setFrequency(in.getFrequency());
|
out.setFrequency(in.getFrequency());
|
||||||
_position++;
|
_position++;
|
||||||
}
|
}
|
||||||
@ -370,7 +370,7 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
out.setMap(in.getMap());
|
out.setMap(in.getMap());
|
||||||
algo->setOutputFormat(out);
|
algo->setOutputFormat(out);
|
||||||
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_DEBUG("convert " << out.getMap() << " -> " << in.getMap());
|
DRAIN_VERBOSE("convert " << out.getMap() << " -> " << in.getMap());
|
||||||
_position++;
|
_position++;
|
||||||
}
|
}
|
||||||
if (out.getFormat() != in.getFormat()) {
|
if (out.getFormat() != in.getFormat()) {
|
||||||
@ -381,7 +381,7 @@ void drain::Process::updateAlgo(size_t _position) {
|
|||||||
out.setFormat(in.getFormat());
|
out.setFormat(in.getFormat());
|
||||||
algo->setOutputFormat(out);
|
algo->setOutputFormat(out);
|
||||||
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
m_listAlgo.insert(m_listAlgo.begin()+_position, algo);
|
||||||
DRAIN_DEBUG("convert " << out.getFormat() << " -> " << in.getFormat());
|
DRAIN_VERBOSE("convert " << out.getFormat() << " -> " << in.getFormat());
|
||||||
_position++;
|
_position++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,9 +401,9 @@ void drain::Process::updateInterAlgo() {
|
|||||||
// cahin is already configured
|
// cahin is already configured
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
DRAIN_DEBUG("Display properties : nbAlgo : " << m_listAlgo.size());
|
DRAIN_VERBOSE("Display properties : nbAlgo : " << m_listAlgo.size());
|
||||||
displayAlgo();
|
displayAlgo();
|
||||||
DRAIN_DEBUG("********* configuration START *************");
|
DRAIN_VERBOSE("********* configuration START *************");
|
||||||
// configure first the endpoint ...
|
// configure first the endpoint ...
|
||||||
if (m_listAlgo.size() > 1) {
|
if (m_listAlgo.size() > 1) {
|
||||||
updateAlgo(m_listAlgo.size());
|
updateAlgo(m_listAlgo.size());
|
||||||
@ -411,7 +411,7 @@ void drain::Process::updateInterAlgo() {
|
|||||||
for (size_t iii=0; iii<=m_listAlgo.size(); ++iii) {
|
for (size_t iii=0; iii<=m_listAlgo.size(); ++iii) {
|
||||||
updateAlgo(iii);
|
updateAlgo(iii);
|
||||||
}
|
}
|
||||||
DRAIN_DEBUG("********* configuration will be done *************");
|
DRAIN_VERBOSE("********* configuration will be done *************");
|
||||||
displayAlgo();
|
displayAlgo();
|
||||||
m_isConfigured = true;
|
m_isConfigured = true;
|
||||||
//exit(-1);
|
//exit(-1);
|
||||||
|
@ -24,6 +24,7 @@ void drain::Resampler::init() {
|
|||||||
drain::Algo::init();
|
drain::Algo::init();
|
||||||
m_type = "Resampler";
|
m_type = "Resampler";
|
||||||
m_supportedFormat.push_back(audio::format_int16);
|
m_supportedFormat.push_back(audio::format_int16);
|
||||||
|
m_residualTimeInResampler = std11::chrono::nanoseconds(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std11::shared_ptr<drain::Resampler> drain::Resampler::create() {
|
std11::shared_ptr<drain::Resampler> drain::Resampler::create() {
|
||||||
@ -77,6 +78,7 @@ void drain::Resampler::configurationChange() {
|
|||||||
m_input.getFrequency(),
|
m_input.getFrequency(),
|
||||||
m_output.getFrequency(),
|
m_output.getFrequency(),
|
||||||
10, &err);
|
10, &err);
|
||||||
|
m_residualTimeInResampler = std11::chrono::nanoseconds(0);
|
||||||
#else
|
#else
|
||||||
DRAIN_WARNING("SPEEX DSP lib not accessible ==> can not resample");
|
DRAIN_WARNING("SPEEX DSP lib not accessible ==> can not resample");
|
||||||
m_needProcess = false;
|
m_needProcess = false;
|
||||||
@ -107,7 +109,7 @@ bool drain::Resampler::process(std11::chrono::system_clock::time_point& _time,
|
|||||||
DRAIN_VERBOSE("Resampler correct timestamp : " << _time << " ==> " << (_time - m_residualTimeInResampler));
|
DRAIN_VERBOSE("Resampler correct timestamp : " << _time << " ==> " << (_time - m_residualTimeInResampler));
|
||||||
_time -= m_residualTimeInResampler;
|
_time -= m_residualTimeInResampler;
|
||||||
|
|
||||||
std11::chrono::nanoseconds inTime((int64_t(_inputNbChunk)*int64_t(1000000000)) / int64_t(m_input.getFrequency()));
|
std11::chrono::nanoseconds inTime((int64_t(_inputNbChunk)*1000000000LL) / int64_t(m_input.getFrequency()));
|
||||||
m_residualTimeInResampler += inTime;
|
m_residualTimeInResampler += inTime;
|
||||||
#ifdef HAVE_SPEEX_DSP_RESAMPLE
|
#ifdef HAVE_SPEEX_DSP_RESAMPLE
|
||||||
float nbInputTime = float(_inputNbChunk)/m_input.getFrequency();
|
float nbInputTime = float(_inputNbChunk)/m_input.getFrequency();
|
||||||
@ -146,7 +148,8 @@ bool drain::Resampler::process(std11::chrono::system_clock::time_point& _time,
|
|||||||
}
|
}
|
||||||
_outputNbChunk = nbChunkOutput;
|
_outputNbChunk = nbChunkOutput;
|
||||||
DRAIN_VERBOSE(" process chunk=" << nbChunkInput << " out=" << nbChunkOutput);
|
DRAIN_VERBOSE(" process chunk=" << nbChunkInput << " out=" << nbChunkOutput);
|
||||||
std11::chrono::nanoseconds outTime((int64_t(_outputNbChunk)*int64_t(1000000000)) / int64_t(m_output.getFrequency()));
|
std11::chrono::nanoseconds outTime((int64_t(_outputNbChunk)*1000000000LL) / int64_t(m_output.getFrequency()));
|
||||||
|
DRAIN_VERBOSE("convert " << _inputNbChunk << " ==> " << _outputNbChunk << " " << inTime.count() << " => " << outTime.count());
|
||||||
// correct time :
|
// correct time :
|
||||||
m_residualTimeInResampler -= outTime;
|
m_residualTimeInResampler -= outTime;
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user