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