HD audio cache: initialise variables before checking for free space
Originally committed to SVN as r6907.
This commit is contained in:
parent
d99f3e3841
commit
5ea71bce89
1 changed files with 7 additions and 7 deletions
|
@ -102,13 +102,6 @@ HDAudioProvider::HDAudioProvider(AudioProvider *src, agi::BackgroundRunner *br)
|
|||
agi::scoped_ptr<AudioProvider> source(src);
|
||||
assert(src->AreSamplesNativeEndian()); // Byteswapping should be done before caching
|
||||
|
||||
// Check free space
|
||||
wxDiskspaceSize_t freespace;
|
||||
if (wxGetDiskSpace(cache_dir(), 0, &freespace)) {
|
||||
if (num_samples * channels * bytes_per_sample > freespace)
|
||||
throw agi::AudioCacheOpenError("Not enough free disk space in " + STD_STR(cache_dir()) + " to cache the audio", 0);
|
||||
}
|
||||
|
||||
bytes_per_sample = source->GetBytesPerSample();
|
||||
num_samples = source->GetNumSamples();
|
||||
channels = source->GetChannels();
|
||||
|
@ -116,6 +109,13 @@ HDAudioProvider::HDAudioProvider(AudioProvider *src, agi::BackgroundRunner *br)
|
|||
filename = source->GetFilename();
|
||||
float_samples = source->AreSamplesFloat();
|
||||
|
||||
// Check free space
|
||||
wxDiskspaceSize_t freespace;
|
||||
if (wxGetDiskSpace(cache_dir(), 0, &freespace)) {
|
||||
if (num_samples * channels * bytes_per_sample > freespace)
|
||||
throw agi::AudioCacheOpenError("Not enough free disk space in " + STD_STR(cache_dir()) + " to cache the audio", 0);
|
||||
}
|
||||
|
||||
diskCacheFilename = cache_path();
|
||||
|
||||
try {
|
||||
|
|
Loading…
Reference in a new issue