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