# Conflicts:
#	indra/newview/llpanelpeople.cpp
master
Ansariel 2024-08-16 12:28:12 +02:00
commit 6473ba38bf
23 changed files with 217 additions and 136 deletions

View File

@ -3160,11 +3160,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>archive</key>
<map>
<key>hash</key>
<string>baabb11f324be350253b1fb58cf262c1aa19fa70</string>
<string>194b4f5957c9f003c46e61a434e23a7c3d1180d6</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.67-debug/webrtc-m114.5735.08.67-debug.10190042668-darwin64-10190042668.tar.zst</string>
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.70-debug/webrtc-m114.5735.08.70-debug.10377605436-darwin64-10377605436.tar.zst</string>
</map>
<key>name</key>
<string>darwin64</string>
@ -3174,11 +3174,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>archive</key>
<map>
<key>hash</key>
<string>a13776c8f99f8975665be66ff8b51a80ba46c718</string>
<string>38e0c7d30b4c40eb04e60ab199440b847cc7c6cf</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.67-debug/webrtc-m114.5735.08.67-debug.10190042668-linux64-10190042668.tar.zst</string>
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.70-debug/webrtc-m114.5735.08.70-debug.10377605436-linux64-10377605436.tar.zst</string>
</map>
<key>name</key>
<string>linux64</string>
@ -3188,11 +3188,11 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>archive</key>
<map>
<key>hash</key>
<string>965ef5d65a14191a52ee9ec6a9a8a1d2ce3f2ffb</string>
<string>053fb5c873df9192e34cddcf2db1c5fdcff76ba1</string>
<key>hash_algorithm</key>
<string>sha1</string>
<key>url</key>
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.67-debug/webrtc-m114.5735.08.67-debug.10190042668-windows64-10190042668.tar.zst</string>
<string>https://github.com/secondlife/3p-webrtc-build/releases/download/m114.5735.08.70-debug/webrtc-m114.5735.08.70-debug.10377605436-windows64-10377605436.tar.zst</string>
</map>
<key>name</key>
<string>windows64</string>
@ -3205,7 +3205,7 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors</string>
<key>copyright</key>
<string>Copyright (c) 2011, The WebRTC project authors. All rights reserved.</string>
<key>version</key>
<string>m114.5735.08.67-debug.10190042668</string>
<string>m114.5735.08.70-debug.10377605436</string>
<key>name</key>
<string>webrtc</string>
<key>vcs_branch</key>

View File

