Ver código fonte

SoundPlayer: Don't silently ignore parsing failures

If we failed to decode a sample we'd presumably want to tell the user,
and we definitely don't want to just go into another round of decoding
somewhere in the middle of a broken sample.
Tim Schumacher 2 anos atrás
pai
commit
877be0eb43
1 arquivos alterados com 9 adições e 10 exclusões
  1. 9 10
      Userland/Applications/SoundPlayer/PlaybackManager.cpp

+ 9 - 10
Userland/Applications/SoundPlayer/PlaybackManager.cpp

@@ -114,15 +114,14 @@ void PlaybackManager::next_buffer()
             return;
         }
 
-        auto maybe_buffer = m_loader->get_more_samples(m_samples_to_load_per_buffer);
-        if (!maybe_buffer.is_error()) {
-            m_current_buffer.swap(maybe_buffer.value());
-            VERIFY(m_resampler.has_value());
-            m_resampler->reset();
-            // FIXME: Handle OOM better.
-            auto resampled = MUST(FixedArray<Audio::Sample>::try_create(m_resampler->resample(move(m_current_buffer)).span()));
-            m_current_buffer.swap(resampled);
-            MUST(m_connection->async_enqueue(m_current_buffer));
-        }
+        // FIXME: This should handle parsing failures gracefully and show them to the user.
+        auto buffer = m_loader->get_more_samples(m_samples_to_load_per_buffer).release_value();
+        m_current_buffer.swap(buffer);
+        VERIFY(m_resampler.has_value());
+        m_resampler->reset();
+        // FIXME: Handle OOM better.
+        auto resampled = MUST(FixedArray<Audio::Sample>::try_create(m_resampler->resample(move(m_current_buffer)).span()));
+        m_current_buffer.swap(resampled);
+        MUST(m_connection->async_enqueue(m_current_buffer));
     }
 }