aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llvoiceclient.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llvoiceclient.cpp180
1 files changed, 89 insertions, 91 deletions
diff --git a/linden/indra/newview/llvoiceclient.cpp b/linden/indra/newview/llvoiceclient.cpp
index 145132a..76ef87d 100644
--- a/linden/indra/newview/llvoiceclient.cpp
+++ b/linden/indra/newview/llvoiceclient.cpp
@@ -1362,10 +1362,13 @@ void LLVoiceClient::login(
1362 mVoiceSIPURIHostName = voice_sip_uri_hostname; 1362 mVoiceSIPURIHostName = voice_sip_uri_hostname;
1363 mVoiceAccountServerURI = voice_account_server_uri; 1363 mVoiceAccountServerURI = voice_account_server_uri;
1364 1364
1365 if((getState() >= stateLoggingIn) && (getState() < stateLoggedOut)) 1365 if(!mAccountHandle.empty())
1366 { 1366 {
1367 // Already logged in. This is an internal error. 1367 // Already logged in.
1368 LL_ERRS("Voice") << "Can't login again. Called from wrong state." << LL_ENDL; 1368 LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
1369
1370 // Don't process another login.
1371 return;
1369 } 1372 }
1370 else if ( account_name != mAccountName ) 1373 else if ( account_name != mAccountName )
1371 { 1374 {
@@ -1431,12 +1434,16 @@ std::string LLVoiceClient::state2string(LLVoiceClient::state inState)
1431 1434
1432 switch(inState) 1435 switch(inState)
1433 { 1436 {
1437 CASE(stateDisableCleanup);
1434 CASE(stateDisabled); 1438 CASE(stateDisabled);
1435 CASE(stateStart); 1439 CASE(stateStart);
1436 CASE(stateDaemonLaunched); 1440 CASE(stateDaemonLaunched);
1437 CASE(stateConnecting); 1441 CASE(stateConnecting);
1442 CASE(stateConnected);
1438 CASE(stateIdle); 1443 CASE(stateIdle);
1439 CASE(stateNeedsProvision); 1444 CASE(stateMicTuningStart);
1445 CASE(stateMicTuningRunning);
1446 CASE(stateMicTuningStop);
1440 CASE(stateConnectorStart); 1447 CASE(stateConnectorStart);
1441 CASE(stateConnectorStarting); 1448 CASE(stateConnectorStarting);
1442 CASE(stateConnectorStarted); 1449 CASE(stateConnectorStarted);
@@ -1447,9 +1454,6 @@ std::string LLVoiceClient::state2string(LLVoiceClient::state inState)
1447 CASE(stateLoggedIn); 1454 CASE(stateLoggedIn);
1448 CASE(stateCreatingSessionGroup); 1455 CASE(stateCreatingSessionGroup);
1449 CASE(stateNoChannel); 1456 CASE(stateNoChannel);
1450 CASE(stateMicTuningStart);
1451 CASE(stateMicTuningRunning);
1452 CASE(stateMicTuningStop);
1453 CASE(stateJoiningSession); 1457 CASE(stateJoiningSession);
1454 CASE(stateSessionJoined); 1458 CASE(stateSessionJoined);
1455 CASE(stateRunning); 1459 CASE(stateRunning);
@@ -1466,7 +1470,6 @@ std::string LLVoiceClient::state2string(LLVoiceClient::state inState)
1466 CASE(stateJoinSessionFailed); 1470 CASE(stateJoinSessionFailed);
1467 CASE(stateJoinSessionFailedWaiting); 1471 CASE(stateJoinSessionFailedWaiting);
1468 CASE(stateJail); 1472 CASE(stateJail);
1469 CASE(stateMicTuningNoLogin);
1470 } 1473 }
1471 1474
1472#undef CASE 1475#undef CASE
@@ -1522,9 +1525,13 @@ void LLVoiceClient::stateMachine()
1522 { 1525 {
1523 updatePosition(); 1526 updatePosition();
1524 } 1527 }
1528 else if(mTuningMode)
1529 {
1530 // Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
1531 }
1525 else 1532 else
1526 { 1533 {
1527 if(getState() != stateDisabled) 1534 if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
1528 { 1535 {
1529 // User turned off voice support. Send the cleanup messages, close the socket, and reset. 1536 // User turned off voice support. Send the cleanup messages, close the socket, and reset.
1530 if(!mConnected) 1537 if(!mConnected)
@@ -1534,16 +1541,10 @@ void LLVoiceClient::stateMachine()
1534 killGateway(); 1541 killGateway();
1535 } 1542 }
1536 1543
1537// leaveAudioSession();
1538 logout(); 1544 logout();
1539 // As of SDK version 4885, this should no longer be necessary. It will linger after the socket close if it needs to.
1540 // ms_sleep(2000);
1541 connectorShutdown(); 1545 connectorShutdown();
1542 closeSocket();
1543 deleteAllSessions();
1544 deleteAllBuddies();
1545 1546
1546 setState(stateDisabled); 1547 setState(stateDisableCleanup);
1547 } 1548 }
1548 } 1549 }
1549 1550
@@ -1579,9 +1580,24 @@ void LLVoiceClient::stateMachine()
1579 1580
1580 switch(getState()) 1581 switch(getState())
1581 { 1582 {
1583 //MARK: stateDisableCleanup
1584 case stateDisableCleanup:
1585 // Clean up and reset everything.
1586 closeSocket();
1587 deleteAllSessions();
1588 deleteAllBuddies();
1589
1590 mConnectorHandle.clear();
1591 mAccountHandle.clear();
1592 mAccountPassword.clear();
1593 mVoiceAccountServerURI.clear();
1594
1595 setState(stateDisabled);
1596 break;
1597
1582 //MARK: stateDisabled 1598 //MARK: stateDisabled
1583 case stateDisabled: 1599 case stateDisabled:
1584 if(mVoiceEnabled && (!mAccountName.empty() || mTuningMode)) 1600 if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
1585 { 1601 {
1586 setState(stateStart); 1602 setState(stateStart);
1587 } 1603 }
@@ -1780,29 +1796,34 @@ void LLVoiceClient::stateMachine()
1780 1796
1781 mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS); 1797 mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
1782 1798
1783 setState(stateIdle); 1799 setState(stateConnected);
1784 } 1800 }
1785 1801
1786 break; 1802 break;
1787 1803
1788 //MARK: stateIdle 1804 //MARK: stateConnected
1789 case stateIdle: 1805 case stateConnected:
1790 // Initial devices query 1806 // Initial devices query
1791 getCaptureDevicesSendMessage(); 1807 getCaptureDevicesSendMessage();
1792 getRenderDevicesSendMessage(); 1808 getRenderDevicesSendMessage();
1793 1809
1794 mLoginRetryCount = 0; 1810 mLoginRetryCount = 0;
1795 1811
1796 setState(stateNeedsProvision); 1812 setState(stateIdle);
1797
1798 break; 1813 break;
1799 1814
1800 //MARK: stateNeedsProvision 1815 //MARK: stateIdle
1801 case stateNeedsProvision: 1816 case stateIdle:
1802 if(!mVoiceEnabled) 1817 // This is the idle state where we're connected to the daemon but haven't set up a connector yet.
1818 if(mTuningMode)
1803 { 1819 {
1804 // We were never logged in. This will shut down the connector. 1820 mTuningExitState = stateIdle;
1805 setState(stateLoggedOut); 1821 setState(stateMicTuningStart);
1822 }
1823 else if(!mVoiceEnabled)
1824 {
1825 // We never started up the connector. This will shut down the daemon.
1826 setState(stateConnectorStopped);
1806 } 1827 }
1807 else if(!mAccountName.empty()) 1828 else if(!mAccountName.empty())
1808 { 1829 {
@@ -1820,50 +1841,8 @@ void LLVoiceClient::stateMachine()
1820 } 1841 }
1821 } 1842 }
1822 } 1843 }
1823 else if(mTuningMode)
1824 {
1825 mTuningExitState = stateNeedsProvision;
1826 setState(stateMicTuningStart);
1827 }
1828 break;
1829
1830 //MARK: stateConnectorStart
1831 case stateConnectorStart:
1832 if(!mVoiceEnabled)
1833 {
1834 // We were never logged in. This will shut down the connector.
1835 setState(stateLoggedOut);
1836 }
1837 else if(!mVoiceAccountServerURI.empty())
1838 {
1839 connectorCreate();
1840 }
1841 else if(mTuningMode)
1842 {
1843 mTuningExitState = stateConnectorStart;
1844 setState(stateMicTuningStart);
1845 }
1846 break;
1847
1848 //MARK: stateConnectorStarting
1849 case stateConnectorStarting: // waiting for connector handle
1850 // connectorCreateResponse() will transition from here to stateConnectorStarted.
1851 break;
1852
1853 //MARK: stateConnectorStarted
1854 case stateConnectorStarted: // connector handle received
1855 if(!mVoiceEnabled)
1856 {
1857 // We were never logged in. This will shut down the connector.
1858 setState(stateLoggedOut);
1859 }
1860 else
1861 {
1862 // The connector is started. Send a login message.
1863 setState(stateNeedsLogin);
1864 }
1865 break; 1844 break;
1866 1845
1867 //MARK: stateMicTuningStart 1846 //MARK: stateMicTuningStart
1868 case stateMicTuningStart: 1847 case stateMicTuningStart:
1869 if(mUpdateTimer.hasExpired()) 1848 if(mUpdateTimer.hasExpired())
@@ -1898,7 +1877,7 @@ void LLVoiceClient::stateMachine()
1898 1877
1899 //MARK: stateMicTuningRunning 1878 //MARK: stateMicTuningRunning
1900 case stateMicTuningRunning: 1879 case stateMicTuningRunning:
1901 if(!mTuningMode || !mVoiceEnabled || mSessionTerminateRequested || mCaptureDeviceDirty || mRenderDeviceDirty) 1880 if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
1902 { 1881 {
1903 // All of these conditions make us leave tuning mode. 1882 // All of these conditions make us leave tuning mode.
1904 setState(stateMicTuningStop); 1883 setState(stateMicTuningStop);
@@ -1952,7 +1931,39 @@ void LLVoiceClient::stateMachine()
1952 1931
1953 } 1932 }
1954 break; 1933 break;
1955 1934
1935 //MARK: stateConnectorStart
1936 case stateConnectorStart:
1937 if(!mVoiceEnabled)
1938 {
1939 // We were never logged in. This will shut down the connector.
1940 setState(stateLoggedOut);
1941 }
1942 else if(!mVoiceAccountServerURI.empty())
1943 {
1944 connectorCreate();
1945 }
1946 break;
1947
1948 //MARK: stateConnectorStarting
1949 case stateConnectorStarting: // waiting for connector handle
1950 // connectorCreateResponse() will transition from here to stateConnectorStarted.
1951 break;
1952
1953 //MARK: stateConnectorStarted
1954 case stateConnectorStarted: // connector handle received
1955 if(!mVoiceEnabled)
1956 {
1957 // We were never logged in. This will shut down the connector.
1958 setState(stateLoggedOut);
1959 }
1960 else
1961 {
1962 // The connector is started. Send a login message.
1963 setState(stateNeedsLogin);
1964 }
1965 break;
1966
1956 //MARK: stateLoginRetry 1967 //MARK: stateLoginRetry
1957 case stateLoginRetry: 1968 case stateLoginRetry:
1958 if(mLoginRetryCount == 0) 1969 if(mLoginRetryCount == 0)
@@ -2311,11 +2322,7 @@ void LLVoiceClient::stateMachine()
2311 2322
2312 //MARK: stateConnectorStopped 2323 //MARK: stateConnectorStopped
2313 case stateConnectorStopped: // connector stop received 2324 case stateConnectorStopped: // connector stop received
2314 // Clean up and reset everything. 2325 setState(stateDisableCleanup);
2315 closeSocket();
2316 deleteAllSessions();
2317 deleteAllBuddies();
2318 setState(stateDisabled);
2319 break; 2326 break;
2320 2327
2321 //MARK: stateConnectorFailed 2328 //MARK: stateConnectorFailed
@@ -2366,11 +2373,6 @@ void LLVoiceClient::stateMachine()
2366 // We have given up. Do nothing. 2373 // We have given up. Do nothing.
2367 break; 2374 break;
2368 2375
2369 //MARK: stateMicTuningNoLogin
2370 case stateMicTuningNoLogin:
2371 // *TODO: Implement me.
2372 LL_WARNS("Voice") << "stateMicTuningNoLogin not handled" << LL_ENDL;
2373 break;
2374 } 2376 }
2375 2377
2376 if(mAudioSession && mAudioSession->mParticipantsChanged) 2378 if(mAudioSession && mAudioSession->mParticipantsChanged)
@@ -2943,12 +2945,8 @@ void LLVoiceClient::daemonDied()
2943 // The daemon died, so the connection is gone. Reset everything and start over. 2945 // The daemon died, so the connection is gone. Reset everything and start over.
2944 LL_WARNS("Voice") << "Connection to vivox daemon lost. Resetting state."<< LL_ENDL; 2946 LL_WARNS("Voice") << "Connection to vivox daemon lost. Resetting state."<< LL_ENDL;
2945 2947
2946 closeSocket();
2947 deleteAllSessions();
2948 deleteAllBuddies();
2949
2950 // Try to relaunch the daemon 2948 // Try to relaunch the daemon
2951 setState(stateDisabled); 2949 setState(stateDisableCleanup);
2952} 2950}
2953 2951
2954void LLVoiceClient::giveUp() 2952void LLVoiceClient::giveUp()
@@ -5631,8 +5629,8 @@ void LLVoiceClient::setVoiceEnabled(bool enabled)
5631 } 5629 }
5632 else 5630 else
5633 { 5631 {
5634 // for now, leave active channel, to auto join when turning voice back on 5632 // Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
5635 //LLVoiceChannel::getCurrentVoiceChannel->deactivate(); 5633 LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
5636 } 5634 }
5637 } 5635 }
5638} 5636}