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

Unified Diff: media/base/audio_bus.cc

Issue 10830268: Allow audio system to handle synchronized low-latency audio I/O (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/audio_bus.h ('k') | media/base/audio_renderer_sink.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_bus.cc
===================================================================
--- media/base/audio_bus.cc (revision 156123)
+++ media/base/audio_bus.cc (working copy)
@@ -20,14 +20,17 @@
// Calculates the required size for an AudioBus with the given params, sets
// |aligned_frames| to the actual frame length of each channel array.
static int CalculateMemorySizeInternal(int channels, int frames,
- int* aligned_frames) {
- CHECK(aligned_frames);
- // Choose a size such that each channel will be aligned by kChannelAlignment
- // when stored in a contiguous block.
- *aligned_frames =
+ int* out_aligned_frames) {
+ // Choose a size such that each channel will be aligned by
+ // kChannelAlignment when stored in a contiguous block.
+ int aligned_frames =
((frames * sizeof(float) + AudioBus::kChannelAlignment - 1) &
~(AudioBus::kChannelAlignment - 1)) / sizeof(float);
- return sizeof(float) * channels * (*aligned_frames);
+
+ if (out_aligned_frames)
+ *out_aligned_frames = aligned_frames;
+
+ return sizeof(float) * channels * aligned_frames;
}
// |Format| is the destination type, |Fixed| is a type larger than |Format|
@@ -188,11 +191,14 @@
}
int AudioBus::CalculateMemorySize(const AudioParameters& params) {
- int aligned_frames = 0;
return CalculateMemorySizeInternal(
- params.channels(), params.frames_per_buffer(), &aligned_frames);
+ params.channels(), params.frames_per_buffer(), NULL);
}
+int AudioBus::CalculateMemorySize(int channels, int frames) {
+ return CalculateMemorySizeInternal(channels, frames, NULL);
+}
+
void AudioBus::BuildChannelData(int channels, int aligned_frames, float* data) {
DCHECK(IsAligned(data));
DCHECK_EQ(channel_data_.size(), 0U);
« no previous file with comments | « media/base/audio_bus.h ('k') | media/base/audio_renderer_sink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698