@ -159,7 +159,8 @@ AccumulatorBufferGroup* ThreadRecorder::activate( AccumulatorBufferGroup* record
ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate( AccumulatorBufferGroup* recording )
{
#if LL_TRACE_ENABLED
if (mActiveRecordings.empty()) return mActiveRecordings.end();
if (mActiveRecordings.empty())
return mActiveRecordings.end();
mActiveRecordings.back()->mPartialRecording.sync();
BlockTimer::updateTimes();
@ -202,7 +203,7 @@ ThreadRecorder::active_recording_list_t::iterator ThreadRecorder::bringUpToDate(
#endif
}
void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording )
void ThreadRecorder::deactivate(AccumulatorBufferGroup* recording)
{
#if LL_TRACE_ENABLED
active_recording_list_t::iterator recording_it = bringUpToDate(recording);
@ -228,9 +229,10 @@ void ThreadRecorder::deactivate( AccumulatorBufferGroup* recording )
#endif
}
ThreadRecorder::ActiveRecording::ActiveRecording( AccumulatorBufferGroup* target )
ThreadRecorder::ActiveRecording::ActiveRecording(AccumulatorBufferGroup* target)
: mTargetRecording(target)
{}
{
}
void ThreadRecorder::ActiveRecording::movePartialToTarget()
{
@ -243,30 +245,30 @@ void ThreadRecorder::ActiveRecording::movePartialToTarget()
// called by child thread
void ThreadRecorder::addChildRecorder( class ThreadRecorder* child )
void ThreadRecorder::addChildRecorder(ThreadRecorder* child)
{
#if LL_TRACE_ENABLED
{ LLMutexLock lock(&mChildListMutex);
mChildThreadRecorders.push_back(child);
}
LLMutexLock lock(&mChildListMutex);
mChildThreadRecorders.push_back(child);
#endif
}
// called by child thread
void ThreadRecorder::removeChildRecorder( class ThreadRecorder* child )
void ThreadRecorder::removeChildRecorder(ThreadRecorder* child)
{
#if LL_TRACE_ENABLED
{ LLMutexLock lock(&mChildListMutex);
mChildThreadRecorders.remove(child);
}
LLMutexLock lock(&mChildListMutex);
mChildThreadRecorders.remove(child);
#endif
}
void ThreadRecorder::pushToParent()
{
#if LL_TRACE_ENABLED
{ LLMutexLock lock(&mSharedRecordingMutex);
LLTrace::get_thread_recorder()->bringUpToDate(&mThreadRecordingBuffers);
if (ThreadRecorder* recorder = LLTrace::get_thread_recorder())
{
LLMutexLock lock(&mSharedRecordingMutex);
recorder->bringUpToDate(&mThreadRecordingBuffers);
mSharedRecordingBuffers.append(mThreadRecordingBuffers);
mThreadRecordingBuffers.reset();
}
@ -278,15 +280,14 @@ void ThreadRecorder::pullFromChildren()
{
#if LL_TRACE_ENABLED
LL_PROFILE_ZONE_SCOPED_CATEGORY_STATS;
if (mActiveRecordings.empty()) return;
{ LLMutexLock lock(&mChildListMutex);
if (!mActiveRecordings.empty())
{
LLMutexLock lock(&mChildListMutex);
AccumulatorBufferGroup& target_recording_buffers = mActiveRecordings.back()->mPartialRecording;
target_recording_buffers.sync();
for (LLTrace::ThreadRecorder* rec : mChildThreadRecorders)
{ LLMutexLock lock(&(rec->mSharedRecordingMutex));
{
LLMutexLock lock(&(rec->mSharedRecordingMutex));
target_recording_buffers.merge(rec->mSharedRecordingBuffers);
rec->mSharedRecordingBuffers.reset();
}
@ -294,13 +295,11 @@ void ThreadRecorder::pullFromChildren()
#endif
}
void set_master_thread_recorder( ThreadRecorder* recorder )
void set_master_thread_recorder(ThreadRecorder* recorder)
{
sMasterThreadRecorder = recorder;
}
ThreadRecorder* get_master_thread_recorder()
{
return sMasterThreadRecorder;

View File

@ -84,13 +84,13 @@ FSFloaterContacts::FSFloaterContacts(const LLSD& seed)
{
LLAvatarTracker::instance().addObserver(this);
// For notification when SIP online status changes.
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
}
FSFloaterContacts::~FSFloaterContacts()
{
// For notification when SIP online status changes.
LLVoiceClient::getInstance()->removeObserver(this);
LLVoiceClient::removeObserver(this);
LLAvatarTracker::instance().removeObserver(this);
if (mRlvBehaviorCallbackConnection.connected())

View File

@ -235,10 +235,7 @@ void FSFloaterIM::onClose(bool app_quitting)
// AO: Make sure observers are removed on close
mVoiceChannelStateChangeConnection.disconnect();
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
LLVoiceClient::removeObserver((LLVoiceClientStatusObserver*)this);
//<FS:ND> FIRE-6077 et al: Always clean up observers when the floater dies
LLAvatarTracker::instance().removeParticularFriendObserver(mOtherParticipantUUID, this);
@ -616,10 +613,7 @@ FSFloaterIM::~FSFloaterIM()
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, (LLView*)this);
mVoiceChannelStateChangeConnection.disconnect();
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
LLVoiceClient::removeObserver((LLVoiceClientStatusObserver*)this);
LLIMModel::LLIMSession* pIMSession = LLIMModel::instance().findIMSession(mSessionID);
if ((pIMSession) && (pIMSession->mSessionType == LLIMModel::LLIMSession::P2P_SESSION))
@ -961,7 +955,7 @@ bool FSFloaterIM::postBuild()
updateButtons(mVoiceChannel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
LL_DEBUGS("FSFloaterIM") << "voice_channel end" << LL_ENDL;
}
LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
LLVoiceClient::addObserver((LLVoiceClientStatusObserver*)this);
// </AO>

View File

@ -79,7 +79,7 @@ FSFloaterVoiceControls::FSFloaterVoiceControls(const LLSD& key)
static LLUICachedControl<S32> voice_left_remove_delay ("VoiceParticipantLeftRemoveDelay", 10);
mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&FSFloaterVoiceControls::removeVoiceLeftParticipant, this, _1), voice_left_remove_delay);
LLVoiceClient::instance().addObserver(this);
LLVoiceClient::addObserver(this);
LLTransientFloaterMgr::getInstance()->addControlView(this);
// update the agent's name if display name setting change
@ -99,10 +99,7 @@ FSFloaterVoiceControls::~FSFloaterVoiceControls()
mAvatarListRefreshConnection.disconnect();
mVoiceChannelStateChangeConnection.disconnect();
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
LLTransientFloaterMgr::getInstance()->removeControlView(this);
}
@ -513,13 +510,12 @@ void FSFloaterVoiceControls::updateAgentModeratorState()
static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids)
{
// Get a list of participants from VoiceClient
std::set<LLUUID> participants;
LLVoiceClient::getInstance()->getParticipantList(participants);
std::set<LLUUID> participants;
LLVoiceClient::getInstance()->getParticipantList(participants);
for (std::set<LLUUID>::const_iterator iter = participants.begin();
iter != participants.end(); ++iter)
for (const auto& speaker_uuid : participants)
{
speakers_uuids.push_back(*iter);
speakers_uuids.emplace_back(speaker_uuid);
}
}

View File

@ -100,10 +100,7 @@ LLConversationViewSession::~LLConversationViewSession()
if (mVoiceClientObserver)
{
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver);
}
LLVoiceClient::removeObserver(mVoiceClientObserver);
delete mVoiceClientObserver;
}
@ -261,16 +258,15 @@ bool LLConversationViewSession::postBuild()
icon->setVisible(true);
mSpeakingIndicator->setSpeakerId(gAgentID, LLUUID::null, true);
mIsInActiveVoiceChannel = true;
if(LLVoiceClient::instanceExists())
if (mVoiceClientObserver)
{
if (mVoiceClientObserver)
{
LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver);
delete mVoiceClientObserver;
}
mVoiceClientObserver = new LLNearbyVoiceClientStatusObserver(this);
LLVoiceClient::getInstance()->addObserver(mVoiceClientObserver);
LLVoiceClient::removeObserver(mVoiceClientObserver);
delete mVoiceClientObserver;
}
mVoiceClientObserver = new LLNearbyVoiceClientStatusObserver(this);
LLVoiceClient::addObserver(mVoiceClientObserver);
break;
}
default:

