Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions api/audio/audio_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ class AudioDeviceModule : public webrtc::RefCountInterface {
// not be present in the stats.
virtual std::optional<Stats> GetStats() const { return std::nullopt; }

// Whether to stop recording when all streams are muted.
virtual bool IsStopOnMuteModeEnabled() const { return true; }

// Only supported on iOS.
#if defined(WEBRTC_IOS)
virtual int GetPlayoutAudioParameters(AudioParameters* params) const = 0;
Expand Down
13 changes: 12 additions & 1 deletion media/engine/webrtc_voice_engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1759,7 +1759,18 @@ bool WebRtcVoiceSendChannel::MuteStream(uint32_t ssrc, bool muted) {
if (adm) {
RTC_LOG(LS_INFO) << "WebRtcVoiceSendChannel::MuteStream: ADM:"
<< is_all_muted;
adm->SetMicrophoneMute(is_all_muted);

if (adm->IsStopOnMuteModeEnabled()) {
if (!is_all_muted && !adm->Recording()) {
if (adm->InitRecording() == 0) {
adm->StartRecording();
}
} else if (is_all_muted && adm->Recording()) {
adm->StopRecording();
}
} else {
adm->SetMicrophoneMute(is_all_muted);
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions modules/audio_device/audio_engine_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ class AudioEngineDevice : public AudioDeviceModule, public AudioSessionObserver

int32_t InitAndStartRecording();

bool IsStopOnMuteModeEnabled() const override;

private:
struct EngineStateUpdate {
EngineState prev;
Expand Down
4 changes: 4 additions & 0 deletions modules/audio_device/audio_engine_device.mm
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@
engine_state_.voice_processing_bypassed = voice_processing_bypassed;
}

bool AudioEngineDevice::IsStopOnMuteModeEnabled() const {
return false;
}

AudioEngineDevice::~AudioEngineDevice() {
RTC_DCHECK_RUN_ON(thread_);

Expand Down
Loading