OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 2 * Copyright (C) 2011 Ericsson AB. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 { | 56 { |
57 ASSERT(m_id.length()); | 57 ASSERT(m_id.length()); |
58 ThreadState::current()->registerPreFinalizer(this); | 58 ThreadState::current()->registerPreFinalizer(this); |
59 } | 59 } |
60 | 60 |
61 void MediaStreamComponent::dispose() | 61 void MediaStreamComponent::dispose() |
62 { | 62 { |
63 m_extraData.clear(); | 63 m_extraData.clear(); |
64 } | 64 } |
65 | 65 |
66 #if ENABLE(WEB_AUDIO) | |
67 void MediaStreamComponent::AudioSourceProviderImpl::wrap(WebAudioSourceProvider*
provider) | 66 void MediaStreamComponent::AudioSourceProviderImpl::wrap(WebAudioSourceProvider*
provider) |
68 { | 67 { |
69 MutexLocker locker(m_provideInputLock); | 68 MutexLocker locker(m_provideInputLock); |
70 m_webAudioSourceProvider = provider; | 69 m_webAudioSourceProvider = provider; |
71 } | 70 } |
72 | 71 |
73 void MediaStreamComponent::AudioSourceProviderImpl::provideInput(AudioBus* bus,
size_t framesToProcess) | 72 void MediaStreamComponent::AudioSourceProviderImpl::provideInput(AudioBus* bus,
size_t framesToProcess) |
74 { | 73 { |
75 ASSERT(bus); | 74 ASSERT(bus); |
76 if (!bus) | 75 if (!bus) |
77 return; | 76 return; |
78 | 77 |
79 MutexTryLocker tryLocker(m_provideInputLock); | 78 MutexTryLocker tryLocker(m_provideInputLock); |
80 if (!tryLocker.locked() || !m_webAudioSourceProvider) { | 79 if (!tryLocker.locked() || !m_webAudioSourceProvider) { |
81 bus->zero(); | 80 bus->zero(); |
82 return; | 81 return; |
83 } | 82 } |
84 | 83 |
85 // Wrap the AudioBus channel data using WebVector. | 84 // Wrap the AudioBus channel data using WebVector. |
86 size_t n = bus->numberOfChannels(); | 85 size_t n = bus->numberOfChannels(); |
87 WebVector<float*> webAudioData(n); | 86 WebVector<float*> webAudioData(n); |
88 for (size_t i = 0; i < n; ++i) | 87 for (size_t i = 0; i < n; ++i) |
89 webAudioData[i] = bus->channel(i)->mutableData(); | 88 webAudioData[i] = bus->channel(i)->mutableData(); |
90 | 89 |
91 m_webAudioSourceProvider->provideInput(webAudioData, framesToProcess); | 90 m_webAudioSourceProvider->provideInput(webAudioData, framesToProcess); |
92 } | 91 } |
93 #endif // #if ENABLE(WEB_AUDIO) | |
94 | 92 |
95 DEFINE_TRACE(MediaStreamComponent) | 93 DEFINE_TRACE(MediaStreamComponent) |
96 { | 94 { |
97 visitor->trace(m_source); | 95 visitor->trace(m_source); |
98 } | 96 } |
99 | 97 |
100 } // namespace blink | 98 } // namespace blink |
OLD | NEW |