- fixed: 'stat music' tried to access a non-existent stream decoder for any music played through Timidity++ on OpenAL.

This commit is contained in:
Christoph Oelckers 2017-01-10 22:16:32 +01:00
parent 2abd16f117
commit 6552e5a7a1

View file

@ -407,7 +407,7 @@ public:
virtual FString GetStats()
{
FString stats;
size_t pos, len;
size_t pos = 0, len = 0;
ALfloat volume;
ALint offset;
ALint processed;
@ -429,13 +429,18 @@ public:
return stats;
}
if (Decoder != nullptr)
{
pos = Decoder->getSampleOffset();
len = Decoder->getSampleLength();
}
lock.unlock();
stats = (state == AL_INITIAL) ? "Buffering" : (state == AL_STOPPED) ? "Underrun" :
(state == AL_PLAYING || state == AL_PAUSED) ? "Ready" : "Unknown state";
if (Decoder != nullptr)
{
if (state == AL_STOPPED)
offset = BufferCount * (Data.Size() / FrameSize);
else
@ -451,6 +456,7 @@ public:
stats.AppendFormat(", %zu.%03zu", pos / 1000, pos % 1000);
if (len > 0)
stats.AppendFormat(" / %zu.%03zu", len / 1000, len % 1000);
}
if(state == AL_PAUSED)
stats += ", paused";
if(state == AL_PLAYING)