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

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

Issue 598243002: Remove implicit HANDLE conversions from media. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | no next file » | 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 #include "media/audio/win/wavein_input_win.h" 5 #include "media/audio/win/wavein_input_win.h"
6 6
7 #pragma comment(lib, "winmm.lib") 7 #pragma comment(lib, "winmm.lib")
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/audio/audio_io.h" 10 #include "media/audio/audio_io.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // As a result, |stopped_event_| will be signaled in callback method. 155 // As a result, |stopped_event_| will be signaled in callback method.
156 base::AutoLock auto_lock(lock_); 156 base::AutoLock auto_lock(lock_);
157 already_stopped = (callback_ == NULL); 157 already_stopped = (callback_ == NULL);
158 callback_ = NULL; 158 callback_ = NULL;
159 } 159 }
160 160
161 if (already_stopped) 161 if (already_stopped)
162 return; 162 return;
163 163
164 // Wait for the callback to finish, it will signal us when ready to be reset. 164 // Wait for the callback to finish, it will signal us when ready to be reset.
165 DWORD wait = ::WaitForSingleObject(stopped_event_, INFINITE); 165 DWORD wait = ::WaitForSingleObject(stopped_event_.Get(), INFINITE);
166 DCHECK_EQ(wait, WAIT_OBJECT_0); 166 DCHECK_EQ(wait, WAIT_OBJECT_0);
167 167
168 // Stop input and reset the current position to zero for |wavein_|. 168 // Stop input and reset the current position to zero for |wavein_|.
169 // All pending buffers are marked as done and returned to the application. 169 // All pending buffers are marked as done and returned to the application.
170 MMRESULT res = ::waveInReset(wavein_); 170 MMRESULT res = ::waveInReset(wavein_);
171 DCHECK_EQ(res, static_cast<MMRESULT>(MMSYSERR_NOERROR)); 171 DCHECK_EQ(res, static_cast<MMRESULT>(MMSYSERR_NOERROR));
172 172
173 state_ = kStateReady; 173 state_ = kStateReady;
174 } 174 }
175 175
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 obj, obj->audio_bus_.get(), buffer->dwBytesRecorded, 0.0); 301 obj, obj->audio_bus_.get(), buffer->dwBytesRecorded, 0.0);
302 302
303 // Queue the finished buffer back with the audio driver. Since we are 303 // Queue the finished buffer back with the audio driver. Since we are
304 // reusing the same buffers we can get away without calling 304 // reusing the same buffers we can get away without calling
305 // waveInPrepareHeader. 305 // waveInPrepareHeader.
306 obj->QueueNextPacket(buffer); 306 obj->QueueNextPacket(buffer);
307 } else { 307 } else {
308 // Main thread has called Stop() and set |callback_| to NULL and is 308 // Main thread has called Stop() and set |callback_| to NULL and is
309 // now waiting to issue waveInReset which will kill this thread. 309 // now waiting to issue waveInReset which will kill this thread.
310 // We should not call AudioSourceCallback code anymore. 310 // We should not call AudioSourceCallback code anymore.
311 ::SetEvent(obj->stopped_event_); 311 ::SetEvent(obj->stopped_event_.Get());
312 } 312 }
313 } else if (msg == WIM_CLOSE) { 313 } else if (msg == WIM_CLOSE) {
314 // Intentionaly no-op for now. 314 // Intentionaly no-op for now.
315 } else if (msg == WIM_OPEN) { 315 } else if (msg == WIM_OPEN) {
316 // Intentionaly no-op for now. 316 // Intentionaly no-op for now.
317 } 317 }
318 } 318 }
319 319
320 } // namespace media 320 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698