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}
This commit is contained in:
aleloi 2016-11-18 02:03:04 -08:00 committed by Commit bot
parent a28780e994
commit 76b3049e7c
3 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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() {

View File

@ -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_);