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

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

Issue 9221010: Adds support for 16kHz input sample rate and mono channel config. in WebRTC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed more size_t Created 8 years, 11 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/audio_util.cc ('k') | media/audio/win/audio_low_latency_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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // Implementation of AudioInputStream for Windows using Windows Core Audio 5 // Implementation of AudioInputStream for Windows using Windows Core Audio
6 // WASAPI for low latency capturing. 6 // WASAPI for low latency capturing.
7 // 7 //
8 // Overview of operation: 8 // Overview of operation:
9 // 9 //
10 // - An object of WASAPIAudioInputStream is created by the AudioManager 10 // - An object of WASAPIAudioInputStream is created by the AudioManager
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // The dtor is typically called by the AudioManager only and it is usually 82 // The dtor is typically called by the AudioManager only and it is usually
83 // triggered by calling AudioInputStream::Close(). 83 // triggered by calling AudioInputStream::Close().
84 virtual ~WASAPIAudioInputStream(); 84 virtual ~WASAPIAudioInputStream();
85 85
86 // Implementation of AudioInputStream. 86 // Implementation of AudioInputStream.
87 virtual bool Open() OVERRIDE; 87 virtual bool Open() OVERRIDE;
88 virtual void Start(AudioInputCallback* callback) OVERRIDE; 88 virtual void Start(AudioInputCallback* callback) OVERRIDE;
89 virtual void Stop() OVERRIDE; 89 virtual void Stop() OVERRIDE;
90 virtual void Close() OVERRIDE; 90 virtual void Close() OVERRIDE;
91 91
92 // Retrieves the stream format that the audio engine uses for its internal 92 // Retrieves the sample rate used by the audio engine for its internal
93 // processing/mixing of shared-mode streams. 93 // processing/mixing of shared-mode streams.
94 static double HardwareSampleRate(ERole device_role); 94 static double HardwareSampleRate(ERole device_role);
95 95
96 // Retrieves the number of audio channels used by the audio engine for its
97 // internal processing/mixing of shared-mode streams.
98 static uint32 HardwareChannelCount(ERole device_role);
99
96 bool started() const { return started_; } 100 bool started() const { return started_; }
97 101
98 private: 102 private:
99 // DelegateSimpleThread::Delegate implementation. 103 // DelegateSimpleThread::Delegate implementation.
100 virtual void Run() OVERRIDE; 104 virtual void Run() OVERRIDE;
101 105
102 // Issues the OnError() callback to the |sink_|. 106 // Issues the OnError() callback to the |sink_|.
103 void HandleError(HRESULT err); 107 void HandleError(HRESULT err);
104 108
105 // The Open() method is divided into these sub methods. 109 // The Open() method is divided into these sub methods.
106 HRESULT SetCaptureDevice(); 110 HRESULT SetCaptureDevice();
107 HRESULT ActivateCaptureDevice(); 111 HRESULT ActivateCaptureDevice();
108 HRESULT GetAudioEngineStreamFormat(); 112 HRESULT GetAudioEngineStreamFormat();
109 bool DesiredFormatIsSupported(); 113 bool DesiredFormatIsSupported();
110 HRESULT InitializeAudioEngine(); 114 HRESULT InitializeAudioEngine();
111 115
116 // Retrieves the stream format that the audio engine uses for its internal
117 // processing/mixing of shared-mode streams.
118 static HRESULT GetMixFormat(ERole device_role, WAVEFORMATEX** device_format);
119
112 // Initializes the COM library for use by the calling thread and set the 120 // Initializes the COM library for use by the calling thread and set the
113 // thread's concurrency model to multi-threaded. 121 // thread's concurrency model to multi-threaded.
114 base::win::ScopedCOMInitializer com_init_; 122 base::win::ScopedCOMInitializer com_init_;
115 123
116 // Our creator, the audio manager needs to be notified when we close. 124 // Our creator, the audio manager needs to be notified when we close.
117 AudioManagerWin* manager_; 125 AudioManagerWin* manager_;
118 126
119 // Capturing is driven by this thread (which has no message loop). 127 // Capturing is driven by this thread (which has no message loop).
120 // All OnData() callbacks will be called from this thread. 128 // All OnData() callbacks will be called from this thread.
121 base::DelegateSimpleThread* capture_thread_; 129 base::DelegateSimpleThread* capture_thread_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 // recorded. 184 // recorded.
177 base::win::ScopedHandle audio_samples_ready_event_; 185 base::win::ScopedHandle audio_samples_ready_event_;
178 186
179 // This event will be signaled when capturing shall stop. 187 // This event will be signaled when capturing shall stop.
180 base::win::ScopedHandle stop_capture_event_; 188 base::win::ScopedHandle stop_capture_event_;
181 189
182 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream); 190 DISALLOW_COPY_AND_ASSIGN(WASAPIAudioInputStream);
183 }; 191 };
184 192
185 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_ 193 #endif // MEDIA_AUDIO_WIN_AUDIO_LOW_LATENCY_INPUT_WIN_H_
OLDNEW
« no previous file with comments | « media/audio/audio_util.cc ('k') | media/audio/win/audio_low_latency_input_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698