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/audio_low_latency_output_win.h" | 5 #include "media/audio/win/audio_low_latency_output_win.h" |
6 | 6 |
7 #include <Functiondiscoverykeys_devpkey.h> | 7 #include <Functiondiscoverykeys_devpkey.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 | 525 |
526 // Derive the actual delay value which will be fed to the | 526 // Derive the actual delay value which will be fed to the |
527 // render client using the OnMoreData() callback. | 527 // render client using the OnMoreData() callback. |
528 audio_delay_bytes = (pos_last_sample_written_frames - | 528 audio_delay_bytes = (pos_last_sample_written_frames - |
529 pos_sample_playing_frames) * format_.Format.nBlockAlign; | 529 pos_sample_playing_frames) * format_.Format.nBlockAlign; |
530 } | 530 } |
531 | 531 |
532 // Read a data packet from the registered client source and | 532 // Read a data packet from the registered client source and |
533 // deliver a delay estimate in the same callback to the client. | 533 // deliver a delay estimate in the same callback to the client. |
534 | 534 |
535 int frames_filled = source_->OnMoreData( | 535 int frames_filled = |
536 audio_bus_.get(), audio_delay_bytes); | 536 source_->OnMoreData(audio_bus_.get(), audio_delay_bytes, 0); |
537 uint32 num_filled_bytes = frames_filled * format_.Format.nBlockAlign; | 537 uint32 num_filled_bytes = frames_filled * format_.Format.nBlockAlign; |
538 DCHECK_LE(num_filled_bytes, packet_size_bytes_); | 538 DCHECK_LE(num_filled_bytes, packet_size_bytes_); |
539 | 539 |
540 // Note: If this ever changes to output raw float the data must be | 540 // Note: If this ever changes to output raw float the data must be |
541 // clipped and sanitized since it may come from an untrusted | 541 // clipped and sanitized since it may come from an untrusted |
542 // source such as NaCl. | 542 // source such as NaCl. |
543 const int bytes_per_sample = format_.Format.wBitsPerSample >> 3; | 543 const int bytes_per_sample = format_.Format.wBitsPerSample >> 3; |
544 audio_bus_->Scale(volume_); | 544 audio_bus_->Scale(volume_); |
545 audio_bus_->ToInterleaved( | 545 audio_bus_->ToInterleaved( |
546 frames_filled, bytes_per_sample, audio_data); | 546 frames_filled, bytes_per_sample, audio_data); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 | 648 |
649 // Ensure that we don't quit the main thread loop immediately next | 649 // Ensure that we don't quit the main thread loop immediately next |
650 // time Start() is called. | 650 // time Start() is called. |
651 ResetEvent(stop_render_event_.Get()); | 651 ResetEvent(stop_render_event_.Get()); |
652 } | 652 } |
653 | 653 |
654 source_ = NULL; | 654 source_ = NULL; |
655 } | 655 } |
656 | 656 |
657 } // namespace media | 657 } // namespace media |
OLD | NEW |