| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y |
| 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N |
| 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #include "modules/webaudio/MediaStreamAudioDestinationNode.h" | 25 #include "modules/webaudio/MediaStreamAudioDestinationNode.h" |
| 26 #include "bindings/core/v8/ExceptionMessages.h" | 26 #include "bindings/core/v8/ExceptionMessages.h" |
| 27 #include "bindings/core/v8/ExceptionState.h" | 27 #include "bindings/core/v8/ExceptionState.h" |
| 28 #include "core/dom/ExceptionCode.h" | 28 #include "core/dom/ExceptionCode.h" |
| 29 #include "modules/webaudio/AbstractAudioContext.h" | |
| 30 #include "modules/webaudio/AudioNodeInput.h" | 29 #include "modules/webaudio/AudioNodeInput.h" |
| 30 #include "modules/webaudio/BaseAudioContext.h" |
| 31 #include "platform/UUID.h" | 31 #include "platform/UUID.h" |
| 32 #include "platform/mediastream/MediaStreamCenter.h" | 32 #include "platform/mediastream/MediaStreamCenter.h" |
| 33 #include "public/platform/WebRTCPeerConnectionHandler.h" | 33 #include "public/platform/WebRTCPeerConnectionHandler.h" |
| 34 #include "wtf/Locker.h" | 34 #include "wtf/Locker.h" |
| 35 | 35 |
| 36 namespace blink { | 36 namespace blink { |
| 37 | 37 |
| 38 // WebAudioCapturerSource ignores the channel count beyond 8, so we set the | 38 // WebAudioCapturerSource ignores the channel count beyond 8, so we set the |
| 39 // block here to avoid anything can cause the crash. | 39 // block here to avoid anything can cause the crash. |
| 40 static const unsigned long kMaxChannelCount = 8; | 40 static const unsigned long kMaxChannelCount = 8; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 unsigned long oldChannelCount = this->channelCount(); | 97 unsigned long oldChannelCount = this->channelCount(); |
| 98 AudioHandler::setChannelCount(channelCount, exceptionState); | 98 AudioHandler::setChannelCount(channelCount, exceptionState); |
| 99 | 99 |
| 100 // Update the pipeline with the new channel count only if absolutely | 100 // Update the pipeline with the new channel count only if absolutely |
| 101 // necessary. This process requires the graph lock. | 101 // necessary. This process requires the graph lock. |
| 102 // | 102 // |
| 103 // TODO(hongchan): There might be a data race here since both threads | 103 // TODO(hongchan): There might be a data race here since both threads |
| 104 // have access to m_mixBus. | 104 // have access to m_mixBus. |
| 105 if (!exceptionState.hadException() && this->channelCount() != oldChannelCoun
t && isInitialized()) { | 105 if (!exceptionState.hadException() && this->channelCount() != oldChannelCoun
t && isInitialized()) { |
| 106 AbstractAudioContext::AutoLocker locker(context()); | 106 BaseAudioContext::AutoLocker locker(context()); |
| 107 m_mixBus = AudioBus::create(channelCount, ProcessingSizeInFrames); | 107 m_mixBus = AudioBus::create(channelCount, ProcessingSizeInFrames); |
| 108 m_source->setAudioFormat(channelCount, context()->sampleRate()); | 108 m_source->setAudioFormat(channelCount, context()->sampleRate()); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 unsigned long MediaStreamAudioDestinationHandler::maxChannelCount() const | 112 unsigned long MediaStreamAudioDestinationHandler::maxChannelCount() const |
| 113 { | 113 { |
| 114 return kMaxChannelCount; | 114 return kMaxChannelCount; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // ---------------------------------------------------------------- | 117 // ---------------------------------------------------------------- |
| 118 | 118 |
| 119 MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(AbstractAudioCo
ntext& context, size_t numberOfChannels) | 119 MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode(BaseAudioContex
t& context, size_t numberOfChannels) |
| 120 : AudioBasicInspectorNode(context) | 120 : AudioBasicInspectorNode(context) |
| 121 { | 121 { |
| 122 setHandler(MediaStreamAudioDestinationHandler::create(*this, numberOfChannel
s)); | 122 setHandler(MediaStreamAudioDestinationHandler::create(*this, numberOfChannel
s)); |
| 123 } | 123 } |
| 124 | 124 |
| 125 MediaStreamAudioDestinationNode* MediaStreamAudioDestinationNode::create(Abstrac
tAudioContext& context, size_t numberOfChannels) | 125 MediaStreamAudioDestinationNode* MediaStreamAudioDestinationNode::create(BaseAud
ioContext& context, size_t numberOfChannels) |
| 126 { | 126 { |
| 127 return new MediaStreamAudioDestinationNode(context, numberOfChannels); | 127 return new MediaStreamAudioDestinationNode(context, numberOfChannels); |
| 128 } | 128 } |
| 129 | 129 |
| 130 MediaStream* MediaStreamAudioDestinationNode::stream() const | 130 MediaStream* MediaStreamAudioDestinationNode::stream() const |
| 131 { | 131 { |
| 132 return static_cast<MediaStreamAudioDestinationHandler&>(handler()).stream(); | 132 return static_cast<MediaStreamAudioDestinationHandler&>(handler()).stream(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace blink | 135 } // namespace blink |
| 136 | 136 |
| OLD | NEW |