From 1daac7272246416473942d05f1f700eb911ae942 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 15 Feb 2012 08:05:28 -0500 Subject: STORM-1812 Music stream does not always restart after teleporting --- indra/newview/llvieweraudio.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llvieweraudio.cpp') diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 2447f5dea8..0114c292dc 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -53,11 +53,14 @@ LLViewerAudio::LLViewerAudio() : { mTeleportFailedConnection = LLViewerParcelMgr::getInstance()-> setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this)); + mTeleportFinishedConnection = LLViewerParcelMgr::getInstance()-> + setTeleportFinishedCallback(boost::bind(&LLViewerAudio::onTeleportFinished, this, _1, _2)); } LLViewerAudio::~LLViewerAudio() { mTeleportFailedConnection.disconnect(); + mTeleportFinishedConnection.disconnect(); } void LLViewerAudio::registerIdleListener() @@ -253,6 +256,19 @@ void LLViewerAudio::onTeleportFailed() if (parcel) { mNextStreamURI = parcel->getMusicURL(); + llinfos << "Teleport failed -- resetting music stream" << llendl; + } + } +} + +void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local) +{ + if (gAudiop && local) + { + LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); + if (parcel) + { + LLViewerParcelMgr::optionally_start_music(parcel->getMusicURL()); } } } -- cgit v1.2.3 From 502e89971f8cf22c49e9c42c38f0aee54a0654c5 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Mon, 14 May 2012 13:20:06 -0400 Subject: STORM-1812 Tweak how music is restarted for teleport within a parcel --- indra/newview/llvieweraudio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvieweraudio.cpp') diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 0114c292dc..c04e6eeb5c 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -268,7 +268,7 @@ void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local) LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) { - LLViewerParcelMgr::optionally_start_music(parcel->getMusicURL()); + mNextStreamURI = parcel->getMusicURL(); } } } -- cgit v1.2.3 From 031c3bbcc4c1fdba9b8a2c797ebcac03310df93b Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Fri, 18 May 2012 16:36:11 -0400 Subject: STORM-1812 / subtask STORM-1861 Media auto-play is off - but music stream starts to play anyway when teleport fails --- indra/newview/llvieweraudio.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'indra/newview/llvieweraudio.cpp') diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index c04e6eeb5c..9953bc1f36 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -49,7 +49,8 @@ LLViewerAudio::LLViewerAudio() : mFadeState(FADE_IDLE), mFadeTime(), mIdleListnerActive(false), - mForcedTeleportFade(false) + mForcedTeleportFade(false), + mWasPlaying(false) { mTeleportFailedConnection = LLViewerParcelMgr::getInstance()-> setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this)); @@ -250,7 +251,7 @@ F32 LLViewerAudio::getFadeVolume() void LLViewerAudio::onTeleportFailed() { - if (gAudiop) + if (gAudiop && mWasPlaying) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) @@ -259,11 +260,12 @@ void LLViewerAudio::onTeleportFailed() llinfos << "Teleport failed -- resetting music stream" << llendl; } } + mWasPlaying = false; } void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local) { - if (gAudiop && local) + if (gAudiop && local && mWasPlaying) { LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (parcel) @@ -271,6 +273,7 @@ void LLViewerAudio::onTeleportFinished(const LLVector3d& pos, const bool& local) mNextStreamURI = parcel->getMusicURL(); } } + mWasPlaying = false; } void init_audio() @@ -378,12 +381,22 @@ void audio_update_volume(bool force_update) { if (progress_view_visible && !LLViewerAudio::getInstance()->getForcedTeleportFade()) { + // 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. + if (gAudiop->getInternetStreamURL().empty()) + { + LLViewerAudio::getInstance()->setWasPlaying(false); + } + else + { + LLViewerAudio::getInstance()->setWasPlaying(true); + } LLViewerAudio::getInstance()->setForcedTeleportFade(true); LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null); } - if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade() == true) + if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade()) { LLViewerAudio::getInstance()->setForcedTeleportFade(false); } -- cgit v1.2.3 From 278d3b15e6f7ecd83e48bb5c7eac11f670776a72 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Sun, 20 May 2012 14:22:38 -0400 Subject: STORM-1812 Store playing state from an additional place. --- indra/newview/llvieweraudio.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvieweraudio.cpp') diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 9953bc1f36..542f16cbee 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -382,15 +382,9 @@ void audio_update_volume(bool force_update) if (progress_view_visible && !LLViewerAudio::getInstance()->getForcedTeleportFade()) { // 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. - if (gAudiop->getInternetStreamURL().empty()) - { - LLViewerAudio::getInstance()->setWasPlaying(false); - } - else - { - LLViewerAudio::getInstance()->setWasPlaying(true); - } + // 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. + LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty()); LLViewerAudio::getInstance()->setForcedTeleportFade(true); LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null); @@ -398,6 +392,7 @@ void audio_update_volume(bool force_update) if (!progress_view_visible && LLViewerAudio::getInstance()->getForcedTeleportFade()) { + LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty()); LLViewerAudio::getInstance()->setForcedTeleportFade(false); } -- cgit v1.2.3 From b2434b2f5e6909d62a6bd0b942d554dcba3cd052 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 30 May 2012 14:23:43 -0400 Subject: STORM-1812 Add debugging lines and call audio_update to try to work around a possible race condition --- indra/newview/llvieweraudio.cpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'indra/newview/llvieweraudio.cpp') 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(); -- cgit v1.2.3 From 29737cb9c00cc46059e3a77bce06d45e45fe4d9f Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Wed, 30 May 2012 17:07:17 -0400 Subject: STORM-1812 First pass at adding teleport started signal --- indra/newview/llvieweraudio.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llvieweraudio.cpp') diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 2ef159ff31..7ac0d3aeaa 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -41,6 +41,7 @@ #include "llstartup.h" #include "llviewerparcelmgr.h" #include "llparcel.h" +#include "llviewermessage.h" ///////////////////////////////////////////////////////// @@ -56,6 +57,8 @@ LLViewerAudio::LLViewerAudio() : setTeleportFailedCallback(boost::bind(&LLViewerAudio::onTeleportFailed, this)); mTeleportFinishedConnection = LLViewerParcelMgr::getInstance()-> setTeleportFinishedCallback(boost::bind(&LLViewerAudio::onTeleportFinished, this, _1, _2)); + mTeleportStartedConnection = LLViewerMessage::getInstance()-> + setTeleportStartedCallback(boost::bind(&LLViewerAudio::onTeleportStarted, this)); } LLViewerAudio::~LLViewerAudio() @@ -249,6 +252,11 @@ F32 LLViewerAudio::getFadeVolume() return fade_volume; } +void LLViewerAudio::onTeleportStarted() +{ +llwarns << "DBG teleport started" << llendl; +} + void LLViewerAudio::onTeleportFailed() { // Calling audio_update_volume makes sure that the music stream is properly set to be restored to -- cgit v1.2.3 From 8e6202ad53415695f0c0f40a366b4f329ff8b714 Mon Sep 17 00:00:00 2001 From: Jonathan Yap Date: Thu, 31 May 2012 06:20:12 -0400 Subject: STORM-1812 Added teleport started callback --- indra/newview/llvieweraudio.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'indra/newview/llvieweraudio.cpp') diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 7ac0d3aeaa..8d8c401dac 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -65,6 +65,7 @@ LLViewerAudio::~LLViewerAudio() { mTeleportFailedConnection.disconnect(); mTeleportFinishedConnection.disconnect(); + mTeleportStartedConnection.disconnect(); } void LLViewerAudio::registerIdleListener() @@ -74,7 +75,6 @@ void LLViewerAudio::registerIdleListener() mIdleListnerActive = true; doOnIdleRepeating(boost::bind(boost::bind(&LLViewerAudio::onIdleUpdate, this))); } - } void LLViewerAudio::startInternetStreamWithAutoFade(std::string streamURI) @@ -254,7 +254,16 @@ F32 LLViewerAudio::getFadeVolume() void LLViewerAudio::onTeleportStarted() { -llwarns << "DBG teleport started" << llendl; + if (!LLViewerAudio::getInstance()->getForcedTeleportFade()) + { + // 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. + LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty()); + LLViewerAudio::getInstance()->setForcedTeleportFade(true); + LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); + LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null); + } } void LLViewerAudio::onTeleportFailed() @@ -398,23 +407,10 @@ void audio_update_volume(bool force_update) { 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. - LLViewerAudio::getInstance()->setWasPlaying(!gAudiop->getInternetStreamURL().empty()); - LLViewerAudio::getInstance()->setForcedTeleportFade(true); - LLViewerAudio::getInstance()->startInternetStreamWithAutoFade(LLStringUtil::null); - LLViewerAudio::getInstance()->setNextStreamURI(LLStringUtil::null); - } - F32 music_volume = gSavedSettings.getF32("AudioLevelMusic"); BOOL music_muted = gSavedSettings.getBOOL("MuteMusic"); F32 fade_volume = LLViewerAudio::getInstance()->getFadeVolume(); -- cgit v1.2.3