diff options
Diffstat (limited to 'indra/newview/llvoiceclient.cpp')
-rw-r--r-- | indra/newview/llvoiceclient.cpp | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 5af7528ada..f293c4c417 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -26,7 +26,9 @@ #include "llvoiceclient.h" #include "llvoicevivox.h" +#if LL_WEBRTC #include "llvoicewebrtc.h" +#endif #include "llviewernetwork.h" #include "llviewercontrol.h" #include "llcommandhandler.h" @@ -120,10 +122,12 @@ LLVoiceModuleInterface *getVoiceModule(const std::string &voice_server_type) { return (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); } +#if LL_WEBRTC else if (voice_server_type == WEBRTC_VOICE_SERVER_TYPE) { return (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); } +#endif else { LLNotificationsUtil::add("VoiceVersionMismatch"); @@ -165,14 +169,18 @@ void LLVoiceClient::init(LLPumpIO *pump) { // Initialize all of the voice modules m_servicePump = pump; +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->init(pump); +#endif LLVivoxVoiceClient::getInstance()->init(pump); } void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID) { gAgent.addRegionChangedCallback(boost::bind(&LLVoiceClient::onRegionChanged, this)); +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->userAuthorized(user_id, agentID); +#endif LLVivoxVoiceClient::getInstance()->userAuthorized(user_id, agentID); } @@ -281,7 +289,9 @@ void LLVoiceClient::setNonSpatialVoiceModule(const std::string &voice_server_typ void LLVoiceClient::setHidden(bool hidden) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setHidden(hidden); +#endif LLVivoxVoiceClient::getInstance()->setHidden(hidden); } @@ -322,7 +332,9 @@ void LLVoiceClient::updateSettings() updateMicMuteLogic(); +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->updateSettings(); +#endif LLVivoxVoiceClient::getInstance()->updateSettings(); } @@ -331,34 +343,54 @@ void LLVoiceClient::updateSettings() void LLVoiceClient::tuningStart() { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningStart(); +#endif LLVivoxVoiceClient::getInstance()->tuningStart(); } void LLVoiceClient::tuningStop() { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningStop(); +#endif LLVivoxVoiceClient::getInstance()->tuningStop(); } bool LLVoiceClient::inTuningMode() { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->inTuningMode(); +#else + return LLVivoxVoiceClient::getInstance()->inTuningMode(); +#endif } void LLVoiceClient::tuningSetMicVolume(float volume) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningSetMicVolume(volume); +#else + LLVivoxVoiceClient::getInstance()->tuningSetMicVolume(volume); +#endif } void LLVoiceClient::tuningSetSpeakerVolume(float volume) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->tuningSetSpeakerVolume(volume); +#else + LLVivoxVoiceClient::getInstance()->tuningSetSpeakerVolume(volume); +#endif } float LLVoiceClient::tuningGetEnergy(void) { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->tuningGetEnergy(); +#else + return LLVivoxVoiceClient::getInstance()->tuningGetEnergy(); +#endif } //------------------------------------------------ @@ -366,40 +398,64 @@ float LLVoiceClient::tuningGetEnergy(void) bool LLVoiceClient::deviceSettingsAvailable() { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->deviceSettingsAvailable(); +#else + return LLVivoxVoiceClient::getInstance()->deviceSettingsAvailable(); +#endif } bool LLVoiceClient::deviceSettingsUpdated() { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->deviceSettingsUpdated(); +#else + return LLVivoxVoiceClient::getInstance()->deviceSettingsUpdated(); +#endif } void LLVoiceClient::refreshDeviceLists(bool clearCurrentList) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->refreshDeviceLists(clearCurrentList); +#else + LLVivoxVoiceClient::getInstance()->refreshDeviceLists(clearCurrentList); +#endif } void LLVoiceClient::setCaptureDevice(const std::string& name) { LLVivoxVoiceClient::getInstance()->setCaptureDevice(name); +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setCaptureDevice(name); +#endif } void LLVoiceClient::setRenderDevice(const std::string& name) { LLVivoxVoiceClient::getInstance()->setRenderDevice(name); +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setRenderDevice(name); +#endif } const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices() { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->getCaptureDevices(); +#else + return LLVivoxVoiceClient::getInstance()->getCaptureDevices(); +#endif } const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->getRenderDevices(); +#else + return LLVivoxVoiceClient::getInstance()->getRenderDevices(); +#endif } @@ -408,13 +464,19 @@ const LLVoiceDeviceList& LLVoiceClient::getRenderDevices() void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants) const { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->getParticipantList(participants); +#endif LLVivoxVoiceClient::getInstance()->getParticipantList(participants); } bool LLVoiceClient::isParticipant(const LLUUID &speaker_id) const { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->isParticipant(speaker_id) || +#else + return +#endif LLVivoxVoiceClient::getInstance()->isParticipant(speaker_id); } @@ -507,13 +569,21 @@ void LLVoiceClient::activateSpatialChannel(bool activate) bool LLVoiceClient::isCurrentChannel(const LLSD& channelInfo) { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->isCurrentChannel(channelInfo) || +#else + return +#endif LLVivoxVoiceClient::getInstance()->isCurrentChannel(channelInfo); } bool LLVoiceClient::compareChannels(const LLSD &channelInfo1, const LLSD &channelInfo2) { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2) || +#else + return +#endif LLVivoxVoiceClient::getInstance()->compareChannels(channelInfo1, channelInfo2); } @@ -555,13 +625,17 @@ LLVoiceP2POutgoingCallInterface *LLVoiceClient::getOutgoingCallInterface(const L void LLVoiceClient::setVoiceVolume(F32 volume) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setVoiceVolume(volume); +#endif LLVivoxVoiceClient::getInstance()->setVoiceVolume(volume); } void LLVoiceClient::setMicGain(F32 gain) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setMicGain(gain); +#endif LLVivoxVoiceClient::getInstance()->setMicGain(gain); } @@ -608,7 +682,9 @@ bool LLVoiceClient::voiceEnabled() void LLVoiceClient::setVoiceEnabled(bool enabled) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setVoiceEnabled(enabled); +#endif LLVivoxVoiceClient::getInstance()->setVoiceEnabled(enabled); } @@ -628,7 +704,9 @@ void LLVoiceClient::updateMicMuteLogic() // Either of these always overrides any other PTT setting. new_mic_mute = true; } +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setMuteMic(new_mic_mute); +#endif LLVivoxVoiceClient::getInstance()->setMuteMic(new_mic_mute); } @@ -723,18 +801,26 @@ bool LLVoiceClient::getVoiceEnabled(const LLUUID& id) const std::string LLVoiceClient::getDisplayName(const LLUUID& id) const { +#if LL_WEBRTC std::string result = LLWebRTCVoiceClient::getInstance()->getDisplayName(id); if (result.empty()) { result = LLVivoxVoiceClient::getInstance()->getDisplayName(id); } return result; +#else + return LLVivoxVoiceClient::getInstance()->getDisplayName(id); +#endif } bool LLVoiceClient::isVoiceWorking() const { +#if LL_WEBRTC return LLVivoxVoiceClient::getInstance()->isVoiceWorking() || LLWebRTCVoiceClient::getInstance()->isVoiceWorking(); +#else + return LLVivoxVoiceClient::getInstance()->isVoiceWorking(); +#endif } bool LLVoiceClient::isParticipantAvatar(const LLUUID& id) @@ -749,7 +835,11 @@ bool LLVoiceClient::isOnlineSIP(const LLUUID& id) bool LLVoiceClient::getIsSpeaking(const LLUUID& id) { +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->getIsSpeaking(id) || +#else + return +#endif LLVivoxVoiceClient::getInstance()->getIsSpeaking(id); } @@ -757,14 +847,22 @@ bool LLVoiceClient::getIsModeratorMuted(const LLUUID& id) { // don't bother worrying about p2p calls, as // p2p calls don't have mute. +#if LL_WEBRTC return LLWebRTCVoiceClient::getInstance()->getIsModeratorMuted(id) || +#else + return +#endif LLVivoxVoiceClient::getInstance()->getIsModeratorMuted(id); } F32 LLVoiceClient::getCurrentPower(const LLUUID& id) { +#if LL_WEBRTC return std::fmax(LLVivoxVoiceClient::getInstance()->getCurrentPower(id), LLWebRTCVoiceClient::getInstance()->getCurrentPower(id)); +#else + return LLVivoxVoiceClient::getInstance()->getCurrentPower(id); +#endif } bool LLVoiceClient::getOnMuteList(const LLUUID& id) @@ -776,12 +874,18 @@ bool LLVoiceClient::getOnMuteList(const LLUUID& id) F32 LLVoiceClient::getUserVolume(const LLUUID& id) { +#if LL_WEBRTC return std::fmax(LLVivoxVoiceClient::getInstance()->getUserVolume(id), LLWebRTCVoiceClient::getInstance()->getUserVolume(id)); +#else + return LLVivoxVoiceClient::getInstance()->getUserVolume(id); +#endif } void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume) { +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->setUserVolume(id, volume); +#endif LLVivoxVoiceClient::getInstance()->setUserVolume(id, volume); } @@ -791,7 +895,9 @@ void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume) void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer) { LLVivoxVoiceClient::getInstance()->addObserver(observer); +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->addObserver(observer); +#endif } void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer) @@ -800,16 +906,20 @@ void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer) { LLVivoxVoiceClient::getInstance()->removeObserver(observer); } +#if LL_WEBRTC if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } +#endif } void LLVoiceClient::addObserver(LLFriendObserver* observer) { LLVivoxVoiceClient::getInstance()->addObserver(observer); +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->addObserver(observer); +#endif } void LLVoiceClient::removeObserver(LLFriendObserver* observer) @@ -818,16 +928,20 @@ void LLVoiceClient::removeObserver(LLFriendObserver* observer) { LLVivoxVoiceClient::getInstance()->removeObserver(observer); } +#if LL_WEBRTC if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } +#endif } void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer) { LLVivoxVoiceClient::getInstance()->addObserver(observer); +#if LL_WEBRTC LLWebRTCVoiceClient::getInstance()->addObserver(observer); +#endif } void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) @@ -836,10 +950,12 @@ void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer) { LLVivoxVoiceClient::getInstance()->removeObserver(observer); } +#if LL_WEBRTC if (LLWebRTCVoiceClient::instanceExists()) { LLWebRTCVoiceClient::getInstance()->removeObserver(observer); } +#endif } std::string LLVoiceClient::sipURIFromID(const LLUUID &id) const @@ -902,10 +1018,12 @@ class LLViewerRequiredVoiceVersion : public LLHTTPNode { voiceModule = (LLVoiceModuleInterface *) LLVivoxVoiceClient::getInstance(); } +#if LL_WEBRTC else if (voice_server_type == "webrtc") { voiceModule = (LLVoiceModuleInterface *) LLWebRTCVoiceClient::getInstance(); } +#endif else { LL_WARNS("Voice") << "Unknown voice server type " << voice_server_type << LL_ENDL; |