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 "content/renderer/media/audio_device.h" | 5 #include "content/renderer/media/audio_device.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/thread_restrictions.h" | 9 #include "base/threading/thread_restrictions.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 TRACE_EVENT0("audio", "AudioDevice::FireRenderCallback"); | 266 TRACE_EVENT0("audio", "AudioDevice::FireRenderCallback"); |
267 | 267 |
268 // Update the audio-delay measurement then ask client to render audio. | 268 // Update the audio-delay measurement then ask client to render audio. |
269 size_t num_frames = render_callback_->Render(audio_data_, | 269 size_t num_frames = render_callback_->Render(audio_data_, |
270 audio_parameters_.frames_per_buffer(), audio_delay_milliseconds); | 270 audio_parameters_.frames_per_buffer(), audio_delay_milliseconds); |
271 | 271 |
272 // Interleave, scale, and clip to int. | 272 // Interleave, scale, and clip to int. |
273 // TODO(crogers/vrk): Figure out a way to avoid the float -> int -> float | 273 // TODO(crogers/vrk): Figure out a way to avoid the float -> int -> float |
274 // conversions that happen in the <audio> and WebRTC scenarios. | 274 // conversions that happen in the <audio> and WebRTC scenarios. |
275 media::InterleaveFloatToInt(audio_data_, shared_memory_.memory(), | 275 media::InterleaveFloatToInt(audio_data_, shared_memory_.memory(), |
276 audio_parameters_.frames_per_buffer(), | 276 num_frames, audio_parameters_.bits_per_sample() / 8); |
277 audio_parameters_.bits_per_sample() / 8); | |
278 | 277 |
279 // Let the host know we are done. | 278 // Let the host know we are done. |
280 media::SetActualDataSizeInBytes(&shared_memory_, memory_length_, | 279 media::SetActualDataSizeInBytes(&shared_memory_, memory_length_, |
281 num_frames * audio_parameters_.GetBytesPerFrame()); | 280 num_frames * audio_parameters_.GetBytesPerFrame()); |
282 } | 281 } |
OLD | NEW |