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 17 matching lines...) Expand all Loading... | |
| 28 #include "modules/webaudio/BaseAudioContext.h" | 28 #include "modules/webaudio/BaseAudioContext.h" |
| 29 #include "platform/audio/AudioUtilities.h" | 29 #include "platform/audio/AudioUtilities.h" |
| 30 #include "platform/audio/DenormalDisabler.h" | 30 #include "platform/audio/DenormalDisabler.h" |
| 31 #include "wtf/Atomics.h" | 31 #include "wtf/Atomics.h" |
| 32 | 32 |
| 33 namespace blink { | 33 namespace blink { |
| 34 | 34 |
| 35 AudioDestinationHandler::AudioDestinationHandler(AudioNode& node, float sampleRa te) | 35 AudioDestinationHandler::AudioDestinationHandler(AudioNode& node, float sampleRa te) |
| 36 : AudioHandler(NodeTypeDestination, node, sampleRate) | 36 : AudioHandler(NodeTypeDestination, node, sampleRate) |
| 37 , m_currentSampleFrame(0) | 37 , m_currentSampleFrame(0) |
| 38 , m_numberOfConnections(0) | |
| 38 { | 39 { |
| 39 addInput(); | 40 addInput(); |
| 40 } | 41 } |
| 41 | 42 |
| 42 AudioDestinationHandler::~AudioDestinationHandler() | 43 AudioDestinationHandler::~AudioDestinationHandler() |
| 43 { | 44 { |
| 44 DCHECK(!isInitialized()); | 45 DCHECK(!isInitialized()); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void AudioDestinationHandler::render(AudioBus* sourceBus, AudioBus* destinationB us, size_t numberOfFrames) | 48 void AudioDestinationHandler::render(AudioBus* sourceBus, AudioBus* destinationB us, size_t numberOfFrames) |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 | 97 |
| 97 // Process nodes which need a little extra help because they are not connect ed to anything, but still need to process. | 98 // Process nodes which need a little extra help because they are not connect ed to anything, but still need to process. |
| 98 context()->deferredTaskHandler().processAutomaticPullNodes(numberOfFrames); | 99 context()->deferredTaskHandler().processAutomaticPullNodes(numberOfFrames); |
| 99 | 100 |
| 100 // Let the context take care of any business at the end of each render quant um. | 101 // Let the context take care of any business at the end of each render quant um. |
| 101 context()->handlePostRenderTasks(); | 102 context()->handlePostRenderTasks(); |
| 102 | 103 |
| 103 // Advance current sample-frame. | 104 // Advance current sample-frame. |
| 104 size_t newSampleFrame = m_currentSampleFrame + numberOfFrames; | 105 size_t newSampleFrame = m_currentSampleFrame + numberOfFrames; |
| 105 releaseStore(&m_currentSampleFrame, newSampleFrame); | 106 releaseStore(&m_currentSampleFrame, newSampleFrame); |
| 107 | |
| 108 // Update connection status. | |
| 109 releaseStore(&m_numberOfConnections, input(0).numberOfRenderingConnections() ); | |
| 110 } | |
| 111 | |
| 112 unsigned AudioDestinationHandler::numberOfConnections() const | |
| 113 { | |
| 114 return acquireLoad(&m_numberOfConnections); | |
| 106 } | 115 } |
| 107 | 116 |
| 108 // ---------------------------------------------------------------- | 117 // ---------------------------------------------------------------- |
| 109 | 118 |
| 110 AudioDestinationNode::AudioDestinationNode(BaseAudioContext& context) | 119 AudioDestinationNode::AudioDestinationNode(BaseAudioContext& context) |
| 111 : AudioNode(context) | 120 : AudioNode(context) |
| 112 { | 121 { |
| 113 } | 122 } |
| 114 | 123 |
| 115 AudioDestinationHandler& AudioDestinationNode::audioDestinationHandler() const | 124 AudioDestinationHandler& AudioDestinationNode::audioDestinationHandler() const |
| 116 { | 125 { |
| 117 return static_cast<AudioDestinationHandler&>(handler()); | 126 return static_cast<AudioDestinationHandler&>(handler()); |
| 118 } | 127 } |
| 119 | 128 |
| 120 unsigned long AudioDestinationNode::maxChannelCount() const | 129 unsigned long AudioDestinationNode::maxChannelCount() const |
| 121 { | 130 { |
| 122 return audioDestinationHandler().maxChannelCount(); | 131 return audioDestinationHandler().maxChannelCount(); |
| 123 } | 132 } |
| 124 | 133 |
| 134 bool AudioDestinationNode::hasConnection() const | |
| 135 { | |
| 136 return audioDestinationHandler().numberOfConnections() > 0; | |
| 137 } | |
|
Raymond Toy
2016/08/26 20:12:15
Since AudioDestinationNode is an AudioNode with a
hongchan
2016/08/27 17:09:40
As we discussed offline, this structure is necessa
| |
| 138 | |
| 125 } // namespace blink | 139 } // namespace blink |
| 126 | 140 |
| OLD | NEW |