forked from mia/Aegisub
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:
parent
a2822356bf
commit
f0b442f4b4
1 changed files with 10 additions and 1 deletions
|
@ -175,7 +175,16 @@ void AudioProvider::GetWaveForm(int *min,int *peak,int64_t start,int w,int h,int
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
// Get audio with volume
|
// Get audio with volume
|
||||||
void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) {
|
void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) {
|
||||||
|
try {
|
||||||
GetAudio(buf,start,count);
|
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 (volume == 1.0) return;
|
||||||
|
|
||||||
if (bytes_per_sample == 2) {
|
if (bytes_per_sample == 2) {
|
||||||
|
|
Loading…
Reference in a new issue