Mercurial > hg > svcore
diff data/fileio/MP3FileReader.cpp @ 1858:14747f24ad04
Use cancellable serialiser; add some more profiling points
author | Chris Cannam |
---|---|
date | Thu, 14 May 2020 16:36:48 +0100 |
parents | 70e172e6cc59 |
children |
line wrap: on
line diff
--- a/data/fileio/MP3FileReader.cpp Thu May 14 16:35:39 2020 +0100 +++ b/data/fileio/MP3FileReader.cpp Thu May 14 16:36:48 2020 +0100 @@ -17,6 +17,7 @@ #include "MP3FileReader.h" #include "base/ProgressReporter.h" +#include "base/Profiler.h" #include "system/System.h" @@ -173,6 +174,8 @@ MP3FileReader::~MP3FileReader() { + Profiler profiler("MP3FileReader::~MP3FileReader"); + if (m_decodeThread) { m_cancelled = true; m_decodeThread->wait(); @@ -302,7 +305,9 @@ m_reader->m_sampleBuffer = nullptr; } - if (m_reader->isDecodeCacheInitialised()) m_reader->finishDecodeCache(); + if (m_reader->isDecodeCacheInitialised()) { + m_reader->finishDecodeCache(); + } m_reader->m_done = true; m_reader->m_completion = 100; @@ -505,7 +510,10 @@ if (m_cacheMode == CacheInTemporaryFile) { // SVDEBUG << "MP3FileReader::accept: channel count " << m_channelCount << ", file rate " << m_fileRate << ", about to start serialised section" << endl; - startSerialised("MP3FileReader::Decode"); + startSerialised("MP3FileReader::Decode", &m_cancelled); + if (m_cancelled) { + return MAD_FLOW_STOP; + } } }