summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2012-05-18 16:36:11 -0400
committerJonathan Yap <none@none>2012-05-18 16:36:11 -0400
commit031c3bbcc4c1fdba9b8a2c797ebcac03310df93b (patch)
tree2454ad0adeec0ad026f192cf79ad8cd3729ae548
parent502e89971f8cf22c49e9c42c38f0aee54a0654c5 (diff)
STORM-1812 / subtask STORM-1861 Media auto-play is off - but music stream starts to play anyway when teleport fails
-rw-r--r--indra/newview/llvieweraudio.cpp21
-rw-r--r--indra/newview/llvieweraudio.h2
2 files changed, 19 insertions, 4 deletions
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);
}
diff --git a/indra/newview/llvieweraudio.h b/indra/newview/llvieweraudio.h
index d3a7d74de2..38c977c605 100644
--- a/indra/newview/llvieweraudio.h
+++ b/indra/newview/llvieweraudio.h
@@ -66,6 +66,7 @@ public:
bool getForcedTeleportFade() { return mForcedTeleportFade; };
void setForcedTeleportFade(bool fade) { mForcedTeleportFade = fade;} ;
void setNextStreamURI(std::string stream) { mNextStreamURI = stream; } ;
+ void setWasPlaying(bool playing) { mWasPlaying = playing;} ;
private:
@@ -76,6 +77,7 @@ private:
LLFrameTimer stream_fade_timer;
bool mIdleListnerActive;
bool mForcedTeleportFade;
+ bool mWasPlaying;
boost::signals2::connection mTeleportFailedConnection;
boost::signals2::connection mTeleportFinishedConnection;