mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-28 16:20:12 +01:00
ODDecodeTask makes progress unless there is an exception
This commit is contained in:
@@ -42,13 +42,13 @@ void ODDecodeTask::DoSomeInternal()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ODFileDecoder* decoder;
|
ODFileDecoder* decoder;
|
||||||
sampleCount blockStartSample = 0;
|
|
||||||
sampleCount blockEndSample = 0;
|
|
||||||
bool success =false;
|
|
||||||
|
|
||||||
for(size_t i=0; i < mWaveTracks.size() && mBlockFiles.size();i++)
|
for(size_t i=0; i < mWaveTracks.size() && mBlockFiles.size();i++)
|
||||||
{
|
{
|
||||||
const auto bf = mBlockFiles[0].lock();
|
const auto bf = mBlockFiles[0].lock();
|
||||||
|
sampleCount blockStartSample = 0;
|
||||||
|
sampleCount blockEndSample = 0;
|
||||||
|
bool success =false;
|
||||||
|
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ void ODDecodeTask::DoSomeInternal()
|
|||||||
if(!decoder->IsInitialized())
|
if(!decoder->IsInitialized())
|
||||||
decoder->Init();
|
decoder->Init();
|
||||||
bf->SetODFileDecoder(decoder);
|
bf->SetODFileDecoder(decoder);
|
||||||
|
// Does not throw:
|
||||||
ret = bf->DoWriteBlockFile();
|
ret = bf->DoWriteBlockFile();
|
||||||
bf->UnlockRead();
|
bf->UnlockRead();
|
||||||
|
|
||||||
@@ -74,24 +75,31 @@ void ODDecodeTask::DoSomeInternal()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
success = true;
|
||||||
// The block file disappeared.
|
// The block file disappeared.
|
||||||
//the waveform in the wavetrack now is shorter, so we need to update mMaxBlockFiles
|
//the waveform in the wavetrack now is shorter, so we need to update mMaxBlockFiles
|
||||||
//because now there is less work to do.
|
//because now there is less work to do.
|
||||||
mMaxBlockFiles--;
|
mMaxBlockFiles--;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Release the refcount we placed on it if we are successful
|
if (success)
|
||||||
if(ret >= 0 ) {
|
{
|
||||||
//take it out of the array - we are done with it.
|
//take it out of the array - we are done with it.
|
||||||
mBlockFiles.erase(mBlockFiles.begin());
|
mBlockFiles.erase(mBlockFiles.begin());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
// The task does not make progress
|
||||||
|
;
|
||||||
|
|
||||||
|
//Release the refcount we placed on it if we are successful
|
||||||
|
if( bf && success ) {
|
||||||
//upddate the gui for all associated blocks. It doesn't matter that we're hitting more wavetracks then we should
|
//upddate the gui for all associated blocks. It doesn't matter that we're hitting more wavetracks then we should
|
||||||
//because this loop runs a number of times equal to the number of tracks, they probably are getting processed in
|
//because this loop runs a number of times equal to the number of tracks, they probably are getting processed in
|
||||||
//the next iteration at the same sample window.
|
//the next iteration at the same sample window.
|
||||||
mWaveTrackMutex.Lock();
|
mWaveTrackMutex.Lock();
|
||||||
for(size_t i=0;i<mWaveTracks.size();i++)
|
for(size_t i=0;i<mWaveTracks.size();i++)
|
||||||
{
|
{
|
||||||
if(success && mWaveTracks[i])
|
if(mWaveTracks[i])
|
||||||
mWaveTracks[i]->AddInvalidRegion(blockStartSample,blockEndSample);
|
mWaveTracks[i]->AddInvalidRegion(blockStartSample,blockEndSample);
|
||||||
}
|
}
|
||||||
mWaveTrackMutex.Unlock();
|
mWaveTrackMutex.Unlock();
|
||||||
|
|||||||
Reference in New Issue
Block a user