OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ | 5 #ifndef COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ |
6 #define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ | 6 #define COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void InitializeOnAudioThread(); | 60 void InitializeOnAudioThread(); |
61 void PlayOnAudioThread( | 61 void PlayOnAudioThread( |
62 const scoped_refptr<media::AudioBusRefCounted>& samples); | 62 const scoped_refptr<media::AudioBusRefCounted>& samples); |
63 void StopOnAudioThread(); | 63 void StopOnAudioThread(); |
64 void StopAndCloseOnAudioThread(); | 64 void StopAndCloseOnAudioThread(); |
65 void FinalizeOnAudioThread(); | 65 void FinalizeOnAudioThread(); |
66 | 66 |
67 // AudioOutputStream::AudioSourceCallback overrides: | 67 // AudioOutputStream::AudioSourceCallback overrides: |
68 // Following methods could be called from *ANY* thread. | 68 // Following methods could be called from *ANY* thread. |
69 virtual int OnMoreData(media::AudioBus* dest, | 69 virtual int OnMoreData(media::AudioBus* dest, |
70 uint32 total_bytes_delay) OVERRIDE; | 70 uint32 total_bytes_delay) override; |
71 virtual void OnError(media::AudioOutputStream* stream) OVERRIDE; | 71 virtual void OnError(media::AudioOutputStream* stream) override; |
72 | 72 |
73 // Flushes the audio loop, making sure that any queued operations are | 73 // Flushes the audio loop, making sure that any queued operations are |
74 // performed. | 74 // performed. |
75 void FlushAudioLoopForTesting(); | 75 void FlushAudioLoopForTesting(); |
76 | 76 |
77 bool is_playing_; | 77 bool is_playing_; |
78 | 78 |
79 // Self-deleting object. | 79 // Self-deleting object. |
80 media::AudioOutputStream* stream_; | 80 media::AudioOutputStream* stream_; |
81 | 81 |
82 scoped_ptr<media::AudioOutputStream> output_stream_for_testing_; | 82 scoped_ptr<media::AudioOutputStream> output_stream_for_testing_; |
83 | 83 |
84 // All fields below here are protected by this lock. | 84 // All fields below here are protected by this lock. |
85 base::Lock state_lock_; | 85 base::Lock state_lock_; |
86 | 86 |
87 scoped_refptr<media::AudioBusRefCounted> samples_; | 87 scoped_refptr<media::AudioBusRefCounted> samples_; |
88 | 88 |
89 // Index to the frame in the samples that we need to play next. | 89 // Index to the frame in the samples that we need to play next. |
90 int frame_index_; | 90 int frame_index_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(AudioPlayer); | 92 DISALLOW_COPY_AND_ASSIGN(AudioPlayer); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace copresence | 95 } // namespace copresence |
96 | 96 |
97 #endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ | 97 #endif // COMPONENTS_COPRESENCE_MEDIUMS_AUDIO_AUDIO_PLAYER_H_ |
OLD | NEW |