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

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

Issue 2408683002: Cleanup of the mixer interface. (Closed)
Patch Set: Added clarifying comments for adding/removing sources and threading aspects of the interface. 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
« no previous file with comments | « webrtc/modules/BUILD.gn ('k') | webrtc/modules/audio_mixer/audio_mixer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 0c7146923838a7cf04f1154a48b967babe9817e7..7e58a8d6a01635a9dde3fa60453131be2e088137 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:
@@ -47,16 +47,23 @@ class AudioMixer {
// mixer.
virtual AudioFrameWithInfo GetAudioFrameWithInfo(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() {}
+ // Since the mixer is reference counted, the destructor may be
+ // called from any thread.
+ ~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. 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.
+ 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. Will only be
« no previous file with comments | « webrtc/modules/BUILD.gn ('k') | webrtc/modules/audio_mixer/audio_mixer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698