Fixed a shutdown crash in LLAudioEngine::assetCallback, and fixed behavior when soundsource re-issues a sound whilst a sound is currently playing for same source. (LLAudioChannel[Impl]::play now re-starts sound if already playing)

This commit is contained in:
Shyotl
2013-10-13 16:22:24 -05:00
parent daa07d031c
commit dbfd0cb7a6
5 changed files with 35 additions and 8 deletions

View File

@@ -1249,6 +1249,9 @@ void LLAudioEngine::startNextTransfer()
// static
void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 result_code, LLExtStat ext_status)
{
if(!gAudiop)
return;
if (result_code)
{
LL_INFOS("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL;
@@ -1469,6 +1472,19 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
return true;
}
}
else if(mCurrentDatap == adp) //Desired sound did not change. Just re-play it.
{
if(getChannel() && getChannel()->isPlaying())
getChannel()->play();
return true;
}
else //Desired sound did change. Release the old channel if set.
{
if(getChannel())
getChannel()->cleanup();
mPlayedOnce = false; //Reset the played flag so the new sound is actually started up.
}
mCurrentDatap = adp;
// Make sure the audio engine knows that we want to request this sound.