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

Side by Side Diff: Source/WebCore/webaudio/OfflineAudioDestinationNode.cpp

Issue 7944005: Merge 94984 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 , m_renderTarget(renderTarget) 45 , m_renderTarget(renderTarget)
46 , m_startedRendering(false) 46 , m_startedRendering(false)
47 { 47 {
48 m_renderBus = adoptPtr(new AudioBus(renderTarget->numberOfChannels(), render QuantumSize)); 48 m_renderBus = adoptPtr(new AudioBus(renderTarget->numberOfChannels(), render QuantumSize));
49 49
50 initialize(); 50 initialize();
51 } 51 }
52 52
53 OfflineAudioDestinationNode::~OfflineAudioDestinationNode() 53 OfflineAudioDestinationNode::~OfflineAudioDestinationNode()
54 { 54 {
55 if (m_renderThread)
56 waitForThreadCompletion(m_renderThread, 0);
57
55 uninitialize(); 58 uninitialize();
56 } 59 }
57 60
58 void OfflineAudioDestinationNode::initialize() 61 void OfflineAudioDestinationNode::initialize()
59 { 62 {
60 if (isInitialized()) 63 if (isInitialized())
61 return; 64 return;
62 65
63 AudioNode::initialize(); 66 AudioNode::initialize();
64 } 67 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 float* source = m_renderBus->channel(channelIndex)->data(); 139 float* source = m_renderBus->channel(channelIndex)->data();
137 float* destination = m_renderTarget->getChannelData(channelIndex)->d ata(); 140 float* destination = m_renderTarget->getChannelData(channelIndex)->d ata();
138 memcpy(destination + n, source, sizeof(float) * framesAvailableToCop y); 141 memcpy(destination + n, source, sizeof(float) * framesAvailableToCop y);
139 } 142 }
140 143
141 n += framesAvailableToCopy; 144 n += framesAvailableToCopy;
142 framesToProcess -= framesAvailableToCopy; 145 framesToProcess -= framesAvailableToCopy;
143 } 146 }
144 147
145 // Our work is done. Let the AudioContext know. 148 // Our work is done. Let the AudioContext know.
149 // See corresponding deref() call in notifyCompleteDispatch().
150 ref();
146 callOnMainThread(notifyCompleteDispatch, this); 151 callOnMainThread(notifyCompleteDispatch, this);
147 } 152 }
148 153
149 void OfflineAudioDestinationNode::notifyCompleteDispatch(void* userData) 154 void OfflineAudioDestinationNode::notifyCompleteDispatch(void* userData)
150 { 155 {
151 OfflineAudioDestinationNode* destinationNode = static_cast<OfflineAudioDesti nationNode*>(userData); 156 OfflineAudioDestinationNode* destinationNode = static_cast<OfflineAudioDesti nationNode*>(userData);
152 ASSERT(destinationNode); 157 ASSERT(destinationNode);
153 if (!destinationNode) 158 if (!destinationNode)
154 return; 159 return;
155 160
156 destinationNode->notifyComplete(); 161 destinationNode->notifyComplete();
162 destinationNode->deref();
157 } 163 }
158 164
159 void OfflineAudioDestinationNode::notifyComplete() 165 void OfflineAudioDestinationNode::notifyComplete()
160 { 166 {
161 context()->fireCompletionEvent(); 167 context()->fireCompletionEvent();
162 } 168 }
163 169
164 } // namespace WebCore 170 } // namespace WebCore
165 171
166 #endif // ENABLE(WEB_AUDIO) 172 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698