Mercurial > hg > svapp
comparison audio/AudioCallbackPlaySource.cpp @ 570:6f54789f3127 3.0-integration
Fix race condition in first-time recording, where adding the recording wave model would prompt the audio play source to note that its channel count had increased (from 0 to, say, 2) and thus to cause the audio device to be reopened, stopping recording. Fix is to make this only happen if channel count increases beyond that of the device, which shouldn't happen in the recording case
author | Chris Cannam |
---|---|
date | Wed, 04 Jan 2017 11:48:03 +0000 |
parents | 36076ef960fb |
children | b3c35447ef31 |
comparison
equal
deleted
inserted
replaced
569:1cc23cee4ebf | 570:6f54789f3127 |
---|---|
233 } | 233 } |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 if (!m_writeBuffers || (int)m_writeBuffers->size() < getTargetChannelCount()) { | 237 if (!m_writeBuffers || (int)m_writeBuffers->size() < getTargetChannelCount()) { |
238 cerr << "m_writeBuffers size = " << (m_writeBuffers ? m_writeBuffers->size() : 0) << endl; | |
239 cerr << "target channel count = " << (getTargetChannelCount()) << endl; | |
238 clearRingBuffers(true, getTargetChannelCount()); | 240 clearRingBuffers(true, getTargetChannelCount()); |
239 buffersIncreased = true; | 241 buffersIncreased = true; |
240 } else { | 242 } else { |
241 if (willPlay) clearRingBuffers(true); | 243 if (willPlay) clearRingBuffers(true); |
242 } | 244 } |
268 m_mutex.unlock(); | 270 m_mutex.unlock(); |
269 | 271 |
270 m_audioGenerator->setTargetChannelCount(getTargetChannelCount()); | 272 m_audioGenerator->setTargetChannelCount(getTargetChannelCount()); |
271 | 273 |
272 if (buffersIncreased) { | 274 if (buffersIncreased) { |
273 SVDEBUG << "AudioCallbackPlaySource::addModel: Number of buffers increased, signalling channelCountIncreased" << endl; | 275 SVDEBUG << "AudioCallbackPlaySource::addModel: Number of buffers increased to " << getTargetChannelCount() << endl; |
274 emit channelCountIncreased(); | 276 if (getTargetChannelCount() > getDeviceChannelCount()) { |
277 SVDEBUG << "AudioCallbackPlaySource::addModel: This is more than the device channel count, signalling channelCountIncreased" << endl; | |
278 emit channelCountIncreased(getTargetChannelCount()); | |
279 } else { | |
280 SVDEBUG << "AudioCallbackPlaySource::addModel: This is no more than the device channel count (" << getDeviceChannelCount() << "), so taking no action" << endl; | |
281 } | |
275 } | 282 } |
276 | 283 |
277 if (!m_fillThread) { | 284 if (!m_fillThread) { |
278 m_fillThread = new FillThread(*this); | 285 m_fillThread = new FillThread(*this); |
279 m_fillThread->start(); | 286 m_fillThread->start(); |