Skip to content
Extraits de code Groupes Projets
Valider 1c9af767 rédigé par Thomas Goyne's avatar Thomas Goyne
Parcourir les fichiers

Move audio decode error handling to GetAudio

Errors when not getting with volume need to be handled too.

Updates #1509.
parent e995cd26
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -61,21 +61,7 @@ ...@@ -61,21 +61,7 @@
#include <libaegisub/log.h> #include <libaegisub/log.h>
void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) const { void AudioProvider::GetAudioWithVolume(void *buf, int64_t start, int64_t count, double volume) const {
try { GetAudio(buf,start,count);
GetAudio(buf,start,count);
}
catch (AudioDecodeError const& e) {
LOG_E("audio_provider") << e.GetChainedMessage();
memset(buf, 0, count*bytes_per_sample);
return;
}
catch (...) {
// FIXME: Poor error handling though better than none, to patch issue #800.
// Just return blank audio if real provider fails.
LOG_E("audio_provider") << "Unknown audio decoding error";
memset(buf, 0, count*bytes_per_sample);
return;
}
if (volume == 1.0) return; if (volume == 1.0) return;
...@@ -128,8 +114,23 @@ void AudioProvider::GetAudio(void *buf, int64_t start, int64_t count) const { ...@@ -128,8 +114,23 @@ void AudioProvider::GetAudio(void *buf, int64_t start, int64_t count) const {
memset(zero_buf, 0, zero_count * bytes_per_sample * channels); memset(zero_buf, 0, zero_count * bytes_per_sample * channels);
} }
if (count > 0) if (count > 0) {
FillBuffer(buf, start, count); try {
FillBuffer(buf, start, count);
}
catch (AudioDecodeError const& e) {
LOG_E("audio_provider") << e.GetChainedMessage();
memset(buf, 0, count*bytes_per_sample);
return;
}
catch (...) {
// FIXME: Poor error handling though better than none, to patch issue #800.
// Just return blank audio if real provider fails.
LOG_E("audio_provider") << "Unknown audio decoding error";
memset(buf, 0, count*bytes_per_sample);
return;
}
}
} }
AudioProvider *AudioProviderFactory::GetProvider(wxString const& filename, int cache) { AudioProvider *AudioProviderFactory::GetProvider(wxString const& filename, int cache) {
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter