From 76b3049e7c0cb6ec1c7bb741a83f71a5e791fbaf Mon Sep 17 00:00:00 2001 From: aleloi Date: Fri, 18 Nov 2016 02:03:04 -0800 Subject: [PATCH] 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} --- webrtc/api/audio/audio_mixer.h | 11 ++++++----- webrtc/modules/audio_mixer/audio_mixer_impl.cc | 3 +-- webrtc/modules/audio_mixer/audio_mixer_impl.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/webrtc/api/audio/audio_mixer.h b/webrtc/api/audio/audio_mixer.h index dbb58ca74a..931f20eaba 100644 --- a/webrtc/api/audio/audio_mixer.h +++ b/webrtc/api/audio/audio_mixer.h @@ -51,12 +51,13 @@ class AudioMixer : public rtc::RefCountInterface { 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 d7025f9e67..4bd96cd72f 100644 --- a/webrtc/modules/audio_mixer/audio_mixer_impl.cc +++ b/webrtc/modules/audio_mixer/audio_mixer_impl.cc @@ -280,13 +280,12 @@ bool AudioMixerImpl::AddSource(Source* audio_source) { 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 ec2989e554..af83367fc4 100644 --- a/webrtc/modules/audio_mixer/audio_mixer_impl.h +++ b/webrtc/modules/audio_mixer/audio_mixer_impl.h @@ -53,7 +53,7 @@ class AudioMixerImpl : public AudioMixer { // 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_);