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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (!audioContext->destination()) { | 85 if (!audioContext->destination()) { |
86 exceptionState.throwDOMException( | 86 exceptionState.throwDOMException( |
87 NotSupportedError, | 87 NotSupportedError, |
88 "OfflineAudioContext(" + String::number(numberOfChannels) | 88 "OfflineAudioContext(" + String::number(numberOfChannels) |
89 + ", " + String::number(numberOfFrames) | 89 + ", " + String::number(numberOfFrames) |
90 + ", " + String::number(sampleRate) | 90 + ", " + String::number(sampleRate) |
91 + ")"); | 91 + ")"); |
92 } | 92 } |
93 | 93 |
94 #if DEBUG_AUDIONODE_REFERENCES | 94 #if DEBUG_AUDIONODE_REFERENCES |
95 fprintf(stderr, "[%p]: OfflineAudioContext::OfflineAudioContext()\n", audioC
ontext); | 95 fprintf(stderr, "[%16p]: OfflineAudioContext::OfflineAudioContext()\n", audi
oContext); |
96 #endif | 96 #endif |
97 DEFINE_STATIC_LOCAL(SparseHistogram, offlineContextChannelCountHistogram, | 97 DEFINE_STATIC_LOCAL(SparseHistogram, offlineContextChannelCountHistogram, |
98 ("WebAudio.OfflineAudioContext.ChannelCount")); | 98 ("WebAudio.OfflineAudioContext.ChannelCount")); |
99 // Arbitrarly limit the maximum length to 1 million frames (about 20 sec | 99 // Arbitrarly limit the maximum length to 1 million frames (about 20 sec |
100 // at 48kHz). The number of buckets is fairly arbitrary. | 100 // at 48kHz). The number of buckets is fairly arbitrary. |
101 DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextLengthHistogram, | 101 DEFINE_STATIC_LOCAL(CustomCountHistogram, offlineContextLengthHistogram, |
102 ("WebAudio.OfflineAudioContext.Length", 1, 1000000, 50)); | 102 ("WebAudio.OfflineAudioContext.Length", 1, 1000000, 50)); |
103 // The limits are the min and max AudioBuffer sample rates currently | 103 // The limits are the min and max AudioBuffer sample rates currently |
104 // supported. We use explicit values here instead of | 104 // supported. We use explicit values here instead of |
105 // AudioUtilities::minAudioBufferSampleRate() and | 105 // AudioUtilities::minAudioBufferSampleRate() and |
(...skipping 28 matching lines...) Expand all Loading... |
134 "failed to create OfflineAudioContext(" + | 134 "failed to create OfflineAudioContext(" + |
135 String::number(numberOfChannels) + ", " + | 135 String::number(numberOfChannels) + ", " + |
136 String::number(numberOfFrames) + ", " + | 136 String::number(numberOfFrames) + ", " + |
137 String::number(sampleRate) + ")")); | 137 String::number(sampleRate) + ")")); |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 OfflineAudioContext::~OfflineAudioContext() | 141 OfflineAudioContext::~OfflineAudioContext() |
142 { | 142 { |
143 #if DEBUG_AUDIONODE_REFERENCES | 143 #if DEBUG_AUDIONODE_REFERENCES |
144 fprintf(stderr, "[%p]: OfflineAudioContext::~OfflineAudioContext()\n", this)
; | 144 fprintf(stderr, "[%16p]: OfflineAudioContext::~OfflineAudioContext()\n", thi
s); |
145 #endif | 145 #endif |
146 } | 146 } |
147 | 147 |
148 DEFINE_TRACE(OfflineAudioContext) | 148 DEFINE_TRACE(OfflineAudioContext) |
149 { | 149 { |
150 visitor->trace(m_renderTarget); | 150 visitor->trace(m_renderTarget); |
151 visitor->trace(m_completeResolver); | 151 visitor->trace(m_completeResolver); |
152 visitor->trace(m_scheduledSuspends); | 152 visitor->trace(m_scheduledSuspends); |
153 BaseAudioContext::trace(visitor); | 153 BaseAudioContext::trace(visitor); |
154 } | 154 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // Note that the GraphLock is required before this check. Since this needs | 441 // Note that the GraphLock is required before this check. Since this needs |
442 // to run on the audio thread, OfflineGraphAutoLocker must be used. | 442 // to run on the audio thread, OfflineGraphAutoLocker must be used. |
443 if (m_scheduledSuspends.contains(currentSampleFrame())) | 443 if (m_scheduledSuspends.contains(currentSampleFrame())) |
444 return true; | 444 return true; |
445 | 445 |
446 return false; | 446 return false; |
447 } | 447 } |
448 | 448 |
449 } // namespace blink | 449 } // namespace blink |
450 | 450 |
OLD | NEW |