Skip to content

Commit a5b6625

Browse files
authored
Fix webrtc_voice_engine not notifying mute change (#128)
Looks like this line was missed during the m125 update. 272127d#diff-56f5e0c459b287281ef3b0431d3f4129e8e4be4c6955d845bcb22210f08b7ba5R2289 Adding it back in so that mic is properly released when muted.
1 parent 432a28b commit a5b6625

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

audio/audio_state.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ void AudioState::RemoveSendingStream(webrtc::AudioSendStream* stream) {
128128
RTC_DCHECK_EQ(1, count);
129129
UpdateAudioTransportWithSendingStreams();
130130

131-
if (!ShouldRecord()) {
131+
bool should_record = ShouldRecord();
132+
RTC_LOG(LS_INFO) << "RemoveSendingStream: should_record = " << should_record;
133+
if (!should_record) {
132134
config_.audio_device_module->StopRecording();
133135
}
134136
}
@@ -222,6 +224,7 @@ void AudioState::OnMuteStreamChanged() {
222224
auto* adm = config_.audio_device_module.get();
223225
bool should_record = ShouldRecord();
224226

227+
RTC_LOG(LS_INFO) << "OnMuteStreamChanged: should_record = " << should_record;
225228
if (should_record && !adm->Recording()) {
226229
if (adm->InitRecording() == 0) {
227230
adm->StartRecording();
@@ -232,8 +235,10 @@ void AudioState::OnMuteStreamChanged() {
232235
}
233236

234237
bool AudioState::ShouldRecord() {
238+
RTC_LOG(LS_INFO) << "ShouldRecord";
235239
// no streams to send
236240
if (sending_streams_.empty()) {
241+
RTC_LOG(LS_INFO) << "ShouldRecord: send stream = empty";
237242
return false;
238243
}
239244

@@ -246,6 +251,7 @@ bool AudioState::ShouldRecord() {
246251
}
247252
}
248253

254+
RTC_LOG(LS_INFO) << "ShouldRecord: " << muted_count << " muted, " << stream_count << " sending";
249255
return muted_count != stream_count;
250256
}
251257

media/engine/webrtc_voice_engine.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,6 +1698,9 @@ bool WebRtcVoiceSendChannel::MuteStream(uint32_t ssrc, bool muted) {
16981698
ap->set_output_will_be_muted(all_muted);
16991699
}
17001700

1701+
// Notfy the AudioState that the mute state has updated.
1702+
engine_->audio_state()->OnMuteStreamChanged();
1703+
17011704
return true;
17021705
}
17031706

0 commit comments

Comments
 (0)