Mercurial > hg > vamp-plugin-sdk
diff src/vamp-hostsdk/PluginSummarisingAdapter.cpp @ 274:33feff966de3
* Fix an infinite loop that occurs with some features
author | cannam |
---|---|
date | Fri, 12 Dec 2008 14:28:42 +0000 |
parents | de3e865f92c8 |
children | ecfb41a370aa |
line wrap: on
line diff
--- a/src/vamp-hostsdk/PluginSummarisingAdapter.cpp Fri Dec 05 16:25:58 2008 +0000 +++ b/src/vamp-hostsdk/PluginSummarisingAdapter.cpp Fri Dec 12 14:28:42 2008 +0000 @@ -613,6 +613,10 @@ SegmentBoundaries::iterator boundaryitr = m_boundaries.begin(); RealTime segmentStart = RealTime::zeroTime; +#ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER_SEGMENT + std::cerr << "segment: starting" << std::endl; +#endif + for (OutputAccumulatorMap::iterator i = m_accumulators.begin(); i != m_accumulators.end(); ++i) { @@ -645,9 +649,24 @@ RealTime segmentStart = RealTime::zeroTime; RealTime segmentEnd = resultEnd - RealTime(1, 0); + RealTime prevSegmentStart = segmentStart - RealTime(1, 0); + while (segmentEnd < resultEnd) { +#ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER_SEGMENT + std::cerr << "segment end " << segmentEnd << " < result end " + << resultEnd << " (with result start " << resultStart << ")" << std::endl; +#endif + findSegmentBounds(resultStart, segmentStart, segmentEnd); + + if (segmentStart == prevSegmentStart) { + // This can happen when we reach the end of the + // input, if a feature's end time overruns the + // input audio end time + break; + } + prevSegmentStart = segmentStart; RealTime chunkStart = resultStart; if (chunkStart < segmentStart) chunkStart = segmentStart;