openal: fix issues with uncache_sound not uncaching sound:

* Previously it only looked for the resolved path, but sounds are not stored with resolved path in the cache (possibly a different bug?)
* It only uncached samples, not streams

Fixes #428
This commit is contained in:
rdb 2018-11-08 15:38:20 +01:00
parent b8ed9b1275
commit cd2ea97b1f

View File

@ -534,6 +534,9 @@ uncache_sound(const Filename &file_name) {
vfs->resolve_filename(path, get_model_path());
SampleCache::iterator sci = _sample_cache.find(path);
if (sci == _sample_cache.end()) {
sci = _sample_cache.find(file_name);
}
if (sci != _sample_cache.end()) {
SoundData *sd = (*sci).second;
if (sd->_client_count == 0) {
@ -542,6 +545,19 @@ uncache_sound(const Filename &file_name) {
delete sd;
}
}
ExpirationQueue::iterator exqi;
for (exqi = _expiring_streams.begin(); exqi != _expiring_streams.end();) {
SoundData *sd = (SoundData *)(*exqi);
if (sd->_client_count == 0) {
if (sd->_movie->get_filename() == path ||
sd->_movie->get_filename() == file_name) {
exqi = _expiring_streams.erase(exqi);
continue;
}
}
++exqi;
}
}
/**