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

Side by Side Diff: Source/modules/webaudio/AudioContext.cpp

Issue 27039002: Fix crash when the OfflineAudioContext constructor is given 0 as numberOfFrames (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 7 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 | Annotate | Revision Log
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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 , m_isOfflineContext(true) 147 , m_isOfflineContext(true)
148 , m_activeSourceCount(0) 148 , m_activeSourceCount(0)
149 { 149 {
150 constructCommon(); 150 constructCommon();
151 151
152 // FIXME: the passed in sampleRate MUST match the hardware sample-rate since HRTFDatabaseLoader is a singleton. 152 // FIXME: the passed in sampleRate MUST match the hardware sample-rate since HRTFDatabaseLoader is a singleton.
153 m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNece ssary(sampleRate); 153 m_hrtfDatabaseLoader = HRTFDatabaseLoader::createAndLoadAsynchronouslyIfNece ssary(sampleRate);
154 154
155 // Create a new destination for offline rendering. 155 // Create a new destination for offline rendering.
156 m_renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampl eRate); 156 m_renderTarget = AudioBuffer::create(numberOfChannels, numberOfFrames, sampl eRate);
157 ASSERT(m_renderTarget);
157 m_destinationNode = OfflineAudioDestinationNode::create(this, m_renderTarget .get()); 158 m_destinationNode = OfflineAudioDestinationNode::create(this, m_renderTarget .get());
159 ASSERT(m_destinationNode);
158 } 160 }
159 161
160 void AudioContext::constructCommon() 162 void AudioContext::constructCommon()
161 { 163 {
162 ScriptWrappable::init(this); 164 ScriptWrappable::init(this);
163 // According to spec AudioContext must die only after page navigate. 165 // According to spec AudioContext must die only after page navigate.
164 // Lets mark it as ActiveDOMObject with pending activity and unmark it in cl ear method. 166 // Lets mark it as ActiveDOMObject with pending activity and unmark it in cl ear method.
165 setPendingActivity(this); 167 setPendingActivity(this);
166 168
167 FFTFrame::initialize(); 169 FFTFrame::initialize();
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 } 1097 }
1096 1098
1097 void AudioContext::decrementActiveSourceCount() 1099 void AudioContext::decrementActiveSourceCount()
1098 { 1100 {
1099 atomicDecrement(&m_activeSourceCount); 1101 atomicDecrement(&m_activeSourceCount);
1100 } 1102 }
1101 1103
1102 } // namespace WebCore 1104 } // namespace WebCore
1103 1105
1104 #endif // ENABLE(WEB_AUDIO) 1106 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « LayoutTests/webaudio/offlineaudiocontext-constructor-expected.txt ('k') | Source/modules/webaudio/OfflineAudioContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698