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 // Implementation of AudioInputStream for Mac OS X using the special AUHAL | 5 // Implementation of AudioInputStream for Mac OS X using the special AUHAL |
6 // input Audio Unit present in OS 10.4 and later. | 6 // input Audio Unit present in OS 10.4 and later. |
7 // The AUHAL input Audio Unit is for low-latency audio I/O. | 7 // The AUHAL input Audio Unit is for low-latency audio I/O. |
8 // | 8 // |
9 // Overview of operation: | 9 // Overview of operation: |
10 // | 10 // |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 class AudioBus; | 60 class AudioBus; |
61 class AudioManagerMac; | 61 class AudioManagerMac; |
62 class DataBuffer; | 62 class DataBuffer; |
63 | 63 |
64 class MEDIA_EXPORT AUAudioInputStream | 64 class MEDIA_EXPORT AUAudioInputStream |
65 : public AgcAudioStream<AudioInputStream> { | 65 : public AgcAudioStream<AudioInputStream> { |
66 public: | 66 public: |
67 // The ctor takes all the usual parameters, plus |manager| which is the | 67 // The ctor takes all the usual parameters, plus |manager| which is the |
68 // the audio manager who is creating this object. | 68 // the audio manager who is creating this object. |
69 AUAudioInputStream(AudioManagerMac* manager, | 69 AUAudioInputStream( |
70 const AudioParameters& input_params, | 70 AudioManagerMac* manager, |
71 AudioDeviceID audio_device_id); | 71 const AudioParameters& input_params, |
| 72 AudioDeviceID audio_device_id, |
| 73 const AudioManager::StatisticsCallback& statistics_callback); |
72 // The dtor is typically called by the AudioManager only and it is usually | 74 // The dtor is typically called by the AudioManager only and it is usually |
73 // triggered by calling AudioInputStream::Close(). | 75 // triggered by calling AudioInputStream::Close(). |
74 ~AUAudioInputStream() override; | 76 ~AUAudioInputStream() override; |
75 | 77 |
76 // Implementation of AudioInputStream. | 78 // Implementation of AudioInputStream. |
77 bool Open() override; | 79 bool Open() override; |
78 void Start(AudioInputCallback* callback) override; | 80 void Start(AudioInputCallback* callback) override; |
79 void Stop() override; | 81 void Stop() override; |
80 void Close() override; | 82 void Close() override; |
81 double GetMaxVolume() override; | 83 double GetMaxVolume() override; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 | 319 |
318 // Counts number of times RestartAudio() has been called. The max number of | 320 // Counts number of times RestartAudio() has been called. The max number of |
319 // attempts is restricted by |kMaxNumberOfRestartAttempts|. | 321 // attempts is restricted by |kMaxNumberOfRestartAttempts|. |
320 // Note that this counter is reset to zero after each successful restart. | 322 // Note that this counter is reset to zero after each successful restart. |
321 size_t number_of_restart_attempts_; | 323 size_t number_of_restart_attempts_; |
322 | 324 |
323 // Counts the total number of times RestartAudio() has been called. It is | 325 // Counts the total number of times RestartAudio() has been called. It is |
324 // set to zero once in the constructor and then never reset again. | 326 // set to zero once in the constructor and then never reset again. |
325 size_t total_number_of_restart_attempts_; | 327 size_t total_number_of_restart_attempts_; |
326 | 328 |
| 329 // Sends statistics info. |
| 330 AudioManager::StatisticsCallback statistics_callback_; |
| 331 |
327 // Used to ensure DevicePropertyChangedOnMainThread() is not called when | 332 // Used to ensure DevicePropertyChangedOnMainThread() is not called when |
328 // this object is destroyed. | 333 // this object is destroyed. |
329 // Note that, all member variables should appear before the WeakPtrFactory. | 334 // Note that, all member variables should appear before the WeakPtrFactory. |
330 base::WeakPtrFactory<AUAudioInputStream> weak_factory_; | 335 base::WeakPtrFactory<AUAudioInputStream> weak_factory_; |
331 | 336 |
332 DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream); | 337 DISALLOW_COPY_AND_ASSIGN(AUAudioInputStream); |
333 }; | 338 }; |
334 | 339 |
335 } // namespace media | 340 } // namespace media |
336 | 341 |
337 #endif // MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_ | 342 #endif // MEDIA_AUDIO_MAC_AUDIO_LOW_LATENCY_INPUT_MAC_H_ |
OLD | NEW |