Reconnect when parcel voice params change.

When parcel voice permissions and region/parcel-only voice
settings change, a callback will be made to the viewer with
new voice credential information.  For webrtc, this means
either just the uuid of the voice channel, or nothing if
voice is disabled.

This change looks at that callback and the channel id,
and sets the appropriate flags on the parcel/region as needed
which will cause voice to be renegotiated.

Also, there was a race condition if the voice connect attempt
was made before caps were retrieved, which would have resulted
in full renegotiate attempts.  Now, just wait until the cap
comes in and continue.
master
Roxie Linden 2024-04-21 21:12:06 -07:00
parent 07d7779d87
commit 98322d5f07
3 changed files with 41 additions and 10 deletions

View File

@ -735,6 +735,10 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti
else
{
RTC_LOG(LS_ERROR) << __FUNCTION__ << "Error creating peer connection: " << error_or_peer_connection.error().message();
for (auto &observer : mSignalingObserverList)
{
observer->OnRenegotiationNeeded();
}
return;
}

View File

@ -1269,6 +1269,35 @@ BOOL LLWebRTCVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
}
// Channel Management
bool LLWebRTCVoiceClient::setSpatialChannel(const LLSD &channelInfo)
{
LL_INFOS("Voice") << "SetSpatialChannel " << channelInfo << LL_ENDL;
LLViewerRegion *regionp = gAgent.getRegion();
if (!regionp)
{
return false;
}
LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
// we don't really have credentials for a spatial channel in webrtc,
// it's all handled by the sim.
if (channelInfo.isMap() && channelInfo.has("channel_uri"))
{
bool allow_voice = !channelInfo["channel_uri"].asString().empty();
if (parcel)
{
parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, allow_voice);
parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, channelInfo["channel_uri"].asUUID() == regionp->getRegionID());
}
else
{
regionp->setRegionFlag(REGION_FLAGS_ALLOW_VOICE, allow_voice);
}
}
return true;
}
void LLWebRTCVoiceClient::leaveNonSpatialChannel()
{
LL_DEBUGS("Voice") << "Request to leave non-spatial channel." << LL_ENDL;
@ -2116,7 +2145,7 @@ void LLVoiceWebRTCConnection::OnIceCandidate(const llwebrtc::LLWebRTCIceCandidat
void LLVoiceWebRTCConnection::processIceUpdates()
{
mOutstandingRequests++;
LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::requestVoiceConnectionCoro",
LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::processIceUpdatesCoro",
boost::bind(&LLVoiceWebRTCConnection::processIceUpdatesCoro, this));
}
@ -2436,7 +2465,9 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection()
if (!regionp || !regionp->capabilitiesReceived())
{
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
// try again.
setVoiceConnectionState(VOICE_STATE_REQUEST_CONNECTION);
return;
}
@ -2988,8 +3019,9 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection()
LL_DEBUGS("Voice") << "Requesting voice connection." << LL_ENDL;
if (!regionp || !regionp->capabilitiesReceived())
{
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; retrying " << LL_ENDL;
// try again.
setVoiceConnectionState(VOICE_STATE_REQUEST_CONNECTION);
return;
}

View File

@ -144,12 +144,7 @@ public:
startAdHocSession(channelInfo, notify_on_first_join, hangup_on_last_leave);
}
bool setSpatialChannel(const LLSD &channelInfo) override
{
// we don't really have credentials for a spatial channel in webrtc,
// it's all handled by the sim.
return true;
}
bool setSpatialChannel(const LLSD &channelInfo) override;
void leaveNonSpatialChannel() override;