Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: webrtc/modules/audio_mixer/audio_mixer.h

Issue 2408683002: Cleanup of the mixer interface. (Closed)
Patch Set: Added checks in Add/Remove source, double add or nonexistent remove is an error. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_mixer/audio_mixer.h
diff --git a/webrtc/modules/audio_mixer/audio_mixer.h b/webrtc/modules/audio_mixer/audio_mixer.h
index 5729e14288c32650f5e755160d830ab7e9f39cd0..009e1b626cca38da0a9f1450b836f50151299834 100644
--- a/webrtc/modules/audio_mixer/audio_mixer.h
+++ b/webrtc/modules/audio_mixer/audio_mixer.h
@@ -13,13 +13,13 @@
#include <memory>
+#include "webrtc/base/refcount.h"
#include "webrtc/modules/include/module_common_types.h"
namespace webrtc {
-class AudioMixer {
+class AudioMixer : public rtc::RefCountInterface {
public:
- static const int kMaximumAmountOfMixedAudioSources = 3;
// A callback class that all mixer participants must inherit from/implement.
class Source {
public:
@@ -44,16 +44,20 @@ class AudioMixer {
// mixer.
virtual AudioFrameWithMuted GetAudioFrameWithMuted(int sample_rate_hz) = 0;
+ // A way for a mixer implementation do distinguish participants.
+ virtual int ssrc() = 0;
+
protected:
virtual ~Source() {}
};
- // Factory method. Constructor disabled.
- static std::unique_ptr<AudioMixer> Create();
- virtual ~AudioMixer() {}
+ ~AudioMixer() override {}
- // Add/remove audio sources as candidates for mixing.
- virtual int32_t SetMixabilityStatus(Source* audio_source, bool mixable) = 0;
+ // Returns true if adding/removing was successful. Adding the same
+ // source twice is forbidden, as is removing a source that is not
+ // present.
+ virtual bool AddSource(Source* audio_source) = 0;
+ virtual bool RemoveSource(Source* audio_source) = 0;
// Performs mixing by asking registered audio sources for audio. The
// mixed result is placed in the provided AudioFrame. Should only be
« no previous file with comments | « no previous file | webrtc/modules/audio_mixer/audio_mixer_impl.h » ('j') | webrtc/modules/audio_mixer/audio_mixer_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698