Mercurial > hg > piper-cpp
changeset 169:f13dc1db2229
Trap and rethrow after locking into failed state
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 31 Jan 2017 11:26:07 +0000 |
parents | 4a37daf5f8b4 |
children | 590b1a1fd955 |
files | vamp-client/PluginStub.h |
diffstat | 1 files changed, 26 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/vamp-client/PluginStub.h Tue Jan 31 11:08:31 2017 +0000 +++ b/vamp-client/PluginStub.h Tue Jan 31 11:26:07 2017 +0000 @@ -166,7 +166,12 @@ m_config.stepSize = int(stepSize); m_config.blockSize = int(blockSize); - m_outputs = m_client->configure(this, m_config); + try { + m_outputs = m_client->configure(this, m_config); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } if (!m_outputs.empty()) { m_state = Configured; @@ -185,8 +190,13 @@ // reset is a no-op if the plugin hasn't been initialised yet return; } - - m_client->reset(this, m_config); + + try { + m_client->reset(this, m_config); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } m_state = Configured; } @@ -258,8 +268,13 @@ (inputBuffers[c], inputBuffers[c] + m_config.blockSize)); } - - return m_client->process(this, vecbuf, timestamp); + + try { + return m_client->process(this, vecbuf, timestamp); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } } virtual FeatureSet getRemainingFeatures() { @@ -278,7 +293,12 @@ m_state = Finished; - return m_client->finish(this); + try { + return m_client->finish(this); + } catch (const std::exception &e) { + m_state = Failed; + throw; + } } // Not Plugin methods, but needed by the PluginClient to support reloads: