From 89690140c79dcbd8466ebd1c637f474670e3a7ce Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Tue, 3 Mar 2015 18:04:05 +0000 Subject: Better MediaConnect handling of 1026 return status, media already connected. --- indra/newview/llvoicevivox.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index a6a7a35b03..ac264d395f 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -95,7 +95,7 @@ const int MAX_LOGIN_RETRIES = 12; // to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen // to make sure we don't make mistake when slight connection problems happen- situation when connection to server is // blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability. -const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50; +const int MAX_NORMAL_JOINING_SPATIAL_NUM = 150; // How often to check for expired voice fonts in seconds const F32 VOICE_FONT_EXPIRY_INTERVAL = 10.f; @@ -1512,7 +1512,7 @@ void LLVivoxVoiceClient::stateMachine() //MARK: stateLeavingSession case stateLeavingSession: // waiting for terminate session response // The handler for the Session.Terminate response will transition from here to stateSessionTerminated. - break; + //break; // brett, should fall through and clean up session before getting terminated event. //MARK: stateSessionTerminated case stateSessionTerminated: @@ -1522,6 +1522,7 @@ void LLVivoxVoiceClient::stateMachine() if(mAudioSession) { + leaveAudioSession(); sessionState *oldSession = mAudioSession; mAudioSession = NULL; @@ -1881,6 +1882,7 @@ void LLVivoxVoiceClient::leaveAudioSession() case stateJoiningSession: case stateSessionJoined: case stateRunning: + case stateSessionTerminated: if(!mAudioSession->mHandle.empty()) { @@ -2813,15 +2815,24 @@ void LLVivoxVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString) { sessionState *session = findSession(requestId); - if(statusCode != 0) + // 1026 is session already has media, somehow mediaconnect was called twice on the same session. + // set the session info to reflect that the user is already connected. + if (statusCode == 1026){ + session->mVoiceEnabled = true; + session->mMediaConnectInProgress = false; + session->mMediaStreamState = streamStateConnected; + session->mTextStreamState = streamStateConnected; + session->mErrorStatusCode = 0; + } + else if (statusCode != 0) { LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL; - if(session) + if (session) { session->mMediaConnectInProgress = false; - session->mErrorStatusCode = statusCode; + session->mErrorStatusCode = statusCode; session->mErrorStatusString = statusString; - if(session == mAudioSession) + if (session == mAudioSession) setState(stateJoinSessionFailed); } } @@ -4611,6 +4622,11 @@ void LLVivoxVoiceClient::enforceTether(void) void LLVivoxVoiceClient::updatePosition(void) { + // Throttle the position updates to one every 1/10 of a second if we are in an audio session at all + if (mAudioSession == NULL) { + return; + } + LLViewerRegion *region = gAgent.getRegion(); if(region && isAgentAvatarValid()) { -- cgit v1.2.3 From 98f98e03bdbfb8a9a9dd1004e15c589c3cfe7ccd Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Fri, 6 Mar 2015 22:14:26 +0000 Subject: More voice related changes to improve the user's experience. --- indra/newview/llimview.cpp | 12 +++---- indra/newview/llvoiceclient.cpp | 14 ++++---- indra/newview/llvoiceclient.h | 4 +-- indra/newview/llvoicevivox.cpp | 71 +++++++++++++++++++++++++---------------- indra/newview/llvoicevivox.h | 12 ++++--- 5 files changed, 65 insertions(+), 48 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 8d8239611c..96d8762c56 100755 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -1262,12 +1262,12 @@ void LLIMModel::sendMessage(const std::string& utf8_text, info = LLAvatarTracker::instance().getBuddyInfo(other_participant_id); U8 offline = (!info || info->isOnline()) ? IM_ONLINE : IM_OFFLINE; - - if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id))) - { - // User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice. - sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text); - } + // Old call to send messages to SLim client, no longer supported. + //if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id))) + //{ + // // User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice. + // sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text); + //} if(!sent) { diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 962cdf0268..6df1bda135 100755 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -363,6 +363,7 @@ BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id) } } +/* obsolete BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message) { if (mVoiceModule) @@ -374,12 +375,13 @@ BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::str return FALSE; } } +*/ void LLVoiceClient::endUserIMSession(const LLUUID& participant_id) { if (mVoiceModule) { - mVoiceModule->endUserIMSession(participant_id); + // mVoiceModule->endUserIMSession(participant_id); // A SLim leftover } } @@ -645,9 +647,8 @@ void LLVoiceClient::keyDown(KEY key, MASK mask) if(!mPTTIsMiddleMouse && LLAgent::isActionAllowed("speak")) { - bool down = (mPTTKey != KEY_NONE) - && gKeyboard->getKeyDown(mPTTKey); - inputUserControlState(down); + bool down = (mPTTKey != KEY_NONE) && gKeyboard->getKeyDown(mPTTKey); + if (down) { inputUserControlState(down); } } } @@ -655,9 +656,8 @@ void LLVoiceClient::keyUp(KEY key, MASK mask) { if(!mPTTIsMiddleMouse) { - bool down = (mPTTKey != KEY_NONE) - && gKeyboard->getKeyDown(mPTTKey); - inputUserControlState(down); + bool down = (mPTTKey != KEY_NONE) && gKeyboard->getKeyDown(mPTTKey); + if (down) { inputUserControlState(down); } } } void LLVoiceClient::middleMouseState(bool down) diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index fb387301be..4c6ff5ef8f 100755 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -214,7 +214,7 @@ public: //@{ virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0; virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0; - virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0; + //virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0; virtual void endUserIMSession(const LLUUID &uuid)=0; //@} @@ -431,7 +431,7 @@ public: //@{ BOOL isSessionTextIMPossible(const LLUUID& id); BOOL isSessionCallBackPossible(const LLUUID& id); - BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message); + //BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return true;} ; void endUserIMSession(const LLUUID &uuid); //@} diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index ac264d395f..68aacb5090 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -95,7 +95,7 @@ const int MAX_LOGIN_RETRIES = 12; // to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen // to make sure we don't make mistake when slight connection problems happen- situation when connection to server is // blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability. -const int MAX_NORMAL_JOINING_SPATIAL_NUM = 150; +const int MAX_NORMAL_JOINING_SPATIAL_NUM = 1500; // How often to check for expired voice fonts in seconds const F32 VOICE_FONT_EXPIRY_INTERVAL = 10.f; @@ -450,17 +450,20 @@ bool LLVivoxVoiceClient::writeString(const std::string &str) (const char*)str.data(), &written); - if(err == 0) + if(err == 0 && written == size) { // Success. result = true; } - // TODO: handle partial writes (written is number of bytes written) - // Need to set socket to non-blocking before this will work. -// else if(APR_STATUS_IS_EAGAIN(err)) -// { -// // -// } + else if (err == 0 && written != size) { + // Did a short write, log it for now + LL_WARNS("Voice") << ") short write on socket sending data to vivox daemon." << "Sent " << written << "bytes instead of " << size < 100) + LL_WARNS() << "There seems to be problem with connecting to a voice channel. Frames to join were " << mSpatialJoiningNum << LL_ENDL; mSpatialJoiningNum = 0; // It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4 @@ -1512,7 +1517,7 @@ void LLVivoxVoiceClient::stateMachine() //MARK: stateLeavingSession case stateLeavingSession: // waiting for terminate session response // The handler for the Session.Terminate response will transition from here to stateSessionTerminated. - //break; // brett, should fall through and clean up session before getting terminated event. + //break; // Fall through and clean up session before getting terminated event. //MARK: stateSessionTerminated case stateSessionTerminated: @@ -1681,7 +1686,8 @@ void LLVivoxVoiceClient::loginSendMessage() << "" << mAccountName << "" << "" << mAccountPassword << "" << "VerifyAnswer" - << "false" + << "false" + << "0" << "Application" << "5" << (autoPostCrashDumps?"true":"") @@ -1913,10 +1919,12 @@ void LLVivoxVoiceClient::leaveAudioSession() case stateJoinSessionFailed: case stateJoinSessionFailedWaiting: setState(stateSessionTerminated); + break; + case stateLeavingSession: // managed to get back to this case statement before the media gets disconnected. break; default: - LL_WARNS("Voice") << "called from unknown state" << LL_ENDL; + LL_WARNS("Voice") << "called from unknown state " << getState() << LL_ENDL; break; } } @@ -1969,6 +1977,7 @@ void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session } +/* obsolete void LLVivoxVoiceClient::sessionTextDisconnectSendMessage(sessionState *session) { std::ostringstream stream; @@ -1982,6 +1991,7 @@ void LLVivoxVoiceClient::sessionTextDisconnectSendMessage(sessionState *session) writeString(stream.str()); } +*/ void LLVivoxVoiceClient::getCaptureDevicesSendMessage() { @@ -2821,7 +2831,7 @@ void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int stat session->mVoiceEnabled = true; session->mMediaConnectInProgress = false; session->mMediaStreamState = streamStateConnected; - session->mTextStreamState = streamStateConnected; + //session->mTextStreamState = streamStateConnected; session->mErrorStatusCode = 0; } else if (statusCode != 0) @@ -3028,7 +3038,7 @@ void LLVivoxVoiceClient::sessionRemovedEvent( // Reset the media state (we now have no info) session->mMediaStreamState = streamStateUnknown; - session->mTextStreamState = streamStateUnknown; + //session->mTextStreamState = streamStateUnknown; // Conditionally delete the session reapSession(session); @@ -3239,8 +3249,9 @@ void LLVivoxVoiceClient::mediaStreamUpdatedEvent( switch(state) { - case streamStateIdle: - // Standard "left audio session" + case streamStateDisconnecting: + case streamStateIdle: + // Standard "left audio session", Vivox state 'disconnected' session->mVoiceEnabled = false; session->mMediaConnectInProgress = false; leftAudioSession(session); @@ -3250,6 +3261,7 @@ void LLVivoxVoiceClient::mediaStreamUpdatedEvent( session->mVoiceEnabled = true; session->mMediaConnectInProgress = false; joinedAudioSession(session); + case streamStateConnecting: // do nothing, but prevents a warning getting into the logs. break; case streamStateRinging: @@ -3284,6 +3296,7 @@ void LLVivoxVoiceClient::mediaStreamUpdatedEvent( } } +/* Obsolete void LLVivoxVoiceClient::textStreamUpdatedEvent( std::string &sessionHandle, std::string &sessionGroupHandle, @@ -3330,6 +3343,7 @@ void LLVivoxVoiceClient::textStreamUpdatedEvent( } } } + obsolete */ void LLVivoxVoiceClient::participantAddedEvent( std::string &sessionHandle, @@ -4196,7 +4210,7 @@ LLVivoxVoiceClient::sessionState* LLVivoxVoiceClient::startUserIMSession(const L if(session->mHandle.empty()) { // Session isn't active -- start it up. - sessionCreateSendMessage(session, false, true); + sessionCreateSendMessage(session, false, false); } else { @@ -4207,6 +4221,7 @@ LLVivoxVoiceClient::sessionState* LLVivoxVoiceClient::startUserIMSession(const L return session; } +/* obsolete BOOL LLVivoxVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message) { bool result = false; @@ -4231,7 +4246,8 @@ BOOL LLVivoxVoiceClient::sendTextMessage(const LLUUID& participant_id, const std return result; } - +*/ +/* obsolete void LLVivoxVoiceClient::sendQueuedTextMessages(sessionState *session) { if(session->mTextStreamState == 1) @@ -4260,6 +4276,7 @@ void LLVivoxVoiceClient::sendQueuedTextMessages(sessionState *session) // Session isn't connected yet, defer until later. } } + obsolete */ void LLVivoxVoiceClient::endUserIMSession(const LLUUID &uuid) { @@ -4270,7 +4287,7 @@ void LLVivoxVoiceClient::endUserIMSession(const LLUUID &uuid) // found the session if(!session->mHandle.empty()) { - sessionTextDisconnectSendMessage(session); + // sessionTextDisconnectSendMessage(session); // a SLim leftover, not used any more. } } else @@ -6835,6 +6852,10 @@ void LLVivoxProtocolParser::processResponse(std::string tag) { LLVivoxVoiceClient::getInstance()->sessionRemovedEvent(sessionHandle, sessionGroupHandle); } + else if (!stricmp(eventTypeCstr, "SessionGroupUpdatedEvent")) + { + //TODO, we don't process this event, but we should not WARN that we have received it. + } else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent")) { LLVivoxVoiceClient::getInstance()->sessionGroupAddedEvent(sessionGroupHandle); @@ -6863,19 +6884,13 @@ void LLVivoxProtocolParser::processResponse(std::string tag) */ LLVivoxVoiceClient::getInstance()->mediaCompletionEvent(sessionGroupHandle, mediaCompletionType); } + /* obsolete, let else statement complain if a text message arrives else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent")) { - /* - - c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1 - c1_m1000xFnPP04IpREWNkuw1cOXlhw==1 - true - 1 - true - - */ + LLVivoxVoiceClient::getInstance()->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming); - } + + } */ else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent")) { /* diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index a4ec9f2a69..541cccd30f 100755 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -109,7 +109,7 @@ public: virtual bool isParticipant(const LLUUID& speaker_id); // Send a text message to the specified user, initiating the session if necessary. - virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message); + // virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message) const {return false;}; // close any existing text IM session with the specified user virtual void endUserIMSession(const LLUUID &uuid); @@ -261,6 +261,8 @@ protected: streamStateIdle = 1, streamStateConnected = 2, streamStateRinging = 3, + streamStateConnecting = 6, // same as Vivox session_media_connecting enum + streamStateDisconnecting = 7, //Same as Vivox session_media_disconnecting enum }; struct participantState { @@ -325,7 +327,7 @@ protected: LLUUID mCallerID; int mErrorStatusCode; int mMediaStreamState; - int mTextStreamState; + int mTextStreamState; // obsolete bool mCreateInProgress; // True if a Session.Create has been sent for this session and no response has been received yet. bool mMediaConnectInProgress; // True if a Session.MediaConnect has been sent for this session and no response has been received yet. bool mVoiceInvitePending; // True if a voice invite is pending for this session (usually waiting on a name lookup) @@ -480,7 +482,7 @@ protected: void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state); void mediaCompletionEvent(std::string &sessionGroupHandle, std::string &mediaCompletionType); void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming); - void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming); + //obsolete void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming); void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString); void sessionGroupAddedEvent(std::string &sessionGroupHandle); void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle); @@ -596,7 +598,7 @@ protected: void sessionTerminateSendMessage(sessionState *session); void sessionGroupTerminateSendMessage(sessionState *session); void sessionMediaDisconnectSendMessage(sessionState *session); - void sessionTextDisconnectSendMessage(sessionState *session); + // void sessionTextDisconnectSendMessage(sessionState *session); @@ -760,7 +762,7 @@ private: // start a text IM session with the specified user // This will be asynchronous, the session may be established at a future time. sessionState* startUserIMSession(const LLUUID& uuid); - void sendQueuedTextMessages(sessionState *session); + // obsolete void sendQueuedTextMessages(sessionState *session); void enforceTether(void); -- cgit v1.2.3 From 4941749bb4d3b66f55c9c61d7e18305d92ec6986 Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Tue, 10 Mar 2015 14:21:41 +0100 Subject: Added the loop back setting so people can hear themselves during the mic test. --- indra/newview/llvoicevivox.cpp | 11 +++++++---- indra/newview/skins/default/xui/en/panel_sound_devices.xml | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 68aacb5090..99190e9919 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -972,8 +972,8 @@ void LLVivoxVoiceClient::stateMachine() } else { - // duration parameter is currently unused, per Mike S. - tuningCaptureStartSendMessage(10000); + // loop mic back to render device. + tuningCaptureStartSendMessage(1); // 1-loop, zero, don't loop setState(stateMicTuningRunning); } @@ -2143,14 +2143,15 @@ void LLVivoxVoiceClient::tuningRenderStopSendMessage() writeString(stream.str()); } -void LLVivoxVoiceClient::tuningCaptureStartSendMessage(int duration) +void LLVivoxVoiceClient::tuningCaptureStartSendMessage(int loop) { LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL; std::ostringstream stream; stream << "" - << "" << duration << "" + << "-1" + << "" << loop << "" << "\n\n\n"; writeString(stream.str()); @@ -2372,6 +2373,8 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void) { std::ostringstream stream; + if (getState() != stateRunning) return; // don't send position updates if we are transitioning between out of running. + if(mSpatialCoordsDirty) { LLVector3 l, u, a, vel; diff --git a/indra/newview/skins/default/xui/en/panel_sound_devices.xml b/indra/newview/skins/default/xui/en/panel_sound_devices.xml index 46cbc1e87f..3dbb7fb7fc 100755 --- a/indra/newview/skins/default/xui/en/panel_sound_devices.xml +++ b/indra/newview/skins/default/xui/en/panel_sound_devices.xml @@ -98,7 +98,7 @@ name="My volume label" top_pad="14" width="200"> - My volume: + Mic volume: Date: Sun, 22 Mar 2015 13:04:09 -0400 Subject: Mic setting changes some device list is up to date, mic loop test works, removed obsolete code and fine tuned voice state machine to avoid frequent neccessary code paths. --- indra/newview/llpanelvoicedevicesettings.cpp | 30 ++- indra/newview/llpanelvoicedevicesettings.h | 2 + indra/newview/llvoiceclient.cpp | 12 + indra/newview/llvoiceclient.h | 2 + indra/newview/llvoicevivox.cpp | 343 +++++++++------------------ indra/newview/llvoicevivox.h | 13 +- 6 files changed, 159 insertions(+), 243 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp index 3946d6a63b..07f8045546 100755 --- a/indra/newview/llpanelvoicedevicesettings.cpp +++ b/indra/newview/llpanelvoicedevicesettings.cpp @@ -51,7 +51,7 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings() mCtrlOutputDevices = NULL; mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice"); mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice"); - mDevicesUpdated = FALSE; + mDevicesUpdated = FALSE; //obsolete mUseTuningMode = true; // grab "live" mic volume level @@ -80,6 +80,10 @@ BOOL LLPanelVoiceDeviceSettings::postBuild() mLocalizedDeviceNames[DEFAULT_DEVICE] = getString("default_text"); mLocalizedDeviceNames["No Device"] = getString("name_no_device"); mLocalizedDeviceNames["Default System Device"] = getString("name_default_system_device"); + + mCtrlOutputDevices->setMouseDownCallback(boost::bind(&LLPanelVoiceDeviceSettings::onOutputDevicesClicked, this)); + mCtrlInputDevices->setMouseDownCallback(boost::bind(&LLPanelVoiceDeviceSettings::onInputDevicesClicked, this)); + return TRUE; } @@ -226,9 +230,8 @@ void LLPanelVoiceDeviceSettings::refresh() mCtrlOutputDevices->add(getLocalizedDeviceName(mOutputDevice), mOutputDevice, ADD_BOTTOM); mCtrlOutputDevices->setValue(mOutputDevice); } - mDevicesUpdated = FALSE; } - else if (!mDevicesUpdated) + else if (LLVoiceClient::getInstance()->deviceSettingsUpdated()) { LLVoiceDeviceList::const_iterator iter; @@ -272,7 +275,6 @@ void LLPanelVoiceDeviceSettings::refresh() mOutputDevice = DEFAULT_DEVICE; } } - mDevicesUpdated = TRUE; } } @@ -281,7 +283,6 @@ void LLPanelVoiceDeviceSettings::initialize() mInputDevice = gSavedSettings.getString("VoiceInputAudioDevice"); mOutputDevice = gSavedSettings.getString("VoiceOutputAudioDevice"); mMicVolume = gSavedSettings.getF32("AudioLevelMic"); - mDevicesUpdated = FALSE; // ask for new device enumeration LLVoiceClient::getInstance()->refreshDeviceLists(); @@ -314,8 +315,8 @@ void LLPanelVoiceDeviceSettings::onCommitInputDevice() { if(LLVoiceClient::getInstance()) { - LLVoiceClient::getInstance()->setCaptureDevice( - mCtrlInputDevices->getValue().asString()); + mInputDevice = mCtrlInputDevices->getValue().asString(); + LLVoiceClient::getInstance()->setRenderDevice(mInputDevice); } } @@ -323,7 +324,18 @@ void LLPanelVoiceDeviceSettings::onCommitOutputDevice() { if(LLVoiceClient::getInstance()) { - LLVoiceClient::getInstance()->setRenderDevice( - mCtrlInputDevices->getValue().asString()); + + mOutputDevice = mCtrlOutputDevices->getValue().asString(); + LLVoiceClient::getInstance()->setRenderDevice(mOutputDevice); } } + +void LLPanelVoiceDeviceSettings::onOutputDevicesClicked() +{ + LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed. +} + +void LLPanelVoiceDeviceSettings::onInputDevicesClicked() +{ + LLVoiceClient::getInstance()->refreshDeviceLists(false); // fill in the pop up menus again if needed. +} diff --git a/indra/newview/llpanelvoicedevicesettings.h b/indra/newview/llpanelvoicedevicesettings.h index 83464f476a..355bc02b05 100755 --- a/indra/newview/llpanelvoicedevicesettings.h +++ b/indra/newview/llpanelvoicedevicesettings.h @@ -53,6 +53,8 @@ protected: void onCommitInputDevice(); void onCommitOutputDevice(); + void onOutputDevicesClicked(); + void onInputDevicesClicked(); F32 mMicVolume; std::string mInputDevice; diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 6df1bda135..e09ca1f72a 100755 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -266,6 +266,18 @@ bool LLVoiceClient::deviceSettingsAvailable() } } +bool LLVoiceClient::deviceSettingsUpdated() +{ + if (mVoiceModule) + { + return mVoiceModule->deviceSettingsUpdated(); + } + else + { + return false; + } +} + void LLVoiceClient::refreshDeviceLists(bool clearCurrentList) { if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList); diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 4c6ff5ef8f..51961468ca 100755 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -128,6 +128,7 @@ public: // This returns true when it's safe to bring up the "device settings" dialog in the prefs. // i.e. when the daemon is running and connected, and the device lists are populated. virtual bool deviceSettingsAvailable()=0; + virtual bool deviceSettingsUpdated() = 0; // Requery the vivox daemon for the current list of input/output devices. // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed @@ -335,6 +336,7 @@ public: // This returns true when it's safe to bring up the "device settings" dialog in the prefs. // i.e. when the daemon is running and connected, and the device lists are populated. bool deviceSettingsAvailable(); + bool deviceSettingsUpdated(); // returns true when the device list has been updated recently. // Requery the vivox daemon for the current list of input/output devices. // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 99190e9919..6ac8d84771 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -91,10 +91,9 @@ const F32 LOGIN_RETRY_SECONDS = 10.0f; const int MAX_LOGIN_RETRIES = 12; // Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine() -// which is treated as normal. If this number is exceeded we suspect there is a problem with connection -// to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen -// to make sure we don't make mistake when slight connection problems happen- situation when connection to server is -// blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability. +// which is treated as normal. The is the number of frames to wait for a channel join before giving up. This was changed +// from the original count of 50 for two reason. Modern PCs have higher frame rates and sometimes the SLVoice process +// backs up processing join requests. There is a log statement that records when channel joins take longer than 100 frames. const int MAX_NORMAL_JOINING_SPATIAL_NUM = 1500; // How often to check for expired voice fonts in seconds @@ -277,9 +276,10 @@ LLVivoxVoiceClient::LLVivoxVoiceClient() : mTuningEnergy(0.0f), mTuningMicVolume(0), mTuningMicVolumeDirty(true), - mTuningSpeakerVolume(0), + mTuningSpeakerVolume(50), // Set to 50 so the user can hear himself when he sets his mic volume mTuningSpeakerVolumeDirty(true), mTuningExitState(stateDisabled), + mDevicesListUpdated(false), mAreaVoiceDisabled(false), mAudioSession(NULL), @@ -718,8 +718,9 @@ void LLVivoxVoiceClient::stateMachine() setVoiceEnabled(false); } - if(mVoiceEnabled || (!mIsInitialized &&!mTerminateDaemon) ) + if ((getState() == stateRunning) && inSpatialChannel() && mUpdateTimer.hasExpired() && !mTerminateDaemon) { + // poll the avatar position so its available in various states when a 3d position is sent. updatePosition(); } else if(mTuningMode) @@ -728,7 +729,8 @@ void LLVivoxVoiceClient::stateMachine() } else { - if((getState() != stateDisabled) && (getState() != stateDisableCleanup)) + if (!gSavedSettings.getBOOL("EnableVoiceChat")) + //if((getState() != stateDisabled) && (getState() != stateDisableCleanup)) { // User turned off voice support. Send the cleanup messages, close the socket, and reset. if(!mConnected || mTerminateDaemon) @@ -746,6 +748,10 @@ void LLVivoxVoiceClient::stateMachine() } } + + // send any requests to adjust mic and speaker settings if they have changed + sendLocalAudioUpdates(); + switch(getState()) { @@ -973,6 +979,19 @@ void LLVivoxVoiceClient::stateMachine() else { // loop mic back to render device. + //setMuteMic(0); // make sure the mic is not muted + std::ostringstream stream; + + stream << "" + << "" << mConnectorHandle << "" + << "false" + << "\n\n\n"; + + // Dirty the mute mic state so that it will get reset when we finishing previewing + mMuteMicDirty = true; + mTuningSpeakerVolumeDirty = true; + + writeString(stream.str()); tuningCaptureStartSendMessage(1); // 1-loop, zero, don't loop setState(stateMicTuningRunning); @@ -1243,16 +1262,8 @@ void LLVivoxVoiceClient::stateMachine() } // Set the initial state of mic mute, local speaker volume, etc. - { - std::ostringstream stream; - - buildLocalAudioUpdates(stream); + sendLocalAudioUpdates(); - if(!stream.str().empty()) - { - writeString(stream.str()); - } - } break; //MARK: stateVoiceFontsWait @@ -1525,9 +1536,9 @@ void LLVivoxVoiceClient::stateMachine() // Must do this first, since it uses mAudioSession. notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); - if(mAudioSession) + if (mAudioSession) { - leaveAudioSession(); + leaveAudioSession(); sessionState *oldSession = mAudioSession; mAudioSession = NULL; @@ -1977,21 +1988,6 @@ void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session } -/* obsolete -void LLVivoxVoiceClient::sessionTextDisconnectSendMessage(sessionState *session) -{ - std::ostringstream stream; - - LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL; - stream - << "" - << "" << session->mGroupHandle << "" - << "" << session->mHandle << "" - << "\n\n\n"; - - writeString(stream.str()); -} -*/ void LLVivoxVoiceClient::getCaptureDevicesSendMessage() { @@ -2050,6 +2046,10 @@ void LLVivoxVoiceClient::setCaptureDevice(const std::string& name) } } } +void LLVivoxVoiceClient::setDevicesListUpdated(bool state) +{ + mDevicesListUpdated = state; +} void LLVivoxVoiceClient::clearRenderDevices() { @@ -2210,6 +2210,16 @@ bool LLVivoxVoiceClient::deviceSettingsAvailable() return result; } +bool LLVivoxVoiceClient::deviceSettingsUpdated() +{ + 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; + } + return false; +} void LLVivoxVoiceClient::refreshDeviceLists(bool clearCurrentList) { @@ -2373,7 +2383,6 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void) { std::ostringstream stream; - if (getState() != stateRunning) return; // don't send position updates if we are transitioning between out of running. if(mSpatialCoordsDirty) { @@ -2582,7 +2591,7 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void) } } - buildLocalAudioUpdates(stream); + //sendLocalAudioUpdates(); obsolete, used to send volume setting on position updates if(!stream.str().empty()) { @@ -2622,68 +2631,73 @@ void LLVivoxVoiceClient::buildSetRenderDevice(std::ostringstream &stream) } } -void LLVivoxVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream) +void LLVivoxVoiceClient::sendLocalAudioUpdates() { - buildSetCaptureDevice(stream); + // Check all of the dirty states and then send messages to those needing to be changed. + // Tuningmode hands its own mute settings. - buildSetRenderDevice(stream); + std::ostringstream stream; - if(mMuteMicDirty) + if (mMuteMicDirty && !mTuningMode) { mMuteMicDirty = false; // Send a local mute command. - - LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic?"true":"false") << LL_ENDL; + + LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mMuteMic ? "true" : "false") << LL_ENDL; stream << "" << "" << mConnectorHandle << "" - << "" << (mMuteMic?"true":"false") << "" + << "" << (mMuteMic ? "true" : "false") << "" << "\n\n\n"; - + } - if(mSpeakerMuteDirty) + if (mSpeakerMuteDirty && !mTuningMode) { - const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0))?"true":"false"); + const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0)) ? "true" : "false"); mSpeakerMuteDirty = false; - LL_INFOS("Voice") << "Setting speaker mute to " << muteval << LL_ENDL; - + LL_INFOS("Voice") << "Setting speaker mute to " << muteval << LL_ENDL; + stream << "" << "" << mConnectorHandle << "" << "" << muteval << "" - << "\n\n\n"; - + << "\n\n\n"; + } - - if(mSpeakerVolumeDirty) + + if (mSpeakerVolumeDirty) { mSpeakerVolumeDirty = false; - LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume << LL_ENDL; + LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume << LL_ENDL; stream << "" << "" << mConnectorHandle << "" << "" << mSpeakerVolume << "" << "\n\n\n"; - + } - - if(mMicVolumeDirty) + + if (mMicVolumeDirty) { mMicVolumeDirty = false; - LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume << LL_ENDL; + LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume << LL_ENDL; stream << "" << "" << mConnectorHandle << "" << "" << mMicVolume << "" - << "\n\n\n"; + << "\n\n\n"; } - + + if (!stream.str().empty()) + { + writeString(stream.str()); + } } ///////////////////////////// @@ -2830,7 +2844,8 @@ void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int stat sessionState *session = findSession(requestId); // 1026 is session already has media, somehow mediaconnect was called twice on the same session. // set the session info to reflect that the user is already connected. - if (statusCode == 1026){ + if (statusCode == 1026) + { session->mVoiceEnabled = true; session->mMediaConnectInProgress = false; session->mMediaStreamState = streamStateConnected; @@ -2846,7 +2861,9 @@ void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int stat session->mErrorStatusCode = statusCode; session->mErrorStatusString = statusString; if (session == mAudioSession) + { setState(stateJoinSessionFailed); + } } } else @@ -2985,7 +3002,6 @@ void LLVivoxVoiceClient::joinedAudioSession(sessionState *session) { setState(stateSessionJoined); - // SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now. // Add the current user as a participant here. participantState *participant = session->addParticipant(sipURIFromName(mAccountName)); if(participant) @@ -3299,55 +3315,6 @@ void LLVivoxVoiceClient::mediaStreamUpdatedEvent( } } -/* Obsolete -void LLVivoxVoiceClient::textStreamUpdatedEvent( - std::string &sessionHandle, - std::string &sessionGroupHandle, - bool enabled, - int state, - bool incoming) -{ - sessionState *session = findSession(sessionHandle); - - if(session) - { - // Save the state for later use - session->mTextStreamState = state; - - // We know about this session - switch(state) - { - case 0: // We see this when the text stream closes - LL_DEBUGS("Voice") << "stream closed" << LL_ENDL; - break; - - case 1: // We see this on an incoming call from the Connector - // Try to send any text messages queued for this session. - sendQueuedTextMessages(session); - - // Send the text chat invite to the GUI layer - // TODO: Question: Should we correlate with the mute list here? - session->mTextInvitePending = true; - if(session->mName.empty()) - { - lookupName(session->mCallerID); - } - else - { - // Act like we just finished resolving the name - avatarNameResolved(session->mCallerID, session->mName); - } - break; - - default: - LL_WARNS("Voice") << "unknown state " << state << LL_ENDL; - break; - - } - } -} - obsolete */ - void LLVivoxVoiceClient::participantAddedEvent( std::string &sessionHandle, std::string &sessionGroupHandle, @@ -4224,62 +4191,6 @@ LLVivoxVoiceClient::sessionState* LLVivoxVoiceClient::startUserIMSession(const L return session; } -/* obsolete -BOOL LLVivoxVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message) -{ - bool result = false; - - // Attempt to locate the indicated session - sessionState *session = startUserIMSession(participant_id); - if(session) - { - // found the session, attempt to send the message - session->mTextMsgQueue.push(message); - - // Try to send queued messages (will do nothing if the session is not open yet) - sendQueuedTextMessages(session); - - // The message is queued, so we succeed. - result = true; - } - else - { - LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL; - } - - return result; -} -*/ -/* obsolete -void LLVivoxVoiceClient::sendQueuedTextMessages(sessionState *session) -{ - if(session->mTextStreamState == 1) - { - if(!session->mTextMsgQueue.empty()) - { - std::ostringstream stream; - - while(!session->mTextMsgQueue.empty()) - { - std::string message = session->mTextMsgQueue.front(); - session->mTextMsgQueue.pop(); - stream - << "" - << "" << session->mHandle << "" - << "text/HTML" - << "" << message << "" - << "" - << "\n\n\n"; - } - writeString(stream.str()); - } - } - else - { - // Session isn't connected yet, defer until later. - } -} - obsolete */ void LLVivoxVoiceClient::endUserIMSession(const LLUUID &uuid) { @@ -4641,11 +4552,6 @@ void LLVivoxVoiceClient::enforceTether(void) void LLVivoxVoiceClient::updatePosition(void) { - - // Throttle the position updates to one every 1/10 of a second if we are in an audio session at all - if (mAudioSession == NULL) { - return; - } LLViewerRegion *region = gAgent.getRegion(); if(region && isAgentAvatarValid()) @@ -5109,7 +5015,7 @@ void LLVivoxVoiceClient::filePlaybackSetMode(bool vox, float speed) LLVivoxVoiceClient::sessionState::sessionState() : mErrorStatusCode(0), mMediaStreamState(streamStateUnknown), - mTextStreamState(streamStateUnknown), + //mTextStreamState(streamStateUnknown), mCreateInProgress(false), mMediaConnectInProgress(false), mVoiceInvitePending(false), @@ -6705,6 +6611,10 @@ void LLVivoxProtocolParser::EndTag(const char *tag) uriString = string; 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); @@ -6833,7 +6743,13 @@ void LLVivoxProtocolParser::processResponse(std::string tag) if (isEvent) { const char *eventTypeCstr = eventTypeString.c_str(); - if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent")) + if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent")) + { + // These happen so often that logging them is pretty useless. + squelchDebugOutput = true; + LLVivoxVoiceClient::getInstance()->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy); + } + else if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent")) { LLVivoxVoiceClient::getInstance()->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state); } @@ -6857,7 +6773,7 @@ void LLVivoxProtocolParser::processResponse(std::string tag) } else if (!stricmp(eventTypeCstr, "SessionGroupUpdatedEvent")) { - //TODO, we don't process this event, but we should not WARN that we have received it. + //nothng useful to process for this event, but we should not WARN that we have received it. } else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent")) { @@ -6887,13 +6803,6 @@ void LLVivoxProtocolParser::processResponse(std::string tag) */ LLVivoxVoiceClient::getInstance()->mediaCompletionEvent(sessionGroupHandle, mediaCompletionType); } - /* obsolete, let else statement complain if a text message arrives - else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent")) - { - - LLVivoxVoiceClient::getInstance()->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming); - - } */ else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent")) { /* @@ -6920,52 +6829,20 @@ void LLVivoxProtocolParser::processResponse(std::string tag) */ LLVivoxVoiceClient::getInstance()->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString); } - else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent")) - { - /* - - c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0 - c1_m1000xFnPP04IpREWNkuw1cOXlhw==0 - sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com - false - true - 44 - 0.0879437 - - */ - - // These happen so often that logging them is pretty useless. - squelchDebugOutput = true; - - LLVivoxVoiceClient::getInstance()->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy); - } else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent")) { // These are really spammy in tuning mode squelchDebugOutput = true; - LLVivoxVoiceClient::getInstance()->auxAudioPropertiesEvent(energy); } - else if (!stricmp(eventTypeCstr, "BuddyChangedEvent")) - { - /* - - c1_m1000xFnPP04IpREWNkuw1cOXlhw== - sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com - Monroe Tester - - 0 - Set - - */ - // TODO: Question: Do we need to process this at all? - } else if (!stricmp(eventTypeCstr, "MessageEvent")) { + //TODO: This probably is not received any more, it was used to support SLim clients LLVivoxVoiceClient::getInstance()->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString); } else if (!stricmp(eventTypeCstr, "SessionNotificationEvent")) { + //TODO: This probably is not received any more, it was used to support SLim clients LLVivoxVoiceClient::getInstance()->sessionNotificationEvent(sessionHandle, uriString, notificationType); } else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent")) @@ -6985,19 +6862,29 @@ void LLVivoxProtocolParser::processResponse(std::string tag) */ // We don't need to process this, but we also shouldn't warn on it, since that confuses people. } - - else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent")) + else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent")) { - /* - - c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0 - - */ // We don't need to process this, but we also shouldn't warn on it, since that confuses people. } - else if (!stricmp(eventTypeCstr, "VoiceServiceConnectionStateChangedEvent")) + else if (!stricmp(eventTypeCstr, "VoiceServiceConnectionStateChangedEvent")) { // Yet another ignored event } + else if (!stricmp(eventTypeCstr, "AudioDeviceHotSwapEvent")) + { + /* + + RenderDeviceChanged< / EventType> + + Speakers(Turtle Beach P11 Headset)< / Device> + Speakers(Turtle Beach P11 Headset)< / DisplayName> + SpecificDevice< / Type> + < / RelevantDevice> + < / Event> + */ + // an audio device was removed or added, fetch and update the local list of audio devices. + LLVivoxVoiceClient::getInstance()->getCaptureDevicesSendMessage(); + LLVivoxVoiceClient::getInstance()->getRenderDevicesSendMessage(); + } else { LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL; @@ -7006,7 +6893,12 @@ void LLVivoxProtocolParser::processResponse(std::string tag) else { const char *actionCstr = actionString.c_str(); - if (!stricmp(actionCstr, "Connector.Create.1")) + if (!stricmp(actionCstr, "Session.Set3DPosition.1")) + { + // We don't need to process these, but they're so spammy we don't want to log them. + squelchDebugOutput = true; + } + else if (!stricmp(actionCstr, "Connector.Create.1")) { LLVivoxVoiceClient::getInstance()->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID); } @@ -7034,11 +6926,6 @@ void LLVivoxProtocolParser::processResponse(std::string tag) { LLVivoxVoiceClient::getInstance()->connectorShutdownResponse(statusCode, statusString); } - else if (!stricmp(actionCstr, "Session.Set3DPosition.1")) - { - // We don't need to process these, but they're so spammy we don't want to log them. - squelchDebugOutput = true; - } else if (!stricmp(actionCstr, "Account.GetSessionFonts.1")) { LLVivoxVoiceClient::getInstance()->accountGetSessionFontsResponse(statusCode, statusString); diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 541cccd30f..1b8a45744a 100755 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -91,6 +91,7 @@ public: // This returns true when it's safe to bring up the "device settings" dialog in the prefs. // i.e. when the daemon is running and connected, and the device lists are populated. virtual bool deviceSettingsAvailable(); + virtual bool deviceSettingsUpdated(); //return if the list has been updated and never fetched, only to be called from the voicepanel. // Requery the vivox daemon for the current list of input/output devices. // If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed @@ -327,7 +328,6 @@ protected: LLUUID mCallerID; int mErrorStatusCode; int mMediaStreamState; - int mTextStreamState; // obsolete bool mCreateInProgress; // True if a Session.Create has been sent for this session and no response has been received yet. bool mMediaConnectInProgress; // True if a Session.MediaConnect has been sent for this session and no response has been received yet. bool mVoiceInvitePending; // True if a voice invite is pending for this session (usually waiting on a name lookup) @@ -459,14 +459,15 @@ protected: void clearCaptureDevices(); void addCaptureDevice(const std::string& name); void clearRenderDevices(); + void setDevicesListUpdated(bool state); void addRenderDevice(const std::string& name); void buildSetAudioDevices(std::ostringstream &stream); void getCaptureDevicesSendMessage(); void getRenderDevicesSendMessage(); - // local audio updates - void buildLocalAudioUpdates(std::ostringstream &stream); + // local audio updates, mic mute, speaker mute, mic volume and speaker volumes + void sendLocalAudioUpdates(); ///////////////////////////// @@ -482,7 +483,6 @@ protected: void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state); void mediaCompletionEvent(std::string &sessionGroupHandle, std::string &mediaCompletionType); void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming); - //obsolete void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming); void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString); void sessionGroupAddedEvent(std::string &sessionGroupHandle); void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle); @@ -678,7 +678,9 @@ private: bool mTuningMicVolumeDirty; int mTuningSpeakerVolume; bool mTuningSpeakerVolumeDirty; - state mTuningExitState; // state to return to when we leave tuning mode. + state mTuningExitState; // state to return to when we leave tuning mode. + bool mDevicesListUpdated; // set to true when the device list has been updated + // and false when the panelvoicedevicesettings has queried for an update status. std::string mSpatialSessionURI; std::string mSpatialSessionCredentials; @@ -762,7 +764,6 @@ private: // start a text IM session with the specified user // This will be asynchronous, the session may be established at a future time. sessionState* startUserIMSession(const LLUUID& uuid); - // obsolete void sendQueuedTextMessages(sessionState *session); void enforceTether(void); -- cgit v1.2.3 From 7ec58ee04789a8cc819d1151529d843045651bc8 Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Mon, 11 May 2015 04:49:12 +0100 Subject: Added application identifier and testing a bug for for group and P2P calling --- indra/newview/llvoicevivox.cpp | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6ac8d84771..5e92d3f340 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -60,6 +60,7 @@ #include "lltrans.h" #include "llviewerwindow.h" #include "llviewercamera.h" +#include "llversioninfo.h" #include "llviewernetwork.h" #include "llnotificationsutil.h" @@ -506,7 +507,8 @@ void LLVivoxVoiceClient::connectorCreate() << ".log" << "" << loglevel << "" << "" - << "" //Name can cause problems per vivox. + << "" << LLVersionInfo::getChannel().c_str() << " " << LLVersionInfo::getVersion().c_str() << "" + //<< "" //Name can cause problems per vivox. << "12" << "\n\n\n"; @@ -1761,21 +1763,31 @@ void LLVivoxVoiceClient::sessionCreateSendMessage(sessionState *session, bool st LL_DEBUGS("Voice") << "With voice font: " << session->mVoiceFontID << " (" << font_index << ")" << LL_ENDL; session->mCreateInProgress = true; - if(startAudio) + if (startAudio) { session->mMediaConnectInProgress = true; } std::ostringstream stream; - stream - << "mSIPURI << "\" action=\"Session.Create.1\">" - << "" << mAccountHandle << "" - << "" << session->mSIPURI << ""; + + if (!session->mGroupHandle.empty()) { + // reuse the current session group + stream + << "mSIPURI << "\" action=\"SessionGroup.AddSession.1\">" + << "" << session->mGroupHandle << ""; + } + else { + stream + << "mSIPURI << "\" action=\"Session.Create.1\">" + << "" << mAccountHandle << ""; + } + + stream << "" << session->mSIPURI << ""; static const std::string allowed_chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - "0123456789" - "-._~"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789" + "-._~"; if(!session->mHash.empty()) { @@ -2523,6 +2535,7 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void) stream << ""; + stream << "1"; //do not generate responses for update requests stream << "\n\n\n"; } @@ -3072,11 +3085,12 @@ void LLVivoxVoiceClient::reapSession(sessionState *session) { if(session) { - if(!session->mHandle.empty()) +/* if(!session->mHandle.empty()) { LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL; } - else if(session->mCreateInProgress) + else*/ + if(session->mCreateInProgress) { LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL; } -- cgit v1.2.3 From bb43a5226b3136317bb13b7d4f4116d0e68d5bb4 Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Mon, 11 May 2015 10:23:29 -0400 Subject: Backed out changeset: 5eee69247775 --- indra/newview/llvoicevivox.cpp | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 5e92d3f340..6ac8d84771 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -60,7 +60,6 @@ #include "lltrans.h" #include "llviewerwindow.h" #include "llviewercamera.h" -#include "llversioninfo.h" #include "llviewernetwork.h" #include "llnotificationsutil.h" @@ -507,8 +506,7 @@ void LLVivoxVoiceClient::connectorCreate() << ".log" << "" << loglevel << "" << "" - << "" << LLVersionInfo::getChannel().c_str() << " " << LLVersionInfo::getVersion().c_str() << "" - //<< "" //Name can cause problems per vivox. + << "" //Name can cause problems per vivox. << "12" << "\n\n\n"; @@ -1763,31 +1761,21 @@ void LLVivoxVoiceClient::sessionCreateSendMessage(sessionState *session, bool st LL_DEBUGS("Voice") << "With voice font: " << session->mVoiceFontID << " (" << font_index << ")" << LL_ENDL; session->mCreateInProgress = true; - if (startAudio) + if(startAudio) { session->mMediaConnectInProgress = true; } std::ostringstream stream; - - if (!session->mGroupHandle.empty()) { - // reuse the current session group - stream - << "mSIPURI << "\" action=\"SessionGroup.AddSession.1\">" - << "" << session->mGroupHandle << ""; - } - else { - stream - << "mSIPURI << "\" action=\"Session.Create.1\">" - << "" << mAccountHandle << ""; - } - - stream << "" << session->mSIPURI << ""; + stream + << "mSIPURI << "\" action=\"Session.Create.1\">" + << "" << mAccountHandle << "" + << "" << session->mSIPURI << ""; static const std::string allowed_chars = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" - "0123456789" - "-._~"; + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" + "0123456789" + "-._~"; if(!session->mHash.empty()) { @@ -2535,7 +2523,6 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void) stream << ""; - stream << "1"; //do not generate responses for update requests stream << "\n\n\n"; } @@ -3085,12 +3072,11 @@ void LLVivoxVoiceClient::reapSession(sessionState *session) { if(session) { -/* if(!session->mHandle.empty()) + if(!session->mHandle.empty()) { LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL; } - else*/ - if(session->mCreateInProgress) + else if(session->mCreateInProgress) { LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL; } -- cgit v1.2.3 From bb3763ca84981139bbdb9291757946a95198ce55 Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Mon, 11 May 2015 16:29:00 +0100 Subject: Application name added to connector create and a test fix for a race conition in group and P2P calling. --- indra/newview/llvoicevivox.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 6ac8d84771..5d1e5327ad 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -60,6 +60,7 @@ #include "lltrans.h" #include "llviewerwindow.h" #include "llviewercamera.h" +#include "llversioninfo.h" #include "llviewernetwork.h" #include "llnotificationsutil.h" @@ -501,14 +502,15 @@ void LLVivoxVoiceClient::connectorCreate() << "" << mVoiceAccountServerURI << "" << "Normal" << "" - << "" << logpath << "" - << "Connector" - << ".log" - << "" << loglevel << "" + << "" << logpath << "" + << "Connector" + << ".log" + << "" << loglevel << "" << "" - << "" //Name can cause problems per vivox. - << "12" - << "\n\n\n"; + << "" << LLVersionInfo::getChannel().c_str() << " " << LLVersionInfo::getVersion().c_str() << "" + //<< "" //Name can cause problems per vivox. + << "12" + << "\n\n\n"; writeString(stream.str()); } @@ -2523,6 +2525,7 @@ void LLVivoxVoiceClient::sendPositionalUpdate(void) stream << ""; + stream << "1"; //do not generate responses for update requests stream << "\n\n\n"; } @@ -3072,11 +3075,12 @@ void LLVivoxVoiceClient::reapSession(sessionState *session) { if(session) { - if(!session->mHandle.empty()) + /*if(!session->mHandle.empty()) { LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL; } - else if(session->mCreateInProgress) + else*/ + if(session->mCreateInProgress) { LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL; } -- cgit v1.2.3 From c4e26ac04dd8fc5cc48266c4a07ec2bd25af00b1 Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Tue, 12 May 2015 21:05:09 +0100 Subject: Deleted some obsolete comments --- indra/newview/llvoicevivox.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 5d1e5327ad..fc96b9e21d 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -3075,11 +3075,7 @@ void LLVivoxVoiceClient::reapSession(sessionState *session) { if(session) { - /*if(!session->mHandle.empty()) - { - LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL; - } - else*/ + if(session->mCreateInProgress) { LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL; @@ -3098,7 +3094,6 @@ void LLVivoxVoiceClient::reapSession(sessionState *session) } else { - // TODO: Question: Should we check for queued text messages here? // We don't have a reason to keep tracking this session, so just delete it. LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL; deleteSession(session); -- cgit v1.2.3 From 239bff71827c2467c953b4ee803a8e0b0348e32a Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Tue, 19 May 2015 20:18:24 -0400 Subject: Changes to remove zlib and vivoxplatform dlls from the windows build --- indra/newview/CMakeLists.txt | 2 -- indra/newview/llvoicevivox.cpp | 9 ++++++--- indra/newview/viewer_manifest.py | 2 -- 3 files changed, 6 insertions(+), 7 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 13040ea423..0e3b802fc7 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1735,8 +1735,6 @@ if (WINDOWS) ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxsdk.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ortp.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libsndfile-1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/zlib1.dll - ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxplatform.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/vivoxoal.dll ${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/ca-bundle.crt ${GOOGLE_PERF_TOOLS_SOURCE} diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index fc96b9e21d..da8f51bc03 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -3067,7 +3067,8 @@ void LLVivoxVoiceClient::sessionRemovedEvent( } else { - LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL; + // Already reaped this session. + LL_DEBUGS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL; } } @@ -3310,7 +3311,8 @@ void LLVivoxVoiceClient::mediaStreamUpdatedEvent( } else { - LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL; + // session disconnectintg and disconnected events arriving after we have already left the session. + LL_DEBUGS("Voice") << "session " << sessionHandle << " not found"<< LL_ENDL; } } @@ -3384,6 +3386,7 @@ void LLVivoxVoiceClient::participantRemovedEvent( } else { + // a late arriving event on a session we have already left. LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL; } } @@ -3468,7 +3471,7 @@ void LLVivoxVoiceClient::participantUpdatedEvent( } else { - LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL; + LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL; } } diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 32cf9d3df6..32c4350b40 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -396,8 +396,6 @@ class Windows_i686_Manifest(ViewerManifest): self.path("vivoxsdk.dll") self.path("ortp.dll") self.path("libsndfile-1.dll") - self.path("zlib1.dll") - self.path("vivoxplatform.dll") self.path("vivoxoal.dll") self.path("ca-bundle.crt") -- cgit v1.2.3 From 97c67a6634de418e85efcfcd116b2e00efb436e3 Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Thu, 2 Jul 2015 12:49:55 -0400 Subject: test fix for a race condition in the state machine when switching between region voice and P2P calls. --- indra/newview/llvoicevivox.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index da8f51bc03..e4b045bdeb 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -1951,7 +1951,10 @@ void LLVivoxVoiceClient::leaveAudioSession() void LLVivoxVoiceClient::sessionTerminateSendMessage(sessionState *session) { std::ostringstream stream; - + + sessionGroupTerminateSendMessage(session); + return; + /* LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL; stream << "" @@ -1959,6 +1962,7 @@ void LLVivoxVoiceClient::sessionTerminateSendMessage(sessionState *session) << "\n\n\n"; writeString(stream.str()); + */ } void LLVivoxVoiceClient::sessionGroupTerminateSendMessage(sessionState *session) @@ -1977,7 +1981,9 @@ void LLVivoxVoiceClient::sessionGroupTerminateSendMessage(sessionState *session) void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session) { std::ostringstream stream; - + sessionGroupTerminateSendMessage(session); + return; + /* LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL; stream << "" @@ -1987,6 +1993,7 @@ void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session << "\n\n\n"; writeString(stream.str()); + */ } -- cgit v1.2.3 From 8aedbbda159344ed1af042e562c34ae5759a3b0d Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Tue, 6 Oct 2015 13:18:53 -0400 Subject: A small state machine change to wait until the media update event has arrived when leaving a region channel and before joining a p2p channel --- indra/newview/llvoicevivox.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index e4b045bdeb..77ce2d9b8f 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -1538,8 +1538,9 @@ void LLVivoxVoiceClient::stateMachine() // Must do this first, since it uses mAudioSession. notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL); - if (mAudioSession) + if (mAudioSession && mSessionTerminateRequested) { + // will only go this section on the frist frame when a call is being cancelled. leaveAudioSession(); sessionState *oldSession = mAudioSession; @@ -1556,6 +1557,8 @@ void LLVivoxVoiceClient::stateMachine() } // 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 + // the region chat. mSessionTerminateRequested = false; if((mVoiceEnabled || !mIsInitialized) && !mRelogRequested && !LLApp::isExiting()) @@ -3176,6 +3179,9 @@ void LLVivoxVoiceClient::leftAudioSession( break; } } + else if ( mAudioSession == NULL && (getState() == stateSessionTerminated) ){ + setState(stateNoChannel); + } } void LLVivoxVoiceClient::accountLoginStateChangeEvent( -- cgit v1.2.3 From 4d81570d62bc9d746565083ef18fdc16c198a5dc Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Wed, 7 Oct 2015 17:39:50 -0400 Subject: A small tweak when SLVoice is not running --- indra/newview/llvoicevivox.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 77ce2d9b8f..7b4d9c11c0 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -391,6 +391,7 @@ void LLVivoxVoiceClient::terminate() #endif closeSocket(); // Need to do this now -- bad things happen if the destructor does it later. cleanUp(); + mConnected = false; } else { @@ -735,16 +736,18 @@ void LLVivoxVoiceClient::stateMachine() //if((getState() != stateDisabled) && (getState() != stateDisableCleanup)) { // User turned off voice support. Send the cleanup messages, close the socket, and reset. - if(!mConnected || mTerminateDaemon) + if(!mConnected && mTerminateDaemon) { // if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill. LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL; killGateway(); mTerminateDaemon = false; + mConnected = false; + } + else { + logout(); + connectorShutdown(); } - - logout(); - connectorShutdown(); setState(stateDisableCleanup); } -- cgit v1.2.3 From 43253a36ec382249249e2dcf7b562af0dfb6fd84 Mon Sep 17 00:00:00 2001 From: Bjoseph Wombat Date: Tue, 3 Nov 2015 11:34:55 -0500 Subject: stopp SLVoice from logging when the timeout for logouts expires. --- indra/newview/llvoicevivox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 7b4d9c11c0..ffc4cbab53 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -819,7 +819,7 @@ void LLVivoxVoiceClient::stateMachine() std::string shutdown_timeout = gSavedSettings.getString("VivoxShutdownTimeout"); if(loglevel.empty()) { - loglevel = "0"; // turn logging off completely + loglevel = "-1"; // turn logging off completely, was 0 for error level logging. } params.args.add("-ll"); -- cgit v1.2.3