1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-20 14:20:06 +02:00

Apply patch by Christopher Rudorff that fixes an issue where re-opening OD projects would create blockfiles with malformed filenames.

Modified by mchinen to cleanup debug messages and fix unbalanced mutex on error.
Original patch notes:

    OD loader doesn't properly continue scanning files
    
    BUG:
    
    * import large audio file with OD import
    * save and close project before OD finishes
    * open project again: OD failes badly on continuing
    
    Syntoms:
    
    * .auf.auf.auf worm files ...
    * truncated wave display
    
    The isse is subtile:
    
    <odpcmaliasblockfile summaryfile="e000031a.auf" aliasfile="/home/chris/Records/test/0.5seek+cue.flac" aliasstart="26738688" aliaslen="524288" aliaschannel="1"/>
    
    A ODPCMAliasBlockFile is a AliasBlockFile which has 3 overloaded
    constructer. One of then silently adds '.aup' to the summaryfile.
    
    So when creating those tracks from XML, we must use the other constructor.
    
    Now we run into a second bug:
    
    AudacityProject::OpenFile calls ProjectFSCK after reading which deletes
    the just created empty directories in the _data/e00 dir. OD is doomed.
    So simply skip rmdir in fsck.  The OD..Blockfiles will disapper when the
    OD finishes, so empty dirs will be deleted on further opening the project.
This commit is contained in:
mchinen 2011-04-28 19:57:37 +00:00
parent fd7491af14
commit ada7eaf758
3 changed files with 8 additions and 7 deletions

View File

@ -1578,6 +1578,7 @@ _("Project check found %d orphan blockfile(s). These files are \
}
if (nResult != FSCKstatus_CLOSE_REQ)
if ((nResult != FSCKstatus_CLOSE_REQ) && !ODManager::HasLoadedODFlag())
{
// Remove any empty directories.
ProgressDialog* pProgress =

View File

@ -272,7 +272,8 @@ BlockFile *ODDecodeBlockFile::BuildFromXML(DirManager &dm, const wxChar **attrs)
}
return new ODDecodeBlockFile(summaryFileName, audioFileName,
aliasStart, aliasLen, aliasChannel,decodeType);
aliasStart, aliasLen, aliasChannel,decodeType,
0,0,0, false);
}

View File

@ -339,7 +339,8 @@ BlockFile *ODPCMAliasBlockFile::BuildFromXML(DirManager &dm, const wxChar **attr
}
return new ODPCMAliasBlockFile(summaryFileName, aliasFileName,
aliasStart, aliasLen, aliasChannel);
aliasStart, aliasLen, aliasChannel,
0,0,0, false);
}
@ -406,7 +407,6 @@ void ODPCMAliasBlockFile::WriteSummary()
char* fileNameChar = new char[strlen(sFullPath.mb_str(wxConvFile)) + 1];
strcpy(fileNameChar, sFullPath.mb_str(wxConvFile));
FILE* summaryFile = fopen(fileNameChar, "wb");
delete [] fileNameChar;
mFileNameMutex.Unlock();
@ -415,12 +415,11 @@ void ODPCMAliasBlockFile::WriteSummary()
// Never silence the Log w.r.t write errors; they always count
//however, this is going to be called from a non-main thread,
//and wxLog calls are not thread safe.
printf("Unable to write summary data to file: ");// %s",
printf("test..\n");
printf(" filename: %s\n", fileNameChar);
mFileNameMutex.Unlock();
printf("Unable to write summary data to file: %s", fileNameChar);
delete [] fileNameChar;
return;
}
delete [] fileNameChar;
// To build the summary data, call ReadData (implemented by the
// derived classes) to get the sample data