|
From: Lasse Kärkkäi. <tr...@us...> - 2010-10-24 15:21:34
|
Module: performous
Branch: master
Commit: c9b99dd56478ba79b3b26416aa67125ef52702bb
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Oct 24 17:19:52 2010 +0200
Proper handling of tracks with missing/broken music files.
---
game/audio.cc | 6 +++++-
game/ffmpeg.hh | 1 +
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/game/audio.cc b/game/audio.cc
index 111c6f7..0ef09f6 100644
--- a/game/audio.cc
+++ b/game/audio.cc
@@ -214,7 +214,11 @@ public:
bool prepare() {
bool ready = true;
for (Tracks::iterator it = tracks.begin(), itend = tracks.end(); it != itend; ++it) {
- if (!it->second->mpeg.audioQueue.prepare(m_pos)) ready = false;
+ FFmpeg& mpeg = it->second->mpeg;
+ if (mpeg.terminating()) continue; // Song loading failed or other error, won't ever get ready
+ if (mpeg.audioQueue.prepare(m_pos)) continue; // Buffering done
+ ready = false; // Need to wait for buffering
+ break;
}
return ready;
}
diff --git a/game/ffmpeg.hh b/game/ffmpeg.hh
index 0f0d7c8..a3b4388 100644
--- a/game/ffmpeg.hh
+++ b/game/ffmpeg.hh
@@ -211,6 +211,7 @@ class FFmpeg {
double duration() const;
/// return current position
double position() { return videoQueue.position(); /* FIXME: remove */ }
+ bool terminating() const { return m_quit; }
private:
class eof_error: public std::exception {};
|