Stream frequency change support and new anti-starvation strategy

This commit is contained in:
Siana Gearz
2013-02-26 23:13:39 +01:00
parent 6ee8cc5798
commit c9ab38d449
3 changed files with 16 additions and 13 deletions

View File

@@ -161,7 +161,6 @@ void LLStreamingAudio_FMODEX::update()
// Reset volume to previously set volume
setGain(getGain());
mFMODInternetStreamChannelp->setPaused(false);
mLastStarved.stop();
}
}
else if(open_state == FMOD_OPENSTATE_ERROR)
@@ -200,6 +199,13 @@ void LLStreamingAudio_FMODEX::update()
if(name == "Title") name = "TITLE";
else if(name == "WM/AlbumArtist") name = "ARTIST";
break;
case(FMOD_TAGTYPE_FMOD):
if (!strcmp(tag.name, "Sample Rate Change"))
{
llinfos << "Stream forced changing sample rate to " << *((float *)tag.data) << llendl;
mFMODInternetStreamChannelp->setFrequency(*((float *)tag.data));
}
continue;
default:
break;
}
@@ -243,19 +249,19 @@ void LLStreamingAudio_FMODEX::update()
}
if(starving)
{
if(!mLastStarved.getStarted())
bool paused = false;
mFMODInternetStreamChannelp->getPaused(&paused);
if(!paused)
{
llinfos << "Stream starvation detected! Muting stream audio until it clears." << llendl;
llinfos << "Stream starvation detected! Pausing stream until buffer nearly full." << llendl;
llinfos << " (diskbusy="<<diskbusy<<")" << llendl;
llinfos << " (progress="<<progress<<")" << llendl;
mFMODInternetStreamChannelp->setMute(true);
mFMODInternetStreamChannelp->setPaused(true);
}
mLastStarved.start();
}
else if(mLastStarved.getStarted() && mLastStarved.getElapsedTimeF32() > 1.f)
else if(progress > 80)
{
mLastStarved.stop();
mFMODInternetStreamChannelp->setMute(false);
mFMODInternetStreamChannelp->setPaused(false);
}
}
}
@@ -263,7 +269,6 @@ void LLStreamingAudio_FMODEX::update()
void LLStreamingAudio_FMODEX::stop()
{
mLastStarved.stop();
if(mMetaData)
{
delete mMetaData;

View File

@@ -79,8 +79,6 @@ private:
std::string mURL;
F32 mGain;
LLTimer mLastStarved;
LLSD *mMetaData;
};

View File

@@ -50,7 +50,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>7000</integer>
<integer>15000</integer>
</map>
<key>SHFMODExDecodeBufferSize</key>
<map>
@@ -61,7 +61,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
<integer>1000</integer>
<integer>2000</integer>
</map>
<key>SHAllowScriptCommands</key>
<map>