| OLD | NEW |
| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 "sampleRate", sampleRate, | 83 "sampleRate", sampleRate, |
| 84 AudioUtilities::minAudioBufferSampleRate(), | 84 AudioUtilities::minAudioBufferSampleRate(), |
| 85 ExceptionMessages::InclusiveBound, | 85 ExceptionMessages::InclusiveBound, |
| 86 AudioUtilities::maxAudioBufferSampleRate(), | 86 AudioUtilities::maxAudioBufferSampleRate(), |
| 87 ExceptionMessages::InclusiveBound)); | 87 ExceptionMessages::InclusiveBound)); |
| 88 return nullptr; | 88 return nullptr; |
| 89 } | 89 } |
| 90 | 90 |
| 91 OfflineAudioContext* audioContext = new OfflineAudioContext( | 91 OfflineAudioContext* audioContext = new OfflineAudioContext( |
| 92 document, numberOfChannels, numberOfFrames, sampleRate, exceptionState); | 92 document, numberOfChannels, numberOfFrames, sampleRate, exceptionState); |
| 93 audioContext->suspendIfNeeded(); |
| 93 | 94 |
| 94 if (!audioContext->destination()) { | 95 if (!audioContext->destination()) { |
| 95 exceptionState.throwDOMException( | 96 exceptionState.throwDOMException( |
| 96 NotSupportedError, "OfflineAudioContext(" + | 97 NotSupportedError, "OfflineAudioContext(" + |
| 97 String::number(numberOfChannels) + ", " + | 98 String::number(numberOfChannels) + ", " + |
| 98 String::number(numberOfFrames) + ", " + | 99 String::number(numberOfFrames) + ", " + |
| 99 String::number(sampleRate) + ")"); | 100 String::number(sampleRate) + ")"); |
| 100 return nullptr; | 101 return nullptr; |
| 101 } | 102 } |
| 102 | 103 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 116 // AudioUtilities::maxAudioBufferSampleRate(). The number of buckets is | 117 // AudioUtilities::maxAudioBufferSampleRate(). The number of buckets is |
| 117 // fairly arbitrary. | 118 // fairly arbitrary. |
| 118 DEFINE_STATIC_LOCAL( | 119 DEFINE_STATIC_LOCAL( |
| 119 CustomCountHistogram, offlineContextSampleRateHistogram, | 120 CustomCountHistogram, offlineContextSampleRateHistogram, |
| 120 ("WebAudio.OfflineAudioContext.SampleRate384kHz", 3000, 384000, 50)); | 121 ("WebAudio.OfflineAudioContext.SampleRate384kHz", 3000, 384000, 50)); |
| 121 | 122 |
| 122 offlineContextChannelCountHistogram.sample(numberOfChannels); | 123 offlineContextChannelCountHistogram.sample(numberOfChannels); |
| 123 offlineContextLengthHistogram.count(numberOfFrames); | 124 offlineContextLengthHistogram.count(numberOfFrames); |
| 124 offlineContextSampleRateHistogram.count(sampleRate); | 125 offlineContextSampleRateHistogram.count(sampleRate); |
| 125 | 126 |
| 126 audioContext->suspendIfNeeded(); | |
| 127 return audioContext; | 127 return audioContext; |
| 128 } | 128 } |
| 129 | 129 |
| 130 OfflineAudioContext::OfflineAudioContext(Document* document, | 130 OfflineAudioContext::OfflineAudioContext(Document* document, |
| 131 unsigned numberOfChannels, | 131 unsigned numberOfChannels, |
| 132 size_t numberOfFrames, | 132 size_t numberOfFrames, |
| 133 float sampleRate, | 133 float sampleRate, |
| 134 ExceptionState& exceptionState) | 134 ExceptionState& exceptionState) |
| 135 : BaseAudioContext(document, numberOfChannels, numberOfFrames, sampleRate), | 135 : BaseAudioContext(document, numberOfChannels, numberOfFrames, sampleRate), |
| 136 m_isRenderingStarted(false), | 136 m_isRenderingStarted(false), |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 | 447 |
| 448 // Note that the GraphLock is required before this check. Since this needs | 448 // Note that the GraphLock is required before this check. Since this needs |
| 449 // to run on the audio thread, OfflineGraphAutoLocker must be used. | 449 // to run on the audio thread, OfflineGraphAutoLocker must be used. |
| 450 if (m_scheduledSuspends.contains(currentSampleFrame())) | 450 if (m_scheduledSuspends.contains(currentSampleFrame())) |
| 451 return true; | 451 return true; |
| 452 | 452 |
| 453 return false; | 453 return false; |
| 454 } | 454 } |
| 455 | 455 |
| 456 } // namespace blink | 456 } // namespace blink |
| OLD | NEW |