Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(603)

Side by Side Diff: media/audio/audio_output_device.cc

Issue 10824304: Upgrade AudioBus to support wrapping, interleaving. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/audio_output_device.h" 5 #include "media/audio/audio_output_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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 // into milliseconds. 263 // into milliseconds.
264 int audio_delay_milliseconds = pending_data / bytes_per_ms_; 264 int audio_delay_milliseconds = pending_data / bytes_per_ms_;
265 265
266 TRACE_EVENT0("audio", "AudioOutputDevice::FireRenderCallback"); 266 TRACE_EVENT0("audio", "AudioOutputDevice::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( 269 size_t num_frames = render_callback_->Render(
270 audio_bus_.get(), audio_delay_milliseconds); 270 audio_bus_.get(), audio_delay_milliseconds);
271 271
272 // Interleave, scale, and clip to int. 272 // Interleave, scale, and clip to int.
273 // TODO(dalecurtis): Remove this when we have float everywhere. 273 // TODO(dalecurtis): Remove this when we have float everywhere:
274 InterleaveFloatToInt( 274 // http://crbug.com/114700
275 audio_bus_.get(), shared_memory_.memory(), num_frames, 275 audio_bus_->ToInterleaved(num_frames, audio_parameters_.bits_per_sample() / 8,
276 audio_parameters_.bits_per_sample() / 8); 276 shared_memory_.memory());
277 277
278 // Let the host know we are done. 278 // Let the host know we are done.
279 SetActualDataSizeInBytes( 279 SetActualDataSizeInBytes(
280 &shared_memory_, memory_length_, 280 &shared_memory_, memory_length_,
281 num_frames * audio_parameters_.GetBytesPerFrame()); 281 num_frames * audio_parameters_.GetBytesPerFrame());
282 } 282 }
283 283
284 } // namespace media. 284 } // namespace media.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698