| 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 11 matching lines...) Expand all Loading... |
| 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 23 * DAMAGE. | 23 * DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "modules/webaudio/AudioDestinationNode.h" | 26 #include "modules/webaudio/AudioDestinationNode.h" |
| 27 #include "modules/webaudio/AudioNodeInput.h" | 27 #include "modules/webaudio/AudioNodeInput.h" |
| 28 #include "modules/webaudio/AudioNodeOutput.h" | 28 #include "modules/webaudio/AudioNodeOutput.h" |
| 29 #include "modules/webaudio/BaseAudioContext.h" | 29 #include "modules/webaudio/BaseAudioContext.h" |
| 30 #include "platform/audio/AudioUtilities.h" | 30 #include "platform/audio/AudioUtilities.h" |
| 31 #include "platform/audio/DenormalDisabler.h" | 31 #include "platform/audio/DenormalDisabler.h" |
| 32 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 32 #include "platform/wtf/Atomics.h" | 33 #include "platform/wtf/Atomics.h" |
| 33 | 34 |
| 34 namespace blink { | 35 namespace blink { |
| 35 | 36 |
| 36 AudioDestinationHandler::AudioDestinationHandler(AudioNode& node) | 37 AudioDestinationHandler::AudioDestinationHandler(AudioNode& node) |
| 37 : AudioHandler(kNodeTypeDestination, node, 0), current_sample_frame_(0) { | 38 : AudioHandler(kNodeTypeDestination, node, 0), current_sample_frame_(0) { |
| 38 AddInput(); | 39 AddInput(); |
| 39 } | 40 } |
| 40 | 41 |
| 41 AudioDestinationHandler::~AudioDestinationHandler() { | 42 AudioDestinationHandler::~AudioDestinationHandler() { |
| 42 DCHECK(!IsInitialized()); | 43 DCHECK(!IsInitialized()); |
| 43 } | 44 } |
| 44 | 45 |
| 45 void AudioDestinationHandler::Render(AudioBus* source_bus, | 46 void AudioDestinationHandler::Render(AudioBus* source_bus, |
| 46 AudioBus* destination_bus, | 47 AudioBus* destination_bus, |
| 47 size_t number_of_frames, | 48 size_t number_of_frames, |
| 48 const AudioIOPosition& output_position) { | 49 const AudioIOPosition& output_position) { |
| 50 TRACE_EVENT0("webaudio", "AudioDestinationHandler::Render"); |
| 51 |
| 49 // We don't want denormals slowing down any of the audio processing | 52 // We don't want denormals slowing down any of the audio processing |
| 50 // since they can very seriously hurt performance. This will take care of all | 53 // since they can very seriously hurt performance. This will take care of all |
| 51 // AudioNodes because they all process within this scope. | 54 // AudioNodes because they all process within this scope. |
| 52 DenormalDisabler denormal_disabler; | 55 DenormalDisabler denormal_disabler; |
| 53 | 56 |
| 54 // Need to check if the context actually alive. Otherwise the subsequent | 57 // Need to check if the context actually alive. Otherwise the subsequent |
| 55 // steps will fail. If the context is not alive somehow, return immediately | 58 // steps will fail. If the context is not alive somehow, return immediately |
| 56 // and do nothing. | 59 // and do nothing. |
| 57 // | 60 // |
| 58 // TODO(hongchan): because the context can go away while rendering, so this | 61 // TODO(hongchan): because the context can go away while rendering, so this |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 AudioDestinationHandler& AudioDestinationNode::GetAudioDestinationHandler() | 120 AudioDestinationHandler& AudioDestinationNode::GetAudioDestinationHandler() |
| 118 const { | 121 const { |
| 119 return static_cast<AudioDestinationHandler&>(Handler()); | 122 return static_cast<AudioDestinationHandler&>(Handler()); |
| 120 } | 123 } |
| 121 | 124 |
| 122 unsigned long AudioDestinationNode::maxChannelCount() const { | 125 unsigned long AudioDestinationNode::maxChannelCount() const { |
| 123 return GetAudioDestinationHandler().MaxChannelCount(); | 126 return GetAudioDestinationHandler().MaxChannelCount(); |
| 124 } | 127 } |
| 125 | 128 |
| 126 } // namespace blink | 129 } // namespace blink |
| OLD | NEW |