Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions indra/newview/llvoicewebrtc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3100,6 +3100,13 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
LL_WARNS("Voice") << "Expected object from data channel:" << data << LL_ENDL;
return;
}

bool is_primary_region = mPrimary;
if (!mPrimary && isSpatial() && gAgent.getRegion())
{
is_primary_region = (mRegionID == gAgent.getRegion()->getRegionID());
LL_WARNS() << "mPrimary is false, expected: " << is_primary_region << " connection state: " << getVoiceConnectionState() << LL_ENDL;
}
boost::json::object voice_data = voice_data_parsed.as_object();
boost::json::object mute;
boost::json::object user_gain;
Expand Down Expand Up @@ -3151,6 +3158,8 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
{
user_gain[participant_id] = (uint32_t)(volume * 200);
}
LL_WARNS() << "Join msg received for participant " << agent_id << " in channel " << mChannelID
<< " , msg_primary: " << primary << LL_ENDL;
}

if (!participant && joined && (primary || !isSpatial()))
Expand Down Expand Up @@ -3186,10 +3195,18 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
if (participant_obj.contains("m") && participant_obj["m"].is_bool())
{
bool is_moderator_muted = participant_obj["m"].as_bool();

std::string is_muted = is_moderator_muted ? "MUTED" : "NOT muted";
LL_WARNS() << "Mute info msg received: " << is_muted << " for participant " << agent_id
<< " in channel " << mChannelID
<< " , spatial: " << isSpatial()
<< " , mPrimary: " << mPrimary
<< " , msg_primary: " << primary
<< " , is_primary_region: " << is_primary_region << LL_ENDL;
if (isSpatial())
{
// ignore muted flags from non-primary server
if (mPrimary || primary)
if (is_primary_region || primary)
{
participant->mIsModeratorMuted = is_moderator_muted;
if (gAgentID == agent_id)
Expand All @@ -3207,11 +3224,16 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
}
else
{
if (isSpatial() && (mPrimary || primary))
if (isSpatial() && (is_primary_region || primary))
{
// mute info message can be received before join message, so try to mute again later
if (participant_obj.contains("m") && participant_obj["m"].is_bool())
{
std::string is_muted = participant_obj["m"].as_bool() ? "MUTED" : "NOT muted";
LL_WARNS() << "Mute info msg received: " << is_muted
<< " but participant " << agent_id
<< " was not found in channel " << mChannelID << LL_ENDL;

bool is_moderator_muted = participant_obj["m"].as_bool();
std::string channel_id = mChannelID;
F32 delay { 1.5f };
Expand All @@ -3223,11 +3245,16 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b
if (participant)
{
participant->mIsModeratorMuted = is_moderator_muted;
LL_WARNS() << "Participant " << agent_id << " is found after delay, is_muted: " << is_moderator_muted << LL_ENDL;
if (gAgentID == agent_id)
{
LLNearbyVoiceModeration::getInstance()->setMutedInfo(channel_id, is_moderator_muted);
}
}
else
{
LL_WARNS() << "Participant " << agent_id << " is still not found in channel " << channel_id << LL_ENDL;
}
}, delay);
}
}
Expand Down
Loading