OLD | NEW |
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 #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 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "media/audio/audio_io.h" | 12 #include "media/audio/audio_io.h" |
13 #include "media/audio/audio_util.h" | 13 #include "media/audio/audio_util.h" |
14 #include "media/audio/win/audio_manager_win.h" | 14 #include "media/audio/win/audio_manager_win.h" |
15 #include "media/audio/win/device_enumeration_win.h" | 15 #include "media/audio/win/device_enumeration_win.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 const int kStopInputStreamCallbackTimeout = 3000; // Three seconds. | 18 const int kStopInputStreamCallbackTimeout = 3000; // Three seconds. |
19 } | 19 } |
20 | 20 |
21 using media::AudioDeviceNames; | 21 namespace media { |
22 | 22 |
23 // Our sound buffers are allocated once and kept in a linked list using the | 23 // Our sound buffers are allocated once and kept in a linked list using the |
24 // the WAVEHDR::dwUser variable. The last buffer points to the first buffer. | 24 // the WAVEHDR::dwUser variable. The last buffer points to the first buffer. |
25 static WAVEHDR* GetNextBuffer(WAVEHDR* current) { | 25 static WAVEHDR* GetNextBuffer(WAVEHDR* current) { |
26 return reinterpret_cast<WAVEHDR*>(current->dwUser); | 26 return reinterpret_cast<WAVEHDR*>(current->dwUser); |
27 } | 27 } |
28 | 28 |
29 PCMWaveInAudioInputStream::PCMWaveInAudioInputStream( | 29 PCMWaveInAudioInputStream::PCMWaveInAudioInputStream( |
30 AudioManagerWin* manager, const AudioParameters& params, int num_buffers, | 30 AudioManagerWin* manager, const AudioParameters& params, int num_buffers, |
31 const std::string& device_id) | 31 const std::string& device_id) |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // waveInPrepareHeader. | 278 // waveInPrepareHeader. |
279 obj->QueueNextPacket(buffer); | 279 obj->QueueNextPacket(buffer); |
280 } | 280 } |
281 } else if (msg == WIM_CLOSE) { | 281 } else if (msg == WIM_CLOSE) { |
282 // We can be closed before calling Start, so it is possible to have a | 282 // We can be closed before calling Start, so it is possible to have a |
283 // null callback at this point. | 283 // null callback at this point. |
284 if (obj->callback_) | 284 if (obj->callback_) |
285 obj->callback_->OnClose(obj); | 285 obj->callback_->OnClose(obj); |
286 } | 286 } |
287 } | 287 } |
| 288 |
| 289 } // namespace media |
OLD | NEW |