diff options
author | Jonathan Yap <none@none> | 2012-05-30 14:23:43 -0400 |
---|---|---|
committer | Jonathan Yap <none@none> | 2012-05-30 14:23:43 -0400 |
commit | b2434b2f5e6909d62a6bd0b942d554dcba3cd052 (patch) | |
tree | 1c37d2faed83205a8412e8613a8717bc03b39c3c /indra/newview/llvieweraudio.cpp | |
parent | 278d3b15e6f7ecd83e48bb5c7eac11f670776a72 (diff) |
STORM-1812 Add debugging lines and call audio_update to try to work around a possible race condition
Diffstat (limited to 'indra/newview/llvieweraudio.cpp')
-rw-r--r-- | indra/newview/llvieweraudio.cpp | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 542f16cbee..2ef159ff31 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -251,13 +251,17 @@ F32 LLViewerAudio::getFadeVolume() void LLViewerAudio::onTeleportFailed() { + // Calling audio_update_volume makes sure that the music stream is properly set to be restored to + // its previous value + audio_update_volume(false); + if (gAudiop && mWasPlaying) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { mNextStreamURI = parcel->getMusicURL(); - llinfos << "Teleport failed -- resetting music stream" << llendl; + llinfos << "Teleport failed -- setting music stream to " << mNextStreamURI << llendl; } } mWasPlaying = false; @@ -265,12 +269,17 @@ void LLViewerAudio::onTeleportFailed() void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local) { + // Calling audio_update_volume makes sure that the music stream is properly set to be restored to + // its previous value + audio_update_volume(false); + if (gAudiop && local && mWasPlaying) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { mNextStreamURI = parcel->getMusicURL(); + llinfos << "Intraparcel teleport -- setting music stream to " << mNextStreamURI << llendl; } } mWasPlaying = false; @@ -379,8 +388,16 @@ void audio_update_volume(bool force_update) // Streaming Music if (gAudiop) { + if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade()) + { +LL_WARNS("FADING") << "DBG ForcedTeleportFade = true, WasPlaying = " << !gAudiop->getInternetStreamURL().empty() << " stream ='" << gAudiop->getInternetStreamURL() << "'" << LL_ENDL; + LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty()); + LLViewerAudio::getInstance()->setForcedTeleportFade(false); + } + if (progress_view_visible && !LLViewerAudio::getInstance()->getForcedTeleportFade()) { +LL_WARNS("FADING") << "DBG ForcedTeleportFade = false, WasPlaying = " << !gAudiop->getInternetStreamURL().empty() << " stream ='" << gAudiop->getInternetStreamURL() << "'" << LL_ENDL; // Even though the music was turned off it was starting up (with autoplay disabled) occasionally // after a failed teleport or after an intra-parcel teleport. Also, the music sometimes was not // restarting after a successful intra-parcel teleport. Setting mWasPlaying fixes these issues. @@ -390,12 +407,6 @@ void audio_update_volume(bool force_update) LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null); } - if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade()) - { - LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty()); - LLViewerAudio::getInstance()->setForcedTeleportFade(false); - } - F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume(); |