Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: media/audio/win/wavein_input_win.h

Issue 9566002: On windows, create PCMWaveInAudioInputStream instance with correct device ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add test. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/win/device_enumeration_win.cc ('k') | media/audio/win/wavein_input_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « media/audio/win/device_enumeration_win.cc ('k') | media/audio/win/wavein_input_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698