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 <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
| 17 #include "base/time/time.h" |
17 #include "components/audio_modem/audio_player.h" | 18 #include "components/audio_modem/audio_player.h" |
18 #include "media/audio/audio_io.h" | 19 #include "media/audio/audio_io.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 class AudioBus; | 22 class AudioBus; |
22 class AudioBusRefCounted; | 23 class AudioBusRefCounted; |
23 } | 24 } |
24 | 25 |
25 namespace audio_modem { | 26 namespace audio_modem { |
26 | 27 |
(...skipping 29 matching lines...) Expand all Loading... |
56 void PlayOnAudioThread( | 57 void PlayOnAudioThread( |
57 const scoped_refptr<media::AudioBusRefCounted>& samples); | 58 const scoped_refptr<media::AudioBusRefCounted>& samples); |
58 void StopOnAudioThread(); | 59 void StopOnAudioThread(); |
59 void StopAndCloseOnAudioThread(); | 60 void StopAndCloseOnAudioThread(); |
60 void FinalizeOnAudioThread(); | 61 void FinalizeOnAudioThread(); |
61 | 62 |
62 // AudioOutputStream::AudioSourceCallback overrides: | 63 // AudioOutputStream::AudioSourceCallback overrides: |
63 // Following methods could be called from *ANY* thread. | 64 // Following methods could be called from *ANY* thread. |
64 int OnMoreData(media::AudioBus* dest, | 65 int OnMoreData(media::AudioBus* dest, |
65 uint32_t total_bytes_delay, | 66 uint32_t total_bytes_delay, |
| 67 base::TimeStamp delay_timestamp, |
66 uint32_t frames_skipped) override; | 68 uint32_t frames_skipped) override; |
67 void OnError(media::AudioOutputStream* stream) override; | 69 void OnError(media::AudioOutputStream* stream) override; |
68 | 70 |
69 bool is_playing_; | 71 bool is_playing_; |
70 | 72 |
71 // Self-deleting object. | 73 // Self-deleting object. |
72 media::AudioOutputStream* stream_; | 74 media::AudioOutputStream* stream_; |
73 | 75 |
74 std::unique_ptr<media::AudioOutputStream> output_stream_for_testing_; | 76 std::unique_ptr<media::AudioOutputStream> output_stream_for_testing_; |
75 | 77 |
76 // All fields below here are protected by this lock. | 78 // All fields below here are protected by this lock. |
77 base::Lock state_lock_; | 79 base::Lock state_lock_; |
78 | 80 |
79 scoped_refptr<media::AudioBusRefCounted> samples_; | 81 scoped_refptr<media::AudioBusRefCounted> samples_; |
80 | 82 |
81 // Index to the frame in the samples that we need to play next. | 83 // Index to the frame in the samples that we need to play next. |
82 int frame_index_; | 84 int frame_index_; |
83 | 85 |
84 DISALLOW_COPY_AND_ASSIGN(AudioPlayerImpl); | 86 DISALLOW_COPY_AND_ASSIGN(AudioPlayerImpl); |
85 }; | 87 }; |
86 | 88 |
87 } // namespace audio_modem | 89 } // namespace audio_modem |
88 | 90 |
89 #endif // COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ | 91 #endif // COMPONENTS_AUDIO_MODEM_AUDIO_PLAYER_IMPL_H_ |
OLD | NEW |