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> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 enum State { | 49 enum State { |
50 kStateEmpty, // Initial state. | 50 kStateEmpty, // Initial state. |
51 kStateReady, // Device obtained and ready to record. | 51 kStateReady, // Device obtained and ready to record. |
52 kStateRecording, // Recording audio. | 52 kStateRecording, // Recording audio. |
53 kStateStopping, // Trying to stop, waiting for callback to finish. | 53 kStateStopping, // Trying to stop, waiting for callback to finish. |
54 kStateStopped, // Stopped. Device was reset. | 54 kStateStopped, // Stopped. Device was reset. |
55 kStateClosed // Device has been released. | 55 kStateClosed // Device has been released. |
56 }; | 56 }; |
57 | 57 |
58 // Allow unit tests to query the device ID. | 58 // Allow unit tests to query the device ID. |
59 friend class AudioInputDeviceTest; | 59 friend class AudioManagerTest; |
60 | 60 |
61 // Windows calls us back with the recorded audio data here. See msdn | 61 // Windows calls us back with the recorded audio data here. See msdn |
62 // documentation for 'waveInProc' for details about the parameters. | 62 // documentation for 'waveInProc' for details about the parameters. |
63 static void CALLBACK WaveCallback(HWAVEIN hwi, UINT msg, DWORD_PTR instance, | 63 static void CALLBACK WaveCallback(HWAVEIN hwi, UINT msg, DWORD_PTR instance, |
64 DWORD_PTR param1, DWORD_PTR param2); | 64 DWORD_PTR param1, DWORD_PTR param2); |
65 | 65 |
66 // If windows reports an error this function handles it and passes it to | 66 // If windows reports an error this function handles it and passes it to |
67 // the attached AudioInputCallback::OnError(). | 67 // the attached AudioInputCallback::OnError(). |
68 void HandleError(MMRESULT error); | 68 void HandleError(MMRESULT error); |
69 | 69 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 // Lock used to avoid conflicts when Stop() is called during a callback. | 123 // Lock used to avoid conflicts when Stop() is called during a callback. |
124 base::Lock lock_; | 124 base::Lock lock_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); | 126 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace media | 129 } // namespace media |
130 | 130 |
131 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ | 131 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
OLD | NEW |