| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 23 matching lines...) Expand all Loading... |
| 34 #include "platform/Logging.h" | 34 #include "platform/Logging.h" |
| 35 #include "platform/graphics/media/MediaPlayer.h" | 35 #include "platform/graphics/media/MediaPlayer.h" |
| 36 #include "wtf/Locker.h" | 36 #include "wtf/Locker.h" |
| 37 | 37 |
| 38 // These are somewhat arbitrary limits, but we need to do some kind of sanity-ch
ecking. | 38 // These are somewhat arbitrary limits, but we need to do some kind of sanity-ch
ecking. |
| 39 const unsigned minSampleRate = 8000; | 39 const unsigned minSampleRate = 8000; |
| 40 const unsigned maxSampleRate = 192000; | 40 const unsigned maxSampleRate = 192000; |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 PassRefPtrWillBeRawPtr<MediaElementAudioSourceNode> MediaElementAudioSourceNode:
:create(AudioContext* context, HTMLMediaElement* mediaElement) | 44 MediaElementAudioSourceNode* MediaElementAudioSourceNode::create(AudioContext* c
ontext, HTMLMediaElement* mediaElement) |
| 45 { | 45 { |
| 46 return adoptRefWillBeNoop(new MediaElementAudioSourceNode(context, mediaElem
ent)); | 46 return adoptRefCountedGarbageCollectedWillBeNoop(new MediaElementAudioSource
Node(context, mediaElement)); |
| 47 } | 47 } |
| 48 | 48 |
| 49 MediaElementAudioSourceNode::MediaElementAudioSourceNode(AudioContext* context,
HTMLMediaElement* mediaElement) | 49 MediaElementAudioSourceNode::MediaElementAudioSourceNode(AudioContext* context,
HTMLMediaElement* mediaElement) |
| 50 : AudioSourceNode(context, context->sampleRate()) | 50 : AudioSourceNode(context, context->sampleRate()) |
| 51 , m_mediaElement(mediaElement) | 51 , m_mediaElement(mediaElement) |
| 52 , m_sourceNumberOfChannels(0) | 52 , m_sourceNumberOfChannels(0) |
| 53 , m_sourceSampleRate(0) | 53 , m_sourceSampleRate(0) |
| 54 { | 54 { |
| 55 ScriptWrappable::init(this); | 55 ScriptWrappable::init(this); |
| 56 // Default to stereo. This could change depending on what the media element | 56 // Default to stereo. This could change depending on what the media element |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 outputBus->zero(); | 138 outputBus->zero(); |
| 139 } | 139 } |
| 140 } else { | 140 } else { |
| 141 // We failed to acquire the lock. | 141 // We failed to acquire the lock. |
| 142 outputBus->zero(); | 142 outputBus->zero(); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 void MediaElementAudioSourceNode::lock() | 146 void MediaElementAudioSourceNode::lock() |
| 147 { | 147 { |
| 148 #if !ENABLE(OILPAN) | |
| 149 ref(); | |
| 150 #endif | |
| 151 m_processLock.lock(); | 148 m_processLock.lock(); |
| 152 } | 149 } |
| 153 | 150 |
| 154 void MediaElementAudioSourceNode::unlock() | 151 void MediaElementAudioSourceNode::unlock() |
| 155 { | 152 { |
| 156 m_processLock.unlock(); | 153 m_processLock.unlock(); |
| 157 #if !ENABLE(OILPAN) | |
| 158 deref(); | |
| 159 #endif | |
| 160 } | 154 } |
| 161 | 155 |
| 162 void MediaElementAudioSourceNode::trace(Visitor* visitor) | 156 void MediaElementAudioSourceNode::trace(Visitor* visitor) |
| 163 { | 157 { |
| 164 visitor->trace(m_mediaElement); | 158 visitor->trace(m_mediaElement); |
| 165 AudioSourceNode::trace(visitor); | 159 AudioSourceNode::trace(visitor); |
| 166 AudioSourceProviderClient::trace(visitor); | 160 AudioSourceProviderClient::trace(visitor); |
| 167 } | 161 } |
| 168 | 162 |
| 169 } // namespace blink | 163 } // namespace blink |
| 170 | 164 |
| 171 #endif // ENABLE(WEB_AUDIO) | 165 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |