# HG changeset patch # User Chris Cannam # Date 1410555525 -3600 # Node ID 86d8a699dfbed931a8e53a7db42af4098f760695 # Parent 4bd0cd3c60f36d6aa25b5268ad356dc012e0ee7c Don't object if two consecutive runs produce the same output, if neither has timestamps anyway diff -r 4bd0cd3c60f3 -r 86d8a699dfbe Test.cpp --- a/Test.cpp Fri Sep 12 18:05:52 2014 +0100 +++ b/Test.cpp Fri Sep 12 21:58:45 2014 +0100 @@ -175,6 +175,22 @@ return true; } +bool +Test::containsTimestamps(const Plugin::FeatureSet &b) +{ + for (Plugin::FeatureSet::const_iterator i = b.begin(); i != b.end(); ++i) { + for (int j = 0; j < (int)i->second.size(); ++j) { + if (i->second[j].values.empty()) continue; + for (int k = 0; k < (int)i->second[j].values.size(); ++k) { + if (i->second[j].hasTimestamp) { + return true; + } + } + } + } + return false; +} + void Test::dumpFeature(const Plugin::Feature &f, bool showValues) { diff -r 4bd0cd3c60f3 -r 86d8a699dfbe Test.h --- a/Test.h Fri Sep 12 18:05:52 2014 +0100 +++ b/Test.h Fri Sep 12 21:58:45 2014 +0100 @@ -110,6 +110,8 @@ bool allFeaturesValid(const Vamp::Plugin::FeatureSet &); // i.e. no NaN/inf + bool containsTimestamps(const Vamp::Plugin::FeatureSet &); + void dumpFeature(const Vamp::Plugin::Feature &, bool showValues); void dump(const Vamp::Plugin::FeatureSet &, bool showValues = true); void dumpTwo(const Result &r, diff -r 4bd0cd3c60f3 -r 86d8a699dfbe TestMultipleRuns.cpp --- a/TestMultipleRuns.cpp Fri Sep 12 18:05:52 2014 +0100 +++ b/TestMultipleRuns.cpp Fri Sep 12 21:58:45 2014 +0100 @@ -246,13 +246,20 @@ if (data) destroyTestAudio(data, channels); if (f[0] == f[1]) { - string message = "Consecutive runs with different starting timestamps produce the same result"; Result res; - if (options & NonDeterministic) res = note(message); - else res = warning(message); - if (options & Verbose) { - cout << message << endl; - dump(f[0], false); + if (containsTimestamps(f[0])) { + string message = "Consecutive runs with different starting timestamps produce the same result"; + if (options & NonDeterministic) { + res = note(message); + } else { + res = warning(message); + } + if (options & Verbose) { + cout << res.message() << endl; + dump(f[0], false); + } + } else { + res = note("Consecutive runs with different starting timestamps produce the same result (but result features contain no timestamps, so this is probably all right)"); } r.push_back(res); } else {