# HG changeset patch # User cannam # Date 1229092122 0 # Node ID 33feff966de3fe68cbfeeb89a551c45fb0ee6077 # Parent de3e865f92c879fb8b247ab97e15f789a324170a * Fix an infinite loop that occurs with some features diff -r de3e865f92c8 -r 33feff966de3 src/vamp-hostsdk/PluginSummarisingAdapter.cpp --- 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;