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

Side by Side Diff: Source/core/platform/audio/SincResampler.cpp

Issue 14628008: Require use of AudioBus::create() to avoid ref-counting issues (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Require use of Created 7 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 } 128 }
129 129
130 void SincResampler::consumeSource(float* buffer, unsigned numberOfSourceFrames) 130 void SincResampler::consumeSource(float* buffer, unsigned numberOfSourceFrames)
131 { 131 {
132 ASSERT(m_sourceProvider); 132 ASSERT(m_sourceProvider);
133 if (!m_sourceProvider) 133 if (!m_sourceProvider)
134 return; 134 return;
135 135
136 // Wrap the provided buffer by an AudioBus for use by the source provider. 136 // Wrap the provided buffer by an AudioBus for use by the source provider.
137 AudioBus bus(1, numberOfSourceFrames, false); 137 RefPtr<AudioBus> bus = AudioBus::create(1, numberOfSourceFrames, false);
138 138
139 // FIXME: Find a way to make the following const-correct: 139 // FIXME: Find a way to make the following const-correct:
140 bus.setChannelMemory(0, buffer, numberOfSourceFrames); 140 bus->setChannelMemory(0, buffer, numberOfSourceFrames);
141 141
142 m_sourceProvider->provideInput(&bus, numberOfSourceFrames); 142 m_sourceProvider->provideInput(bus.get(), numberOfSourceFrames);
143 } 143 }
144 144
145 namespace { 145 namespace {
146 146
147 // BufferSourceProvider is an AudioSourceProvider wrapping an in-memory buffer. 147 // BufferSourceProvider is an AudioSourceProvider wrapping an in-memory buffer.
148 148
149 class BufferSourceProvider : public AudioSourceProvider { 149 class BufferSourceProvider : public AudioSourceProvider {
150 public: 150 public:
151 BufferSourceProvider(const float* source, size_t numberOfSourceFrames) 151 BufferSourceProvider(const float* source, size_t numberOfSourceFrames)
152 : m_source(source) 152 : m_source(source)
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 // Step (4) 466 // Step (4)
467 // Refresh the buffer with more input. 467 // Refresh the buffer with more input.
468 consumeSource(r5, m_blockSize); 468 consumeSource(r5, m_blockSize);
469 } 469 }
470 } 470 }
471 471
472 } // namespace WebCore 472 } // namespace WebCore
473 473
474 #endif // ENABLE(WEB_AUDIO) 474 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/core/platform/audio/Reverb.cpp ('k') | Source/core/platform/audio/chromium/AudioDestinationChromium.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698