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

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

Issue 11567023: Merge 168111 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1312/src/
Patch Set: Created 8 years 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/base/media_switches.h » ('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 #include "media/audio/win/waveout_output_win.h" 5 #include "media/audio/win/waveout_output_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <mmsystem.h> 8 #include <mmsystem.h>
9 #pragma comment(lib, "winmm.lib") 9 #pragma comment(lib, "winmm.lib")
10 10
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 271 }
272 272
273 // Stop playback. 273 // Stop playback.
274 MMRESULT res = ::waveOutReset(waveout_); 274 MMRESULT res = ::waveOutReset(waveout_);
275 if (res != MMSYSERR_NOERROR) { 275 if (res != MMSYSERR_NOERROR) {
276 state_ = PCMA_PLAYING; 276 state_ = PCMA_PLAYING;
277 HandleError(res); 277 HandleError(res);
278 return; 278 return;
279 } 279 }
280 280
281 // Wait for lock to ensure all outstanding callbacks have completed.
282 base::AutoLock auto_lock(lock_);
283
281 // waveOutReset() leaves buffers in the unpredictable state, causing 284 // waveOutReset() leaves buffers in the unpredictable state, causing
282 // problems if we want to close, release, or reuse them. Fix the states. 285 // problems if we want to close, release, or reuse them. Fix the states.
283 for (int ix = 0; ix != num_buffers_; ++ix) { 286 for (int ix = 0; ix != num_buffers_; ++ix) {
284 GetBuffer(ix)->dwFlags = WHDR_PREPARED; 287 GetBuffer(ix)->dwFlags = WHDR_PREPARED;
285 } 288 }
286 289
287 // Don't use callback after Stop(). 290 // Don't use callback after Stop().
288 callback_ = NULL; 291 callback_ = NULL;
289 292
290 state_ = PCMA_READY; 293 state_ = PCMA_READY;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 buffer, 407 buffer,
405 sizeof(WAVEHDR)); 408 sizeof(WAVEHDR));
406 if (result != MMSYSERR_NOERROR) 409 if (result != MMSYSERR_NOERROR)
407 stream->HandleError(result); 410 stream->HandleError(result);
408 stream->pending_bytes_ += buffer->dwBufferLength; 411 stream->pending_bytes_ += buffer->dwBufferLength;
409 } 412 }
410 } 413 }
411 } 414 }
412 415
413 } // namespace media 416 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_util.cc ('k') | media/base/media_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698