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

Side by Side Diff: Source/modules/webaudio/AudioNodeInput.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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 24 matching lines...) Expand all
35 35
36 using namespace std; 36 using namespace std;
37 37
38 namespace WebCore { 38 namespace WebCore {
39 39
40 AudioNodeInput::AudioNodeInput(AudioNode* node) 40 AudioNodeInput::AudioNodeInput(AudioNode* node)
41 : AudioSummingJunction(node->context()) 41 : AudioSummingJunction(node->context())
42 , m_node(node) 42 , m_node(node)
43 { 43 {
44 // Set to mono by default. 44 // Set to mono by default.
45 m_internalSummingBus = adoptRef(new AudioBus(1, AudioNode::ProcessingSizeInF rames)); 45 m_internalSummingBus = AudioBus::create(1, AudioNode::ProcessingSizeInFrames );
46 } 46 }
47 47
48 void AudioNodeInput::connect(AudioNodeOutput* output) 48 void AudioNodeInput::connect(AudioNodeOutput* output)
49 { 49 {
50 ASSERT(context()->isGraphOwner()); 50 ASSERT(context()->isGraphOwner());
51 51
52 ASSERT(output && node()); 52 ASSERT(output && node());
53 if (!output || !node()) 53 if (!output || !node())
54 return; 54 return;
55 55
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 137
138 void AudioNodeInput::updateInternalBus() 138 void AudioNodeInput::updateInternalBus()
139 { 139 {
140 ASSERT(context()->isAudioThread() && context()->isGraphOwner()); 140 ASSERT(context()->isAudioThread() && context()->isGraphOwner());
141 141
142 unsigned numberOfInputChannels = numberOfChannels(); 142 unsigned numberOfInputChannels = numberOfChannels();
143 143
144 if (numberOfInputChannels == m_internalSummingBus->numberOfChannels()) 144 if (numberOfInputChannels == m_internalSummingBus->numberOfChannels())
145 return; 145 return;
146 146
147 m_internalSummingBus = adoptRef(new AudioBus(numberOfInputChannels, AudioNod e::ProcessingSizeInFrames)); 147 m_internalSummingBus = AudioBus::create(numberOfInputChannels, AudioNode::Pr ocessingSizeInFrames);
148 } 148 }
149 149
150 unsigned AudioNodeInput::numberOfChannels() const 150 unsigned AudioNodeInput::numberOfChannels() const
151 { 151 {
152 AudioNode::ChannelCountMode mode = node()->internalChannelCountMode(); 152 AudioNode::ChannelCountMode mode = node()->internalChannelCountMode();
153 if (mode == AudioNode::Explicit) 153 if (mode == AudioNode::Explicit)
154 return node()->channelCount(); 154 return node()->channelCount();
155 155
156 // Find the number of channels of the connection with the largest number of channels. 156 // Find the number of channels of the connection with the largest number of channels.
157 unsigned maxChannels = 1; // one channel is the minimum allowed 157 unsigned maxChannels = 1; // one channel is the minimum allowed
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 // Handle multiple connections case. 238 // Handle multiple connections case.
239 sumAllConnections(internalSummingBus, framesToProcess); 239 sumAllConnections(internalSummingBus, framesToProcess);
240 240
241 return internalSummingBus; 241 return internalSummingBus;
242 } 242 }
243 243
244 } // namespace WebCore 244 } // namespace WebCore
245 245
246 #endif // ENABLE(WEB_AUDIO) 246 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioDestinationNode.h ('k') | Source/modules/webaudio/AudioNodeOutput.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698