Skip to content

Commit 917c720

Browse files
committed
Squashed commit of the following:
commit 98dc0ac Author: Hiroshi Horie <[email protected]> Date: Thu Jan 23 03:27:20 2025 +0900 Rendering fix commit 345f8b7 Author: Hiroshi Horie <[email protected]> Date: Thu Jan 23 00:41:35 2025 +0900 Manual rendering commit be003d5 Author: Hiroshi Horie <[email protected]> Date: Wed Jan 22 12:03:18 2025 +0900 RTCAudioDeviceModuleDelegate commit 2babb14 Author: Hiroshi Horie <[email protected]> Date: Fri Jan 17 16:18:39 2025 +0900 Squashed recent improvements Pre initialize mode Pre initialize logic Persistent Checks Fix buffer logic Patch default input_mute state Buffer checks Start buffer on enable Delay estimate 0 Stop engine on interrupt Pass should_resume Silence warning Correct session config Fix state Start logic Misc Rem ses Rem ses2 State helper Minor patch Simplify Change stop create order Working state Ref State helpers commit 235da97 Author: Hiroshi Horie <[email protected]> Date: Tue Jan 14 15:52:32 2025 +0900 Squashed recent progress commit 6ba820c Author: Hiroshi Horie <[email protected]> Date: Tue Dec 31 01:57:09 2024 +0900 Squashed recent progress Fix adm selection Fixes Revert adm selection in audio_device_impl Rename IsManualRenderingMode Simplify pcm buffer delegate Fixes Fixes Ducking config Strip manual rendering logic Runtime-ducking config Fix compile Fix start recording Connect output Buffer logic Enable output when input is enabled commit 49ca1ee Author: Hiroshi Horie <[email protected]> Date: Sun Dec 22 04:32:07 2024 +0700 Check AGC commit 5bbeb48 Author: Hiroshi Horie <[email protected]> Date: Sat Dec 21 14:15:31 2024 +0700 Debug print audio graph commit 631126f Author: Hiroshi Horie <[email protected]> Date: Fri Dec 20 23:24:42 2024 +0700 Fix macOS vp commit e07b814 Author: Hiroshi Horie <[email protected]> Date: Tue Dec 17 12:28:55 2024 +0700 Clean up imports commit 1bdb158 Author: Hiroshi Horie <[email protected]> Date: Wed Dec 11 12:35:12 2024 +0700 Muted talker detection commit 0324b22 Author: Hiroshi Horie <[email protected]> Date: Mon Dec 16 21:11:45 2024 +0700 Rename AudioDeviceSink commit ed22ffb Author: Hiroshi Horie <[email protected]> Date: Tue Dec 17 01:11:23 2024 +0700 Move to private method commit db00fe4 Author: Hiroshi Horie <[email protected]> Date: Wed Dec 11 00:16:55 2024 +0700 Other audio ducking commit a7282bd Author: Hiroshi Horie <[email protected]> Date: Thu Dec 5 15:27:34 2024 +0700 AudioEngine commit d31187b Author: Hiroshi Horie <[email protected]> Date: Thu Dec 5 15:26:38 2024 +0700 Connect voice engine mute to adm commit 3df68d4 Author: Hiroshi Horie <[email protected]> Date: Fri Oct 11 20:41:44 2024 +0900 Revert "Stop recording on mute (turn off mic indicator) (#55)" This reverts commit c0209ef.
1 parent bbe4412 commit 917c720

38 files changed

+2462
-297
lines changed

audio/audio_send_stream.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,6 @@ void AudioSendStream::SetMuted(bool muted) {
415415
channel_send_->SetInputMute(muted);
416416
}
417417

418-
bool AudioSendStream::GetMuted() {
419-
RTC_DCHECK_RUN_ON(&worker_thread_checker_);
420-
return channel_send_->InputMute();
421-
}
422-
423418
webrtc::AudioSendStream::Stats AudioSendStream::GetStats() const {
424419
return GetStats(true);
425420
}

