Applied MAINT-862. Sounds not playing first time. http://hg.secondlife.com/viewer-beta/changeset/24a7281bef42

This commit is contained in:
Shyotl
2012-06-09 01:50:14 -05:00
parent 5228aa7029
commit 332c8f997c
3 changed files with 31 additions and 16 deletions

View File

@@ -1279,6 +1279,7 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
adp->setHasValidData(false);
adp->setHasLocalData(false);
adp->setHasDecodedData(false);
adp->setHasCompletedDecode(true);
}
}
else
@@ -1380,16 +1381,18 @@ void LLAudioSource::update()
if (!getCurrentBuffer())
{
if (getCurrentData())
LLAudioData *adp = getCurrentData();
if (adp)
{
// Hack - try and load the sound. Will do this as a callback
// on decode later.
if (getCurrentData()->load() && getCurrentData()->getBuffer())
if (adp->load() && adp->getBuffer())
{
play(getCurrentData()->getID());
play(adp->getID());
}
else
else if (adp->hasCompletedDecode()) // Only mark corrupted after decode is done
{
llwarns << "Marking LLAudioSource corrupted for " << adp->getID() << llendl;
mCorrupted = true ;
}
}
@@ -1812,6 +1815,7 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
mBufferp(NULL),
mHasLocalData(false),
mHasDecodedData(false),
mHasCompletedDecode(false),
mHasValidData(true)
{
if (uuid.isNull())
@@ -1823,12 +1827,13 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
if (gAudiop && gAudiop->hasDecodedFile(uuid))
{
// Already have a decoded version, don't need to decode it.
mHasLocalData = true;
mHasDecodedData = true;
setHasLocalData(true);
setHasDecodedData(true);
setHasCompletedDecode(true);
}
else if (gAssetStorage && gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND))
{
mHasLocalData = true;
setHasLocalData(true);
}
}