| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_AUDIO_INPUT_CONTROLLER_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 6 #define MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/lock.h" | |
| 9 #include "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 10 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/synchronization/lock.h" |
| 11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 12 #include "media/audio/audio_io.h" | 12 #include "media/audio/audio_io.h" |
| 13 #include "media/audio/audio_manager.h" | 13 #include "media/audio/audio_manager.h" |
| 14 | 14 |
| 15 // An AudioInputController controls an AudioInputStream and records data | 15 // An AudioInputController controls an AudioInputStream and records data |
| 16 // from this input stream. It has an important function that it executes | 16 // from this input stream. It has an important function that it executes |
| 17 // audio operations like record, pause, stop, etc. on a separate thread. | 17 // audio operations like record, pause, stop, etc. on a separate thread. |
| 18 // | 18 // |
| 19 // All the public methods of AudioInputController are non-blocking except | 19 // All the public methods of AudioInputController are non-blocking except |
| 20 // close, the actual operations are performed on the audio input controller | 20 // close, the actual operations are performed on the audio input controller |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 void DoReportError(int code); | 114 void DoReportError(int code); |
| 115 | 115 |
| 116 EventHandler* handler_; | 116 EventHandler* handler_; |
| 117 AudioInputStream* stream_; | 117 AudioInputStream* stream_; |
| 118 | 118 |
| 119 // |state_| is written on the audio input controller thread and is read on | 119 // |state_| is written on the audio input controller thread and is read on |
| 120 // the hardware audio thread. These operations need to be locked. But lock | 120 // the hardware audio thread. These operations need to be locked. But lock |
| 121 // is not required for reading on the audio input controller thread. | 121 // is not required for reading on the audio input controller thread. |
| 122 State state_; | 122 State state_; |
| 123 | 123 |
| 124 Lock lock_; | 124 base::Lock lock_; |
| 125 | 125 |
| 126 // The audio input controller thread that this object runs on. | 126 // The audio input controller thread that this object runs on. |
| 127 base::Thread thread_; | 127 base::Thread thread_; |
| 128 | 128 |
| 129 static Factory* factory_; | 129 static Factory* factory_; |
| 130 | 130 |
| 131 DISALLOW_COPY_AND_ASSIGN(AudioInputController); | 131 DISALLOW_COPY_AND_ASSIGN(AudioInputController); |
| 132 }; | 132 }; |
| 133 | 133 |
| 134 } // namespace media | 134 } // namespace media |
| 135 | 135 |
| 136 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ | 136 #endif // MEDIA_AUDIO_AUDIO_INPUT_CONTROLLER_H_ |
| OLD | NEW |