diff options
Diffstat (limited to 'indra/llaudio')
-rw-r--r-- | indra/llaudio/llaudiodecodemgr.cpp | 2 | ||||
-rw-r--r-- | indra/llaudio/llaudioengine.cpp | 23 | ||||
-rw-r--r-- | indra/llaudio/llaudioengine.h | 2 |
3 files changed, 22 insertions, 5 deletions
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index f0b44f97d2..7f747c2eca 100644 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -215,7 +215,7 @@ BOOL LLVorbisDecodeState::initDecode() return(FALSE); } - S32 sample_count = ov_pcm_total(&mVF, -1); + S32 sample_count = (S32)ov_pcm_total(&mVF, -1); size_t size_guess = (size_t)sample_count; vorbis_info* vi = ov_info(&mVF, -1); size_guess *= (vi? vi->channels : 1); 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; diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index 30d2490635..28b69e1973 100644 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -37,6 +37,7 @@ #include "lluuid.h" #include "llframetimer.h" #include "llassettype.h" +#include "llextendedstatus.h" #include "lllistener.h" @@ -334,6 +335,7 @@ protected: bool mSyncSlave; bool mQueueSounds; bool mPlayedOnce; + bool mCorrupted; S32 mType; LLVector3d mPositionGlobal; LLVector3 mVelocity; |