From c8f0cdd1a9cc28d684022a24496aa243d4be47f4 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 12 Aug 2024 18:07:44 +0200 Subject: #2257 BugSplat Crash #1503682: SecondLifeViewer!LLFloaterIMSessionTab::enableDisableCallBtn(438) --- indra/newview/llfloaterimsessiontab.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 0ed84c381f..049f4aec92 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -433,7 +433,7 @@ void LLFloaterIMSessionTab::draw() void LLFloaterIMSessionTab::enableDisableCallBtn() { - if (LLVoiceClient::instanceExists() && mVoiceButton) + if (!LLApp::isExiting() && LLVoiceClient::instanceExists() && mVoiceButton) { mVoiceButton->setEnabled( mSessionID.notNull() -- cgit v1.2.3 From 06846d78b50b8acd773b4c5bda0b4ed88f212a9c Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 12 Aug 2024 21:26:35 +0200 Subject: #2263 BugSplat Crash #1503400: SecondLifeViewer!LLDrawable::getFace(320) --- indra/newview/llflexibleobject.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llflexibleobject.cpp b/indra/newview/llflexibleobject.cpp index 7ed62d68bd..009b9e2829 100644 --- a/indra/newview/llflexibleobject.cpp +++ b/indra/newview/llflexibleobject.cpp @@ -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 } -- cgit v1.2.3 From 2e2f10f7dd1756251bb311cbc2ea872020d864c6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Mon, 12 Aug 2024 18:56:37 +0300 Subject: Remove unused setting BrowserWebSecurityDisabled --- indra/newview/llviewermedia.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 66182684ad..49a4e27194 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1753,9 +1753,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"); -- cgit v1.2.3 From e086437f12db31cb2dcc2e8fdf12794cc802cc0d Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 Aug 2024 08:55:23 +0300 Subject: viewer-private#262 webrtc crashes on shutdown removeObserver failed to remove an im session floater --- indra/newview/llconversationview.cpp | 20 ++++++++----------- indra/newview/llfloaterimsession.cpp | 9 ++++----- indra/newview/llfloaterimsessiontab.cpp | 8 +++++++- indra/newview/llfloaterimsessiontab.h | 1 + indra/newview/llpanelgroup.cpp | 7 ++----- indra/newview/llpanelpeople.cpp | 14 ++++--------- indra/newview/llpanelprofile.cpp | 5 +---- indra/newview/llspeakingindicatormanager.cpp | 7 ++----- indra/newview/llvoicechannel.cpp | 11 ++++------ indra/newview/llvoiceclient.cpp | 30 ++++++++++++++++++++++------ indra/newview/llvoiceclient.h | 12 +++++------ 11 files changed, 63 insertions(+), 61 deletions(-) (limited to 'indra') diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp index 117dab8d58..03eb9f0652 100644 --- a/indra/newview/llconversationview.cpp +++ b/indra/newview/llconversationview.cpp @@ -98,10 +98,7 @@ LLConversationViewSession::~LLConversationViewSession() if (mVoiceClientObserver) { - if (LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver(mVoiceClientObserver); - } + LLVoiceClient::removeObserver(mVoiceClientObserver); delete mVoiceClientObserver; } @@ -259,16 +256,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: diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index b782515c14..f954e72376 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -287,10 +287,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); @@ -366,7 +364,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) @@ -537,6 +535,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)); diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 049f4aec92..081288fae5 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -433,7 +433,7 @@ void LLFloaterIMSessionTab::draw() void LLFloaterIMSessionTab::enableDisableCallBtn() { - if (!LLApp::isExiting() && LLVoiceClient::instanceExists() && mVoiceButton) + if (LLVoiceClient::instanceExists() && mVoiceButton) { mVoiceButton->setEnabled( mSessionID.notNull() @@ -546,6 +546,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") + "]:" diff --git a/indra/newview/llfloaterimsessiontab.h b/indra/newview/llfloaterimsessiontab.h index 00b43f499b..006b92e54b 100644 --- a/indra/newview/llfloaterimsessiontab.h +++ b/indra/newview/llfloaterimsessiontab.h @@ -82,6 +82,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); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 372f1a9d20..1ab8265d83 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -98,10 +98,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) @@ -194,7 +191,7 @@ BOOL LLPanelGroup::postBuild() mJoinText = panel_general->getChild("join_cost_text"); } - LLVoiceClient::getInstance()->addObserver(this); + LLVoiceClient::addObserver(this); return TRUE; } diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 24f3ad88cc..9b0a52d3e9 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -338,7 +338,7 @@ public: LLAvatarTracker::instance().addObserver(this); // For notification when SIP online status changes. - LLVoiceClient::getInstance()->addObserver(this); + LLVoiceClient::addObserver(this); mInvObserver = new LLInventoryFriendCardObserver(this); } @@ -346,10 +346,7 @@ public: { // will be deleted by ~LLInventoryModel //delete mInvObserver; - if (LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver(this); - } + LLVoiceClient::removeObserver(this); LLAvatarTracker::instance().removeObserver(this); } @@ -577,10 +574,7 @@ LLPanelPeople::~LLPanelPeople() delete mFriendListUpdater; delete mRecentListUpdater; - if(LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver(this); - } + LLVoiceClient::removeObserver(this); } void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list) @@ -721,7 +715,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(); diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 151e137b1d..a1d4c7c658 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -702,10 +702,7 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife() LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); } - if (LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver((LLVoiceClientStatusObserver*)this); - } + LLVoiceClient::removeObserver((LLVoiceClientStatusObserver*)this); if (mAvatarNameCacheConnection.connected()) { diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp index f16ab3b25a..34bed8a269 100644 --- a/indra/newview/llspeakingindicatormanager.cpp +++ b/indra/newview/llspeakingindicatormanager.cpp @@ -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*/) diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index 9b144048f7..8cda7c76da 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -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); @@ -219,7 +216,7 @@ void LLVoiceChannel::deactivate() LLVoiceClient::getInstance()->setUserPTTState(false); } } - LLVoiceClient::getInstance()->removeObserver(this); + LLVoiceClient::removeObserver(this); if (sCurrentVoiceChannel == this) { @@ -259,7 +256,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 +748,7 @@ void LLVoiceChannelProximal::deactivate() { setState(STATE_HUNG_UP); } - LLVoiceClient::getInstance()->removeObserver(this); + LLVoiceClient::removeObserver(this); LLVoiceClient::getInstance()->activateSpatialChannel(false); } diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 5132b9bb07..d1b482dce7 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -796,8 +796,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) @@ -808,8 +814,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) @@ -820,8 +832,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 diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index fdc00a98e8..19dd34f5e0 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -482,12 +482,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; -- cgit v1.2.3 From bf3e2e2b172dffbe745092a062f48bb6bc8b269f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 Aug 2024 11:22:03 +0300 Subject: viewer-private#262 webrtc crashes on shutdown #2 --- indra/newview/llvoicewebrtc.cpp | 50 ++++++++++++++++++++++++++++++++--------- indra/newview/llvoicewebrtc.h | 6 +++-- 2 files changed, 44 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index ff3c0eccd2..1ee1e69b79 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -237,12 +237,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(); } //--------------------------------------------------- @@ -656,6 +671,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"); @@ -1704,7 +1723,7 @@ void LLWebRTCVoiceClient::predSetUserMute(const LLWebRTCVoiceClient::sessionStat //------------------------------------------------------------------------ // Sessions -std::map LLWebRTCVoiceClient::sessionState::mSessions; +std::map LLWebRTCVoiceClient::sessionState::sSessions; LLWebRTCVoiceClient::sessionState::sessionState() : @@ -1791,13 +1810,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(); } @@ -1807,8 +1832,8 @@ LLWebRTCVoiceClient::sessionState::ptr_t LLWebRTCVoiceClient::sessionState::matc sessionStatePtr_t result; // *TODO: My kingdom for a lambda! - std::map::iterator it = mSessions.find(channel_id); - if (it != mSessions.end()) + std::map::iterator it = sSessions.find(channel_id); + if (it != sSessions.end()) { result = (*it).second; } @@ -1817,17 +1842,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::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 { @@ -1873,6 +1898,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()); @@ -1912,14 +1942,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 { diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index f699bd6df9..48c50a1ea3 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -70,6 +70,7 @@ class LLWebRTCVoiceClient : public LLSingleton, 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 mSessions; // canonical list of outstanding sessions. + static std::map sSessions; // canonical list of outstanding sessions. static void for_eachPredicate(const std::pair &a, -- cgit v1.2.3 From ab86e77818e76bdf3ef660b9fa964217265be3e7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 13 Aug 2024 19:31:48 +0300 Subject: viewer-private#260 The 'Speak' button looks disabled during IM voice chat p2p channels was reusing obsolete channel info --- indra/newview/llimview.cpp | 5 +++++ indra/newview/llvoicechannel.cpp | 12 ++++++++++++ indra/newview/llvoicechannel.h | 4 +++- 3 files changed, 20 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d3f013c67c..17b5af74d2 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -3857,6 +3857,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; diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index 8cda7c76da..7f578171af 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -115,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; @@ -915,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; diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h index 46a3f552cb..95fd247ca6 100644 --- a/indra/newview/llvoicechannel.h +++ b/indra/newview/llvoicechannel.h @@ -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; -- cgit v1.2.3 From b36dacce33b074cd758f0e6f314924bcc50f817f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 14 Aug 2024 18:14:20 +0300 Subject: viewer#2204 crash at connectionStateMachine --- indra/newview/llvoicewebrtc.cpp | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 1ee1e69b79..06baea4ba2 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2397,6 +2397,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); + } }); } @@ -2511,7 +2517,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 @@ -2773,9 +2783,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: @@ -2785,7 +2804,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; -- cgit v1.2.3 From 8897ebeb6a0f1d96c7150385a01cb03cd0c43f50 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 14 Aug 2024 14:38:37 -0700 Subject: Voice dot not always visible after crossing region boundaries. For issue #2064 The connection to the voice server was not upgraded/downgraded to primary/secondary when crossing region boundaries, so the server sent the wrong value and the viewer chose not to display a voice dot. --- indra/newview/llvoicewebrtc.cpp | 26 +++++++++++++++++++++++++- indra/newview/llvoicewebrtc.h | 3 ++- 2 files changed, 27 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 06baea4ba2..84d1e767f8 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2150,8 +2150,21 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID ®ionID, const s mOutstandingRequests(0), mChannelID(channelID), mRegionID(regionID), + mPrimary(false), mRetryWaitPeriod(0) { + if (isSpatial()) + { + if (gAgent.getRegion()) + { + mPrimary = (regionID == gAgent.getRegion()->getRegionID()); + } + } + else + { + mPrimary = true; + } + // retries wait a short period...randomize it so // all clients don't try to reconnect at once. mRetryWaitSecs = ((F32) rand() / (RAND_MAX)) + 0.5; @@ -2755,6 +2768,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) @@ -3023,7 +3047,7 @@ void LLVoiceWebRTCConnection::sendJoin() Json::Value root = Json::objectValue; Json::Value join_obj = Json::objectValue; LLUUID regionID = gAgent.getRegion()->getRegionID(); - if ((regionID == mRegionID) || !isSpatial()) + if (mPrimary) { join_obj["p"] = true; } diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 48c50a1ea3..324b4c5b9c 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -622,7 +622,7 @@ class LLVoiceWebRTCConnection : bool connectionStateMachine(); - virtual bool isSpatial() = 0; + virtual bool isSpatial() { return false; } LLUUID getRegionID() { return mRegionID; } @@ -686,6 +686,7 @@ class LLVoiceWebRTCConnection : LLVoiceClientStatusObserver::EStatusType mCurrentStatus; LLUUID mRegionID; + bool mPrimary; LLUUID mViewerSession; std::string mChannelID; -- cgit v1.2.3 From 661b6d12a0b4c249ca698f03e17a6ceeabde09c4 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 14 Aug 2024 15:22:15 -0700 Subject: Don't call virtual functions in a derived class constructor --- indra/newview/llvoicewebrtc.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 84d1e767f8..919b541efe 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2150,20 +2150,9 @@ LLVoiceWebRTCConnection::LLVoiceWebRTCConnection(const LLUUID ®ionID, const s mOutstandingRequests(0), mChannelID(channelID), mRegionID(regionID), - mPrimary(false), + mPrimary(true), mRetryWaitPeriod(0) { - if (isSpatial()) - { - if (gAgent.getRegion()) - { - mPrimary = (regionID == gAgent.getRegion()->getRegionID()); - } - } - else - { - mPrimary = true; - } // retries wait a short period...randomize it so // all clients don't try to reconnect at once. @@ -3065,6 +3054,10 @@ LLVoiceWebRTCSpatialConnection::LLVoiceWebRTCSpatialConnection(const LLUUID ® LLVoiceWebRTCConnection(regionID, channelID), mParcelLocalID(parcelLocalID) { + if (gAgent.getRegion()) + { + mPrimary = (regionID == gAgent.getRegion()->getRegionID()); + } } LLVoiceWebRTCSpatialConnection::~LLVoiceWebRTCSpatialConnection() -- cgit v1.2.3 From 3ca4bb6bf7ba1367e06705da3968174ff9448d7d Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 15 Aug 2024 15:56:53 +0200 Subject: #2307 BugSplat Crash #1504734: LLViewerTexture::getNumFaces() --- indra/newview/llviewertexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 9aee1c0caf..03dca1e5f3 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -834,7 +834,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; } -- cgit v1.2.3 From 10ef293bc93230437d8aa3b17fcc1bfdc78f6ba8 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 15 Aug 2024 17:46:58 +0200 Subject: BugSplat Crash #1504587: std::vector::empty() --- indra/llcommon/lltracethreadrecorder.cpp | 45 ++++++++++++++++---------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'indra') diff --git a/indra/llcommon/lltracethreadrecorder.cpp b/indra/llcommon/lltracethreadrecorder.cpp index be3e585ef8..375cb050cc 100644 --- a/indra/llcommon/lltracethreadrecorder.cpp +++ b/indra/llcommon/lltracethreadrecorder.cpp @@ -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; -- cgit v1.2.3 From 1ff30757bc3ccc4b2ac26f04bdc2ca99f25d694d Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Fri, 16 Aug 2024 13:16:39 -0700 Subject: Log WebRTC devices on webrtc initialization. --- indra/newview/llvoicewebrtc.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 093b16eaad..387016f9af 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -269,6 +269,7 @@ void LLWebRTCVoiceClient::init(LLPumpIO* pump) mWebRTCDeviceInterface = llwebrtc::getDeviceInterface(); mWebRTCDeviceInterface->setDevicesObserver(this); mMainQueue = LL::WorkQueue::getInstance("mainloop"); + refreshDeviceLists(); } void LLWebRTCVoiceClient::terminate() @@ -637,7 +638,7 @@ void LLWebRTCVoiceClient::clearCaptureDevices() void LLWebRTCVoiceClient::addCaptureDevice(const LLVoiceDevice& device) { - LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL; + LL_INFOS("Voice") << "Voice Capture Device: '" << device.display_name << "' (" << device.full_name << ")" << LL_ENDL; mCaptureDevices.push_back(device); } @@ -706,7 +707,7 @@ void LLWebRTCVoiceClient::clearRenderDevices() void LLWebRTCVoiceClient::addRenderDevice(const LLVoiceDevice& device) { - LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL; + LL_INFOS("Voice") << "Voice Render Device: '" << device.display_name << "' (" << device.full_name << ")" << LL_ENDL; mRenderDevices.push_back(device); } -- cgit v1.2.3 From 2efad2182a5f6b8404afd9ea363b3a9088de3207 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 17 Aug 2024 00:21:27 -0700 Subject: Fixes to managing device start/stop playout/recording. Fixes prevent attempting to start playout/recording before the devices are set up, to prevent restarting playout/recording, to prevent attempts to stop when not playing/recording, and so on... This should address the case where audio device changes can cause an assert. It should also address the case where audio was unnecessarily played or transmitted when connecting. And, when voice is disabled, the audio devices are not set up to play/record so there should be no disruption of bluetooth music from other apps. --- indra/llwebrtc/llwebrtc.cpp | 58 +++++++++++++++++++++++++++++++++++------- indra/llwebrtc/llwebrtc_impl.h | 2 ++ 2 files changed, 51 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index 2c890acbdb..d154bfb8eb 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -251,8 +251,7 @@ void LLWebRTCImpl::init() apm_config.noise_suppression.level = webrtc::AudioProcessing::Config::NoiseSuppression::kVeryHigh; apm_config.transient_suppression.enabled = true; apm_config.pipeline.multi_channel_render = true; - apm_config.pipeline.multi_channel_capture = true; - apm_config.pipeline.multi_channel_capture = true; + apm_config.pipeline.multi_channel_capture = false; webrtc::ProcessingConfig processing_config; processing_config.input_stream().set_num_channels(2); @@ -279,7 +278,6 @@ void LLWebRTCImpl::init() nullptr /* audio_mixer */, mAudioProcessingModule); - mWorkerThread->BlockingCall([this]() { mPeerDeviceModule->StartPlayout(); }); } void LLWebRTCImpl::terminate() @@ -340,6 +338,22 @@ void LLWebRTCImpl::setRecording(bool recording) }); } +void LLWebRTCImpl::setPlayout(bool playing) +{ + mWorkerThread->PostTask( + [this, playing]() + { + if (playing) + { + mPeerDeviceModule->StartPlayout(); + } + else + { + mPeerDeviceModule->StopPlayout(); + } + }); +} + void LLWebRTCImpl::setAudioConfig(LLWebRTCDeviceInterface::AudioConfig config) { webrtc::AudioProcessing::Config apm_config; @@ -402,7 +416,6 @@ void LLWebRTCImpl::unsetDevicesObserver(LLWebRTCDevicesObserver *observer) void ll_set_device_module_capture_device(rtc::scoped_refptr device_module, int16_t device) { - device_module->StopRecording(); #if WEBRTC_WIN if (device < 0) { @@ -420,7 +433,6 @@ void ll_set_device_module_capture_device(rtc::scoped_refptrInitMicrophone(); device_module->InitRecording(); device_module->SetStereoRecording(false); - device_module->StartRecording(); } void LLWebRTCImpl::setCaptureDevice(const std::string &id) @@ -444,18 +456,32 @@ void LLWebRTCImpl::setCaptureDevice(const std::string &id) mRecordingDevice = recordingDevice; if (mTuningMode) { - mWorkerThread->PostTask([this, recordingDevice]() { ll_set_device_module_capture_device(mTuningDeviceModule, recordingDevice); }); + mWorkerThread->PostTask([this, recordingDevice]() + { + ll_set_device_module_capture_device(mTuningDeviceModule, recordingDevice); + }); } else { - mWorkerThread->PostTask([this, recordingDevice]() { ll_set_device_module_capture_device(mPeerDeviceModule, recordingDevice); }); + mWorkerThread->PostTask([this, recordingDevice]() + { + bool recording = mPeerDeviceModule->Recording(); + if (recording) + { + mPeerDeviceModule->StopRecording(); + } + ll_set_device_module_capture_device(mPeerDeviceModule, recordingDevice); + if (recording) + { + mPeerDeviceModule->StartRecording(); + } + }); } } void ll_set_device_module_render_device(rtc::scoped_refptr device_module, int16_t device) { - device_module->StopPlayout(); #if WEBRTC_WIN if (device < 0) { @@ -506,8 +532,16 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id) mWorkerThread->PostTask( [this, playoutDevice]() { + bool playing = mPeerDeviceModule->Playing(); + if (playing) + { + mPeerDeviceModule->StopPlayout(); + } ll_set_device_module_render_device(mPeerDeviceModule, playoutDevice); - mPeerDeviceModule->StartPlayout(); + if (playing) + { + mPeerDeviceModule->StartPlayout(); + } }); } } @@ -633,6 +667,11 @@ LLWebRTCPeerConnectionInterface *LLWebRTCImpl::newPeerConnection() rtc::scoped_refptr peerConnection = rtc::scoped_refptr(new rtc::RefCountedObject()); peerConnection->init(this); + if (mPeerConnections.empty()) + { + setRecording(true); + setPlayout(true); + } mPeerConnections.emplace_back(peerConnection); peerConnection->enableSenderTracks(!mMute); return peerConnection.get(); @@ -649,6 +688,7 @@ void LLWebRTCImpl::freePeerConnection(LLWebRTCPeerConnectionInterface* peer_conn if (mPeerConnections.empty()) { setRecording(false); + setPlayout(false); } } diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h index c5b32123eb..f8a7873af8 100644 --- a/indra/llwebrtc/llwebrtc_impl.h +++ b/indra/llwebrtc/llwebrtc_impl.h @@ -278,6 +278,8 @@ class LLWebRTCImpl : public LLWebRTCDeviceInterface, public webrtc::AudioDeviceS // enables/disables capture via the capture device void setRecording(bool recording); + void setPlayout(bool playing); + protected: LLWebRTCLogSink* mLogSink; -- cgit v1.2.3 From 63d17b395b8b4c4ca32a09d64754a99b13abedb1 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sat, 17 Aug 2024 20:11:46 -0700 Subject: Microphone was being prematurely enabled on login for a short period. The microphone issue was causing a short moment of sound, and was causing bluetooth headsets to switch to hands-free/one channel mode which is disruptive. Also, update webrtc to deal with issue where airpods were garbled after coming out of hands-free mode. --- indra/llwebrtc/llwebrtc.cpp | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'indra') diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index d154bfb8eb..dd7883f973 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -206,10 +206,10 @@ void LLWebRTCImpl::init() mTuningDeviceModule->SetAudioDeviceSink(this); mTuningDeviceModule->InitMicrophone(); mTuningDeviceModule->InitSpeaker(); + mTuningDeviceModule->SetStereoRecording(false); + mTuningDeviceModule->SetStereoPlayout(true); mTuningDeviceModule->InitRecording(); mTuningDeviceModule->InitPlayout(); - mTuningDeviceModule->SetStereoRecording(true); - mTuningDeviceModule->SetStereoPlayout(true); updateDevices(); }); @@ -227,10 +227,6 @@ void LLWebRTCImpl::init() mPeerDeviceModule->EnableBuiltInAEC(false); mPeerDeviceModule->InitMicrophone(); mPeerDeviceModule->InitSpeaker(); - mPeerDeviceModule->InitRecording(); - mPeerDeviceModule->InitPlayout(); - mPeerDeviceModule->SetStereoRecording(true); - mPeerDeviceModule->SetStereoPlayout(true); }); // The custom processor allows us to retrieve audio data (and levels) @@ -253,6 +249,8 @@ void LLWebRTCImpl::init() apm_config.pipeline.multi_channel_render = true; apm_config.pipeline.multi_channel_capture = false; + mAudioProcessingModule->ApplyConfig(apm_config); + webrtc::ProcessingConfig processing_config; processing_config.input_stream().set_num_channels(2); processing_config.input_stream().set_sample_rate_hz(48000); @@ -263,10 +261,8 @@ void LLWebRTCImpl::init() processing_config.reverse_output_stream().set_num_channels(2); processing_config.reverse_output_stream().set_sample_rate_hz(48000); - mAudioProcessingModule->ApplyConfig(apm_config); mAudioProcessingModule->Initialize(processing_config); - mPeerConnectionFactory = webrtc::CreatePeerConnectionFactory(mNetworkThread.get(), mWorkerThread.get(), mSignalingThread.get(), @@ -329,6 +325,8 @@ void LLWebRTCImpl::setRecording(bool recording) { if (recording) { + mPeerDeviceModule->SetStereoRecording(false); + mPeerDeviceModule->InitRecording(); mPeerDeviceModule->StartRecording(); } else @@ -345,6 +343,8 @@ void LLWebRTCImpl::setPlayout(bool playing) { if (playing) { + mPeerDeviceModule->SetStereoPlayout(true); + mPeerDeviceModule->InitPlayout(); mPeerDeviceModule->StartPlayout(); } else @@ -430,9 +430,9 @@ void ll_set_device_module_capture_device(rtc::scoped_refptrSetRecordingDevice(device + 1); #endif + device_module->SetStereoRecording(false); device_module->InitMicrophone(); device_module->InitRecording(); - device_module->SetStereoRecording(false); } void LLWebRTCImpl::setCaptureDevice(const std::string &id) @@ -494,9 +494,9 @@ void ll_set_device_module_render_device(rtc::scoped_refptrSetPlayoutDevice(device + 1); #endif + device_module->SetStereoPlayout(true); device_module->InitSpeaker(); device_module->InitPlayout(); - device_module->SetStereoPlayout(true); } void LLWebRTCImpl::setRenderDevice(const std::string &id) @@ -626,6 +626,8 @@ void LLWebRTCImpl::setTuningMode(bool enable) //mTuningDeviceModule->StopPlayout(); ll_set_device_module_render_device(mPeerDeviceModule, mPlayoutDevice); ll_set_device_module_capture_device(mPeerDeviceModule, mRecordingDevice); + mPeerDeviceModule->SetStereoPlayout(true); + mPeerDeviceModule->SetStereoRecording(false); mPeerDeviceModule->InitPlayout(); mPeerDeviceModule->InitRecording(); mPeerDeviceModule->StartPlayout(); @@ -667,13 +669,13 @@ LLWebRTCPeerConnectionInterface *LLWebRTCImpl::newPeerConnection() rtc::scoped_refptr peerConnection = rtc::scoped_refptr(new rtc::RefCountedObject()); peerConnection->init(this); + mPeerConnections.emplace_back(peerConnection); + peerConnection->enableSenderTracks(!mMute); if (mPeerConnections.empty()) { setRecording(true); setPlayout(true); } - mPeerConnections.emplace_back(peerConnection); - peerConnection->enableSenderTracks(!mMute); return peerConnection.get(); } @@ -702,7 +704,7 @@ void LLWebRTCImpl::freePeerConnection(LLWebRTCPeerConnectionInterface* peer_conn LLWebRTCPeerConnectionImpl::LLWebRTCPeerConnectionImpl() : mWebRTCImpl(nullptr), mPeerConnection(nullptr), - mMute(false), + mMute(true), mAnswerReceived(false) { } @@ -724,8 +726,8 @@ void LLWebRTCPeerConnectionImpl::init(LLWebRTCImpl * webrtc_impl) } void LLWebRTCPeerConnectionImpl::terminate() { - mWebRTCImpl->PostSignalingTask( - [=]() + mWebRTCImpl->SignalingBlockingCall( + [this]() { if (mPeerConnection) { @@ -847,7 +849,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti codecparam.clock_rate = 48000; codecparam.num_channels = 2; codecparam.parameters["stereo"] = "1"; - codecparam.parameters["sprop-stereo"] = "1"; + codecparam.parameters["sprop-stereo"] = "0"; params.codecs.push_back(codecparam); sender->SetParameters(params); } @@ -862,7 +864,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti codecparam.clock_rate = 48000; codecparam.num_channels = 2; codecparam.parameters["stereo"] = "1"; - codecparam.parameters["sprop-stereo"] = "1"; + codecparam.parameters["sprop-stereo"] = "0"; params.codecs.push_back(codecparam); receiver->SetParameters(params); } @@ -1009,7 +1011,7 @@ void LLWebRTCPeerConnectionImpl::OnAddTrack(rtc::scoped_refptrSetParameters(params); } @@ -1200,7 +1202,7 @@ void LLWebRTCPeerConnectionImpl::OnSuccess(webrtc::SessionDescriptionInterface * else if (sdp_line.find("a=fmtp:" + opus_payload) == 0) { sdp_mangled_stream << sdp_line << "a=fmtp:" << opus_payload - << " minptime=10;useinbandfec=1;stereo=1;sprop-stereo=1;maxplaybackrate=48000;sprop-maxplaybackrate=48000;sprop-maxcapturerate=48000\n"; + << " minptime=10;useinbandfec=1;stereo=1;sprop-stereo=0;maxplaybackrate=48000;sprop-maxplaybackrate=48000;sprop-maxcapturerate=48000\n"; } else { -- cgit v1.2.3 From 28fdd6e78658f9935eeb2b122265e05aecb548ed Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sun, 18 Aug 2024 00:30:16 -0700 Subject: Update webrtc to fix loss of stereo in bluetooth issue. When transitioning from mic-on hands-free mode to mic off, it's expected that the audio stream would return to stereo. Inproper logic in the mac device code in webrtc was preventing that. --- indra/llwebrtc/llwebrtc.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'indra') diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp index dd7883f973..0daa767766 100644 --- a/indra/llwebrtc/llwebrtc.cpp +++ b/indra/llwebrtc/llwebrtc.cpp @@ -849,7 +849,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti codecparam.clock_rate = 48000; codecparam.num_channels = 2; codecparam.parameters["stereo"] = "1"; - codecparam.parameters["sprop-stereo"] = "0"; + codecparam.parameters["sprop-stereo"] = "1"; params.codecs.push_back(codecparam); sender->SetParameters(params); } @@ -864,7 +864,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti codecparam.clock_rate = 48000; codecparam.num_channels = 2; codecparam.parameters["stereo"] = "1"; - codecparam.parameters["sprop-stereo"] = "0"; + codecparam.parameters["sprop-stereo"] = "1"; params.codecs.push_back(codecparam); receiver->SetParameters(params); } @@ -1011,7 +1011,7 @@ void LLWebRTCPeerConnectionImpl::OnAddTrack(rtc::scoped_refptrSetParameters(params); } @@ -1202,7 +1202,7 @@ void LLWebRTCPeerConnectionImpl::OnSuccess(webrtc::SessionDescriptionInterface * else if (sdp_line.find("a=fmtp:" + opus_payload) == 0) { sdp_mangled_stream << sdp_line << "a=fmtp:" << opus_payload - << " minptime=10;useinbandfec=1;stereo=1;sprop-stereo=0;maxplaybackrate=48000;sprop-maxplaybackrate=48000;sprop-maxcapturerate=48000\n"; + << " minptime=10;useinbandfec=1;stereo=1;sprop-stereo=1;maxplaybackrate=48000;sprop-maxplaybackrate=48000;sprop-maxcapturerate=48000\n"; } else { -- cgit v1.2.3 From 7cc3ff55b97b94a3b52daebfe072eb22192c710b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 16 Aug 2024 19:27:48 +0300 Subject: viewer#2296 Don't show 'are you sure you want to leave the call' when shutting down --- indra/llui/llfloater.cpp | 8 ++++++++ indra/llui/llfloater.h | 1 + indra/newview/llfloaterimcontainer.cpp | 6 +++--- indra/newview/llfloaterimcontainer.h | 2 +- indra/newview/llfloaterimsession.cpp | 8 +++++++- 5 files changed, 20 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index e6ecf3c283..f29f9286c9 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1926,6 +1926,14 @@ void LLFloater::onClickClose( LLFloater* self ) self->onClickCloseBtn(); } +// static +void LLFloater::onClickClose(LLFloater* self, bool app_quitting) +{ + if (!self) + return; + self->onClickCloseBtn(app_quitting); +} + void LLFloater::onClickCloseBtn(bool app_quitting) { closeFloater(false); diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 3d75c42f60..9be2240f6f 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -363,6 +363,7 @@ public: // } static void onClickClose(LLFloater* floater); + static void onClickClose(LLFloater* floater, bool app_quitting); static void onClickMinimize(LLFloater* floater); static void onClickTearOff(LLFloater* floater); static void onClickDock(LLFloater* floater); diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index 08e13276b3..cf66507a66 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -2432,7 +2432,7 @@ void LLFloaterIMContainer::closeHostedFloater() onClickCloseBtn(); } -void LLFloaterIMContainer::closeAllConversations() +void LLFloaterIMContainer::closeAllConversations(bool app_quitting) { std::vector ids; for (conversations_items_map::iterator it_session = mConversationsItems.begin(); it_session != mConversationsItems.end(); it_session++) @@ -2447,7 +2447,7 @@ void LLFloaterIMContainer::closeAllConversations() for (std::vector::const_iterator it = ids.begin(); it != ids.end(); ++it) { LLFloaterIMSession *conversationFloater = LLFloaterIMSession::findInstance(*it); - LLFloater::onClickClose(conversationFloater); + LLFloater::onClickClose(conversationFloater, app_quitting); } } @@ -2470,7 +2470,7 @@ void LLFloaterIMContainer::closeFloater(bool app_quitting/* = false*/) { if(app_quitting) { - closeAllConversations(); + closeAllConversations(app_quitting); onClickCloseBtn(app_quitting); } else diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index e11445d779..d1cfd3442c 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -117,7 +117,7 @@ public: void assignResizeLimits(); virtual bool handleKeyHere(KEY key, MASK mask ); /*virtual*/ void closeFloater(bool app_quitting = false); - void closeAllConversations(); + void closeAllConversations(bool app_quitting); void closeSelectedConversations(const uuid_vec_t& ids); /*virtual*/ bool isFrontmost(); diff --git a/indra/newview/llfloaterimsession.cpp b/indra/newview/llfloaterimsession.cpp index a2a3dac442..557b3f27c5 100644 --- a/indra/newview/llfloaterimsession.cpp +++ b/indra/newview/llfloaterimsession.cpp @@ -138,8 +138,14 @@ void LLFloaterIMSession::onTearOffClicked() } // virtual -void LLFloaterIMSession::onClickCloseBtn(bool) +void LLFloaterIMSession::onClickCloseBtn(bool app_qutting) { + if (app_qutting) + { + LLFloaterIMSessionTab::onClickCloseBtn(); + return; + } + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); if (session != NULL) -- cgit v1.2.3 From 226f7bc5b78bbaf13485f2e94b4e185ccd1c5608 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Sun, 18 Aug 2024 23:07:29 -0700 Subject: Use the release build of webrtc to avoid pedantic asserts which are handled properly anyway. --- indra/llwebrtc/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/llwebrtc/CMakeLists.txt b/indra/llwebrtc/CMakeLists.txt index 30aaec1265..a18b716003 100644 --- a/indra/llwebrtc/CMakeLists.txt +++ b/indra/llwebrtc/CMakeLists.txt @@ -31,6 +31,7 @@ add_library (llwebrtc SHARED ${llwebrtc_SOURCE_FILES}) set_target_properties(llwebrtc PROPERTIES PUBLIC_HEADER llwebrtc.h) if (WINDOWS) + cmake_policy(SET CMP0091 NEW) set_target_properties(llwebrtc PROPERTIES LINK_FLAGS "/debug /LARGEADDRESSAWARE" @@ -42,7 +43,10 @@ if (WINDOWS) wmcodecdspuuid msdmo strmiids - iphlpapi) + iphlpapi + libcmt) + # as the webrtc libraries are release, build this binary as release as well. + target_compile_options(llwebrtc PRIVATE "/MT") if (USE_BUGSPLAT) set_target_properties(llwebrtc PROPERTIES PDB_OUTPUT_DIRECTORY "${SYMBOLS_STAGING_DIR}") endif (USE_BUGSPLAT) -- cgit v1.2.3 From b5754c881648ab75a9c6cabc116e2d55eed7620a Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Mon, 19 Aug 2024 14:37:08 -0700 Subject: #2345 Disable mirrors from the feature table regardless of quality level. (#2352) --- indra/newview/featuretable.txt | 6 +++--- indra/newview/featuretable_mac.txt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'indra') diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt index 03849a0326..e11b406094 100644 --- a/indra/newview/featuretable.txt +++ b/indra/newview/featuretable.txt @@ -252,7 +252,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 512 RenderHeroProbeDistance 1 8 RenderHeroProbeUpdateRate 1 2 @@ -288,7 +288,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 1024 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 @@ -324,7 +324,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 2048 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt index 7aa8504eaa..b984ed217f 100644 --- a/indra/newview/featuretable_mac.txt +++ b/indra/newview/featuretable_mac.txt @@ -286,7 +286,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 2 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 512 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 @@ -322,7 +322,7 @@ RenderReflectionsEnabled 1 1 RenderReflectionProbeDetail 1 1 RenderScreenSpaceReflections 1 0 RenderReflectionProbeLevel 1 3 -RenderMirrors 1 1 +RenderMirrors 1 0 RenderHeroProbeResolution 1 1024 RenderHeroProbeDistance 1 16 RenderHeroProbeUpdateRate 1 1 -- cgit v1.2.3 From 1d017b76292cf8c7afad34ec54d7401e2f1795e5 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 20 Aug 2024 08:28:35 -0400 Subject: Trim trailing blank line. --- indra/llmessage/message_string_table.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra') diff --git a/indra/llmessage/message_string_table.cpp b/indra/llmessage/message_string_table.cpp index 6d2157eec9..084c373265 100644 --- a/indra/llmessage/message_string_table.cpp +++ b/indra/llmessage/message_string_table.cpp @@ -88,4 +88,3 @@ char* LLMessageStringTable::getString(const char *str) } return mString[hash_value]; } - -- cgit v1.2.3