| Index: components/copresence/mediums/audio/audio_player_impl.h
|
| diff --git a/components/copresence/mediums/audio/audio_player.h b/components/copresence/mediums/audio/audio_player_impl.h
|
| similarity index 66%
|
| copy from components/copresence/mediums/audio/audio_player.h
|
| copy to components/copresence/mediums/audio/audio_player_impl.h
|
| index e2bb64dce169199347dcdc50533b369ff5f49429..84e0753894018829fdff3ab2b97e92ed4901566a 100644
|
| --- a/components/copresence/mediums/audio/audio_player.h
|
| +++ b/components/copresence/mediums/audio/audio_player_impl.h
|
| @@ -2,8 +2,8 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_
|
| -#define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_
|
| +#ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_IMPL_H_
|
| +#define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_IMPL_H_
|
|
|
| #include <vector>
|
|
|
| @@ -11,6 +11,7 @@
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/synchronization/lock.h"
|
| +#include "components/copresence/mediums/audio/audio_player.h"
|
| #include "media/audio/audio_io.h"
|
|
|
| namespace media {
|
| @@ -20,25 +21,19 @@ 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 AudioPlayerImpl final
|
| + : public AudioPlayer,
|
| + public media::AudioOutputStream::AudioSourceCallback {
|
| public:
|
| - AudioPlayer();
|
| + AudioPlayerImpl();
|
|
|
| - // Initializes the object. Do not use this object before calling this method.
|
| - virtual void Initialize();
|
| -
|
| - // 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);
|
| -
|
| - // Stop playing.
|
| - virtual void Stop();
|
| -
|
| - // Cleans up and deletes this object. Do not use object after this call.
|
| - virtual void Finalize();
|
| -
|
| - bool IsPlaying();
|
| + // AudioPlayer overrides:
|
| + void Initialize() override;
|
| + void Play(const scoped_refptr<media::AudioBusRefCounted>& samples) override;
|
| + void Stop() override;
|
| + void Finalize() override;
|
| + bool IsPlaying() override;
|
|
|
| // Takes ownership of the stream.
|
| void set_output_stream_for_testing(
|
| @@ -46,15 +41,13 @@ class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback {
|
| output_stream_for_testing_.reset(output_stream_for_testing);
|
| }
|
|
|
| - protected:
|
| - ~AudioPlayer() override;
|
| - 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();
|
| @@ -88,9 +81,9 @@ 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
|
|
|
| -#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_
|
| +#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_IMPL_H_
|
|
|