summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2024-07-26 13:01:13 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2024-07-30 07:31:05 +0300
commit7b119c01e0c179bac3dfe8b8c8ee05016099c9aa (patch)
treee2b5cdad4d9bec3732533b7b98ec9deb05bb33f3
parentb746e78c78eaba3460b0f49208dc8b864c376d34 (diff)
viewer-private#255 p2p outgoing calls did not work correctly
Issue: P2P was catching STATUS_LEFT_CHANNEL meant for nearby chat and adopting channel info for itself Solution: - Moved one of notifyStatusObservers calls so that it would have uri data instead of firing with no channel info - Made p2p sessions init with uri data, like it was before webrtc. Which is used to distinguish observer notifications. - Removed mAudioSessionChanged. It was unused yet confusing.
-rw-r--r--indra/newview/llvoicechannel.cpp13
-rw-r--r--indra/newview/llvoicevivox.cpp14
-rw-r--r--indra/newview/llvoicevivox.h1
3 files changed, 17 insertions, 11 deletions
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 8681411a98..29817ab03a 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -122,7 +122,13 @@ void LLVoiceChannel::onChange(EStatusType type, const LLSD& channelInfo, bool pr
{
LL_DEBUGS("Voice") << "Incoming channel info: " << channelInfo << LL_ENDL;
LL_DEBUGS("Voice") << "Current channel info: " << mChannelInfo << LL_ENDL;
- if (mChannelInfo.isUndefined() || (mChannelInfo.isMap() && mChannelInfo.size() == 0))
+ if (mChannelInfo.has("channel_uri")
+ && (!channelInfo.has("channel_uri") || mChannelInfo["channel_uri"] != channelInfo["channel_uri"]))
+ {
+ return;
+ }
+ if (mChannelInfo.isUndefined()
+ || (mChannelInfo.isMap() && mChannelInfo.size() <= 1)) // p2p will have uri beforehand
{
mChannelInfo = channelInfo;
}
@@ -768,6 +774,11 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID &session_id,
mReceivedCall(FALSE),
mOutgoingCallInterface(outgoing_call_interface)
{
+ std::string sip_uri = LLVoiceClient::getInstance()->sipURIFromID(other_user_id);
+ if (!sip_uri.empty())
+ {
+ mChannelInfo["channel_uri"] = sip_uri;
+ }
}
void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 4694ea92bb..9215160202 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -296,7 +296,6 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() :
mDevicesListUpdated(false),
mAudioSession(), // TBD - should be NULL
- mAudioSessionChanged(false),
mNextAudioSession(),
mCurrentParcelLocalID(0),
@@ -1641,7 +1640,6 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession)
LL_INFOS("Voice") << "Adding or joining voice session " << nextSession->mHandle << LL_ENDL;
mAudioSession = nextSession;
- mAudioSessionChanged = true;
if (!mAudioSession || !mAudioSession->mReconnect)
{
mNextAudioSession.reset();
@@ -1898,9 +1896,8 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
sessionStatePtr_t oldSession = mAudioSession;
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); // needs mAudioSession for uri
mAudioSession.reset();
- // We just notified status observers about this change. Don't do it again.
- mAudioSessionChanged = false;
// The old session may now need to be deleted.
reapSession(oldSession);
@@ -1908,9 +1905,9 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait)
else
{
LL_WARNS("Voice") << "terminateAudioSession(" << wait << ") with NULL mAudioSession" << LL_ENDL;
+ notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
}
- notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
// Always reset the terminate request flag when we get here.
// Some slower PCs have a race condition where they can switch to an incoming P2P call faster than the state machine leaves
@@ -3832,7 +3829,6 @@ void LLVivoxVoiceClient::joinedAudioSession(const sessionStatePtr_t &session)
sessionStatePtr_t oldSession = mAudioSession;
mAudioSession = session;
- mAudioSessionChanged = true;
// The old session may now need to be deleted.
reapSession(oldSession);
@@ -6147,7 +6143,6 @@ void LLVivoxVoiceClient::deleteSession(const sessionStatePtr_t &session)
if(mAudioSession == session)
{
mAudioSession.reset();
- mAudioSessionChanged = true;
}
// ditto for the next audio session
@@ -6256,9 +6251,10 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta
}
}
+ LLSD channel_info = getAudioSessionChannelInfo();
LL_DEBUGS("Voice")
<< " " << LLVoiceClientStatusObserver::status2string(status)
- << ", session channelInfo " << getAudioSessionChannelInfo()
+ << ", session channelInfo " << channel_info
<< ", proximal is " << inSpatialChannel()
<< LL_ENDL;
@@ -6273,7 +6269,7 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta
)
{
LLVoiceClientStatusObserver* observer = *it;
- observer->onChange(status, getAudioSessionChannelInfo(), inSpatialChannel());
+ observer->onChange(status, channel_info, inSpatialChannel());
// In case onError() deleted an entry.
it = mStatusObservers.upper_bound(observer);
}
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index 55c1fb50d0..12e3d11eef 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -706,7 +706,6 @@ private:
std::string mChannelName; // Name of the channel to be looked up
sessionStatePtr_t mAudioSession; // Session state for the current audio session
- bool mAudioSessionChanged; // set to true when the above pointer gets changed, so observers can be notified.
sessionStatePtr_t mNextAudioSession; // Session state for the audio session we're trying to join