| 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 28 matching lines...) Expand all Loading... |
| 39 m_currentSampleFrame(0) { | 39 m_currentSampleFrame(0) { |
| 40 addInput(); | 40 addInput(); |
| 41 } | 41 } |
| 42 | 42 |
| 43 AudioDestinationHandler::~AudioDestinationHandler() { | 43 AudioDestinationHandler::~AudioDestinationHandler() { |
| 44 DCHECK(!isInitialized()); | 44 DCHECK(!isInitialized()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void AudioDestinationHandler::render(AudioBus* sourceBus, | 47 void AudioDestinationHandler::render(AudioBus* sourceBus, |
| 48 AudioBus* destinationBus, | 48 AudioBus* destinationBus, |
| 49 size_t numberOfFrames) { | 49 size_t numberOfFrames, |
| 50 const AudioIOPosition& outputPosition) { |
| 50 // We don't want denormals slowing down any of the audio processing | 51 // We don't want denormals slowing down any of the audio processing |
| 51 // since they can very seriously hurt performance. This will take care of all | 52 // since they can very seriously hurt performance. This will take care of all |
| 52 // AudioNodes because they all process within this scope. | 53 // AudioNodes because they all process within this scope. |
| 53 DenormalDisabler denormalDisabler; | 54 DenormalDisabler denormalDisabler; |
| 54 | 55 |
| 55 // Need to check if the context actually alive. Otherwise the subsequent | 56 // Need to check if the context actually alive. Otherwise the subsequent |
| 56 // steps will fail. If the context is not alive somehow, return immediately | 57 // steps will fail. If the context is not alive somehow, return immediately |
| 57 // and do nothing. | 58 // and do nothing. |
| 58 // | 59 // |
| 59 // TODO(hongchan): because the context can go away while rendering, so this | 60 // TODO(hongchan): because the context can go away while rendering, so this |
| 60 // check cannot guarantee the safe execution of the following steps. | 61 // check cannot guarantee the safe execution of the following steps. |
| 61 DCHECK(context()); | 62 DCHECK(context()); |
| 62 if (!context()) | 63 if (!context()) |
| 63 return; | 64 return; |
| 64 | 65 |
| 65 context()->deferredTaskHandler().setAudioThreadToCurrentThread(); | 66 context()->deferredTaskHandler().setAudioThreadToCurrentThread(); |
| 66 | 67 |
| 67 // If the destination node is not initialized, pass the silence to the final | 68 // If the destination node is not initialized, pass the silence to the final |
| 68 // audio destination (one step before the FIFO). This check is for the case | 69 // audio destination (one step before the FIFO). This check is for the case |
| 69 // where the destination is in the middle of tearing down process. | 70 // where the destination is in the middle of tearing down process. |
| 70 if (!isInitialized()) { | 71 if (!isInitialized()) { |
| 71 destinationBus->zero(); | 72 destinationBus->zero(); |
| 72 return; | 73 return; |
| 73 } | 74 } |
| 74 | 75 |
| 75 // Let the context take care of any business at the start of each render | 76 // Let the context take care of any business at the start of each render |
| 76 // quantum. | 77 // quantum. |
| 77 context()->handlePreRenderTasks(); | 78 context()->handlePreRenderTasks(outputPosition); |
| 78 | 79 |
| 79 // Prepare the local audio input provider for this render quantum. | 80 // Prepare the local audio input provider for this render quantum. |
| 80 if (sourceBus) | 81 if (sourceBus) |
| 81 m_localAudioInputProvider.set(sourceBus); | 82 m_localAudioInputProvider.set(sourceBus); |
| 82 | 83 |
| 83 DCHECK_GE(numberOfInputs(), 1u); | 84 DCHECK_GE(numberOfInputs(), 1u); |
| 84 if (numberOfInputs() < 1) { | 85 if (numberOfInputs() < 1) { |
| 85 destinationBus->zero(); | 86 destinationBus->zero(); |
| 86 return; | 87 return; |
| 87 } | 88 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 116 | 117 |
| 117 AudioDestinationHandler& AudioDestinationNode::audioDestinationHandler() const { | 118 AudioDestinationHandler& AudioDestinationNode::audioDestinationHandler() const { |
| 118 return static_cast<AudioDestinationHandler&>(handler()); | 119 return static_cast<AudioDestinationHandler&>(handler()); |
| 119 } | 120 } |
| 120 | 121 |
| 121 unsigned long AudioDestinationNode::maxChannelCount() const { | 122 unsigned long AudioDestinationNode::maxChannelCount() const { |
| 122 return audioDestinationHandler().maxChannelCount(); | 123 return audioDestinationHandler().maxChannelCount(); |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace blink | 126 } // namespace blink |
| OLD | NEW |