diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index f0b44f97d2..5f0129ddf6 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -591,6 +591,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID()); adp->setHasDecodedData(TRUE); adp->setHasValidData(TRUE); + adp->setHasDecodeRequestPending( false ); // All done, buffer can be used. // At this point, we could see if anyone needs this sound immediately, but // I'm not sure that there's a reason to - we need to poll all of the playing @@ -600,6 +601,14 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) else { llinfos << "Vorbis decode failed!!!" << llendl; + + // Decode failed, mark audiodata as not waiting for decoded data, then it can be reused. + + LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID()); + if( adp ) + adp->setHasDecodeRequestPending( false ); + + // } mCurrentDecodep = NULL; } diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index a45a49c47c..f2acc01dae 100644 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -1230,6 +1230,7 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E adp->setHasValidData(false); adp->setHasLocalData(false); adp->setHasDecodedData(false); + adp->setHasDecodeRequestPending( false ); // Buffer has no data, can be reused. } } else @@ -1243,7 +1244,8 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E else { adp->setHasValidData(true); - adp->setHasLocalData(true); + adp->setHasLocalData(true); + adp->setHasDecodeRequestPending( true ); // Data must be decoded, wait for it. gAudioDecodeMgrp->addDecodeRequest(uuid); } } @@ -1311,6 +1313,13 @@ void LLAudioSource::update() { if (getCurrentData()) { + // Don't try to load if still waiting for decoded data. Otherwise load fails, mCorrupted gets set and we never get a sound played. + + if( getCurrentData()->hasDecodeRequestPending() ) + return; + + // + // Hack - try and load the sound. Will do this as a callback // on decode later. if (getCurrentData()->load() && getCurrentData()->getBuffer()) @@ -1736,10 +1745,12 @@ LLAudioData::LLAudioData(const LLUUID &uuid) : mBufferp(NULL), mHasLocalData(false), mHasDecodedData(false), - mHasValidData(true) + mHasValidData(true), + mHasDecodeRequest(true) { if (uuid.isNull()) { + mHasDecodeRequest = false; // This is a null sound. return; } @@ -1749,10 +1760,14 @@ LLAudioData::LLAudioData(const LLUUID &uuid) : // Already have a decoded version, don't need to decode it. mHasLocalData = true; mHasDecodedData = true; + + mHasDecodeRequest = false; } else if (gAssetStorage && gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND)) { mHasLocalData = true; + + mHasDecodeRequest = false; } } diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index a47ee7ca7c..888bf88d5b 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -385,6 +385,15 @@ protected: bool mHasLocalData; bool mHasDecodedData; bool mHasValidData; + + // Mark data as still waiting for being decoded. +public: + void setHasDecodeRequestPending( bool aRequestPending ) { mHasDecodeRequest = aRequestPending; } + bool hasDecodeRequestPending() const { return mHasDecodeRequest; } + +private: + bool mHasDecodeRequest; + // };