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

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

Issue 2396483002: Made MixerAudioSource a pure interface. (Closed)
Patch Set: Small changes in response to reviewer comments. 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_impl.h
diff --git a/webrtc/modules/audio_mixer/audio_mixer_impl.h b/webrtc/modules/audio_mixer/audio_mixer_impl.h
index ecfcbfa621d1d2213c719a23cc1331d90237c0b8..668eef3f8c7b266535b55796f1325da9a92f2ad5 100644
--- a/webrtc/modules/audio_mixer/audio_mixer_impl.h
+++ b/webrtc/modules/audio_mixer/audio_mixer_impl.h
@@ -15,11 +15,13 @@
#include <memory>
#include <vector>
+#include "webrtc/base/gtest_prod_util.h"
the sun 2016/10/06 09:50:31 not needed
aleloi 2016/10/06 12:17:12 Removed.
#include "webrtc/base/thread_annotations.h"
#include "webrtc/base/thread_checker.h"
#include "webrtc/engine_configurations.h"
#include "webrtc/modules/audio_mixer/audio_mixer.h"
#include "webrtc/modules/audio_mixer/audio_mixer_defines.h"
+#include "webrtc/modules/audio_mixer/audio_source_with_mix_status.h"
#include "webrtc/modules/audio_processing/include/audio_processing.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
@@ -28,14 +30,14 @@
namespace webrtc {
typedef std::vector<AudioFrame*> AudioFrameList;
-typedef std::vector<MixerAudioSource*> MixerAudioSourceList;
+typedef std::vector<AudioSourceWithMixStatus> MixerAudioSourceList;
class AudioMixerImpl : public AudioMixer {
public:
// AudioProcessing only accepts 10 ms frames.
static const int kFrameDurationInMs = 10;
- static std::unique_ptr<AudioMixer> Create(int id);
+ static std::unique_ptr<AudioMixerImpl> Create(int id);
~AudioMixerImpl() override;
@@ -51,6 +53,11 @@ class AudioMixerImpl : public AudioMixer {
bool AnonymousMixabilityStatus(
const MixerAudioSource& audio_source) const override;
+ // Returns true if the source was mixed last round. Returns
+ // false and logs an error if the source was never added to the
+ // mixer.
+ bool GetAudioSourceMixabilityStatusForTest(MixerAudioSource* audio_source);
+
private:
AudioMixerImpl(int id, std::unique_ptr<AudioProcessing> limiter);
@@ -61,11 +68,11 @@ class AudioMixerImpl : public AudioMixer {
// Compute what audio sources to mix from audio_source_list_. Ramp
// in and out. Update mixed status. Mixes up to
// kMaximumAmountOfMixedAudioSources audio sources.
- AudioFrameList GetNonAnonymousAudio() const EXCLUSIVE_LOCKS_REQUIRED(crit_);
+ AudioFrameList GetNonAnonymousAudio() EXCLUSIVE_LOCKS_REQUIRED(crit_);
// Return the AudioFrames that should be mixed anonymously. Ramp in
// and out. Update mixed status.
- AudioFrameList GetAnonymousAudio() const EXCLUSIVE_LOCKS_REQUIRED(crit_);
+ AudioFrameList GetAnonymousAudio() EXCLUSIVE_LOCKS_REQUIRED(crit_);
// This function returns true if it finds the MixerAudioSource in the
// specified list of MixerAudioSources.
@@ -86,6 +93,12 @@ class AudioMixerImpl : public AudioMixer {
int GetOutputAudioLevelFullRange() override;
+ // Searches for the AudioSourceWithMixStatus object corresponding to
+ // an audio source. If the audio source was never added with
+ // Set*MixabilityStatus, this returns nullptr.
+ AudioSourceWithMixStatus* GetSourceWithStatusForTest(
+ MixerAudioSource* audio_source);
+
rtc::CriticalSection crit_;
const int32_t id_;

Powered by Google App Engine
This is Rietveld 408576698