Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); | 178 m_renderingAutomaticPullNodes.resize(m_automaticPullNodes.size()); |
| 179 ASSERT(!m_renderingAutomaticPullNodes.size()); | 179 ASSERT(!m_renderingAutomaticPullNodes.size()); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void AudioContext::lazyInitialize() | 182 void AudioContext::lazyInitialize() |
| 183 { | 183 { |
| 184 if (!m_isInitialized) { | 184 if (!m_isInitialized) { |
| 185 // Don't allow the context to initialize a second time after it's alread y been explicitly uninitialized. | 185 // Don't allow the context to initialize a second time after it's alread y been explicitly uninitialized. |
| 186 ASSERT(!m_isAudioThreadFinished); | 186 ASSERT(!m_isAudioThreadFinished); |
| 187 if (!m_isAudioThreadFinished) { | 187 if (!m_isAudioThreadFinished) { |
| 188 // When a destination node of context is created, initialize() shoul d be skipped to initialize afterwards by creation of other node. | |
|
Raymond Toy
2014/04/02 17:11:32
I think this reads better. Adjust as needed.
// C
KhNo
2014/04/03 13:21:02
Done.
| |
| 188 if (m_destinationNode.get()) { | 189 if (m_destinationNode.get()) { |
| 189 m_destinationNode->initialize(); | 190 m_destinationNode->initialize(); |
| 190 | 191 |
| 191 if (!isOfflineContext()) { | 192 if (!isOfflineContext()) { |
| 192 // This starts the audio thread. The destination node's prov ideInput() method will now be called repeatedly to render audio. | 193 // This starts the audio thread. The destination node's prov ideInput() method will now be called repeatedly to render audio. |
| 193 // Each time provideInput() is called, a portion of the audi o stream is rendered. Let's call this time period a "render quantum". | 194 // Each time provideInput() is called, a portion of the audi o stream is rendered. Let's call this time period a "render quantum". |
| 194 // NOTE: for now default AudioContext does not need an expli cit startRendering() call from JavaScript. | 195 // NOTE: for now default AudioContext does not need an expli cit startRendering() call from JavaScript. |
| 195 // We may want to consider requiring it for symmetry with Of flineAudioContext. | 196 // We may want to consider requiring it for symmetry with Of flineAudioContext. |
| 196 m_destinationNode->startRendering(); | 197 m_destinationNode->startRendering(); |
| 197 ++s_hardwareContextCount; | 198 ++s_hardwareContextCount; |
| 198 } | 199 } |
| 199 | 200 |
| 201 m_isInitialized = true; | |
| 200 } | 202 } |
| 201 m_isInitialized = true; | |
| 202 } | 203 } |
| 203 } | 204 } |
| 204 } | 205 } |
| 205 | 206 |
| 206 void AudioContext::clear() | 207 void AudioContext::clear() |
| 207 { | 208 { |
| 208 // We have to release our reference to the destination node before the conte xt will ever be deleted since the destination node holds a reference to the cont ext. | 209 // We have to release our reference to the destination node before the conte xt will ever be deleted since the destination node holds a reference to the cont ext. |
| 209 if (m_destinationNode) | 210 if (m_destinationNode) |
| 210 m_destinationNode.clear(); | 211 m_destinationNode.clear(); |
| 211 | 212 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 339 SyntaxError, | 340 SyntaxError, |
| 340 "invalid ArrayBuffer for audioData."); | 341 "invalid ArrayBuffer for audioData."); |
| 341 return; | 342 return; |
| 342 } | 343 } |
| 343 m_audioDecoder.decodeAsync(audioData, sampleRate(), successCallback, errorCa llback); | 344 m_audioDecoder.decodeAsync(audioData, sampleRate(), successCallback, errorCa llback); |
| 344 } | 345 } |
| 345 | 346 |
| 346 PassRefPtr<AudioBufferSourceNode> AudioContext::createBufferSource() | 347 PassRefPtr<AudioBufferSourceNode> AudioContext::createBufferSource() |
| 347 { | 348 { |
| 348 ASSERT(isMainThread()); | 349 ASSERT(isMainThread()); |
| 349 lazyInitialize(); | |
| 350 RefPtr<AudioBufferSourceNode> node = AudioBufferSourceNode::create(this, m_d estinationNode->sampleRate()); | 350 RefPtr<AudioBufferSourceNode> node = AudioBufferSourceNode::create(this, m_d estinationNode->sampleRate()); |
| 351 | 351 |
| 352 // Because this is an AudioScheduledSourceNode, the context keeps a referenc e until it has finished playing. | 352 // Because this is an AudioScheduledSourceNode, the context keeps a referenc e until it has finished playing. |
| 353 // When this happens, AudioScheduledSourceNode::finish() calls AudioContext: :notifyNodeFinishedProcessing(). | 353 // When this happens, AudioScheduledSourceNode::finish() calls AudioContext: :notifyNodeFinishedProcessing(). |
| 354 refNode(node.get()); | 354 refNode(node.get()); |
| 355 | 355 |
| 356 return node; | 356 return node; |
| 357 } | 357 } |
| 358 | 358 |
| 359 PassRefPtr<MediaElementAudioSourceNode> AudioContext::createMediaElementSource(H TMLMediaElement* mediaElement, ExceptionState& exceptionState) | 359 PassRefPtr<MediaElementAudioSourceNode> AudioContext::createMediaElementSource(H TMLMediaElement* mediaElement, ExceptionState& exceptionState) |
| 360 { | 360 { |
| 361 ASSERT(isMainThread()); | |
| 361 if (!mediaElement) { | 362 if (!mediaElement) { |
| 362 exceptionState.throwDOMException( | 363 exceptionState.throwDOMException( |
| 363 InvalidStateError, | 364 InvalidStateError, |
| 364 "invalid HTMLMedialElement."); | 365 "invalid HTMLMedialElement."); |
| 365 return nullptr; | 366 return nullptr; |
| 366 } | 367 } |
| 367 | 368 |
| 368 ASSERT(isMainThread()); | |
| 369 lazyInitialize(); | |
| 370 | |
| 371 // First check if this media element already has a source node. | 369 // First check if this media element already has a source node. |
| 372 if (mediaElement->audioSourceNode()) { | 370 if (mediaElement->audioSourceNode()) { |
| 373 exceptionState.throwDOMException( | 371 exceptionState.throwDOMException( |
| 374 InvalidStateError, | 372 InvalidStateError, |
| 375 "invalid HTMLMediaElement."); | 373 "invalid HTMLMediaElement."); |
| 376 return nullptr; | 374 return nullptr; |
| 377 } | 375 } |
| 378 | 376 |
| 379 RefPtr<MediaElementAudioSourceNode> node = MediaElementAudioSourceNode::crea te(this, mediaElement); | 377 RefPtr<MediaElementAudioSourceNode> node = MediaElementAudioSourceNode::crea te(this, mediaElement); |
| 380 | 378 |
| 381 mediaElement->setAudioSourceNode(node.get()); | 379 mediaElement->setAudioSourceNode(node.get()); |
| 382 | 380 |
| 383 refNode(node.get()); // context keeps reference until node is disconnected | 381 refNode(node.get()); // context keeps reference until node is disconnected |
| 384 return node; | 382 return node; |
| 385 } | 383 } |
| 386 | 384 |
| 387 PassRefPtr<MediaStreamAudioSourceNode> AudioContext::createMediaStreamSource(Med iaStream* mediaStream, ExceptionState& exceptionState) | 385 PassRefPtr<MediaStreamAudioSourceNode> AudioContext::createMediaStreamSource(Med iaStream* mediaStream, ExceptionState& exceptionState) |
| 388 { | 386 { |
| 387 ASSERT(isMainThread()); | |
| 389 if (!mediaStream) { | 388 if (!mediaStream) { |
| 390 exceptionState.throwDOMException( | 389 exceptionState.throwDOMException( |
| 391 InvalidStateError, | 390 InvalidStateError, |
| 392 "invalid MediaStream source"); | 391 "invalid MediaStream source"); |
| 393 return nullptr; | 392 return nullptr; |
| 394 } | 393 } |
| 395 | 394 |
| 396 ASSERT(isMainThread()); | |
| 397 lazyInitialize(); | |
| 398 | |
| 399 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); | 395 MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks(); |
| 400 if (audioTracks.isEmpty()) { | 396 if (audioTracks.isEmpty()) { |
| 401 exceptionState.throwDOMException( | 397 exceptionState.throwDOMException( |
| 402 InvalidStateError, | 398 InvalidStateError, |
| 403 "MediaStream has no audio track"); | 399 "MediaStream has no audio track"); |
| 404 return nullptr; | 400 return nullptr; |
| 405 } | 401 } |
| 406 | 402 |
| 407 // Use the first audio track in the media stream. | 403 // Use the first audio track in the media stream. |
| 408 RefPtr<MediaStreamTrack> audioTrack = audioTracks[0]; | 404 RefPtr<MediaStreamTrack> audioTrack = audioTracks[0]; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 436 | 432 |
| 437 PassRefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t buffe rSize, size_t numberOfInputChannels, ExceptionState& exceptionState) | 433 PassRefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t buffe rSize, size_t numberOfInputChannels, ExceptionState& exceptionState) |
| 438 { | 434 { |
| 439 // Set number of output channels to stereo by default. | 435 // Set number of output channels to stereo by default. |
| 440 return createScriptProcessor(bufferSize, numberOfInputChannels, 2, exception State); | 436 return createScriptProcessor(bufferSize, numberOfInputChannels, 2, exception State); |
| 441 } | 437 } |
| 442 | 438 |
| 443 PassRefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t buffe rSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionSta te& exceptionState) | 439 PassRefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t buffe rSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionSta te& exceptionState) |
| 444 { | 440 { |
| 445 ASSERT(isMainThread()); | 441 ASSERT(isMainThread()); |
| 446 lazyInitialize(); | |
| 447 RefPtr<ScriptProcessorNode> node = ScriptProcessorNode::create(this, m_desti nationNode->sampleRate(), bufferSize, numberOfInputChannels, numberOfOutputChann els); | 442 RefPtr<ScriptProcessorNode> node = ScriptProcessorNode::create(this, m_desti nationNode->sampleRate(), bufferSize, numberOfInputChannels, numberOfOutputChann els); |
| 448 | 443 |
| 449 if (!node.get()) { | 444 if (!node.get()) { |
| 450 if (!numberOfInputChannels && !numberOfOutputChannels) { | 445 if (!numberOfInputChannels && !numberOfOutputChannels) { |
| 451 exceptionState.throwDOMException( | 446 exceptionState.throwDOMException( |
| 452 IndexSizeError, | 447 IndexSizeError, |
| 453 "number of input channels and output channels cannot both be zer o."); | 448 "number of input channels and output channels cannot both be zer o."); |
| 454 } else if (numberOfInputChannels > AudioContext::maxNumberOfChannels()) { | 449 } else if (numberOfInputChannels > AudioContext::maxNumberOfChannels()) { |
| 455 exceptionState.throwDOMException( | 450 exceptionState.throwDOMException( |
| 456 IndexSizeError, | 451 IndexSizeError, |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 472 return nullptr; | 467 return nullptr; |
| 473 } | 468 } |
| 474 | 469 |
| 475 refNode(node.get()); // context keeps reference until we stop making javascr ipt rendering callbacks | 470 refNode(node.get()); // context keeps reference until we stop making javascr ipt rendering callbacks |
| 476 return node; | 471 return node; |
| 477 } | 472 } |
| 478 | 473 |
| 479 PassRefPtr<BiquadFilterNode> AudioContext::createBiquadFilter() | 474 PassRefPtr<BiquadFilterNode> AudioContext::createBiquadFilter() |
| 480 { | 475 { |
| 481 ASSERT(isMainThread()); | 476 ASSERT(isMainThread()); |
| 482 lazyInitialize(); | |
| 483 return BiquadFilterNode::create(this, m_destinationNode->sampleRate()); | 477 return BiquadFilterNode::create(this, m_destinationNode->sampleRate()); |
| 484 } | 478 } |
| 485 | 479 |
| 486 PassRefPtr<WaveShaperNode> AudioContext::createWaveShaper() | 480 PassRefPtr<WaveShaperNode> AudioContext::createWaveShaper() |
| 487 { | 481 { |
| 488 ASSERT(isMainThread()); | 482 ASSERT(isMainThread()); |
| 489 lazyInitialize(); | |
| 490 return WaveShaperNode::create(this); | 483 return WaveShaperNode::create(this); |
| 491 } | 484 } |
| 492 | 485 |
| 493 PassRefPtr<PannerNode> AudioContext::createPanner() | 486 PassRefPtr<PannerNode> AudioContext::createPanner() |
| 494 { | 487 { |
| 495 ASSERT(isMainThread()); | 488 ASSERT(isMainThread()); |
| 496 lazyInitialize(); | |
| 497 return PannerNode::create(this, m_destinationNode->sampleRate()); | 489 return PannerNode::create(this, m_destinationNode->sampleRate()); |
| 498 } | 490 } |
| 499 | 491 |
| 500 PassRefPtr<ConvolverNode> AudioContext::createConvolver() | 492 PassRefPtr<ConvolverNode> AudioContext::createConvolver() |
| 501 { | 493 { |
| 502 ASSERT(isMainThread()); | 494 ASSERT(isMainThread()); |
| 503 lazyInitialize(); | |
| 504 return ConvolverNode::create(this, m_destinationNode->sampleRate()); | 495 return ConvolverNode::create(this, m_destinationNode->sampleRate()); |
| 505 } | 496 } |
| 506 | 497 |
| 507 PassRefPtr<DynamicsCompressorNode> AudioContext::createDynamicsCompressor() | 498 PassRefPtr<DynamicsCompressorNode> AudioContext::createDynamicsCompressor() |
| 508 { | 499 { |
| 509 ASSERT(isMainThread()); | 500 ASSERT(isMainThread()); |
| 510 lazyInitialize(); | |
| 511 return DynamicsCompressorNode::create(this, m_destinationNode->sampleRate()) ; | 501 return DynamicsCompressorNode::create(this, m_destinationNode->sampleRate()) ; |
| 512 } | 502 } |
| 513 | 503 |
| 514 PassRefPtr<AnalyserNode> AudioContext::createAnalyser() | 504 PassRefPtr<AnalyserNode> AudioContext::createAnalyser() |
| 515 { | 505 { |
| 516 ASSERT(isMainThread()); | 506 ASSERT(isMainThread()); |
| 517 lazyInitialize(); | |
| 518 return AnalyserNode::create(this, m_destinationNode->sampleRate()); | 507 return AnalyserNode::create(this, m_destinationNode->sampleRate()); |
| 519 } | 508 } |
| 520 | 509 |
| 521 PassRefPtr<GainNode> AudioContext::createGain() | 510 PassRefPtr<GainNode> AudioContext::createGain() |
| 522 { | 511 { |
| 523 ASSERT(isMainThread()); | 512 ASSERT(isMainThread()); |
| 524 lazyInitialize(); | |
| 525 return GainNode::create(this, m_destinationNode->sampleRate()); | 513 return GainNode::create(this, m_destinationNode->sampleRate()); |
| 526 } | 514 } |
| 527 | 515 |
| 528 PassRefPtr<DelayNode> AudioContext::createDelay(ExceptionState& exceptionState) | 516 PassRefPtr<DelayNode> AudioContext::createDelay(ExceptionState& exceptionState) |
| 529 { | 517 { |
| 530 const double defaultMaxDelayTime = 1; | 518 const double defaultMaxDelayTime = 1; |
| 531 return createDelay(defaultMaxDelayTime, exceptionState); | 519 return createDelay(defaultMaxDelayTime, exceptionState); |
| 532 } | 520 } |
| 533 | 521 |
| 534 PassRefPtr<DelayNode> AudioContext::createDelay(double maxDelayTime, ExceptionSt ate& exceptionState) | 522 PassRefPtr<DelayNode> AudioContext::createDelay(double maxDelayTime, ExceptionSt ate& exceptionState) |
| 535 { | 523 { |
| 536 ASSERT(isMainThread()); | 524 ASSERT(isMainThread()); |
| 537 lazyInitialize(); | |
| 538 RefPtr<DelayNode> node = DelayNode::create(this, m_destinationNode->sampleRa te(), maxDelayTime, exceptionState); | 525 RefPtr<DelayNode> node = DelayNode::create(this, m_destinationNode->sampleRa te(), maxDelayTime, exceptionState); |
| 539 if (exceptionState.hadException()) | 526 if (exceptionState.hadException()) |
| 540 return nullptr; | 527 return nullptr; |
| 541 return node; | 528 return node; |
| 542 } | 529 } |
| 543 | 530 |
| 544 PassRefPtr<ChannelSplitterNode> AudioContext::createChannelSplitter(ExceptionSta te& exceptionState) | 531 PassRefPtr<ChannelSplitterNode> AudioContext::createChannelSplitter(ExceptionSta te& exceptionState) |
| 545 { | 532 { |
| 546 const unsigned ChannelSplitterDefaultNumberOfOutputs = 6; | 533 const unsigned ChannelSplitterDefaultNumberOfOutputs = 6; |
| 547 return createChannelSplitter(ChannelSplitterDefaultNumberOfOutputs, exceptio nState); | 534 return createChannelSplitter(ChannelSplitterDefaultNumberOfOutputs, exceptio nState); |
| 548 } | 535 } |
| 549 | 536 |
| 550 PassRefPtr<ChannelSplitterNode> AudioContext::createChannelSplitter(size_t numbe rOfOutputs, ExceptionState& exceptionState) | 537 PassRefPtr<ChannelSplitterNode> AudioContext::createChannelSplitter(size_t numbe rOfOutputs, ExceptionState& exceptionState) |
| 551 { | 538 { |
| 552 ASSERT(isMainThread()); | 539 ASSERT(isMainThread()); |
| 553 lazyInitialize(); | |
| 554 | |
| 555 RefPtr<ChannelSplitterNode> node = ChannelSplitterNode::create(this, m_desti nationNode->sampleRate(), numberOfOutputs); | 540 RefPtr<ChannelSplitterNode> node = ChannelSplitterNode::create(this, m_desti nationNode->sampleRate(), numberOfOutputs); |
| 556 | 541 |
| 557 if (!node.get()) { | 542 if (!node.get()) { |
| 558 exceptionState.throwDOMException( | 543 exceptionState.throwDOMException( |
| 559 IndexSizeError, | 544 IndexSizeError, |
| 560 "number of outputs (" + String::number(numberOfOutputs) | 545 "number of outputs (" + String::number(numberOfOutputs) |
| 561 + ") must be between 1 and " | 546 + ") must be between 1 and " |
| 562 + String::number(AudioContext::maxNumberOfChannels()) + "."); | 547 + String::number(AudioContext::maxNumberOfChannels()) + "."); |
| 563 return nullptr; | 548 return nullptr; |
| 564 } | 549 } |
| 565 | 550 |
| 566 return node; | 551 return node; |
| 567 } | 552 } |
| 568 | 553 |
| 569 PassRefPtr<ChannelMergerNode> AudioContext::createChannelMerger(ExceptionState& exceptionState) | 554 PassRefPtr<ChannelMergerNode> AudioContext::createChannelMerger(ExceptionState& exceptionState) |
| 570 { | 555 { |
| 571 const unsigned ChannelMergerDefaultNumberOfInputs = 6; | 556 const unsigned ChannelMergerDefaultNumberOfInputs = 6; |
| 572 return createChannelMerger(ChannelMergerDefaultNumberOfInputs, exceptionStat e); | 557 return createChannelMerger(ChannelMergerDefaultNumberOfInputs, exceptionStat e); |
| 573 } | 558 } |
| 574 | 559 |
| 575 PassRefPtr<ChannelMergerNode> AudioContext::createChannelMerger(size_t numberOfI nputs, ExceptionState& exceptionState) | 560 PassRefPtr<ChannelMergerNode> AudioContext::createChannelMerger(size_t numberOfI nputs, ExceptionState& exceptionState) |
| 576 { | 561 { |
| 577 ASSERT(isMainThread()); | 562 ASSERT(isMainThread()); |
| 578 lazyInitialize(); | |
| 579 | |
| 580 RefPtr<ChannelMergerNode> node = ChannelMergerNode::create(this, m_destinati onNode->sampleRate(), numberOfInputs); | 563 RefPtr<ChannelMergerNode> node = ChannelMergerNode::create(this, m_destinati onNode->sampleRate(), numberOfInputs); |
| 581 | 564 |
| 582 if (!node.get()) { | 565 if (!node.get()) { |
| 583 exceptionState.throwDOMException( | 566 exceptionState.throwDOMException( |
| 584 IndexSizeError, | 567 IndexSizeError, |
| 585 "number of inputs (" + String::number(numberOfInputs) | 568 "number of inputs (" + String::number(numberOfInputs) |
| 586 + ") must be between 1 and " | 569 + ") must be between 1 and " |
| 587 + String::number(AudioContext::maxNumberOfChannels()) + "."); | 570 + String::number(AudioContext::maxNumberOfChannels()) + "."); |
| 588 return nullptr; | 571 return nullptr; |
| 589 } | 572 } |
| 590 | 573 |
| 591 return node; | 574 return node; |
| 592 } | 575 } |
| 593 | 576 |
| 594 PassRefPtr<OscillatorNode> AudioContext::createOscillator() | 577 PassRefPtr<OscillatorNode> AudioContext::createOscillator() |
| 595 { | 578 { |
| 596 ASSERT(isMainThread()); | 579 ASSERT(isMainThread()); |
| 597 lazyInitialize(); | |
| 598 | |
| 599 RefPtr<OscillatorNode> node = OscillatorNode::create(this, m_destinationNode ->sampleRate()); | 580 RefPtr<OscillatorNode> node = OscillatorNode::create(this, m_destinationNode ->sampleRate()); |
| 600 | 581 |
| 601 // Because this is an AudioScheduledSourceNode, the context keeps a referenc e until it has finished playing. | 582 // Because this is an AudioScheduledSourceNode, the context keeps a referenc e until it has finished playing. |
| 602 // When this happens, AudioScheduledSourceNode::finish() calls AudioContext: :notifyNodeFinishedProcessing(). | 583 // When this happens, AudioScheduledSourceNode::finish() calls AudioContext: :notifyNodeFinishedProcessing(). |
| 603 refNode(node.get()); | 584 refNode(node.get()); |
| 604 | 585 |
| 605 return node; | 586 return node; |
| 606 } | 587 } |
| 607 | 588 |
| 608 PassRefPtr<PeriodicWave> AudioContext::createPeriodicWave(Float32Array* real, Fl oat32Array* imag, ExceptionState& exceptionState) | 589 PassRefPtr<PeriodicWave> AudioContext::createPeriodicWave(Float32Array* real, Fl oat32Array* imag, ExceptionState& exceptionState) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 641 } | 622 } |
| 642 | 623 |
| 643 if (imag->length() > 4096) { | 624 if (imag->length() > 4096) { |
| 644 exceptionState.throwDOMException( | 625 exceptionState.throwDOMException( |
| 645 IndexSizeError, | 626 IndexSizeError, |
| 646 "length of imaginary array (" + String::number(imag->length()) | 627 "length of imaginary array (" + String::number(imag->length()) |
| 647 + ") exceeds allowed maximum of 4096"); | 628 + ") exceeds allowed maximum of 4096"); |
| 648 return nullptr; | 629 return nullptr; |
| 649 } | 630 } |
| 650 | 631 |
| 651 lazyInitialize(); | |
| 652 return PeriodicWave::create(sampleRate(), real, imag); | 632 return PeriodicWave::create(sampleRate(), real, imag); |
| 653 } | 633 } |
| 654 | 634 |
| 655 void AudioContext::notifyNodeFinishedProcessing(AudioNode* node) | 635 void AudioContext::notifyNodeFinishedProcessing(AudioNode* node) |
| 656 { | 636 { |
| 657 ASSERT(isAudioThread()); | 637 ASSERT(isAudioThread()); |
| 658 m_finishedNodes.append(node); | 638 m_finishedNodes.append(node); |
| 659 } | 639 } |
| 660 | 640 |
| 661 void AudioContext::derefFinishedSourceNodes() | 641 void AudioContext::derefFinishedSourceNodes() |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 } | 1018 } |
| 1039 | 1019 |
| 1040 void AudioContext::decrementActiveSourceCount() | 1020 void AudioContext::decrementActiveSourceCount() |
| 1041 { | 1021 { |
| 1042 atomicDecrement(&m_activeSourceCount); | 1022 atomicDecrement(&m_activeSourceCount); |
| 1043 } | 1023 } |
| 1044 | 1024 |
| 1045 } // namespace WebCore | 1025 } // namespace WebCore |
| 1046 | 1026 |
| 1047 #endif // ENABLE(WEB_AUDIO) | 1027 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |