Chromium Code Reviews| 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 a6bebceae083b6be1de90f2d76a30550ef13be8e..8f3f26c9bfa2911d9a0423fb97ac6d76881c0f14 100644 |
| --- a/components/copresence/mediums/audio/audio_player.h |
| +++ b/components/copresence/mediums/audio/audio_player.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_ |
| -#define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_ |
| +#ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ |
| +#define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ |
| #include <vector> |
| @@ -26,17 +26,19 @@ class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback { |
| AudioPlayer(); |
| // Initializes the object. Do not use this object before calling this method. |
| - void Initialize(); |
| + 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. |
| - void Play(const scoped_refptr<media::AudioBusRefCounted>& samples); |
| + virtual void Play(const scoped_refptr<media::AudioBusRefCounted>& samples); |
| // Stop playing. |
| - void Stop(); |
| + virtual void Stop(); |
| + |
| + virtual bool IsPlaying(); |
|
xiyuan
2014/08/12 18:57:50
nit: Make it a non-virtual accessor?
rkc
2014/08/13 00:29:00
Done.
|
| // Cleans up and deletes this object. Do not use object after this call. |
| - void Finalize(); |
| + virtual void Finalize(); |
| // Takes ownership of the stream. |
| void set_output_stream_for_testing( |
| @@ -44,13 +46,16 @@ class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback { |
| output_stream_for_testing_.reset(output_stream_for_testing); |
| } |
| + protected: |
| + virtual ~AudioPlayer(); |
| + |
| + bool is_playing_; |
|
xiyuan
2014/08/12 18:57:50
nit: prefer to have protected setter accessor than
rkc
2014/08/13 00:29:00
Done.
|
| + |
| private: |
| friend class AudioPlayerTest; |
| FRIEND_TEST_ALL_PREFIXES(AudioPlayerTest, BasicPlayAndStop); |
| FRIEND_TEST_ALL_PREFIXES(AudioPlayerTest, OutOfOrderPlayAndStopMultiple); |
| - virtual ~AudioPlayer(); |
| - |
| // Methods to do our various operations; all of these need to be run on the |
| // audio thread. |
| void InitializeOnAudioThread(); |
| @@ -75,8 +80,6 @@ class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback { |
| scoped_ptr<media::AudioOutputStream> output_stream_for_testing_; |
| - bool is_playing_; |
| - |
| // All fields below here are protected by this lock. |
| base::Lock state_lock_; |
| @@ -90,4 +93,4 @@ class AudioPlayer : public media::AudioOutputStream::AudioSourceCallback { |
| } // namespace copresence |
| -#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_ |
| +#endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ |