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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // inherit from RefCounted. | 45 // inherit from RefCounted. |
46 template<> struct CrossThreadCopierBase<false, false, false, PassRefPtr<ScriptPr
ocessorNode> > : public CrossThreadCopierPassThrough<PassRefPtr<ScriptProcessorN
ode> > { | 46 template<> struct CrossThreadCopierBase<false, false, false, PassRefPtr<ScriptPr
ocessorNode> > : public CrossThreadCopierPassThrough<PassRefPtr<ScriptProcessorN
ode> > { |
47 }; | 47 }; |
48 #endif | 48 #endif |
49 | 49 |
50 static size_t chooseBufferSize() | 50 static size_t chooseBufferSize() |
51 { | 51 { |
52 // Choose a buffer size based on the audio hardware buffer size. Arbitarily
make it a power of | 52 // Choose a buffer size based on the audio hardware buffer size. Arbitarily
make it a power of |
53 // two that is 4 times greater than the hardware buffer size. | 53 // two that is 4 times greater than the hardware buffer size. |
54 // FIXME: What is the best way to choose this? | 54 // FIXME: What is the best way to choose this? |
55 size_t hardwareBufferSize = blink::Platform::current()->audioHardwareBufferS
ize(); | 55 size_t hardwareBufferSize = Platform::current()->audioHardwareBufferSize(); |
56 size_t bufferSize = 1 << static_cast<unsigned>(log2(4 * hardwareBufferSize)
+ 0.5); | 56 size_t bufferSize = 1 << static_cast<unsigned>(log2(4 * hardwareBufferSize)
+ 0.5); |
57 | 57 |
58 if (bufferSize < 256) | 58 if (bufferSize < 256) |
59 return 256; | 59 return 256; |
60 if (bufferSize > 16384) | 60 if (bufferSize > 16384) |
61 return 16384; | 61 return 16384; |
62 | 62 |
63 return bufferSize; | 63 return bufferSize; |
64 } | 64 } |
65 | 65 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 void ScriptProcessorNode::trace(Visitor* visitor) | 284 void ScriptProcessorNode::trace(Visitor* visitor) |
285 { | 285 { |
286 visitor->trace(m_inputBuffers); | 286 visitor->trace(m_inputBuffers); |
287 visitor->trace(m_outputBuffers); | 287 visitor->trace(m_outputBuffers); |
288 AudioNode::trace(visitor); | 288 AudioNode::trace(visitor); |
289 } | 289 } |
290 | 290 |
291 } // namespace blink | 291 } // namespace blink |
292 | 292 |
293 #endif // ENABLE(WEB_AUDIO) | 293 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |