Mute using enable.
Muting using the device module microphone mute was muting other applications, speakers, and so on. Instead, we mute by enabling/disabling the input and output streams.master
parent
b10731f6f9
commit
e92e4d762e
|
|
@ -287,16 +287,11 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id)
|
|||
break;
|
||||
}
|
||||
}
|
||||
mTuningDeviceModule->SetSpeakerMute(true);
|
||||
bool was_tuning_playing = mTuningDeviceModule->Playing();
|
||||
if (was_tuning_playing)
|
||||
{
|
||||
mTuningDeviceModule->StopPlayout();
|
||||
}
|
||||
if (mPeerDeviceModule)
|
||||
{
|
||||
mPeerDeviceModule->SetSpeakerMute(true);
|
||||
}
|
||||
|
||||
mTuningDeviceModule->SetPlayoutDevice(tuningPlayoutDevice);
|
||||
mTuningDeviceModule->InitSpeaker();
|
||||
|
|
@ -326,10 +321,8 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id)
|
|||
mPeerDeviceModule->InitSpeaker();
|
||||
mPeerDeviceModule->InitPlayout();
|
||||
mPeerDeviceModule->StartPlayout();
|
||||
mPeerDeviceModule->SetSpeakerMute(false);
|
||||
|
||||
}
|
||||
mTuningDeviceModule->SetSpeakerMute(false);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -369,29 +362,25 @@ void LLWebRTCImpl::setTuningMode(bool enable)
|
|||
{
|
||||
|
||||
mTuningDeviceModule->StartRecording();
|
||||
mTuningDeviceModule->SetMicrophoneMute(false);
|
||||
|
||||
|
||||
mTuningDeviceModule->SetSpeakerMute(false);
|
||||
|
||||
if (mPeerDeviceModule)
|
||||
{
|
||||
mPeerDeviceModule->StopRecording();
|
||||
mPeerDeviceModule->SetSpeakerMute(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mTuningDeviceModule->StartRecording();
|
||||
if (mPeerDeviceModule)
|
||||
{
|
||||
mPeerDeviceModule->StartRecording();
|
||||
mPeerDeviceModule->SetSpeakerMute(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
for (auto& connection : mPeerConnections)
|
||||
{
|
||||
connection->enableTracks(enable ? false : !mMute);
|
||||
connection->enableSenderTracks(enable ? false : !mMute);
|
||||
connection->enableReceiverTracks(!enable);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -409,7 +398,7 @@ LLWebRTCPeerConnection * LLWebRTCImpl::newPeerConnection()
|
|||
peerConnection->init(this);
|
||||
|
||||
mPeerConnections.emplace_back(peerConnection);
|
||||
peerConnection->enableTracks(!mMute);
|
||||
peerConnection->enableSenderTracks(!mMute);
|
||||
return peerConnection.get();
|
||||
}
|
||||
|
||||
|
|
@ -570,7 +559,7 @@ void LLWebRTCPeerConnectionImpl::shutdownConnection()
|
|||
});
|
||||
}
|
||||
|
||||
void LLWebRTCPeerConnectionImpl::enableTracks(bool enable)
|
||||
void LLWebRTCPeerConnectionImpl::enableSenderTracks(bool enable)
|
||||
{
|
||||
// set_enabled shouldn't be done on the worker thread
|
||||
if (mPeerConnection)
|
||||
|
|
@ -583,6 +572,19 @@ void LLWebRTCPeerConnectionImpl::enableTracks(bool enable)
|
|||
}
|
||||
}
|
||||
|
||||
void LLWebRTCPeerConnectionImpl::enableReceiverTracks(bool enable)
|
||||
{
|
||||
// set_enabled shouldn't be done on the worker thread
|
||||
if (mPeerConnection)
|
||||
{
|
||||
auto receivers = mPeerConnection->GetReceivers();
|
||||
for (auto &receiver : receivers)
|
||||
{
|
||||
receiver->track()->set_enabled(enable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLWebRTCPeerConnectionImpl::AnswerAvailable(const std::string &sdp)
|
||||
{
|
||||
RTC_LOG(LS_INFO) << __FUNCTION__ << " Remote SDP: " << sdp;
|
||||
|
|
|
|||
|
|
@ -261,7 +261,6 @@ LLWebRTCVoiceClient::LLWebRTCVoiceClient() :
|
|||
|
||||
mEarLocation(0),
|
||||
mSpeakerVolumeDirty(true),
|
||||
mSpeakerMuteDirty(true),
|
||||
mMicVolume(0),
|
||||
mMicVolumeDirty(true),
|
||||
|
||||
|
|
@ -583,16 +582,7 @@ LLVoiceDeviceList& LLWebRTCVoiceClient::getCaptureDevices()
|
|||
|
||||
void LLWebRTCVoiceClient::setCaptureDevice(const std::string& name)
|
||||
{
|
||||
bool inTuningMode = mIsInTuningMode;
|
||||
if (inTuningMode)
|
||||
{
|
||||
tuningStop();
|
||||
}
|
||||
mWebRTCDeviceInterface->setCaptureDevice(name);
|
||||
if (inTuningMode)
|
||||
{
|
||||
tuningStart();
|
||||
}
|
||||
}
|
||||
void LLWebRTCVoiceClient::setDevicesListUpdated(bool state)
|
||||
{
|
||||
|
|
@ -1863,12 +1853,6 @@ void LLWebRTCVoiceClient::setVoiceVolume(F32 volume)
|
|||
if (volume != mSpeakerVolume)
|
||||
{
|
||||
{
|
||||
int min_volume = 0.0;
|
||||
if ((volume == min_volume) || (mSpeakerVolume == min_volume))
|
||||
{
|
||||
mSpeakerMuteDirty = true;
|
||||
}
|
||||
|
||||
mSpeakerVolume = volume;
|
||||
mSpeakerVolumeDirty = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -645,7 +645,6 @@ private:
|
|||
S32 mEarLocation;
|
||||
|
||||
bool mSpeakerVolumeDirty;
|
||||
bool mSpeakerMuteDirty;
|
||||
float mSpeakerVolume;
|
||||
|
||||
int mMicVolume;
|
||||
|
|
|
|||
Loading…
Reference in New Issue