| 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/waveout_output_win.h" | 5 #include "media/audio/win/waveout_output_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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 | 328 |
| 329 void PCMWaveOutAudioOutputStream::GetVolume(double* volume) { | 329 void PCMWaveOutAudioOutputStream::GetVolume(double* volume) { |
| 330 if (!waveout_) | 330 if (!waveout_) |
| 331 return; | 331 return; |
| 332 *volume = volume_; | 332 *volume = volume_; |
| 333 } | 333 } |
| 334 | 334 |
| 335 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) { | 335 void PCMWaveOutAudioOutputStream::HandleError(MMRESULT error) { |
| 336 DLOG(WARNING) << "PCMWaveOutAudio error " << error; | 336 DLOG(WARNING) << "PCMWaveOutAudio error " << error; |
| 337 if (callback_) | 337 if (callback_) |
| 338 callback_->OnError(this, error); | 338 callback_->OnError(this); |
| 339 } | 339 } |
| 340 | 340 |
| 341 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { | 341 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { |
| 342 DCHECK_EQ(channels_, format_.Format.nChannels); | 342 DCHECK_EQ(channels_, format_.Format.nChannels); |
| 343 // Call the source which will fill our buffer with pleasant sounds and | 343 // Call the source which will fill our buffer with pleasant sounds and |
| 344 // return to us how many bytes were used. | 344 // return to us how many bytes were used. |
| 345 // TODO(fbarchard): Handle used 0 by queueing more. | 345 // TODO(fbarchard): Handle used 0 by queueing more. |
| 346 | 346 |
| 347 // HACK: Yield if Read() is called too often. On older platforms which are | 347 // HACK: Yield if Read() is called too often. On older platforms which are |
| 348 // still using the WaveOut backend, we run into synchronization issues where | 348 // still using the WaveOut backend, we run into synchronization issues where |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 buffer, | 416 buffer, |
| 417 sizeof(WAVEHDR)); | 417 sizeof(WAVEHDR)); |
| 418 if (result != MMSYSERR_NOERROR) | 418 if (result != MMSYSERR_NOERROR) |
| 419 stream->HandleError(result); | 419 stream->HandleError(result); |
| 420 stream->pending_bytes_ += buffer->dwBufferLength; | 420 stream->pending_bytes_ += buffer->dwBufferLength; |
| 421 } | 421 } |
| 422 } | 422 } |
| 423 } | 423 } |
| 424 | 424 |
| 425 } // namespace media | 425 } // namespace media |
| OLD | NEW |