summaryrefslogtreecommitdiff
path: root/indra/newview/llvoicechannel.cpp
diff options
context:
space:
mode:
authorRoxie Linden <roxie@lindenlab.com>2010-03-01 15:31:04 -0800
committerRoxie Linden <roxie@lindenlab.com>2010-03-01 15:31:04 -0800
commitb11a625e6ff89470d25273fa426ed13f7abc4a6a (patch)
treea5e923a8211926f119f1cf45ded6cd4222c9250b /indra/newview/llvoicechannel.cpp
parent6575b685e91d334198789c88dec2efab7e5a1ac9 (diff)
parenta2efe4bb4154b7ecb9c7cb279f7a28d7d401a93a (diff)
Automated merge with a few fixups for code review comments
Diffstat (limited to 'indra/newview/llvoicechannel.cpp')
-rw-r--r--indra/newview/llvoicechannel.cpp64
1 files changed, 34 insertions, 30 deletions
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index fac7fa6a18..338bc12f04 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -72,9 +72,9 @@ private:
void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
{
- llwarns << "LLVoiceCallCapResponder::error("
+ LL_WARNS("Voice") << "LLVoiceCallCapResponder::error("
<< status << ": " << reason << ")"
- << llendl;
+ << LL_ENDL;
LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
if ( channelp )
{
@@ -104,8 +104,8 @@ void LLVoiceCallCapResponder::result(const LLSD& content)
LLSD::map_const_iterator iter;
for(iter = content.beginMap(); iter != content.endMap(); ++iter)
{
- llinfos << "LLVoiceCallCapResponder::result got "
- << iter->first << llendl;
+ LL_DEBUGS("Voice") << "LLVoiceCallCapResponder::result got "
+ << iter->first << LL_ENDL;
}
channelp->setChannelInfo(
@@ -131,10 +131,8 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
{
// a voice channel already exists for this session id, so this instance will be orphaned
// the end result should simply be the failure to make voice calls
- llwarns << "Duplicate voice channels registered for session_id " << session_id << llendl;
+ LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
}
-
- LLVoiceClient::getInstance()->addObserver(this);
}
LLVoiceChannel::~LLVoiceChannel()
@@ -145,7 +143,7 @@ LLVoiceChannel::~LLVoiceChannel()
// later in other destructors anyway). EXT-5524
if(LLVoiceClient::instanceExists())
{
- gVoiceClient->removeObserver(this);
+ LLVoiceClient::getInstance()->removeObserver(this);
}
sVoiceChannelMap.erase(mSessionID);
@@ -165,13 +163,13 @@ void LLVoiceChannel::setChannelInfo(
if (mURI.empty())
{
LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
- llwarns << "Received empty URI for channel " << mSessionName << llendl;
+ LL_WARNS("Voice") << "Received empty URI for channel " << mSessionName << LL_ENDL;
deactivate();
}
else if (mCredentials.empty())
{
LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
- llwarns << "Received empty credentials for channel " << mSessionName << llendl;
+ LL_WARNS("Voice") << "Received empty credentials for channel " << mSessionName << LL_ENDL;
deactivate();
}
else
@@ -286,13 +284,14 @@ void LLVoiceChannel::deactivate()
//Default mic is OFF when leaving voice calls
if (gSavedSettings.getBOOL("AutoDisengageMic") &&
sCurrentVoiceChannel == this &&
- gVoiceClient->getUserPTTState())
+ LLVoiceClient::getInstance()->getUserPTTState())
{
gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
- gVoiceClient->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
}
}
-
+ LLVoiceClient::getInstance()->removeObserver(this);
+
if (sCurrentVoiceChannel == this)
{
// default channel is proximal channel
@@ -332,7 +331,9 @@ void LLVoiceChannel::activate()
{
setState(STATE_CALL_STARTED);
}
-
+
+ LLVoiceClient::getInstance()->addObserver(this);
+
//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
sCurrentVoiceChannelChangedSignal(this->mSessionID);
}
@@ -374,6 +375,11 @@ LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri)
}
}
+LLVoiceChannel* LLVoiceChannel::getCurrentVoiceChannel()
+{
+ return sCurrentVoiceChannel;
+}
+
void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id)
{
sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID));
@@ -425,7 +431,6 @@ void LLVoiceChannel::initClass()
sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
}
-
//static
void LLVoiceChannel::suspend()
{
@@ -441,7 +446,7 @@ void LLVoiceChannel::resume()
{
if (sSuspended)
{
- if (gVoiceClient->voiceEnabled())
+ if (LLVoiceClient::getInstance()->voiceEnabled())
{
if (sSuspendedVoiceChannel)
{
@@ -511,9 +516,9 @@ void LLVoiceChannelGroup::activate()
#endif
//Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
- if (gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
+ if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
{
- gVoiceClient->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
}
}
@@ -560,7 +565,7 @@ void LLVoiceChannelGroup::setChannelInfo(
else
{
//*TODO: notify user
- llwarns << "Received invalid credentials for channel " << mSessionName << llendl;
+ LL_WARNS("Voice") << "Received invalid credentials for channel " << mSessionName << LL_ENDL;
deactivate();
}
}
@@ -659,7 +664,6 @@ void LLVoiceChannelGroup::setState(EState state)
LLVoiceChannelProximal::LLVoiceChannelProximal() :
LLVoiceChannel(LLUUID::null, LLStringUtil::null)
{
- activate();
}
BOOL LLVoiceChannelProximal::isActive()
@@ -671,13 +675,13 @@ void LLVoiceChannelProximal::activate()
{
if (callStarted()) return;
- LLVoiceChannel::activate();
-
- if (callStarted())
+ if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
{
- // this implicitly puts you back in the spatial channel
- LLVoiceClient::getInstance()->leaveNonSpatialChannel();
+ // we're connected to a non-spatial channel, so disconnect.
+ LLVoiceClient::getInstance()->leaveNonSpatialChannel();
}
+ LLVoiceChannel::activate();
+
}
void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
@@ -707,7 +711,7 @@ void LLVoiceChannelProximal::handleStatusChange(EStatusType status)
return;
case STATUS_VOICE_DISABLED:
//skip showing "Voice not available at your current location" when agent voice is disabled (EXT-4749)
- if(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking())
+ if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
{
//TODO: remove or redirect this call status notification
// LLCallInfoDialog::show("unavailable", mNotifyArgs);
@@ -767,7 +771,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string
void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
{
- llinfos << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << llendl;
+ LL_INFOS("Voice") << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << LL_ENDL;
// status updates
switch(type)
@@ -841,9 +845,9 @@ void LLVoiceChannelP2P::activate()
LLRecentPeople::instance().add(mOtherUserID);
//Default mic is ON on initiating/joining P2P calls
- if (!gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
+ if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
{
- gVoiceClient->inputUserControlState(true);
+ LLVoiceClient::getInstance()->inputUserControlState(true);
}
}
}
@@ -906,7 +910,7 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s
void LLVoiceChannelP2P::setState(EState state)
{
- llinfos << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << llendl;
+ LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;
if (mReceivedCall) // incoming call
{