summaryrefslogtreecommitdiff
path: root/indra/llaudio/llaudioengine.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-02-27 11:51:57 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-02-27 11:51:57 -0500
commite7ab3da7a7f5c68e3544a64c30f011762572995a (patch)
tree65a8aab420f23e7b53c72c7326a26a6c4901489f /indra/llaudio/llaudioengine.cpp
parentc0318d1bf988217e1fbb0593d03c4f0235a13ea3 (diff)
parent4a7848148e886676dd24bfcf4f50db06bffb28da (diff)
Automated merge with file:///Users/nat/linden/viewer-leap-daggy
Diffstat (limited to 'indra/llaudio/llaudioengine.cpp')
-rw-r--r--indra/llaudio/llaudioengine.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 5e540ad8c5..5fa28cb902 100644
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -1264,6 +1264,7 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mSyncSlave(false),
mQueueSounds(false),
mPlayedOnce(false),
+ mCorrupted(false),
mType(type),
mChannelp(NULL),
mCurrentDatap(NULL),
@@ -1296,16 +1297,25 @@ void LLAudioSource::setChannel(LLAudioChannel *channelp)
void LLAudioSource::update()
{
+ if(mCorrupted)
+ {
+ return ; //no need to update
+ }
+
if (!getCurrentBuffer())
{
if (getCurrentData())
{
// Hack - try and load the sound. Will do this as a callback
// on decode later.
- if (getCurrentData()->load())
+ if (getCurrentData()->load() && getCurrentData()->getBuffer())
{
play(getCurrentData()->getID());
- }
+ }
+ else
+ {
+ mCorrupted = true ;
+ }
}
}
}
@@ -1421,6 +1431,11 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
bool LLAudioSource::isDone() const
{
+ if(mCorrupted)
+ {
+ return true ;
+ }
+
const F32 MAX_AGE = 60.f;
const F32 MAX_UNPLAYED_AGE = 15.f;
const F32 MAX_MUTED_AGE = 11.f;
@@ -1736,7 +1751,7 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
}
}
-
+//return false when the audio file is corrupted.
bool LLAudioData::load()
{
// For now, just assume we're going to use one buffer per audiodata.
@@ -1752,7 +1767,7 @@ bool LLAudioData::load()
{
// No free buffers, abort.
llinfos << "Not able to allocate a new audio buffer, aborting." << llendl;
- return false;
+ return true;
}
std::string uuid_str;