Let AudioProvider::GetAudioWithVolume() catch exceptions in AudioProvider::GetAudio() and return blank audio when that happens. Errors are not logged or otherwise handled. This fixes #800 for most cases, even if poorly.

Originally committed to SVN as r2883.
This commit is contained in:
Niels Martin Hansen 2009-04-29 19:30:02 +00:00
parent 92202a99bf
commit 866f9d21fc
1 changed files with 10 additions and 1 deletions

View File

@ -175,7 +175,16 @@ void AudioProvider::GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int
/////////////////////////
// Get audio with volume
void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) {
GetAudio(buf,start,count);
try {
GetAudio(buf,start,count);
}
catch (...) {
// FIXME: Poor error handling though better than none, to patch issue #800.
// Just return blank audio if real provider fails.
memset(buf, 0, count*bytes_per_sample);
return;
}
if (volume == 1.0) return;
if (bytes_per_sample == 2) {