| Index: components/copresence/mediums/audio/audio_player.h
|
| diff --git a/components/copresence/mediums/audio/audio_player.h b/components/copresence/mediums/audio/audio_player.h
|
| index 96c1f0f3bf1a267703b07fd221bc59b5e6993e26..742c4bcd0d4e3f18211732b112284052837feb82 100644
|
| --- a/components/copresence/mediums/audio/audio_player.h
|
| +++ b/components/copresence/mediums/audio/audio_player.h
|
| @@ -20,25 +20,42 @@ class AudioBusRefCounted;
|
|
|
| namespace copresence {
|
|
|
| -// The AudioPlayer class will play a set of samples till it is told to stop.
|
| -class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback {
|
| +// The AudioPlayerImpl class will play a set of samples till it is told to stop.
|
| +class AudioPlayer {
|
| public:
|
| - AudioPlayer();
|
| -
|
| // Initializes the object. Do not use this object before calling this method.
|
| - virtual void Initialize();
|
| + virtual void Initialize() = 0;
|
|
|
| // Play the given samples. These samples will keep on being played in a loop
|
| // till we explicitly tell the player to stop playing.
|
| - virtual void Play(const scoped_refptr<media::AudioBusRefCounted>& samples);
|
| + virtual void Play(
|
| + const scoped_refptr<media::AudioBusRefCounted>& samples) = 0;
|
|
|
| // Stop playing.
|
| - virtual void Stop();
|
| + virtual void Stop() = 0;
|
|
|
| // Cleans up and deletes this object. Do not use object after this call.
|
| - virtual void Finalize();
|
| + virtual void Finalize() = 0;
|
| +
|
| + virtual bool IsPlaying() = 0;
|
| +
|
| + protected:
|
| + virtual ~AudioPlayer() {}
|
| +};
|
|
|
| - bool IsPlaying();
|
| +// The AudioPlayerImpl class will play a set of samples till it is told to stop.
|
| +class AudioPlayerImpl : public AudioPlayer,
|
| + public media::AudioOutputStream::AudioSourceCallback {
|
| + public:
|
| + AudioPlayerImpl();
|
| +
|
| + // AudioPlayer overrides:
|
| + virtual void Initialize() override;
|
| + virtual void Play(
|
| + const scoped_refptr<media::AudioBusRefCounted>& samples) override;
|
| + virtual void Stop() override;
|
| + virtual void Finalize() override;
|
| + virtual bool IsPlaying() override;
|
|
|
| // Takes ownership of the stream.
|
| void set_output_stream_for_testing(
|
| @@ -46,15 +63,13 @@ class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback {
|
| output_stream_for_testing_.reset(output_stream_for_testing);
|
| }
|
|
|
| - protected:
|
| - virtual ~AudioPlayer();
|
| - void set_is_playing(bool is_playing) { is_playing_ = is_playing; }
|
| -
|
| private:
|
| friend class AudioPlayerTest;
|
| FRIEND_TEST_ALL_PREFIXES(AudioPlayerTest, BasicPlayAndStop);
|
| FRIEND_TEST_ALL_PREFIXES(AudioPlayerTest, OutOfOrderPlayAndStopMultiple);
|
|
|
| + virtual ~AudioPlayerImpl();
|
| +
|
| // Methods to do our various operations; all of these need to be run on the
|
| // audio thread.
|
| void InitializeOnAudioThread();
|
| @@ -89,7 +104,7 @@ class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback {
|
| // Index to the frame in the samples that we need to play next.
|
| int frame_index_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(AudioPlayer);
|
| + DISALLOW_COPY_AND_ASSIGN(AudioPlayerImpl);
|
| };
|
|
|
| } // namespace copresence
|
|
|