summaryrefslogtreecommitdiff
path: root/indra/llwebrtc
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwebrtc')
-rw-r--r--indra/llwebrtc/CMakeLists.txt23
-rw-r--r--indra/llwebrtc/llwebrtc.cpp66
-rw-r--r--indra/llwebrtc/llwebrtc_impl.h7
3 files changed, 75 insertions, 21 deletions
diff --git a/indra/llwebrtc/CMakeLists.txt b/indra/llwebrtc/CMakeLists.txt
index 7700eeb7c6..a64a3e4dac 100644
--- a/indra/llwebrtc/CMakeLists.txt
+++ b/indra/llwebrtc/CMakeLists.txt
@@ -28,9 +28,7 @@ list(APPEND llwebrtc_SOURCE_FILES ${llwebrtc_HEADER_FILES})
add_library (llwebrtc SHARED ${llwebrtc_SOURCE_FILES})
-if (NOT USESYSTEMLIBS)
-set_target_properties(llwebrtc PROPERTIES PUBLIC_HEADER llwebrtc.h)
-endif (NOT USESYSTEMLIBS)
+#set_target_properties(llwebrtc PROPERTIES PUBLIC_HEADER llwebrtc.h)
if (WINDOWS)
cmake_policy(SET CMP0091 NEW)
@@ -80,12 +78,17 @@ endif (LL_TESTS)
if (INSTALL)
if (DARWIN)
set(_LIB ../Frameworks)
- elseif (EXISTS ${CMAKE_SYSROOT}/usr/lib/${ARCH}-linux-gnu)
+ elseif (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu))
set(_LIB lib/${ARCH}-linux-gnu)
- elseif (EXISTS /lib64 AND NOT ${LINUX_DISTRO} MATCHES arch)
- set(_LIB lib64)
- else (DARWIN)
+ elseif (${LINUX_DISTRO} MATCHES fedora OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed) OR (${LINUX_DISTRO} MATCHES gentoo))
+ set(_LIB lib${ADDRESS_SIZE})
+ else ()
set(_LIB lib)
- endif (DARWIN)
- install(TARGETS ${PROJECT_NAME} DESTINATION ${_LIB})
-endif (INSTALL)
+ endif ()
+
+ if (WINDOWS)
+ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/${PROJECT_NAME}.dll DESTINATION .)
+ else ()
+ install(TARGETS ${PROJECT_NAME} DESTINATION ${_LIB})
+ endif ()
+endif ()
diff --git a/indra/llwebrtc/llwebrtc.cpp b/indra/llwebrtc/llwebrtc.cpp
index 9b3dde4d0f..12d02bbcc1 100644
--- a/indra/llwebrtc/llwebrtc.cpp
+++ b/indra/llwebrtc/llwebrtc.cpp
@@ -432,9 +432,7 @@ void ll_set_device_module_capture_device(rtc::scoped_refptr<webrtc::AudioDeviceM
// has it at 0
device_module->SetRecordingDevice(device + 1);
#endif
- device_module->SetStereoRecording(false);
device_module->InitMicrophone();
- device_module->InitRecording();
}
void LLWebRTCImpl::setCaptureDevice(const std::string &id)
@@ -475,6 +473,8 @@ void LLWebRTCImpl::setCaptureDevice(const std::string &id)
ll_set_device_module_capture_device(mPeerDeviceModule, recordingDevice);
if (recording)
{
+ mPeerDeviceModule->SetStereoRecording(false);
+ mPeerDeviceModule->InitRecording();
mPeerDeviceModule->StartRecording();
}
});
@@ -496,9 +496,7 @@ void ll_set_device_module_render_device(rtc::scoped_refptr<webrtc::AudioDeviceMo
#else
device_module->SetPlayoutDevice(device + 1);
#endif
- device_module->SetStereoPlayout(true);
device_module->InitSpeaker();
- device_module->InitPlayout();
}
void LLWebRTCImpl::setRenderDevice(const std::string &id)
@@ -542,6 +540,8 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id)
ll_set_device_module_render_device(mPeerDeviceModule, playoutDevice);
if (playing)
{
+ mPeerDeviceModule->SetStereoPlayout(true);
+ mPeerDeviceModule->InitPlayout();
mPeerDeviceModule->StartPlayout();
}
});
@@ -672,7 +672,10 @@ LLWebRTCPeerConnectionInterface *LLWebRTCImpl::newPeerConnection()
peerConnection->init(this);
mPeerConnections.emplace_back(peerConnection);
- peerConnection->enableSenderTracks(!mMute);
+ // Should it really start disabled?
+ // Seems like something doesn't get the memo and senders need to be reset later
+ // to remove the voice indicator from taskbar
+ peerConnection->enableSenderTracks(false);
if (mPeerConnections.empty())
{
setRecording(true);
@@ -706,7 +709,7 @@ void LLWebRTCImpl::freePeerConnection(LLWebRTCPeerConnectionInterface* peer_conn
LLWebRTCPeerConnectionImpl::LLWebRTCPeerConnectionImpl() :
mWebRTCImpl(nullptr),
mPeerConnection(nullptr),
- mMute(true),
+ mMute(MUTE_INITIAL),
mAnswerReceived(false)
{
}
@@ -741,6 +744,19 @@ void LLWebRTCPeerConnectionImpl::terminate()
}
}
+ // to remove 'Secondlife is recording' icon from taskbar
+ // if user was speaking
+ auto senders = mPeerConnection->GetSenders();
+ for (auto& sender : senders)
+ {
+ auto track = sender->track();
+ if (track)
+ {
+ track->set_enabled(false);
+ }
+ }
+ mPeerConnection->SetAudioRecording(false);
+
mPeerConnection->Close();
if (mLocalStream)
{
@@ -830,6 +846,7 @@ bool LLWebRTCPeerConnectionImpl::initializeConnection(const LLWebRTCPeerConnecti
audioOptions.auto_gain_control = true;
audioOptions.echo_cancellation = true;
audioOptions.noise_suppression = true;
+ audioOptions.init_recording_on_send = false;
mLocalStream = mPeerConnectionFactory->CreateLocalMediaStream("SLStream");
@@ -889,6 +906,7 @@ void LLWebRTCPeerConnectionImpl::enableSenderTracks(bool enable)
// set_enabled shouldn't be done on the worker thread.
if (mPeerConnection)
{
+ mPeerConnection->SetAudioRecording(enable);
auto senders = mPeerConnection->GetSenders();
for (auto &sender : senders)
{
@@ -934,12 +952,23 @@ void LLWebRTCPeerConnectionImpl::AnswerAvailable(const std::string &sdp)
void LLWebRTCPeerConnectionImpl::setMute(bool mute)
{
- mMute = mute;
+ EMicMuteState new_state = mute ? MUTE_MUTED : MUTE_UNMUTED;
+ if (new_state == mMute)
+ {
+ return; // no change
+ }
+ bool force_reset = mMute == MUTE_INITIAL && mute;
+ bool enable = !mute;
+ mMute = new_state;
+
mWebRTCImpl->PostSignalingTask(
- [this]()
+ [this, force_reset, enable]()
{
if (mPeerConnection)
{
+ // SetAudioRecording must be called before enabling/disabling tracks.
+ mPeerConnection->SetAudioRecording(enable);
+
auto senders = mPeerConnection->GetSenders();
RTC_LOG(LS_INFO) << __FUNCTION__ << (mMute ? "disabling" : "enabling") << " streams count " << senders.size();
@@ -948,7 +977,14 @@ void LLWebRTCPeerConnectionImpl::setMute(bool mute)
auto track = sender->track();
if (track)
{
- track->set_enabled(!mMute);
+ if (force_reset)
+ {
+ // Force notify observers
+ // Was it disabled too early?
+ // Without this microphone icon in Win's taskbar will stay
+ track->set_enabled(true);
+ }
+ track->set_enabled(enable);
}
}
}
@@ -957,7 +993,17 @@ void LLWebRTCPeerConnectionImpl::setMute(bool mute)
void LLWebRTCPeerConnectionImpl::resetMute()
{
- setMute(mMute);
+ switch(mMute)
+ {
+ case MUTE_MUTED:
+ setMute(true);
+ break;
+ case MUTE_UNMUTED:
+ setMute(false);
+ break;
+ default:
+ break;
+ }
}
void LLWebRTCPeerConnectionImpl::setReceiveVolume(float volume)
diff --git a/indra/llwebrtc/llwebrtc_impl.h b/indra/llwebrtc/llwebrtc_impl.h
index 99accb2c20..dfdb19e9be 100644
--- a/indra/llwebrtc/llwebrtc_impl.h
+++ b/indra/llwebrtc/llwebrtc_impl.h
@@ -425,7 +425,12 @@ class LLWebRTCPeerConnectionImpl : public LLWebRTCPeerConnectionInterface,
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> mPeerConnectionFactory;
- bool mMute;
+ typedef enum {
+ MUTE_INITIAL,
+ MUTE_MUTED,
+ MUTE_UNMUTED,
+ } EMicMuteState;
+ EMicMuteState mMute;
// signaling
std::vector<LLWebRTCSignalingObserver *> mSignalingObserverList;