View File

@ -775,7 +775,7 @@ bool LLVolumeImplFlexible::doUpdateGeometry(LLDrawable *drawable)
}
}
if (volume->mDrawable.isNull())
if (volume->mDrawable.isNull() || volume->mDrawable->isDead())
{
return true; // No update to complete
}

View File

@ -345,10 +345,8 @@ void LLFloaterIMSession::sendMsg(const std::string& msg)
LLFloaterIMSession::~LLFloaterIMSession()
{
mVoiceChannelStateChangeConnection.disconnect();
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this);
@ -424,7 +422,7 @@ bool LLFloaterIMSession::postBuild()
childSetAction("voice_call_btn", boost::bind(&LLFloaterIMSession::onCallButtonClicked, this));
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
//*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla"
//see LLFloaterIMPanel for how it is done (IB)
@ -595,6 +593,7 @@ void LLFloaterIMSession::boundVoiceChannel()
LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID);
if(voice_channel)
{
mVoiceChannelStateChangeConnection.disconnect();
mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback(
boost::bind(&LLFloaterIMSession::onVoiceChannelStateChanged, this, _1, _2));

View File

@ -548,6 +548,12 @@ void LLFloaterIMSessionTab::closeFloater(bool app_quitting)
super::closeFloater(app_quitting);
}
void LLFloaterIMSessionTab::deleteAllChildren()
{
super::deleteAllChildren();
mVoiceButton = NULL;
}
std::string LLFloaterIMSessionTab::appendTime()
{
std::string timeStr = "[" + LLTrans::getString("TimeHour") + "]:"

View File

@ -84,6 +84,7 @@ public:
/*virtual*/ void setVisible(bool visible);
/*virtual*/ void setFocus(bool focus);
/*virtual*/ void closeFloater(bool app_quitting = false);
/*virtual*/ void deleteAllChildren();
// Handle the left hand participant list widgets
void addConversationViewParticipant(LLConversationItem* item, bool update_view = true);

View File

@ -4422,6 +4422,11 @@ bool LLIMMgr::startCall(const LLUUID& session_id, LLVoiceChannel::EDirection dir
{
voice_channel->setChannelInfo(voice_channel_info);
}
else if (voice_channel->getState() < LLVoiceChannel::STATE_READY)
{
// restart if there wa an error or it was hang up
voice_channel->resetChannelInfo();
}
voice_channel->setCallDirection(direction);
voice_channel->activate();
return true;

View File

@ -105,10 +105,7 @@ LLPanelGroup::LLPanelGroup()
LLPanelGroup::~LLPanelGroup()
{
LLGroupMgr::getInstance()->removeObserver(this);
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
}
void LLPanelGroup::onOpen(const LLSD& key)
@ -264,7 +261,7 @@ bool LLPanelGroup::postBuild()
mJoinText = panel_general->getChild<LLUICtrl>("join_cost_text");
}
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
// <FS:Ansariel> TabContainer switch
mIsUsingTabContainer = (findChild<LLTabContainer>("groups_accordion") != NULL);

View File

@ -358,7 +358,7 @@ public:
LLAvatarTracker::instance().addObserver(this);
// For notification when SIP online status changes.
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
// <FS:Ansariel> Disconnect LLFriendCardsManager
if (gSavedSettings.getBOOL("FSCreateCallingCards"))
mInvObserver = new LLInventoryFriendCardObserver(this);
@ -368,10 +368,7 @@ public:
{
// will be deleted by ~LLInventoryModel
//delete mInvObserver;
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
LLAvatarTracker::instance().removeObserver(this);
}
@ -630,10 +627,7 @@ LLPanelPeople::~LLPanelPeople()
mGroupsFilterCommitConnection.disconnect();
mRecentFilterCommitConnection.disconnect();
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::getInstance()->removeObserver(this);
// [FS:CR] Contact sets
if (mContactSetChangedConnection.connected())
@ -830,7 +824,7 @@ bool LLPanelPeople::postBuild()
// Must go after setting commit callback and initializing all pointers to children.
mTabContainer->selectTabByName(NEARBY_TAB_NAME);
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
// call this method in case some list is empty and buttons can be in inconsistent state
updateButtons();

View File

@ -729,10 +729,7 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife()
LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), &mPropertiesObserver);
}
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this);
}
LLVoiceClient::removeObserver((LLVoiceClientStatusObserver*)this);
if (mAvatarNameCacheConnection.connected())
{

View File

@ -182,7 +182,7 @@ void SpeakingIndicatorManager::unregisterSpeakingIndicator(const LLUUID& speaker
SpeakingIndicatorManager::SpeakingIndicatorManager()
{
LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&SpeakingIndicatorManager::sOnCurrentChannelChanged, this, _1));
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
}
SpeakingIndicatorManager::~SpeakingIndicatorManager()
@ -193,10 +193,7 @@ void SpeakingIndicatorManager::cleanupSingleton()
{
// Don't use LLVoiceClient::getInstance() here without a check,
// singleton MAY have already been destroyed.
if (LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
}
void SpeakingIndicatorManager::sOnCurrentChannelChanged(const LLUUID& /*session_id*/)

View File

@ -1794,9 +1794,7 @@ LLPluginClassMedia* LLViewerMediaImpl::newSourceFromMediaType(std::string media_
bool javascript_enabled = gSavedSettings.getBOOL("BrowserJavascriptEnabled");
media_source->setJavascriptEnabled(javascript_enabled || clean_browser);
// collect 'web security disabled' (see Chrome --web-security-disabled) setting from prefs and send to embedded browser
bool web_security_disabled = gSavedSettings.getBOOL("BrowserWebSecurityDisabled");
media_source->setWebSecurityDisabled(web_security_disabled || clean_browser);
media_source->setWebSecurityDisabled(clean_browser);
// collect setting indicates if local file access from file URLs is allowed from prefs and send to embedded browser
bool file_access_from_file_urls = gSavedSettings.getBOOL("BrowserFileAccessFromFileUrls");

View File

@ -871,7 +871,7 @@ S32 LLViewerTexture::getTotalNumFaces() const
S32 LLViewerTexture::getNumFaces(U32 ch) const
{
llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
return mNumFaces[ch];
return ch < LLRender::NUM_TEXTURE_CHANNELS ? mNumFaces[ch] : 0;
}

View File

@ -81,10 +81,7 @@ LLVoiceChannel::~LLVoiceChannel()
{
sCurrentVoiceChannel = NULL;
// Must check instance exists here, the singleton MAY have already been destroyed.
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->removeObserver(this);
}
LLVoiceClient::removeObserver(this);
}
sVoiceChannelMap.erase(mSessionID);
@ -118,6 +115,12 @@ void LLVoiceChannel::setChannelInfo(const LLSD &channelInfo)
}
}
void LLVoiceChannel::resetChannelInfo()
{
mChannelInfo = LLSD();
mState = STATE_NO_CHANNEL_INFO;
}
void LLVoiceChannel::onChange(EStatusType type, const LLSD& channelInfo, bool proximal)
{
LL_DEBUGS("Voice") << "Incoming channel info: " << channelInfo << LL_ENDL;
@ -219,7 +222,7 @@ void LLVoiceChannel::deactivate()
LLVoiceClient::getInstance()->setUserPTTState(false);
}
}
LLVoiceClient::getInstance()->removeObserver(this);
LLVoiceClient::removeObserver(this);
if (sCurrentVoiceChannel == this)
{
@ -259,7 +262,7 @@ void LLVoiceChannel::activate()
setState(STATE_CALL_STARTED);
}
LLVoiceClient::getInstance()->addObserver(this);
LLVoiceClient::addObserver(this);
//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
sCurrentVoiceChannelChangedSignal(this->mSessionID);
@ -751,7 +754,7 @@ void LLVoiceChannelProximal::deactivate()
{
setState(STATE_HUNG_UP);
}
LLVoiceClient::getInstance()->removeObserver(this);
LLVoiceClient::removeObserver(this);
LLVoiceClient::getInstance()->activateSpatialChannel(false);
}
@ -918,6 +921,12 @@ void LLVoiceChannelP2P::setChannelInfo(const LLSD& channel_info)
}
}
void LLVoiceChannelP2P::resetChannelInfo()
{
mChannelInfo = LLVoiceClient::getInstance()->getP2PChannelInfoTemplate(mOtherUserID);
mState = STATE_NO_CHANNEL_INFO; // we have template, not full info
}
void LLVoiceChannelP2P::setState(EState state)
{
LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;

View File

@ -72,7 +72,8 @@ public:
virtual void handleError(EStatusType status);
virtual void deactivate();
virtual void activate();
virtual void setChannelInfo(const LLSD &channelInfo);
virtual void setChannelInfo(const LLSD& channelInfo);
virtual void resetChannelInfo();
virtual void requestChannelInfo();
virtual bool isActive() const;
virtual bool callStarted() const;
@ -189,6 +190,7 @@ class LLVoiceChannelP2P : public LLVoiceChannelGroup
void requestChannelInfo() override;
void deactivate() override;
void setChannelInfo(const LLSD& channel_info) override;
void resetChannelInfo() override;
protected:
void setState(EState state) override;

View File

@ -859,8 +859,14 @@ void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
}
void LLVoiceClient::addObserver(LLFriendObserver* observer)
@ -871,8 +877,14 @@ void LLVoiceClient::addObserver(LLFriendObserver* observer)
void LLVoiceClient::removeObserver(LLFriendObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
}
void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
@ -883,8 +895,14 @@ void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
if (LLVivoxVoiceClient::instanceExists())
{
LLVivoxVoiceClient::getInstance()->removeObserver(observer);
}
if (LLWebRTCVoiceClient::instanceExists())
{
LLWebRTCVoiceClient::getInstance()->removeObserver(observer);
}
}
std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const

