Mercurial > hg > svcore
comparison data/fileio/BQAFileReader.cpp @ 1858:14747f24ad04
Use cancellable serialiser; add some more profiling points
author | Chris Cannam |
---|---|
date | Thu, 14 May 2020 16:36:48 +0100 |
parents | 8aa1447fe27e |
children |
comparison
equal
deleted
inserted
replaced
1857:14c776dad920 | 1858:14747f24ad04 |
---|---|
113 } | 113 } |
114 } | 114 } |
115 | 115 |
116 BQAFileReader::~BQAFileReader() | 116 BQAFileReader::~BQAFileReader() |
117 { | 117 { |
118 Profiler profiler("BQAFileReader::~BQAFileReader"); | |
119 | |
118 if (m_decodeThread) { | 120 if (m_decodeThread) { |
119 m_cancelled = true; | 121 m_cancelled = true; |
120 m_decodeThread->wait(); | 122 m_decodeThread->wait(); |
121 delete m_decodeThread; | 123 delete m_decodeThread; |
122 } | 124 } |
123 | 125 |
124 delete m_stream; | 126 delete m_stream; |
125 } | 127 } |
126 | 128 |
127 void | 129 void |
128 BQAFileReader::cancelled() | 130 BQAFileReader::cancelled() |
132 | 134 |
133 void | 135 void |
134 BQAFileReader::DecodeThread::run() | 136 BQAFileReader::DecodeThread::run() |
135 { | 137 { |
136 if (m_reader->m_cacheMode == CacheInTemporaryFile) { | 138 if (m_reader->m_cacheMode == CacheInTemporaryFile) { |
137 m_reader->startSerialised("BQAFileReader::Decode"); | 139 m_reader->startSerialised("BQAFileReader::Decode", |
140 &m_reader->m_cancelled); | |
141 if (m_reader->m_cancelled) { | |
142 return; | |
143 } | |
138 } | 144 } |
139 | 145 |
140 sv_frame_t blockSize = 65536; | 146 sv_frame_t blockSize = 65536; |
141 floatvec_t block(blockSize * m_reader->getChannelCount(), 0.f); | 147 floatvec_t block(blockSize * m_reader->getChannelCount(), 0.f); |
142 | 148 |