OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ | 5 #ifndef MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ |
6 #define MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ | 6 #define MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ |
7 | 7 |
8 #include <AudioToolbox/AudioFormat.h> | 8 #include <AudioToolbox/AudioFormat.h> |
9 #include <AudioToolbox/AudioQueue.h> | 9 #include <AudioToolbox/AudioQueue.h> |
10 | 10 |
11 #include "base/cancelable_callback.h" | 11 #include "base/cancelable_callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "media/audio/audio_io.h" | 14 #include "media/audio/audio_io.h" |
15 #include "media/audio/audio_parameters.h" | 15 #include "media/audio/audio_parameters.h" |
16 | 16 |
17 namespace media { | 17 namespace media { |
18 | 18 |
19 class AudioBus; | |
20 class AudioManagerMac; | 19 class AudioManagerMac; |
21 | 20 |
22 // Implementation of AudioInputStream for Mac OS X using the audio queue service | 21 // Implementation of AudioInputStream for Mac OS X using the audio queue service |
23 // present in OS 10.5 and later. Design reflects PCMQueueOutAudioOutputStream. | 22 // present in OS 10.5 and later. Design reflects PCMQueueOutAudioOutputStream. |
24 class PCMQueueInAudioInputStream : public AudioInputStream { | 23 class PCMQueueInAudioInputStream : public AudioInputStream { |
25 public: | 24 public: |
26 // Parameters as per AudioManager::MakeAudioInputStream. | 25 // Parameters as per AudioManager::MakeAudioInputStream. |
27 PCMQueueInAudioInputStream(AudioManagerMac* manager, | 26 PCMQueueInAudioInputStream(AudioManagerMac* manager, |
28 const AudioParameters& params); | 27 const AudioParameters& params); |
29 virtual ~PCMQueueInAudioInputStream(); | 28 virtual ~PCMQueueInAudioInputStream(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 AudioQueueRef audio_queue_; | 76 AudioQueueRef audio_queue_; |
78 // Size of each of the buffers in |audio_buffers_| | 77 // Size of each of the buffers in |audio_buffers_| |
79 uint32 buffer_size_bytes_; | 78 uint32 buffer_size_bytes_; |
80 // True iff Start() has been called successfully. | 79 // True iff Start() has been called successfully. |
81 bool started_; | 80 bool started_; |
82 // Used to determine if we need to slow down |callback_| calls. | 81 // Used to determine if we need to slow down |callback_| calls. |
83 base::TimeTicks last_fill_; | 82 base::TimeTicks last_fill_; |
84 // Used to defer Start() to workaround http://crbug.com/160920. | 83 // Used to defer Start() to workaround http://crbug.com/160920. |
85 base::CancelableClosure deferred_start_cb_; | 84 base::CancelableClosure deferred_start_cb_; |
86 | 85 |
87 scoped_ptr<media::AudioBus> audio_bus_; | |
88 | |
89 DISALLOW_COPY_AND_ASSIGN(PCMQueueInAudioInputStream); | 86 DISALLOW_COPY_AND_ASSIGN(PCMQueueInAudioInputStream); |
90 }; | 87 }; |
91 | 88 |
92 } // namespace media | 89 } // namespace media |
93 | 90 |
94 #endif // MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ | 91 #endif // MEDIA_AUDIO_MAC_AUDIO_INPUT_MAC_H_ |
OLD | NEW |