Merge pull request #1150 from secondlife/roxie/webrtc-voice
commit
f2ec9e5cca
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "llwebrtc_impl.h"
|
||||
#include <algorithm>
|
||||
#include <format>
|
||||
#include <string.h>
|
||||
|
||||
#include "api/audio_codecs/audio_decoder_factory.h"
|
||||
|
|
@ -389,7 +388,7 @@ void LLWebRTCImpl::unsetDevicesObserver(LLWebRTCDevicesObserver *observer)
|
|||
void ll_set_device_module_capture_device(rtc::scoped_refptr<webrtc::AudioDeviceModule> device_module, int16_t device)
|
||||
{
|
||||
device_module->StopRecording();
|
||||
#if LL_WINDOWS
|
||||
#if WEBRTC_WIN
|
||||
if (device < 0)
|
||||
{
|
||||
device_module->SetRecordingDevice(webrtc::AudioDeviceModule::kDefaultDevice);
|
||||
|
|
@ -442,7 +441,7 @@ void LLWebRTCImpl::setCaptureDevice(const std::string &id)
|
|||
void ll_set_device_module_render_device(rtc::scoped_refptr<webrtc::AudioDeviceModule> device_module, int16_t device)
|
||||
{
|
||||
device_module->StopPlayout();
|
||||
#if LL_WINDOWS
|
||||
#if WEBRTC_WIN
|
||||
if (device < 0)
|
||||
{
|
||||
device_module->SetPlayoutDevice(webrtc::AudioDeviceModule::kDefaultDevice);
|
||||
|
|
@ -501,10 +500,10 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id)
|
|||
// updateDevices needs to happen on the worker thread.
|
||||
void LLWebRTCImpl::updateDevices()
|
||||
{
|
||||
int16_t renderDeviceCount = mTuningDeviceModule->PlayoutDevices();
|
||||
int16_t renderDeviceCount = mTuningDeviceModule->PlayoutDevices();
|
||||
|
||||
mPlayoutDeviceList.clear();
|
||||
#if LL_WINDOWS
|
||||
#if WEBRTC_WIN
|
||||
int16_t index = 0;
|
||||
#else
|
||||
// index zero is always "Default" for darwin/linux,
|
||||
|
|
@ -522,7 +521,7 @@ void LLWebRTCImpl::updateDevices()
|
|||
int16_t captureDeviceCount = mTuningDeviceModule->RecordingDevices();
|
||||
|
||||
mRecordingDeviceList.clear();
|
||||
#if LL_WINDOWS
|
||||
#if WEBRTC_WIN
|
||||
index = 0;
|
||||
#else
|
||||
// index zero is always "Default" for darwin/linux,
|
||||
|
|
|
|||
|
|
@ -78,7 +78,12 @@ class LLWebRTCVoiceDevice
|
|||
LLWebRTCVoiceDevice(const std::string &display_name, const std::string &id) :
|
||||
mDisplayName(display_name),
|
||||
mID(id)
|
||||
{};
|
||||
{
|
||||
if (mID.empty())
|
||||
{
|
||||
mID = display_name;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
typedef std::vector<LLWebRTCVoiceDevice> LLWebRTCVoiceDeviceList;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#define WEBRTC_POSIX 1
|
||||
#elif __linux__
|
||||
#define WEBRTC_LINUX 1
|
||||
#define WEBRTC_POSIX 1
|
||||
#endif
|
||||
|
||||
#include "llwebrtc.h"
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ enum EMultiAgentChatSessionType
|
|||
|
||||
void startConferenceCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId, LLSD agents);
|
||||
|
||||
void startP2PCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId);
|
||||
void startP2PVoiceCoro(std::string url, LLUUID tempSessionId, LLUUID creatorId, LLUUID otherParticipantId);
|
||||
|
||||
void chatterBoxInvitationCoro(std::string url, LLUUID sessionId, LLIMMgr::EInvitationType invitationType);
|
||||
void chatterBoxHistoryCoro(std::string url, LLUUID sessionId, std::string from, std::string message, U32 timestamp);
|
||||
|
|
@ -456,14 +456,14 @@ void startConferenceCoro(std::string url,
|
|||
}
|
||||
}
|
||||
|
||||
void startP2PCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID otherParticipantId)
|
||||
void startP2PVoiceCoro(std::string url, LLUUID sessionID, LLUUID creatorId, LLUUID otherParticipantId)
|
||||
{
|
||||
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("ConferenceChatStart", httpPolicy));
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("StartP2PVoiceCoro", httpPolicy));
|
||||
LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
|
||||
|
||||
LLSD postData;
|
||||
postData["method"] = "start p2p";
|
||||
postData["method"] = "start p2p voice";
|
||||
postData["session-id"] = sessionID;
|
||||
postData["params"] = otherParticipantId;
|
||||
LLSD altParams;
|
||||
|
|
@ -2125,7 +2125,7 @@ bool LLIMModel::sendStartSession(
|
|||
if (region)
|
||||
{
|
||||
std::string url = region->getCapability("ChatSessionRequest");
|
||||
LLCoros::instance().launch("startP2P", boost::bind(&startP2PCoro, url, temp_session_id, gAgent.getID(), other_participant_id));
|
||||
LLCoros::instance().launch("startP2PVoiceCoro", boost::bind(&startP2PVoiceCoro, url, temp_session_id, gAgent.getID(), other_participant_id));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
@ -2727,7 +2727,7 @@ LLIncomingCallDialog::LLIncomingCallDialog(const LLSD& payload) :
|
|||
|
||||
void LLIncomingCallDialog::onLifetimeExpired()
|
||||
{
|
||||
LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(mPayload["voice_session_info"]);
|
||||
LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(mPayload["voice_channel_info"]);
|
||||
if (call)
|
||||
{
|
||||
// restart notification's timer if call is still valid
|
||||
|
|
@ -3005,24 +3005,42 @@ void LLIncomingCallDialog::processCallResponse(S32 response, const LLSD &payload
|
|||
{
|
||||
if (type == IM_SESSION_P2P_INVITE)
|
||||
{
|
||||
LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(payload["voice_session_info"]);
|
||||
// decline p2p voice, either via the vivox-style call mechanism
|
||||
// or via the webrtc-style "decline p2p" mechanism.
|
||||
LLVoiceP2PIncomingCallInterfacePtr call = LLVoiceClient::getInstance()->getIncomingCallInterface(payload["voice_channel_info"]);
|
||||
if (call)
|
||||
{
|
||||
call->declineInvite();
|
||||
}
|
||||
else
|
||||
{
|
||||
// webrtc-style decline.
|
||||
LLViewerRegion *region = gAgent.getRegion();
|
||||
if (region)
|
||||
{
|
||||
std::string url = region->getCapability("ChatSessionRequest");
|
||||
|
||||
LLSD data;
|
||||
data["method"] = "decline p2p voice";
|
||||
data["session-id"] = session_id;
|
||||
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data, "P2P declined", "P2P decline failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string url = gAgent.getRegion()->getCapability(
|
||||
"ChatSessionRequest");
|
||||
LLViewerRegion *region = gAgent.getRegion();
|
||||
if (region)
|
||||
{
|
||||
std::string url = region->getCapability("ChatSessionRequest");
|
||||
|
||||
LLSD data;
|
||||
data["method"] = "decline invitation";
|
||||
data["session-id"] = session_id;
|
||||
LLSD data;
|
||||
data["method"] = "decline invitation";
|
||||
data["session-id"] = session_id;
|
||||
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data,
|
||||
"Invitation declined",
|
||||
"Invitation decline failed.");
|
||||
LLCoreHttpUtil::HttpCoroutineAdapter::messageHttpPost(url, data, "Invitation declined", "Invitation decline failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3572,6 +3590,40 @@ void LLIMMgr::clearPendingInvitation(const LLUUID& session_id)
|
|||
|
||||
void LLIMMgr::processAgentListUpdates(const LLUUID& session_id, const LLSD& body)
|
||||
{
|
||||
if (body.isMap() && body.has("agent_updates") && body["agent_updates"].isMap())
|
||||
{
|
||||
LLSD::map_const_iterator update_it;
|
||||
for (update_it = body["agent_updates"].beginMap(); update_it != body["agent_updates"].endMap(); ++update_it)
|
||||
{
|
||||
LLUUID agent_id = LLUUID(update_it->first);
|
||||
LLSD agent_data = update_it->second;
|
||||
if (agent_data.has("transition") && agent_data["transition"].asString() == "LEAVE")
|
||||
{
|
||||
// ignore actual leaves as those will be handled separately.
|
||||
continue;
|
||||
}
|
||||
|
||||
if (agent_id != gAgentID && agent_data.isMap() && agent_data.has("info") && agent_data["info"].isMap())
|
||||
{
|
||||
// Is one of the participants leaving a P2P Chat?
|
||||
if (agent_data["info"].has("can_voice_chat") && !agent_data["info"]["can_voice_chat"].asBoolean())
|
||||
{
|
||||
LLVoiceChannelGroup *channelp = dynamic_cast < LLVoiceChannelGroup*>(LLVoiceChannel::getChannelByID(session_id));
|
||||
if (channelp && channelp->isP2P())
|
||||
{
|
||||
// it's an adhoc-style P2P channel, and the peer has declined voice. notify the user
|
||||
// and shut down the voice channel.
|
||||
LLSD notifyArgs = LLSD::emptyMap();
|
||||
notifyArgs["VOICE_CHANNEL_NAME"] = channelp->getSessionName();
|
||||
LLNotificationsUtil::add("P2PCallDeclined", notifyArgs);
|
||||
endCall(session_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LLFloaterIMSession* im_floater = LLFloaterIMSession::findInstance(session_id);
|
||||
if ( im_floater )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -147,6 +147,8 @@ public:
|
|||
void setChannelInfo(const LLSD &channelInfo) override;
|
||||
void requestChannelInfo() override;
|
||||
|
||||
bool isP2P() { return mIsP2P; }
|
||||
|
||||
protected:
|
||||
void setState(EState state) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -5089,7 +5089,7 @@ bool LLVivoxVoiceClient::isCurrentChannel(const LLSD &channelInfo)
|
|||
}
|
||||
if (mAudioSession)
|
||||
{
|
||||
if (!channelInfo["sessionHandle"].asString().empty())
|
||||
if (!channelInfo["session_handle"].asString().empty())
|
||||
{
|
||||
return mAudioSession->mHandle == channelInfo["session_handle"].asString();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1360,7 +1360,7 @@ bool LLWebRTCVoiceClient::isCurrentChannel(const LLSD &channelInfo)
|
|||
|
||||
if (mSession)
|
||||
{
|
||||
if (!channelInfo["sessionHandle"].asString().empty())
|
||||
if (!channelInfo["session_handle"].asString().empty())
|
||||
{
|
||||
return mSession->mHandle == channelInfo["session_handle"].asString();
|
||||
}
|
||||
|
|
@ -2368,12 +2368,14 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro()
|
|||
if (!regionp || !regionp->capabilitiesReceived())
|
||||
{
|
||||
LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL;
|
||||
setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
|
||||
return;
|
||||
}
|
||||
|
||||
std::string url = regionp->getCapability("ProvisionVoiceAccountRequest");
|
||||
if (url.empty())
|
||||
{
|
||||
setVoiceConnectionState(VOICE_STATE_SESSION_RETRY);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue