Merge pull request #11986 from kencooke/audio-wavloader-fix

Unsupported WAV files should always be logged and not played
This commit is contained in:
Brad Hefta-Gaub 2017-12-15 15:24:24 -08:00 committed by GitHub
commit 4ceedf7731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -96,9 +96,13 @@ void SoundProcessor::run() {
QByteArray outputAudioByteArray;
int sampleRate = interpretAsWav(rawAudioByteArray, outputAudioByteArray);
if (sampleRate != 0) {
downSample(outputAudioByteArray, sampleRate);
if (sampleRate == 0) {
qCDebug(audio) << "Unsupported WAV file type";
emit onError(300, "Failed to load sound file, reason: unsupported WAV file type");
return;
}
downSample(outputAudioByteArray, sampleRate);
} else if (fileName.endsWith(RAW_EXTENSION)) {
// check if this was a stereo raw file
// since it's raw the only way for us to know that is if the file was called .stereo.raw