| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/audio_device.h" | 5 #include "chrome/renderer/audio_device.h" |
| 6 | 6 |
| 7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
| 8 #include "chrome/common/render_messages.h" |
| 8 #include "chrome/common/render_messages_params.h" | 9 #include "chrome/common/render_messages_params.h" |
| 9 #include "chrome/renderer/render_thread.h" | 10 #include "chrome/renderer/render_thread.h" |
| 10 #include "media/audio/audio_util.h" | 11 #include "media/audio/audio_util.h" |
| 11 | 12 |
| 12 scoped_refptr<AudioMessageFilter> AudioDevice::filter_; | 13 scoped_refptr<AudioMessageFilter> AudioDevice::filter_; |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // AudioMessageFilterCreator is intended to be used as a singleton so we can | 17 // AudioMessageFilterCreator is intended to be used as a singleton so we can |
| 17 // get access to a shared AudioMessageFilter. | 18 // get access to a shared AudioMessageFilter. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void AudioDevice::FireRenderCallback() { | 179 void AudioDevice::FireRenderCallback() { |
| 179 if (callback_) { | 180 if (callback_) { |
| 180 // Ask client to render audio. | 181 // Ask client to render audio. |
| 181 callback_->Render(audio_data_, buffer_size_); | 182 callback_->Render(audio_data_, buffer_size_); |
| 182 | 183 |
| 183 // Interleave, scale, and clip to int16. | 184 // Interleave, scale, and clip to int16. |
| 184 int16* output_buffer16 = static_cast<int16*>(shared_memory_data()); | 185 int16* output_buffer16 = static_cast<int16*>(shared_memory_data()); |
| 185 media::InterleaveFloatToInt16(audio_data_, output_buffer16, buffer_size_); | 186 media::InterleaveFloatToInt16(audio_data_, output_buffer16, buffer_size_); |
| 186 } | 187 } |
| 187 } | 188 } |
| OLD | NEW |