| OLD | NEW |
| 1 // Copyright (c) 2011 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 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 state_ = kStateClosed; | 180 state_ = kStateClosed; |
| 181 wavein_ = NULL; | 181 wavein_ = NULL; |
| 182 FreeBuffers(); | 182 FreeBuffers(); |
| 183 } | 183 } |
| 184 // Tell the audio manager that we have been released. This can result in | 184 // Tell the audio manager that we have been released. This can result in |
| 185 // the manager destroying us in-place so this needs to be the last thing | 185 // the manager destroying us in-place so this needs to be the last thing |
| 186 // we do on this function. | 186 // we do on this function. |
| 187 manager_->ReleaseInputStream(this); | 187 manager_->ReleaseInputStream(this); |
| 188 } | 188 } |
| 189 | 189 |
| 190 double PCMWaveInAudioInputStream::GetMaxVolume() { |
| 191 // TODO(xians): Add volume support. |
| 192 return 0.0; |
| 193 } |
| 194 |
| 195 void PCMWaveInAudioInputStream::SetVolume(double volume) { |
| 196 // TODO(xians): Add volume support. |
| 197 } |
| 198 |
| 199 double PCMWaveInAudioInputStream::GetVolume() { |
| 200 // TODO(xians): Add volume support. |
| 201 return 0.0; |
| 202 } |
| 203 |
| 190 void PCMWaveInAudioInputStream::HandleError(MMRESULT error) { | 204 void PCMWaveInAudioInputStream::HandleError(MMRESULT error) { |
| 191 DLOG(WARNING) << "PCMWaveInAudio error " << error; | 205 DLOG(WARNING) << "PCMWaveInAudio error " << error; |
| 192 callback_->OnError(this, error); | 206 callback_->OnError(this, error); |
| 193 } | 207 } |
| 194 | 208 |
| 195 void PCMWaveInAudioInputStream::QueueNextPacket(WAVEHDR *buffer) { | 209 void PCMWaveInAudioInputStream::QueueNextPacket(WAVEHDR *buffer) { |
| 196 MMRESULT res = ::waveInAddBuffer(wavein_, buffer, sizeof(WAVEHDR)); | 210 MMRESULT res = ::waveInAddBuffer(wavein_, buffer, sizeof(WAVEHDR)); |
| 197 if (res != MMSYSERR_NOERROR) | 211 if (res != MMSYSERR_NOERROR) |
| 198 HandleError(res); | 212 HandleError(res); |
| 199 } | 213 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 // waveInPrepareHeader. | 278 // waveInPrepareHeader. |
| 265 obj->QueueNextPacket(buffer); | 279 obj->QueueNextPacket(buffer); |
| 266 } | 280 } |
| 267 } else if (msg == WIM_CLOSE) { | 281 } else if (msg == WIM_CLOSE) { |
| 268 // 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 |
| 269 // null callback at this point. | 283 // null callback at this point. |
| 270 if (obj->callback_) | 284 if (obj->callback_) |
| 271 obj->callback_->OnClose(obj); | 285 obj->callback_->OnClose(obj); |
| 272 } | 286 } |
| 273 } | 287 } |
| OLD | NEW |