OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ | 5 #ifndef COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ |
6 #define COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ | 6 #define COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 void StopAndCloseOnAudioThread(); | 58 void StopAndCloseOnAudioThread(); |
59 void FinalizeOnAudioThread(); | 59 void FinalizeOnAudioThread(); |
60 | 60 |
61 // AudioOutputStream::AudioSourceCallback overrides: | 61 // AudioOutputStream::AudioSourceCallback overrides: |
62 // Following methods could be called from *ANY* thread. | 62 // Following methods could be called from *ANY* thread. |
63 int OnMoreData(media::AudioBus* dest, | 63 int OnMoreData(media::AudioBus* dest, |
64 uint32_t total_bytes_delay, | 64 uint32_t total_bytes_delay, |
65 uint32_t frames_skipped) override; | 65 uint32_t frames_skipped) override; |
66 void OnError(media::AudioOutputStream* stream) override; | 66 void OnError(media::AudioOutputStream* stream) override; |
67 | 67 |
| 68 // Flushes the audio loop, making sure that any queued operations are |
| 69 // performed. |
| 70 void FlushAudioLoopForTesting(); |
| 71 |
68 bool is_playing_; | 72 bool is_playing_; |
69 | 73 |
70 // Self-deleting object. | 74 // Self-deleting object. |
71 media::AudioOutputStream* stream_; | 75 media::AudioOutputStream* stream_; |
72 | 76 |
73 scoped_ptr<media::AudioOutputStream> output_stream_for_testing_; | 77 scoped_ptr<media::AudioOutputStream> output_stream_for_testing_; |
74 | 78 |
75 // All fields below here are protected by this lock. | 79 // All fields below here are protected by this lock. |
76 base::Lock state_lock_; | 80 base::Lock state_lock_; |
77 | 81 |
78 scoped_refptr<media::AudioBusRefCounted> samples_; | 82 scoped_refptr<media::AudioBusRefCounted> samples_; |
79 | 83 |
80 // Index to the frame in the samples that we need to play next. | 84 // Index to the frame in the samples that we need to play next. |
81 int frame_index_; | 85 int frame_index_; |
82 | 86 |
83 DISALLOW_COPY_AND_ASSIGN(AudioPlayerImpl); | 87 DISALLOW_COPY_AND_ASSIGN(AudioPlayerImpl); |
84 }; | 88 }; |
85 | 89 |
86 } // namespace audio_modem | 90 } // namespace audio_modem |
87 | 91 |
88 #endif // COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ | 92 #endif // COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ |
OLD | NEW |