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

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

Issue 18188: Testing to determine why some trybots have issues with some PCMWave testing.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | « no previous file | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <windows.h> 5 #include <windows.h>
6 #include <mmsystem.h> 6 #include <mmsystem.h>
7 #pragma comment(lib, "winmm.lib") 7 #pragma comment(lib, "winmm.lib")
8 8
9 #include "media/audio/win/waveout_output_win.h" 9 #include "media/audio/win/waveout_output_win.h"
10 10
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 bool PCMWaveOutAudioOutputStream::Open(size_t buffer_size) { 71 bool PCMWaveOutAudioOutputStream::Open(size_t buffer_size) {
72 if (state_ != PCMA_BRAND_NEW) 72 if (state_ != PCMA_BRAND_NEW)
73 return false; 73 return false;
74 // Open the device. We'll be getting callback in WaveCallback function. They 74 // Open the device. We'll be getting callback in WaveCallback function. They
75 // occur in a magic, time-critical thread that windows creates. 75 // occur in a magic, time-critical thread that windows creates.
76 MMRESULT result = ::waveOutOpen(&waveout_, device_id_, &format_, 76 MMRESULT result = ::waveOutOpen(&waveout_, device_id_, &format_,
77 reinterpret_cast<DWORD_PTR>(WaveCallback), 77 reinterpret_cast<DWORD_PTR>(WaveCallback),
78 reinterpret_cast<DWORD_PTR>(this), 78 reinterpret_cast<DWORD_PTR>(this),
79 CALLBACK_FUNCTION); 79 CALLBACK_FUNCTION);
80 if (result != MMSYSERR_NOERROR) 80 if (result != MMSYSERR_NOERROR) {
81 fprintf(stderr, "waveOutOpen error %d\n", result);
81 return false; 82 return false;
82 83 }
83 // If we don't have a packet size we use 100ms. 84 // If we don't have a packet size we use 100ms.
84 if (!buffer_size) 85 if (!buffer_size)
85 buffer_size = format_.nAvgBytesPerSec / 10; 86 buffer_size = format_.nAvgBytesPerSec / 10;
86 87
87 SetupBuffers(buffer_size); 88 SetupBuffers(buffer_size);
88 buffer_size_ = buffer_size; 89 buffer_size_ = buffer_size;
89 state_ = PCMA_READY; 90 state_ = PCMA_READY;
90 return true; 91 return true;
91 } 92 }
92 93
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 247 }
247 obj->QueueNextPacket(buffer); 248 obj->QueueNextPacket(buffer);
248 } else if (msg == WOM_CLOSE) { 249 } else if (msg == WOM_CLOSE) {
249 // We can be closed before calling Start, so it is possible to have a 250 // We can be closed before calling Start, so it is possible to have a
250 // null callback at this point. 251 // null callback at this point.
251 if (obj->callback_) 252 if (obj->callback_)
252 obj->callback_->OnClose(obj); 253 obj->callback_->OnClose(obj);
253 } 254 }
254 } 255 }
255 256
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698