| 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 <windows.h> | 8 #include <windows.h> |
| 9 #include <mmsystem.h> | 9 #include <mmsystem.h> |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 private: | 40 private: |
| 41 enum State { | 41 enum State { |
| 42 kStateEmpty, // Initial state. | 42 kStateEmpty, // Initial state. |
| 43 kStateReady, // Device obtained and ready to record. | 43 kStateReady, // Device obtained and ready to record. |
| 44 kStateRecording, // Recording audio. | 44 kStateRecording, // Recording audio. |
| 45 kStateStopping, // Trying to stop, waiting for callback to finish. | 45 kStateStopping, // Trying to stop, waiting for callback to finish. |
| 46 kStateStopped, // Stopped. Device was reset. | 46 kStateStopped, // Stopped. Device was reset. |
| 47 kStateClosed // Device has been released. | 47 kStateClosed // Device has been released. |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 // Allow unit tests to query the device ID. |
| 51 friend class AudioInputDeviceTest; |
| 52 |
| 50 // Windows calls us back with the recorded audio data here. See msdn | 53 // Windows calls us back with the recorded audio data here. See msdn |
| 51 // documentation for 'waveInProc' for details about the parameters. | 54 // documentation for 'waveInProc' for details about the parameters. |
| 52 static void CALLBACK WaveCallback(HWAVEIN hwi, UINT msg, DWORD_PTR instance, | 55 static void CALLBACK WaveCallback(HWAVEIN hwi, UINT msg, DWORD_PTR instance, |
| 53 DWORD_PTR param1, DWORD_PTR param2); | 56 DWORD_PTR param1, DWORD_PTR param2); |
| 54 | 57 |
| 55 // If windows reports an error this function handles it and passes it to | 58 // If windows reports an error this function handles it and passes it to |
| 56 // the attached AudioInputCallback::OnError(). | 59 // the attached AudioInputCallback::OnError(). |
| 57 void HandleError(MMRESULT error); | 60 void HandleError(MMRESULT error); |
| 58 | 61 |
| 59 // Allocates and prepares the memory that will be used for recording. | 62 // Allocates and prepares the memory that will be used for recording. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 // Pointer to the first allocated audio buffer. This object owns it. | 107 // Pointer to the first allocated audio buffer. This object owns it. |
| 105 WAVEHDR* buffer_; | 108 WAVEHDR* buffer_; |
| 106 | 109 |
| 107 // An event that is signaled when the callback thread is ready to stop. | 110 // An event that is signaled when the callback thread is ready to stop. |
| 108 base::win::ScopedHandle stopped_event_; | 111 base::win::ScopedHandle stopped_event_; |
| 109 | 112 |
| 110 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); | 113 DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); |
| 111 }; | 114 }; |
| 112 | 115 |
| 113 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ | 116 #endif // MEDIA_AUDIO_WIN_WAVEIN_INPUT_WIN_H_ |
| OLD | NEW |