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