diff --git a/src/analyzer/analyzerqueue.cpp b/src/analyzer/analyzerqueue.cpp index e3b95041a166..f574f79cd9ea 100644 --- a/src/analyzer/analyzerqueue.cpp +++ b/src/analyzer/analyzerqueue.cpp @@ -349,8 +349,7 @@ void AnalyzerQueue::execThread() { if (!pAudioSource) { kLogger.warning() << "Failed to open file for analyzing:" - << nextTrack->getLocation() - << *pAudioSource; + << nextTrack->getLocation(); emptyCheck(); continue; } diff --git a/src/test/soundproxy_test.cpp b/src/test/soundproxy_test.cpp index e3a3c9341b60..2a670552793b 100644 --- a/src/test/soundproxy_test.cpp +++ b/src/test/soundproxy_test.cpp @@ -1,3 +1,4 @@ +#include #include #include "test/mixxxtest.h" @@ -74,7 +75,7 @@ class SoundSourceProxyTest: public MixxxTest { // to test the upscaling of channels mixxx::AudioSource::OpenParams openParams; openParams.setChannelCount(2); - auto pAudioSource = proxy.openAudioSource(); + auto pAudioSource = proxy.openAudioSource(openParams); EXPECT_FALSE(!pAudioSource); if (pAudioSource->channelCount() != 2) { // Wrap into proxy object @@ -157,7 +158,7 @@ TEST_F(SoundSourceProxyTest, open) { for (const auto& filePath: getFilePaths()) { ASSERT_TRUE(SoundSourceProxy::isFileNameSupported(filePath)); - mixxx::AudioSourcePointer pAudioSource(openAudioSource(filePath)); + mixxx::AudioSourcePointer pAudioSource = openAudioSource(filePath); // Obtaining an AudioSource may fail for unsupported file formats, // even if the corresponding file extension is supported, e.g. // AAC vs. ALAC in .m4a files @@ -171,6 +172,23 @@ TEST_F(SoundSourceProxyTest, open) { } } +TEST_F(SoundSourceProxyTest, openEmptyFile) { + for (const auto& fileNameSuffix: getFileNameSuffixes()) { + QTemporaryFile tempFile("emptyXXXXXX" + fileNameSuffix); + qDebug() << "Created testing to open empty file:" + << tempFile.fileName(); + tempFile.open(); + tempFile.close(); + + ASSERT_TRUE(SoundSourceProxy::isFileNameSupported(tempFile.fileName())); + auto pTrack = Track::newTemporary(tempFile.fileName()); + SoundSourceProxy proxy(pTrack); + + auto pAudioSource = proxy.openAudioSource(); + EXPECT_TRUE(!pAudioSource); + } +} + TEST_F(SoundSourceProxyTest, readArtist) { auto pTrack = Track::newTemporary( kTestDir.absoluteFilePath("artist.mp3"));