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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp

Issue 2431653003: Add constructor for MediaStreamAudioSourceNode (Closed)
Patch Set: Created 4 years, 2 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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 10 matching lines...) Expand all
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
23 * DAMAGE. 23 * DAMAGE.
24 */ 24 */
25 25
26 #include "modules/webaudio/MediaStreamAudioSourceNode.h" 26 #include "modules/webaudio/MediaStreamAudioSourceNode.h"
27 27
28 #include "core/dom/ExceptionCode.h" 28 #include "core/dom/ExceptionCode.h"
29 #include "modules/webaudio/AudioNodeOutput.h" 29 #include "modules/webaudio/AudioNodeOutput.h"
30 #include "modules/webaudio/BaseAudioContext.h" 30 #include "modules/webaudio/BaseAudioContext.h"
31 #include "modules/webaudio/MediaStreamAudioSourceOptions.h"
31 #include "wtf/Locker.h" 32 #include "wtf/Locker.h"
32 #include <memory> 33 #include <memory>
33 34
34 namespace blink { 35 namespace blink {
35 36
36 MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler( 37 MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler(
37 AudioNode& node, 38 AudioNode& node,
38 MediaStream& mediaStream, 39 MediaStream& mediaStream,
39 MediaStreamTrack* audioTrack, 40 MediaStreamTrack* audioTrack,
40 std::unique_ptr<AudioSourceProvider> audioSourceProvider) 41 std::unique_ptr<AudioSourceProvider> audioSourceProvider)
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 165
165 // TODO(hongchan): Only stereo streams are supported right now. We should be 166 // TODO(hongchan): Only stereo streams are supported right now. We should be
166 // able to accept multi-channel streams. 167 // able to accept multi-channel streams.
167 node->setFormat(2, context.sampleRate()); 168 node->setFormat(2, context.sampleRate());
168 // context keeps reference until node is disconnected 169 // context keeps reference until node is disconnected
169 context.notifySourceNodeStartedProcessing(node); 170 context.notifySourceNodeStartedProcessing(node);
170 171
171 return node; 172 return node;
172 } 173 }
173 174
175 MediaStreamAudioSourceNode* MediaStreamAudioSourceNode::create(
176 BaseAudioContext* context,
177 const MediaStreamAudioSourceOptions& options,
178 ExceptionState& exceptionState) {
179 return create(*context, *options.mediaStream(), exceptionState);
180 }
181
174 DEFINE_TRACE(MediaStreamAudioSourceNode) { 182 DEFINE_TRACE(MediaStreamAudioSourceNode) {
175 AudioSourceProviderClient::trace(visitor); 183 AudioSourceProviderClient::trace(visitor);
176 AudioSourceNode::trace(visitor); 184 AudioSourceNode::trace(visitor);
177 } 185 }
178 186
179 MediaStreamAudioSourceHandler& 187 MediaStreamAudioSourceHandler&
180 MediaStreamAudioSourceNode::mediaStreamAudioSourceHandler() const { 188 MediaStreamAudioSourceNode::mediaStreamAudioSourceHandler() const {
181 return static_cast<MediaStreamAudioSourceHandler&>(handler()); 189 return static_cast<MediaStreamAudioSourceHandler&>(handler());
182 } 190 }
183 191
184 MediaStream* MediaStreamAudioSourceNode::getMediaStream() const { 192 MediaStream* MediaStreamAudioSourceNode::getMediaStream() const {
185 return mediaStreamAudioSourceHandler().getMediaStream(); 193 return mediaStreamAudioSourceHandler().getMediaStream();
186 } 194 }
187 195
188 void MediaStreamAudioSourceNode::setFormat(size_t numberOfChannels, 196 void MediaStreamAudioSourceNode::setFormat(size_t numberOfChannels,
189 float sourceSampleRate) { 197 float sourceSampleRate) {
190 mediaStreamAudioSourceHandler().setFormat(numberOfChannels, sourceSampleRate); 198 mediaStreamAudioSourceHandler().setFormat(numberOfChannels, sourceSampleRate);
191 } 199 }
192 200
193 } // namespace blink 201 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698