mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-14 15:48:21 +02:00
Avoid deadlocks that sometimes happened when starting a scrub...
This commit is contained in:
commit
ceb1a91cb9
@ -410,6 +410,14 @@ struct AudioIO::ScrubQueue
|
|||||||
return previous.mS1 / mRate;
|
return previous.mS1 / mRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is for avoiding deadlocks while starting a scrub:
|
||||||
|
// Audio stream needs to be unblocked
|
||||||
|
void Nudge()
|
||||||
|
{
|
||||||
|
wxMutexLocker locker(mUpdating);
|
||||||
|
mAvailable.Signal();
|
||||||
|
}
|
||||||
|
|
||||||
void PoisonPill()
|
void PoisonPill()
|
||||||
{
|
{
|
||||||
// Main thread is shutting down the scrubbing
|
// Main thread is shutting down the scrubbing
|
||||||
@ -478,8 +486,7 @@ struct AudioIO::ScrubQueue
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxASSERT(mPoisoned);
|
// We got the shut-down signal, or we got nudged
|
||||||
// We got the shut-down signal
|
|
||||||
startSample = endSample = duration = -1L;
|
startSample = endSample = duration = -1L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1874,8 +1881,11 @@ int AudioIO::StartStream(const WaveTrackArray &playbackTracks,
|
|||||||
// FillBuffers will ALWAYS get called from the Audio thread.
|
// FillBuffers will ALWAYS get called from the Audio thread.
|
||||||
mAudioThreadShouldCallFillBuffersOnce = true;
|
mAudioThreadShouldCallFillBuffersOnce = true;
|
||||||
|
|
||||||
while( mAudioThreadShouldCallFillBuffersOnce == true )
|
while( mAudioThreadShouldCallFillBuffersOnce == true ) {
|
||||||
|
if (mScrubQueue)
|
||||||
|
mScrubQueue->Nudge();
|
||||||
wxMilliSleep( 50 );
|
wxMilliSleep( 50 );
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||||
// if no playback, reset the midi time to zero to roughly sync
|
// if no playback, reset the midi time to zero to roughly sync
|
||||||
|
Loading…
x
Reference in New Issue
Block a user