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 #pragma comment(lib, "winmm.lib") | 7 #pragma comment(lib, "winmm.lib") |
8 | 8 |
9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 } | 320 } |
321 | 321 |
322 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { | 322 void PCMWaveOutAudioOutputStream::QueueNextPacket(WAVEHDR *buffer) { |
323 DCHECK_EQ(channels_, format_.Format.nChannels); | 323 DCHECK_EQ(channels_, format_.Format.nChannels); |
324 // Call the source which will fill our buffer with pleasant sounds and | 324 // Call the source which will fill our buffer with pleasant sounds and |
325 // return to us how many bytes were used. | 325 // return to us how many bytes were used. |
326 // TODO(fbarchard): Handle used 0 by queueing more. | 326 // TODO(fbarchard): Handle used 0 by queueing more. |
327 | 327 |
328 // TODO(sergeyu): Specify correct hardware delay for |total_delay_bytes|. | 328 // TODO(sergeyu): Specify correct hardware delay for |total_delay_bytes|. |
329 uint32 total_delay_bytes = pending_bytes_; | 329 uint32 total_delay_bytes = pending_bytes_; |
330 int frames_filled = callback_->OnMoreData( | 330 int frames_filled = |
331 audio_bus_.get(), total_delay_bytes); | 331 callback_->OnMoreData(audio_bus_.get(), total_delay_bytes, 0); |
332 uint32 used = frames_filled * audio_bus_->channels() * | 332 uint32 used = frames_filled * audio_bus_->channels() * |
333 format_.Format.wBitsPerSample / 8; | 333 format_.Format.wBitsPerSample / 8; |
334 | 334 |
335 if (used <= buffer_size_) { | 335 if (used <= buffer_size_) { |
336 // Note: If this ever changes to output raw float the data must be clipped | 336 // Note: If this ever changes to output raw float the data must be clipped |
337 // and sanitized since it may come from an untrusted source such as NaCl. | 337 // and sanitized since it may come from an untrusted source such as NaCl. |
338 audio_bus_->Scale(volume_); | 338 audio_bus_->Scale(volume_); |
339 audio_bus_->ToInterleaved( | 339 audio_bus_->ToInterleaved( |
340 frames_filled, format_.Format.wBitsPerSample / 8, buffer->lpData); | 340 frames_filled, format_.Format.wBitsPerSample / 8, buffer->lpData); |
341 | 341 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 buffer, | 388 buffer, |
389 sizeof(WAVEHDR)); | 389 sizeof(WAVEHDR)); |
390 if (result != MMSYSERR_NOERROR) | 390 if (result != MMSYSERR_NOERROR) |
391 stream->HandleError(result); | 391 stream->HandleError(result); |
392 stream->pending_bytes_ += buffer->dwBufferLength; | 392 stream->pending_bytes_ += buffer->dwBufferLength; |
393 } | 393 } |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 } // namespace media | 397 } // namespace media |
OLD | NEW |