diff options
Diffstat (limited to 'indra/newview/llvoicevivox.cpp')
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 115 |
1 files changed, 78 insertions, 37 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 1676f70b1e..da874008c8 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -283,7 +283,7 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : mDevicesListUpdated(false), mAreaVoiceDisabled(false), - mAudioSession(), + mAudioSession(), // TBD - should be NULL mAudioSessionChanged(false), mNextAudioSession(), @@ -723,8 +723,10 @@ bool LLVivoxVoiceClient::endAndDisconnectSession() bool LLVivoxVoiceClient::callbackEndDaemon(const LLSD& data) { + LL_DEBUGS("Voice") << LL_ENDL; if (!LLAppViewer::isExiting()) { + LL_DEBUGS("Voice") << "SLVoice terminated " << ll_stream_notation_sd(data) << LL_ENDL; terminateAudioSession(false); closeSocket(); cleanUp(); @@ -741,6 +743,7 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() if (!voiceEnabled()) { // Voice is locked out, we must not launch the vivox daemon. + LL_WARNS("Voice") << "voice disabled; not starting daemon" << LL_ENDL; return false; } @@ -748,11 +751,6 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() { #ifndef VIVOXDAEMON_REMOTEHOST // Launch the voice daemon - - // *FIX:Mani - Using the executable dir instead - // of mAppRODataDir, the working directory from which the app - // is launched. - //std::string exe_path = gDirUtilp->getAppRODataDir(); std::string exe_path = gDirUtilp->getExecutableDir(); exe_path += gDirUtilp->getDirDelimiter(); #if LL_WINDOWS @@ -807,13 +805,16 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() params.postend = sGatewayPump.getName(); sGatewayPump.listen("VivoxDaemonPump", boost::bind(&LLVivoxVoiceClient::callbackEndDaemon, this, _1)); + LL_INFOS("Voice") << "Launching SLVoice" << LL_ENDL; + LL_DEBUGS("Voice") << "SLVoice params " << params << LL_ENDL; + sGatewayPtr = LLProcess::create(params); mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost").c_str(), gSavedSettings.getU32("VivoxVoicePort")); } else { - LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL; + LL_WARNS("Voice") << exe_path << " not found." << LL_ENDL; return false; } #else @@ -900,12 +901,15 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() while (!gAgent.getRegion() || !gAgent.getRegion()->capabilitiesReceived()) { + LL_DEBUGS("Voice") << "no capabilities for voice provisioning; waiting " << LL_ENDL; // *TODO* Pump a message for wake up. llcoro::suspend(); } std::string url = gAgent.getRegionCapability("ProvisionVoiceAccountRequest"); + LL_DEBUGS("Voice") << "region ready for voice provisioning; url=" << url << LL_ENDL; + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("voiceAccountProvision", httpPolicy)); @@ -953,14 +957,23 @@ bool LLVivoxVoiceClient::provisionVoiceAccount() std::string voiceUserName = result["username"].asString(); std::string voicePassword = result["password"].asString(); - //LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << dumpResponse() << LL_ENDL; - if (result.has("voice_sip_uri_hostname")) + { voiceSipUriHostname = result["voice_sip_uri_hostname"].asString(); - + } + // this key is actually misnamed -- it will be an entire URI, not just a hostname. if (result.has("voice_account_server_name")) + { voiceAccountServerUri = result["voice_account_server_name"].asString(); + } + + LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response" + << " user " << (voiceUserName.empty() ? "not set" : "set") + << " password " << (voicePassword.empty() ? "not set" : "set") + << " sip uri " << voiceSipUriHostname + << " account uri " << voiceAccountServerUri + << LL_ENDL; setLoginInfo(voiceUserName, voicePassword, voiceSipUriHostname, voiceAccountServerUri); @@ -972,8 +985,11 @@ bool LLVivoxVoiceClient::establishVoiceConnection() LLEventPump &voiceConnectPump = LLEventPumps::instance().obtain("vivoxClientPump"); if (!mVoiceEnabled && mIsInitialized) + { + LL_WARNS("Voice") << "cannot establish connection; enabled "<<mVoiceEnabled<<" initialized "<<mIsInitialized<<LL_ENDL; return false; - + } + LLSD result; bool connected(false); bool giving_up(false); @@ -1269,6 +1285,10 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo() // state. If the cap request is still pending, // the responder will check to see if we've moved // to a new session and won't change any state. + LL_DEBUGS("Voice") << "terminate requested " << mSessionTerminateRequested + << " enabled " << mVoiceEnabled + << " initialized " << mIsInitialized + << LL_ENDL; terminateAudioSession(true); return false; } @@ -1293,17 +1313,30 @@ bool LLVivoxVoiceClient::requestParcelVoiceInfo() LLSD voice_credentials = result["voice_credentials"]; if (voice_credentials.has("channel_uri")) { + LL_DEBUGS("Voice") << "got voice channel uri" << LL_ENDL; uri = voice_credentials["channel_uri"].asString(); } + else + { + LL_WARNS("Voice") << "No voice channel uri" << LL_ENDL; + } + if (voice_credentials.has("channel_credentials")) { + LL_DEBUGS("Voice") << "got voice channel credentials" << LL_ENDL; credentials = voice_credentials["channel_credentials"].asString(); } - } + else + { + LL_WARNS("Voice") << "No voice channel credentials" << LL_ENDL; - if (!uri.empty()) - LL_INFOS("Voice") << "Voice URI is " << uri << LL_ENDL; + } + } + else + { + LL_WARNS("Voice") << "No voice credentials" << LL_ENDL; + } // set the spatial channel. If no voice credentials or uri are // available, then we simply drop out of voice spatially. @@ -1366,7 +1399,10 @@ bool LLVivoxVoiceClient::addAndJoinSession(const sessionStatePtr_t &nextSession) if (!mVoiceEnabled && mIsInitialized) { - LL_DEBUGS("Voice") << "Voice no longer enabled. Exiting." << LL_ENDL; + LL_DEBUGS("Voice") << "Voice no longer enabled. Exiting" + << " enabled " << mVoiceEnabled + << " initialized " << mIsInitialized + << LL_ENDL; mIsJoiningSession = false; // User bailed out during connect -- jump straight to teardown. terminateAudioSession(true); @@ -1489,7 +1525,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) if (mAudioSession) { - LL_INFOS("Voice") << "Terminating current voice session " << mAudioSession->mHandle << LL_ENDL; + LL_INFOS("Voice") << "terminateAudioSession(" << wait << ") Terminating current voice session " << mAudioSession->mHandle << LL_ENDL; if (mIsLoggedIn) { @@ -1563,7 +1599,7 @@ bool LLVivoxVoiceClient::terminateAudioSession(bool wait) } else { - LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL; + LL_WARNS("Voice") << "terminateAudioSession(" << wait << ") with NULL mAudioSession" << LL_ENDL; } notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); @@ -1655,8 +1691,10 @@ bool LLVivoxVoiceClient::waitForChannel() if (mRelogRequested) { + LL_DEBUGS("Voice") << "Relog Requested, restarting provisioning" << LL_ENDL; if (!provisionVoiceAccount()) { + LL_WARNS("Voice") << "provisioning voice failed; giving up" << LL_ENDL; giveUp(); return false; } @@ -1676,6 +1714,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) if (mSessionTerminateRequested) { + LL_DEBUGS("Voice") << "runSession terminate requested " << LL_ENDL; terminateAudioSession(true); } // if a relog has been requested then addAndJoineSession @@ -1783,6 +1822,7 @@ bool LLVivoxVoiceClient::runSession(const sessionStatePtr_t &session) } mIsInChannel = false; + LL_DEBUGS("Voice") << "terminating at end of runSession" << LL_ENDL; terminateAudioSession(true); return true; @@ -1978,6 +2018,7 @@ bool LLVivoxVoiceClient::performMicTuning() if (mTuningSpeakerVolumeDirty) { + LL_INFOS("Voice") << "setting tuning speaker level to " << mTuningSpeakerVolume << LL_ENDL; stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">" << "<Level>" << mTuningSpeakerVolume << "</Level>" @@ -2335,11 +2376,10 @@ void LLVivoxVoiceClient::clearCaptureDevices() mCaptureDevices.clear(); } -void LLVivoxVoiceClient::addCaptureDevice(const std::string& name) +void LLVivoxVoiceClient::addCaptureDevice(const LLVoiceDevice& device) { - LL_DEBUGS("Voice") << name << LL_ENDL; - - mCaptureDevices.push_back(name); + LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL; + mCaptureDevices.push_back(device); } LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices() @@ -2377,10 +2417,10 @@ void LLVivoxVoiceClient::clearRenderDevices() mRenderDevices.clear(); } -void LLVivoxVoiceClient::addRenderDevice(const std::string& name) +void LLVivoxVoiceClient::addRenderDevice(const LLVoiceDevice& device) { - LL_DEBUGS("Voice") << name << LL_ENDL; - mRenderDevices.push_back(name); + LL_DEBUGS("Voice") << "display: '" << device.display_name << "' device: '" << device.full_name << "'" << LL_ENDL; + mRenderDevices.push_back(device); } LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices() @@ -2528,13 +2568,13 @@ bool LLVivoxVoiceClient::deviceSettingsAvailable() } bool LLVivoxVoiceClient::deviceSettingsUpdated() { + bool updated = mDevicesListUpdated; if (mDevicesListUpdated) { // a hot swap event or a polling of the audio devices has been parsed since the last redraw of the input and output device panel. - mDevicesListUpdated = !mDevicesListUpdated; // toggle the setting - return true; + mDevicesListUpdated = false; // toggle the setting } - return false; + return updated; } void LLVivoxVoiceClient::refreshDeviceLists(bool clearCurrentList) @@ -2553,8 +2593,7 @@ void LLVivoxVoiceClient::daemonDied() // The daemon died, so the connection is gone. Reset everything and start over. LL_WARNS("Voice") << "Connection to vivox daemon lost. Resetting state."<< LL_ENDL; - // Try to relaunch the daemon - /*TODO:*/ + //TODO: Try to relaunch the daemon } void LLVivoxVoiceClient::giveUp() @@ -2915,7 +2954,6 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void) } } - //sendLocalAudioUpdates(); obsolete, used to send volume setting on position updates std::string update(stream.str()); if(!update.empty()) { @@ -2960,7 +2998,8 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates() { // Check all of the dirty states and then send messages to those needing to be changed. // Tuningmode hands its own mute settings. - + LL_DEBUGS("Voice")<<LL_ENDL; + std::ostringstream stream; if (mMuteMicDirty && !mTuningMode) @@ -2969,7 +3008,7 @@ void LLVivoxVoiceClient::sendLocalAudioUpdates() // Send a local mute command. - LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic ? "true" : "false") << LL_ENDL; + LL_INFOS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic ? "true" : "false") << LL_ENDL; stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">" << "<ConnectorHandle>" << LLVivoxSecurity::getInstance()->connectorHandle() << "</ConnectorHandle>" @@ -3231,8 +3270,6 @@ void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int stat { LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL; } - - /*TODO: Post response?*/ } void LLVivoxVoiceClient::logoutResponse(int statusCode, std::string &statusString) @@ -4037,7 +4074,7 @@ void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, st void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy) { - LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL; + LL_DEBUGS("VoiceEnergy") << "got energy " << energy << LL_ENDL; mTuningEnergy = energy; } @@ -7022,16 +7059,20 @@ void LLVivoxProtocolParser::EndTag(const char *tag) else if (!stricmp("Presence", tag)) statusString = string; else if (!stricmp("CaptureDevices", tag)) + { LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true); + } else if (!stricmp("RenderDevices", tag)) + { LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true); + } else if (!stricmp("CaptureDevice", tag)) { - LLVivoxVoiceClient::getInstance()->addCaptureDevice(deviceString); + LLVivoxVoiceClient::getInstance()->addCaptureDevice(LLVoiceDevice(displayNameString, deviceString)); } else if (!stricmp("RenderDevice", tag)) { - LLVivoxVoiceClient::getInstance()->addRenderDevice(deviceString); + LLVivoxVoiceClient::getInstance()->addRenderDevice(LLVoiceDevice(displayNameString, deviceString)); } else if (!stricmp("BlockMask", tag)) blockMask = string; |