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.meow-7.2.2
parent
e5a95a96bf
commit
4f4f9032cb
|
|
@ -287,16 +287,11 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mTuningDeviceModule->SetSpeakerMute(true);
|
|
||||||
bool was_tuning_playing = mTuningDeviceModule->Playing();
|
bool was_tuning_playing = mTuningDeviceModule->Playing();
|
||||||
if (was_tuning_playing)
|
if (was_tuning_playing)
|
||||||
{
|
{
|
||||||
mTuningDeviceModule->StopPlayout();
|
mTuningDeviceModule->StopPlayout();
|
||||||
}
|
}
|
||||||
if (mPeerDeviceModule)
|
|
||||||
{
|
|
||||||
mPeerDeviceModule->SetSpeakerMute(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
mTuningDeviceModule->SetPlayoutDevice(tuningPlayoutDevice);
|
mTuningDeviceModule->SetPlayoutDevice(tuningPlayoutDevice);
|
||||||
mTuningDeviceModule->InitSpeaker();
|
mTuningDeviceModule->InitSpeaker();
|
||||||
|
|
@ -326,10 +321,8 @@ void LLWebRTCImpl::setRenderDevice(const std::string &id)
|
||||||
mPeerDeviceModule->InitSpeaker();
|
mPeerDeviceModule->InitSpeaker();
|
||||||
mPeerDeviceModule->InitPlayout();
|
mPeerDeviceModule->InitPlayout();
|
||||||
mPeerDeviceModule->StartPlayout();
|
mPeerDeviceModule->StartPlayout();
|
||||||
mPeerDeviceModule->SetSpeakerMute(false);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
mTuningDeviceModule->SetSpeakerMute(false);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -369,29 +362,25 @@ void LLWebRTCImpl::setTuningMode(bool enable)
|
||||||
{
|
{
|
||||||
|
|
||||||
mTuningDeviceModule->StartRecording();
|
mTuningDeviceModule->StartRecording();
|
||||||
mTuningDeviceModule->SetMicrophoneMute(false);
|
|
||||||
|
|
||||||
|
|
||||||
mTuningDeviceModule->SetSpeakerMute(false);
|
|
||||||
|
|
||||||
if (mPeerDeviceModule)
|
if (mPeerDeviceModule)
|
||||||
{
|
{
|
||||||
mPeerDeviceModule->StopRecording();
|
mPeerDeviceModule->StopRecording();
|
||||||
mPeerDeviceModule->SetSpeakerMute(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
mTuningDeviceModule->StartRecording();
|
||||||
if (mPeerDeviceModule)
|
if (mPeerDeviceModule)
|
||||||
{
|
{
|
||||||
mPeerDeviceModule->StartRecording();
|
mPeerDeviceModule->StartRecording();
|
||||||
mPeerDeviceModule->SetSpeakerMute(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
for (auto& connection : mPeerConnections)
|
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);
|
peerConnection->init(this);
|
||||||
|
|
||||||
mPeerConnections.emplace_back(peerConnection);
|
mPeerConnections.emplace_back(peerConnection);
|
||||||
peerConnection->enableTracks(!mMute);
|
peerConnection->enableSenderTracks(!mMute);
|
||||||
return peerConnection.get();
|
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
|
// set_enabled shouldn't be done on the worker thread
|
||||||
if (mPeerConnection)
|
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)
|
void LLWebRTCPeerConnectionImpl::AnswerAvailable(const std::string &sdp)
|
||||||
{
|
{
|
||||||
RTC_LOG(LS_INFO) << __FUNCTION__ << " Remote SDP: " << sdp;
|
RTC_LOG(LS_INFO) << __FUNCTION__ << " Remote SDP: " << sdp;
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,6 @@ LLWebRTCVoiceClient::LLWebRTCVoiceClient() :
|
||||||
|
|
||||||
mEarLocation(0),
|
mEarLocation(0),
|
||||||
mSpeakerVolumeDirty(true),
|
mSpeakerVolumeDirty(true),
|
||||||
mSpeakerMuteDirty(true),
|
|
||||||
mMicVolume(0),
|
mMicVolume(0),
|
||||||
mMicVolumeDirty(true),
|
mMicVolumeDirty(true),
|
||||||
|
|
||||||
|
|
@ -583,16 +582,7 @@ LLVoiceDeviceList& LLWebRTCVoiceClient::getCaptureDevices()
|
||||||
|
|
||||||
void LLWebRTCVoiceClient::setCaptureDevice(const std::string& name)
|
void LLWebRTCVoiceClient::setCaptureDevice(const std::string& name)
|
||||||
{
|
{
|
||||||
bool inTuningMode = mIsInTuningMode;
|
|
||||||
if (inTuningMode)
|
|
||||||
{
|
|
||||||
tuningStop();
|
|
||||||
}
|
|
||||||
mWebRTCDeviceInterface->setCaptureDevice(name);
|
mWebRTCDeviceInterface->setCaptureDevice(name);
|
||||||
if (inTuningMode)
|
|
||||||
{
|
|
||||||
tuningStart();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
void LLWebRTCVoiceClient::setDevicesListUpdated(bool state)
|
void LLWebRTCVoiceClient::setDevicesListUpdated(bool state)
|
||||||
{
|
{
|
||||||
|
|
@ -1863,12 +1853,6 @@ void LLWebRTCVoiceClient::setVoiceVolume(F32 volume)
|
||||||
if (volume != mSpeakerVolume)
|
if (volume != mSpeakerVolume)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
int min_volume = 0.0;
|
|
||||||
if ((volume == min_volume) || (mSpeakerVolume == min_volume))
|
|
||||||
{
|
|
||||||
mSpeakerMuteDirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
mSpeakerVolume = volume;
|
mSpeakerVolume = volume;
|
||||||
mSpeakerVolumeDirty = true;
|
mSpeakerVolumeDirty = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -645,7 +645,6 @@ private:
|
||||||
S32 mEarLocation;
|
S32 mEarLocation;
|
||||||
|
|
||||||
bool mSpeakerVolumeDirty;
|
bool mSpeakerVolumeDirty;
|
||||||
bool mSpeakerMuteDirty;
|
|
||||||
float mSpeakerVolume;
|
float mSpeakerVolume;
|
||||||
|
|
||||||
int mMicVolume;
|
int mMicVolume;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue