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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 26 matching lines...) Expand all Loading... |
37 #include "platform/mediastream/MediaConstraints.h" | 37 #include "platform/mediastream/MediaConstraints.h" |
38 #include "public/platform/WebAudioDestinationConsumer.h" | 38 #include "public/platform/WebAudioDestinationConsumer.h" |
39 #include "public/platform/WebMediaConstraints.h" | 39 #include "public/platform/WebMediaConstraints.h" |
40 #include "public/platform/WebString.h" | 40 #include "public/platform/WebString.h" |
41 #include "wtf/MainThread.h" | 41 #include "wtf/MainThread.h" |
42 #include "wtf/PassOwnPtr.h" | 42 #include "wtf/PassOwnPtr.h" |
43 #include "wtf/Vector.h" | 43 #include "wtf/Vector.h" |
44 | 44 |
45 using namespace WebCore; | 45 using namespace WebCore; |
46 | 46 |
47 namespace WebKit { | 47 namespace blink { |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
51 class ExtraDataContainer : public MediaStreamSource::ExtraData { | 51 class ExtraDataContainer : public MediaStreamSource::ExtraData { |
52 public: | 52 public: |
53 ExtraDataContainer(WebMediaStreamSource::ExtraData* extraData) : m_extraData
(adoptPtr(extraData)) { } | 53 ExtraDataContainer(WebMediaStreamSource::ExtraData* extraData) : m_extraData
(adoptPtr(extraData)) { } |
54 | 54 |
55 WebMediaStreamSource::ExtraData* extraData() { return m_extraData.get(); } | 55 WebMediaStreamSource::ExtraData* extraData() { return m_extraData.get(); } |
56 | 56 |
57 private: | 57 private: |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 m_consumer->setFormat(numberOfChannels, sampleRate); | 205 m_consumer->setFormat(numberOfChannels, sampleRate); |
206 } | 206 } |
207 | 207 |
208 void ConsumerWrapper::consumeAudio(AudioBus* bus, size_t numberOfFrames) | 208 void ConsumerWrapper::consumeAudio(AudioBus* bus, size_t numberOfFrames) |
209 { | 209 { |
210 if (!bus) | 210 if (!bus) |
211 return; | 211 return; |
212 | 212 |
213 // Wrap AudioBus. | 213 // Wrap AudioBus. |
214 size_t numberOfChannels = bus->numberOfChannels(); | 214 size_t numberOfChannels = bus->numberOfChannels(); |
215 WebKit::WebVector<const float*> busVector(numberOfChannels); | 215 blink::WebVector<const float*> busVector(numberOfChannels); |
216 for (size_t i = 0; i < numberOfChannels; ++i) | 216 for (size_t i = 0; i < numberOfChannels; ++i) |
217 busVector[i] = bus->channel(i)->data(); | 217 busVector[i] = bus->channel(i)->data(); |
218 | 218 |
219 m_consumer->consumeAudio(busVector, numberOfFrames); | 219 m_consumer->consumeAudio(busVector, numberOfFrames); |
220 } | 220 } |
221 | 221 |
222 void WebMediaStreamSource::addAudioConsumer(WebAudioDestinationConsumer* consume
r) | 222 void WebMediaStreamSource::addAudioConsumer(WebAudioDestinationConsumer* consume
r) |
223 { | 223 { |
224 ASSERT(isMainThread()); | 224 ASSERT(isMainThread()); |
225 ASSERT(!m_private.isNull() && consumer); | 225 ASSERT(!m_private.isNull() && consumer); |
(...skipping 10 matching lines...) Expand all Loading... |
236 for (Vector<RefPtr<AudioDestinationConsumer> >::const_iterator it = consumer
s.begin(); it != consumers.end(); ++it) { | 236 for (Vector<RefPtr<AudioDestinationConsumer> >::const_iterator it = consumer
s.begin(); it != consumers.end(); ++it) { |
237 ConsumerWrapper* wrapper = static_cast<ConsumerWrapper*>((*it).get()); | 237 ConsumerWrapper* wrapper = static_cast<ConsumerWrapper*>((*it).get()); |
238 if (wrapper->consumer() == consumer) { | 238 if (wrapper->consumer() == consumer) { |
239 m_private->removeAudioConsumer(wrapper); | 239 m_private->removeAudioConsumer(wrapper); |
240 return true; | 240 return true; |
241 } | 241 } |
242 } | 242 } |
243 return false; | 243 return false; |
244 } | 244 } |
245 | 245 |
246 } // namespace WebKit | 246 } // namespace blink |
OLD | NEW |