audio/audio_send_stream.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ class AudioSendStream final : public webrtc::AudioSendStream,
9494
int payload_frequency,
9595
int event,
9696
int duration_ms) override;
97-
bool GetMuted() override;
9897
void SetMuted(bool muted) override;
9998
webrtc::AudioSendStream::Stats GetStats() const override;
10099
webrtc::AudioSendStream::Stats GetStats(

audio/audio_state.cc

Lines changed: 14 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -98,26 +98,22 @@ void AudioState::AddSendingStream(webrtc::AudioSendStream* stream,
9898
UpdateAudioTransportWithSendingStreams();
9999

100100
// Make sure recording is initialized; start recording if enabled.
101-
if (ShouldRecord()) {
102-
auto* adm = config_.audio_device_module.get();
103-
if (!adm->Recording()) {
104-
if (adm->InitRecording() == 0) {
105-
if (recording_enabled_) {
106-
107-
// TODO: Verify if the following windows only logic is still required.
101+
auto* adm = config_.audio_device_module.get();
102+
if (!adm->Recording()) {
103+
if (adm->InitRecording() == 0) {
104+
if (recording_enabled_) {
108105
#if defined(WEBRTC_WIN)
109-
if (adm->BuiltInAECIsAvailable() && !adm->Playing()) {
110-
if (!adm->PlayoutIsInitialized()) {
111-
adm->InitPlayout();
112-
}
113-
adm->StartPlayout();
106+
if (adm->BuiltInAECIsAvailable() && !adm->Playing()) {
107+
if (!adm->PlayoutIsInitialized()) {
108+
adm->InitPlayout();
114109
}
115-
#endif
116-
adm->StartRecording();
110+
adm->StartPlayout();
117111
}
118-
} else {
119-
RTC_DLOG_F(LS_ERROR) << "Failed to initialize recording.";
112+
#endif
113+
adm->StartRecording();
120114
}
115+
} else {
116+
RTC_DLOG_F(LS_ERROR) << "Failed to initialize recording.";
121117
}
122118
}
123119
}
@@ -127,10 +123,7 @@ void AudioState::RemoveSendingStream(webrtc::AudioSendStream* stream) {
127123
auto count = sending_streams_.erase(stream);
128124
RTC_DCHECK_EQ(1, count);
129125
UpdateAudioTransportWithSendingStreams();
130-
131-
bool should_record = ShouldRecord();
132-
RTC_LOG(LS_INFO) << "RemoveSendingStream: should_record = " << should_record;
133-
if (!should_record) {
126+
if (sending_streams_.empty()) {
134127
config_.audio_device_module->StopRecording();
135128
}
136129
}
@@ -158,7 +151,7 @@ void AudioState::SetRecording(bool enabled) {
158151
if (recording_enabled_ != enabled) {
159152
recording_enabled_ = enabled;
160153
if (enabled) {
161-
if (ShouldRecord()) {
154+
if (!sending_streams_.empty()) {
162155
config_.audio_device_module->StartRecording();
163156
}
164157
} else {
@@ -218,43 +211,6 @@ void AudioState::UpdateNullAudioPollerState() {
218211
null_audio_poller_.Stop();
219212
}
220213
}
221-
222-
void AudioState::OnMuteStreamChanged() {
223-
224-
auto* adm = config_.audio_device_module.get();
225-
bool should_record = ShouldRecord();
226-
227-
RTC_LOG(LS_INFO) << "OnMuteStreamChanged: should_record = " << should_record;
228-
if (should_record && !adm->Recording()) {
229-
if (adm->InitRecording() == 0) {
230-
adm->StartRecording();
231-
}
232-
} else if (!should_record && adm->Recording()) {
233-
adm->StopRecording();
234-
}
235-
}
236-
237-
bool AudioState::ShouldRecord() {
238-
RTC_LOG(LS_INFO) << "ShouldRecord";
239-
// no streams to send
240-
if (sending_streams_.empty()) {
241-
RTC_LOG(LS_INFO) << "ShouldRecord: send stream = empty";
242-
return false;
243-
}
244-
245-
int stream_count = sending_streams_.size();
246-
247-
int muted_count = 0;
248-
for (const auto& kv : sending_streams_) {
249-
if (kv.first->GetMuted()) {
250-
muted_count++;
251-
}
252-
}
253-
254-
RTC_LOG(LS_INFO) << "ShouldRecord: " << muted_count << " muted, " << stream_count << " sending";
255-
return muted_count != stream_count;
256-
}
257-
258214
} // namespace internal
259215

260216
rtc::scoped_refptr<AudioState> AudioState::Create(

audio/audio_state.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ class AudioState : public webrtc::AudioState {
4747

4848
void SetStereoChannelSwapping(bool enable) override;
4949

50-
void OnMuteStreamChanged() override;
51-
5250
AudioDeviceModule* audio_device_module() {
5351
RTC_DCHECK(config_.audio_device_module);
5452
return config_.audio_device_module.get();
@@ -66,9 +64,6 @@ class AudioState : public webrtc::AudioState {
6664
void UpdateAudioTransportWithSendingStreams();
6765
void UpdateNullAudioPollerState() RTC_RUN_ON(&thread_checker_);
6866

69-
// Returns true when at least 1 stream exists and all streams are not muted.
70-
bool ShouldRecord();
71-
7267
SequenceChecker thread_checker_;
7368
SequenceChecker process_thread_checker_{SequenceChecker::kDetached};
7469
const webrtc::AudioState::Config config_;

audio/channel_send.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ class ChannelSend : public ChannelSendInterface,
100100
// Muting, Volume and Level.
101101
void SetInputMute(bool enable) override;
102102

103-
bool InputMute() const override;
104-
105103
// Stats.
106104
ANAStats GetANAStatistics() const override;
107105

@@ -165,6 +163,8 @@ class ChannelSend : public ChannelSendInterface,
165163
size_t payloadSize,
166164
int64_t absolute_capture_timestamp_ms) override;
167165

166+
bool InputMute() const;
167+
168168
int32_t SendRtpAudio(AudioFrameType frameType,
169169
uint8_t payloadType,
170170
uint32_t rtp_timestamp_without_offset,

audio/channel_send.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,6 @@ class ChannelSendInterface {
8383
virtual bool SendTelephoneEventOutband(int event, int duration_ms) = 0;
8484
virtual void OnBitrateAllocation(BitrateAllocationUpdate update) = 0;
8585
virtual int GetTargetBitrate() const = 0;
86-
87-
virtual bool InputMute() const = 0;
8886
virtual void SetInputMute(bool muted) = 0;
8987

9088
virtual void ProcessAndEncodeAudio(

call/audio_send_stream.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ class AudioSendStream : public AudioSender {
190190
int event,
191191
int duration_ms) = 0;
192192

193-
virtual bool GetMuted() = 0;
194193
virtual void SetMuted(bool muted) = 0;
195194

196195
virtual Stats GetStats() const = 0;

call/audio_state.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ class AudioState : public rtc::RefCountInterface {
5959

6060
virtual void SetStereoChannelSwapping(bool enable) = 0;
6161

62-
// Notify the AudioState that a stream updated it's mute state.
63-
virtual void OnMuteStreamChanged() = 0;
64-
6562
static rtc::scoped_refptr<AudioState> Create(
6663
const AudioState::Config& config);
6764

media/engine/webrtc_voice_engine.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1698,8 +1698,10 @@ 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();
1701+
webrtc::AudioDeviceModule* adm = engine()->adm();
1702+
if (adm) {
1703+
adm->SetMicrophoneMute(all_muted);
1704+
}
17031705

17041706
return true;
17051707
}

media/engine/webrtc_voice_engine.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
132132

133133
absl::optional<webrtc::AudioDeviceModule::Stats> GetAudioDeviceStats()
134134
override;
135-
// Moved to public so WebRtcVoiceMediaChannel can access it.
136-
webrtc::AudioState* audio_state();
137135

138136
private:
139137
// Every option that is "set" will be applied. Every option not "set" will be
@@ -147,6 +145,7 @@ class WebRtcVoiceEngine final : public VoiceEngineInterface {
147145

148146
webrtc::AudioDeviceModule* adm();
149147
webrtc::AudioProcessing* apm() const;
148+
webrtc::AudioState* audio_state();
150149

151150
std::vector<AudioCodec> CollectCodecs(
152151
const std::vector<webrtc::AudioCodecSpec>& specs) const;

0 commit comments

Comments
 (0)