diff options
author | dolphin <dolphin@lindenlab.com> | 2013-05-20 10:08:27 -0700 |
---|---|---|
committer | dolphin <dolphin@lindenlab.com> | 2013-05-20 10:08:27 -0700 |
commit | 716a963d5544977863d07770c3c6449b3d9897bb (patch) | |
tree | 36ce3c4707851bb04f557d790fe410d26a009293 /indra/llaudio/llstreamingaudio_fmodex.cpp | |
parent | 6308f93c6adddc9d396e8d2527e97e0d02c4aa52 (diff) | |
parent | 0ebcb7e3fd1452d42b5ca48139f99a4fd632d235 (diff) |
Merge with viewer-release
Diffstat (limited to 'indra/llaudio/llstreamingaudio_fmodex.cpp')
-rw-r--r-- | indra/llaudio/llstreamingaudio_fmodex.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp index 4a74267650..42f30aa1c4 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.cpp +++ b/indra/llaudio/llstreamingaudio_fmodex.cpp @@ -153,7 +153,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) @@ -168,21 +167,43 @@ void LLStreamingAudio_FMODEX::update() if(mFMODInternetStreamChannelp->getCurrentSound(&sound) == FMOD_OK && sound) { + FMOD_TAG tag; + S32 tagcount, dirtytagcount; + + if(sound->getNumTags(&tagcount, &dirtytagcount) == FMOD_OK && dirtytagcount) + { + for(S32 i = 0; i < tagcount; ++i) + { + if(sound->getTag(NULL, i, &tag)!=FMOD_OK) + continue; + + if (tag.type == 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; + } + } + } + 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); } } } @@ -190,8 +211,6 @@ void LLStreamingAudio_FMODEX::update() void LLStreamingAudio_FMODEX::stop() { - mLastStarved.stop(); - if (mFMODInternetStreamChannelp) { mFMODInternetStreamChannelp->setPaused(true); @@ -291,7 +310,7 @@ LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, con { mInternetStreamURL = url; - FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_MPEGSEARCH | FMOD_IGNORETAGS, 0, &mInternetStream); + FMOD_RESULT result = mSystem->createStream(url.c_str(), FMOD_2D | FMOD_NONBLOCKING | FMOD_IGNORETAGS, 0, &mInternetStream); if (result!= FMOD_OK) { |