Changed the interface AudioMixer::RemoveSource to have a void return type.
In the AudioMixerImpl implementation, removing a source never fails
and the return value is always true (see audio_mixer/audio_mixer_impl.cc).
A return value of |false| signaled that removing a source failed for
some reason. We have come to the conclusion that
* we don't know how to handle a return value of |false|
* we can't think of why an alternative implementation would need to
signal failure when removing a stream.
To avoid having a status code that is never read, never acted upon and
probably never set to anything but |true|, we change ::RemoveSource to
not have a return value.
NOTRY=True
BUG=webrtc:6346
Review-Url: https://codereview.webrtc.org/2506173003
Cr-Commit-Position: refs/heads/master@{#15150}
diff --git a/webrtc/api/audio/audio_mixer.h b/webrtc/api/audio/audio_mixer.h
index dbb58ca..931f20e 100644
--- a/webrtc/api/audio/audio_mixer.h
+++ b/webrtc/api/audio/audio_mixer.h
@@ -51,12 +51,13 @@
virtual ~Source() {}
};
- // Returns true if adding/removing was successful. A source is never
- // added twice and removal is never attempted if a source has not
- // been successfully added to the mixer. Addition and removal can
- // happen on different threads.
+ // Returns true if adding was successful. A source is never added
+ // twice. Addition and removal can happen on different threads.
virtual bool AddSource(Source* audio_source) = 0;
- virtual bool RemoveSource(Source* audio_source) = 0;
+
+ // Removal is never attempted if a source has not been successfully
+ // added to the mixer.
+ virtual void RemoveSource(Source* audio_source) = 0;
// Performs mixing by asking registered audio sources for audio. The
// mixed result is placed in the provided AudioFrame. This method
diff --git a/webrtc/modules/audio_mixer/audio_mixer_impl.cc b/webrtc/modules/audio_mixer/audio_mixer_impl.cc
index d7025f9..4bd96cd 100644
--- a/webrtc/modules/audio_mixer/audio_mixer_impl.cc
+++ b/webrtc/modules/audio_mixer/audio_mixer_impl.cc
@@ -280,13 +280,12 @@
return true;
}
-bool AudioMixerImpl::RemoveSource(Source* audio_source) {
+void AudioMixerImpl::RemoveSource(Source* audio_source) {
RTC_DCHECK(audio_source);
rtc::CritScope lock(&crit_);
const auto iter = FindSourceInList(audio_source, &audio_source_list_);
RTC_DCHECK(iter != audio_source_list_.end()) << "Source not present in mixer";
audio_source_list_.erase(iter);
- return true;
}
AudioFrameList AudioMixerImpl::GetAudioFromSources() {
diff --git a/webrtc/modules/audio_mixer/audio_mixer_impl.h b/webrtc/modules/audio_mixer/audio_mixer_impl.h
index ec2989e..af83367 100644
--- a/webrtc/modules/audio_mixer/audio_mixer_impl.h
+++ b/webrtc/modules/audio_mixer/audio_mixer_impl.h
@@ -53,7 +53,7 @@
// AudioMixer functions
bool AddSource(Source* audio_source) override;
- bool RemoveSource(Source* audio_source) override;
+ void RemoveSource(Source* audio_source) override;
void Mix(size_t number_of_channels,
AudioFrame* audio_frame_for_mixing) override LOCKS_EXCLUDED(crit_);