| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/base/filter_host.h" | 5 #include "media/base/filter_host.h" |
| 6 #include "media/filters/audio_renderer_impl.h" | 6 #include "media/filters/audio_renderer_impl.h" |
| 7 | 7 |
| 8 namespace media { | 8 namespace media { |
| 9 | 9 |
| 10 // We'll try to fill 4096 samples per buffer, which is roughly ~92ms of audio | 10 // We'll try to fill 4096 samples per buffer, which is roughly ~92ms of audio |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 size_t AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void, | 51 size_t AudioRendererImpl::OnMoreData(AudioOutputStream* stream, void* dest_void, |
| 52 size_t len, int pending_bytes) { | 52 size_t len, int pending_bytes) { |
| 53 // TODO(scherkus): handle end of stream. | 53 // TODO(scherkus): handle end of stream. |
| 54 if (!stream_) | 54 if (!stream_) |
| 55 return 0; | 55 return 0; |
| 56 | 56 |
| 57 // TODO(scherkus): Maybe change OnMoreData to pass in char/uint8 or similar. | 57 // TODO(scherkus): Maybe change OnMoreData to pass in char/uint8 or similar. |
| 58 // TODO(fbarchard): Waveout_output_win.h should handle zero length buffers | 58 // TODO(fbarchard): Waveout_output_win.h should handle zero length buffers |
| 59 // without clicking. | 59 // without clicking. |
| 60 pending_bytes = static_cast<int>(ceil(pending_bytes * GetPlaybackRate())); |
| 60 base::TimeDelta delay = base::TimeDelta::FromMicroseconds( | 61 base::TimeDelta delay = base::TimeDelta::FromMicroseconds( |
| 61 base::Time::kMicrosecondsPerSecond * pending_bytes / bytes_per_second_); | 62 base::Time::kMicrosecondsPerSecond * pending_bytes / bytes_per_second_); |
| 62 return FillBuffer(static_cast<uint8*>(dest_void), len, delay); | 63 return FillBuffer(static_cast<uint8*>(dest_void), len, delay); |
| 63 } | 64 } |
| 64 | 65 |
| 65 void AudioRendererImpl::OnClose(AudioOutputStream* stream) { | 66 void AudioRendererImpl::OnClose(AudioOutputStream* stream) { |
| 66 // TODO(scherkus): implement OnClose. | 67 // TODO(scherkus): implement OnClose. |
| 67 NOTIMPLEMENTED(); | 68 NOTIMPLEMENTED(); |
| 68 } | 69 } |
| 69 | 70 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 97 } | 98 } |
| 98 return true; | 99 return true; |
| 99 } | 100 } |
| 100 | 101 |
| 101 void AudioRendererImpl::OnStop() { | 102 void AudioRendererImpl::OnStop() { |
| 102 if (stream_) | 103 if (stream_) |
| 103 stream_->Stop(); | 104 stream_->Stop(); |
| 104 } | 105 } |
| 105 | 106 |
| 106 } // namespace media | 107 } // namespace media |
| OLD | NEW |