View File

@ -513,12 +513,12 @@ public:
void onRegionChanged();
void addObserver(LLVoiceClientStatusObserver* observer);
void removeObserver(LLVoiceClientStatusObserver* observer);
void addObserver(LLFriendObserver* observer);
void removeObserver(LLFriendObserver* observer);
void addObserver(LLVoiceClientParticipantObserver* observer);
void removeObserver(LLVoiceClientParticipantObserver* observer);
static void addObserver(LLVoiceClientStatusObserver* observer);
static void removeObserver(LLVoiceClientStatusObserver* observer);
static void addObserver(LLFriendObserver* observer);
static void removeObserver(LLFriendObserver* observer);
static void addObserver(LLVoiceClientParticipantObserver* observer);
static void removeObserver(LLVoiceClientParticipantObserver* observer);
std::string sipURIFromID(const LLUUID &id) const;
LLSD getP2PChannelInfoTemplate(const LLUUID& id) const;

View File

@ -235,12 +235,27 @@ LLWebRTCVoiceClient::LLWebRTCVoiceClient() :
//---------------------------------------------------
LLWebRTCVoiceClient::~LLWebRTCVoiceClient()
{
}
void LLWebRTCVoiceClient::cleanupSingleton()
{
if (mAvatarNameCacheConnection.connected())
{
mAvatarNameCacheConnection.disconnect();
}
sShuttingDown = true;
if (mSession)
{
mSession->shutdownAllConnections();
}
if (mNextSession)
{
mNextSession->shutdownAllConnections();
}
cleanUp();
sessionState::clearSessions();
}
//---------------------------------------------------
@ -654,6 +669,10 @@ void LLWebRTCVoiceClient::OnDevicesChanged(const llwebrtc::LLWebRTCVoiceDeviceLi
void LLWebRTCVoiceClient::OnDevicesChangedImpl(const llwebrtc::LLWebRTCVoiceDeviceList &render_devices,
const llwebrtc::LLWebRTCVoiceDeviceList &capture_devices)
{
if (sShuttingDown)
{
return;
}
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
@ -1705,7 +1724,7 @@ void LLWebRTCVoiceClient::predSetUserMute(const LLWebRTCVoiceClient::sessionStat
//------------------------------------------------------------------------
// Sessions
std::map<std::string, LLWebRTCVoiceClient::sessionState::ptr_t> LLWebRTCVoiceClient::sessionState::mSessions;
std::map<std::string, LLWebRTCVoiceClient::sessionState::ptr_t> LLWebRTCVoiceClient::sessionState::sSessions;
LLWebRTCVoiceClient::sessionState::sessionState() :
@ -1792,13 +1811,19 @@ void LLWebRTCVoiceClient::sessionState::addSession(
const std::string & channelID,
LLWebRTCVoiceClient::sessionState::ptr_t& session)
{
mSessions[channelID] = session;
sSessions[channelID] = session;
}
LLWebRTCVoiceClient::sessionState::~sessionState()
{
LL_DEBUGS("Voice") << "Destroying session CHANNEL=" << mChannelID << LL_ENDL;
if (!mShuttingDown)
{
shutdownAllConnections();
}
mWebRTCConnections.clear();
removeAllParticipants();
}
@ -1808,8 +1833,8 @@ LLWebRTCVoiceClient::sessionState::ptr_t LLWebRTCVoiceClient::sessionState::matc
sessionStatePtr_t result;
// *TODO: My kingdom for a lambda!
std::map<std::string, ptr_t>::iterator it = mSessions.find(channel_id);
if (it != mSessions.end())
std::map<std::string, ptr_t>::iterator it = sSessions.find(channel_id);
if (it != sSessions.end())
{
result = (*it).second;
}
@ -1818,17 +1843,17 @@ LLWebRTCVoiceClient::sessionState::ptr_t LLWebRTCVoiceClient::sessionState::matc
void LLWebRTCVoiceClient::sessionState::for_each(sessionFunc_t func)
{
std::for_each(mSessions.begin(), mSessions.end(), boost::bind(for_eachPredicate, _1, func));
std::for_each(sSessions.begin(), sSessions.end(), boost::bind(for_eachPredicate, _1, func));
}
void LLWebRTCVoiceClient::sessionState::reapEmptySessions()
{
std::map<std::string, ptr_t>::iterator iter;
for (iter = mSessions.begin(); iter != mSessions.end();)
for (iter = sSessions.begin(); iter != sSessions.end();)
{
if (iter->second->isEmpty())
{
iter = mSessions.erase(iter);
iter = sSessions.erase(iter);
}
else
{
@ -1874,6 +1899,11 @@ LLWebRTCVoiceClient::sessionStatePtr_t LLWebRTCVoiceClient::addSession(const std
}
}
void LLWebRTCVoiceClient::sessionState::clearSessions()
{
sSessions.clear();
}
LLWebRTCVoiceClient::sessionStatePtr_t LLWebRTCVoiceClient::findP2PSession(const LLUUID &agent_id)
{
sessionStatePtr_t result = sessionState::matchSessionByChannelID(agent_id.asString());
@ -1913,14 +1943,14 @@ void LLWebRTCVoiceClient::sessionState::processSessionStates()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE
auto iter = mSessions.begin();
while (iter != mSessions.end())
auto iter = sSessions.begin();
while (iter != sSessions.end())
{
if (!iter->second->processConnectionStates() && iter->second->mShuttingDown)
{
// if the connections associated with a session are gone,
// and this session is shutting down, remove it.
iter = mSessions.erase(iter);
iter = sSessions.erase(iter);
}
else
{
@ -2121,8 +2151,10 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID &regionID, const s
mOutstandingRequests(0),
mChannelID(channelID),
mRegionID(regionID),
mPrimary(true),
mRetryWaitPeriod(0)
{
// retries wait a short period...randomize it so
// all clients don't try to reconnect at once.
mRetryWaitSecs = ((F32) rand() / (RAND_MAX)) + 0.5;
@ -2368,6 +2400,12 @@ void LLVoiceWebRTCConnection::OnPeerConnectionClosed()
setVoiceConnectionState(VOICE_STATE_CLOSED);
mOutstandingRequests--;
}
else if (LLWebRTCVoiceClient::isShuttingDown())
{
// disconnect was initialized by llwebrtc::terminate() instead of connectionStateMachine
LL_INFOS("Voice") << "Peer connection has closed, but state is " << mVoiceConnectionState << LL_ENDL;
setVoiceConnectionState(VOICE_STATE_CLOSED);
}
});
}
@ -2476,7 +2514,11 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio
LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts);
connection->mOutstandingRequests--;
connection->setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
if (connection->getVoiceConnectionState() == VOICE_STATE_WAIT_FOR_EXIT)
{
connection->setVoiceConnectionState(VOICE_STATE_SESSION_EXIT);
}
}
// Tell the simulator to tell the Secondlife WebRTC server that we want a voice
@ -2710,6 +2752,17 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
{
mRetryWaitPeriod = 0;
mRetryWaitSecs = ((F32) rand() / (RAND_MAX)) + 0.5;
LLUUID agentRegionID;
if (isSpatial() && gAgent.getRegion())
{
bool primary = (mRegionID == gAgent.getRegion()->getRegionID());
if (primary != mPrimary)
{
mPrimary = primary;
sendJoin();
}
}
// we'll stay here as long as the session remains up.
if (mShutDown)
@ -2738,9 +2791,18 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
break;
case VOICE_STATE_DISCONNECT:
setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT);
LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnectionCoro",
boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this->shared_from_this()));
if (!LLWebRTCVoiceClient::isShuttingDown())
{
setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT);
LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnectionCoro",
boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this->shared_from_this()));
}
else
{
// llwebrtc::terminate() is already shuting down the connection.
setVoiceConnectionState(VOICE_STATE_WAIT_FOR_CLOSE);
mOutstandingRequests++;
}
break;
case VOICE_STATE_WAIT_FOR_EXIT:
@ -2750,7 +2812,11 @@ bool LLVoiceWebRTCConnection::connectionStateMachine()
{
setVoiceConnectionState(VOICE_STATE_WAIT_FOR_CLOSE);
mOutstandingRequests++;
mWebRTCPeerConnectionInterface->shutdownConnection();
if (!LLWebRTCVoiceClient::isShuttingDown())
{
mWebRTCPeerConnectionInterface->shutdownConnection();
}
// else was already posted by llwebrtc::terminate().
break;
case VOICE_STATE_WAIT_FOR_CLOSE:
break;
@ -2980,7 +3046,7 @@ void LLVoiceWebRTCConnection::sendJoin()
boost::json::object root;
boost::json::object join_obj;
LLUUID regionID = gAgent.getRegion()->getRegionID();
if ((regionID == mRegionID) || !isSpatial())
if (mPrimary)
{
join_obj["p"] = true;
}
@ -2998,6 +3064,10 @@ LLVoiceWebRTCSpatialConnection::LLVoiceWebRTCSpatialConnection(const LLUUID &reg
LLVoiceWebRTCConnection(regionID, channelID),
mParcelLocalID(parcelLocalID)
{
if (gAgent.getRegion())
{
mPrimary = (regionID == gAgent.getRegion()->getRegionID());
}
}
LLVoiceWebRTCSpatialConnection::~LLVoiceWebRTCSpatialConnection()

View File

@ -70,6 +70,7 @@ class LLWebRTCVoiceClient : public LLSingleton<LLWebRTCVoiceClient>,
virtual ~LLWebRTCVoiceClient();
public:
void cleanupSingleton() override;
/// @name LLVoiceModuleInterface virtual implementations
/// @see LLVoiceModuleInterface
//@{
@ -300,6 +301,7 @@ public:
static void for_each(sessionFunc_t func);
static void reapEmptySessions();
static void clearSessions();
bool isEmpty() { return mWebRTCConnections.empty(); }
@ -319,7 +321,7 @@ public:
participantUUIDMap mParticipantsByUUID;
static bool hasSession(const std::string &sessionID)
{ return mSessions.find(sessionID) != mSessions.end(); }
{ return sSessions.find(sessionID) != sSessions.end(); }
bool mHangupOnLastLeave; // notify observers after the session becomes empty.
bool mNotifyOnFirstJoin; // notify observers when the first peer joins.
@ -330,7 +332,7 @@ public:
private:
static std::map<std::string, ptr_t> mSessions; // canonical list of outstanding sessions.
static std::map<std::string, ptr_t> sSessions; // canonical list of outstanding sessions.
static void for_eachPredicate(const std::pair<std::string,
LLWebRTCVoiceClient::sessionState::wptr_t> &a,
@ -620,7 +622,7 @@ class LLVoiceWebRTCConnection :
bool connectionStateMachine();
virtual bool isSpatial() = 0;
virtual bool isSpatial() { return false; }
LLUUID getRegionID() { return mRegionID; }
@ -684,6 +686,7 @@ class LLVoiceWebRTCConnection :
LLVoiceClientStatusObserver::EStatusType mCurrentStatus;
LLUUID mRegionID;
bool mPrimary;
LLUUID mViewerSession;
std::string mChannelID;