| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "media/audio/audio_io.h" | 13 #include "media/audio/audio_io.h" |
| 14 #include "media/audio/audio_util.h" | 14 #include "media/audio/audio_util.h" |
| 15 #include "media/audio/win/audio_manager_win.h" | 15 #include "media/audio/win/audio_manager_win.h" |
| 16 | 16 |
| 17 namespace { | |
| 18 | |
| 19 // Our sound buffers are allocated once and kept in a linked list using the | 17 // Our sound buffers are allocated once and kept in a linked list using the |
| 20 // the WAVEHDR::dwUser variable. The last buffer points to the first buffer. | 18 // the WAVEHDR::dwUser variable. The last buffer points to the first buffer. |
| 21 WAVEHDR* GetNextBuffer(WAVEHDR* current) { | 19 static WAVEHDR* GetNextBuffer(WAVEHDR* current) { |
| 22 return reinterpret_cast<WAVEHDR*>(current->dwUser); | 20 return reinterpret_cast<WAVEHDR*>(current->dwUser); |
| 23 } | 21 } |
| 24 | 22 |
| 25 } // namespace | |
| 26 | |
| 27 PCMWaveInAudioInputStream::PCMWaveInAudioInputStream( | 23 PCMWaveInAudioInputStream::PCMWaveInAudioInputStream( |
| 28 AudioManagerWin* manager, AudioParameters params, int num_buffers, | 24 AudioManagerWin* manager, AudioParameters params, int num_buffers, |
| 29 UINT device_id) | 25 UINT device_id) |
| 30 : state_(kStateEmpty), | 26 : state_(kStateEmpty), |
| 31 manager_(manager), | 27 manager_(manager), |
| 32 device_id_(device_id), | 28 device_id_(device_id), |
| 33 wavein_(NULL), | 29 wavein_(NULL), |
| 34 callback_(NULL), | 30 callback_(NULL), |
| 35 num_buffers_(num_buffers), | 31 num_buffers_(num_buffers), |
| 36 buffer_(NULL), | 32 buffer_(NULL), |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // waveInPrepareHeader. | 203 // waveInPrepareHeader. |
| 208 obj->QueueNextPacket(buffer); | 204 obj->QueueNextPacket(buffer); |
| 209 } | 205 } |
| 210 } else if (msg == WIM_CLOSE) { | 206 } else if (msg == WIM_CLOSE) { |
| 211 // We can be closed before calling Start, so it is possible to have a | 207 // We can be closed before calling Start, so it is possible to have a |
| 212 // null callback at this point. | 208 // null callback at this point. |
| 213 if (obj->callback_) | 209 if (obj->callback_) |
| 214 obj->callback_->OnClose(obj); | 210 obj->callback_->OnClose(obj); |
| 215 } | 211 } |
| 216 } | 212 } |
| OLD | NEW |