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_WIN_WAVEIN_INPUT_WIN_H_ | 5 #ifndef MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
6 #define MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ | 6 #define MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <windows.h> | 10 #include <windows.h> |
11 #include <mmsystem.h> | 11 #include <mmsystem.h> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/synchronization/lock.h" |
15 #include "base/win/scoped_handle.h" | 16 #include "base/win/scoped_handle.h" |
16 #include "media/audio/audio_io.h" | 17 #include "media/audio/audio_io.h" |
17 #include "media/audio/audio_parameters.h" | 18 #include "media/audio/audio_parameters.h" |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 | 21 |
21 class AudioManagerWin; | 22 class AudioManagerWin; |
22 | 23 |
23 class PCMWaveInAudioInputStream : public AudioInputStream { | 24 class PCMWaveInAudioInputStream : public AudioInputStream { |
24 public: | 25 public: |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 110 |
110 // Handle to the instance of the wave device. | 111 // Handle to the instance of the wave device. |
111 HWAVEIN wavein_; | 112 HWAVEIN wavein_; |
112 | 113 |
113 // Pointer to the first allocated audio buffer. This object owns it. | 114 // Pointer to the first allocated audio buffer. This object owns it. |
114 WAVEHDR* buffer_; | 115 WAVEHDR* buffer_; |
115 | 116 |
116 // An event that is signaled when the callback thread is ready to stop. | 117 // An event that is signaled when the callback thread is ready to stop. |
117 base::win::ScopedHandle stopped_event_; | 118 base::win::ScopedHandle stopped_event_; |
118 | 119 |
| 120 // Lock used to avoid conflicts when Stop() is called during a callback. |
| 121 base::Lock lock_; |
| 122 |
119 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); | 123 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); |
120 }; | 124 }; |
121 | 125 |
122 } // namespace media | 126 } // namespace media |
123 | 127 |
124 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ | 128 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
OLD | NEW |