| 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 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 #include "platform/audio/AudioBus.h" | 35 #include "platform/audio/AudioBus.h" |
| 36 #include "platform/mediastream/MediaStreamSource.h" | 36 #include "platform/mediastream/MediaStreamSource.h" |
| 37 #include "public/platform/WebAudioDestinationConsumer.h" | 37 #include "public/platform/WebAudioDestinationConsumer.h" |
| 38 #include "public/platform/WebMediaConstraints.h" | 38 #include "public/platform/WebMediaConstraints.h" |
| 39 #include "public/platform/WebString.h" | 39 #include "public/platform/WebString.h" |
| 40 #include "wtf/MainThread.h" | 40 #include "wtf/MainThread.h" |
| 41 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
| 42 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
| 43 | 43 |
| 44 using namespace WebCore; | 44 using namespace blink; |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 class ExtraDataContainer : public MediaStreamSource::ExtraData { | 50 class ExtraDataContainer : public MediaStreamSource::ExtraData { |
| 51 public: | 51 public: |
| 52 ExtraDataContainer(PassOwnPtr<WebMediaStreamSource::ExtraData> extraData) :
m_extraData(extraData) { } | 52 ExtraDataContainer(PassOwnPtr<WebMediaStreamSource::ExtraData> extraData) :
m_extraData(extraData) { } |
| 53 | 53 |
| 54 WebMediaStreamSource::ExtraData* extraData() { return m_extraData.get(); } | 54 WebMediaStreamSource::ExtraData* extraData() { return m_extraData.get(); } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 OwnPtr<WebMediaStreamSource::ExtraData> m_extraData; | 57 OwnPtr<WebMediaStreamSource::ExtraData> m_extraData; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 } // namespace | 60 } // namespace |
| 61 | 61 |
| 62 WebMediaStreamSource WebMediaStreamSource::ExtraData::owner() | 62 WebMediaStreamSource WebMediaStreamSource::ExtraData::owner() |
| 63 { | 63 { |
| 64 ASSERT(m_owner); | 64 ASSERT(m_owner); |
| 65 return WebMediaStreamSource(m_owner); | 65 return WebMediaStreamSource(m_owner); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void WebMediaStreamSource::ExtraData::setOwner(WebCore::MediaStreamSource* owner
) | 68 void WebMediaStreamSource::ExtraData::setOwner(blink::MediaStreamSource* owner) |
| 69 { | 69 { |
| 70 ASSERT(!m_owner); | 70 ASSERT(!m_owner); |
| 71 m_owner = owner; | 71 m_owner = owner; |
| 72 } | 72 } |
| 73 | 73 |
| 74 WebMediaStreamSource::WebMediaStreamSource(const PassRefPtr<MediaStreamSource>&
mediaStreamSource) | 74 WebMediaStreamSource::WebMediaStreamSource(const PassRefPtr<MediaStreamSource>&
mediaStreamSource) |
| 75 : m_private(mediaStreamSource) | 75 : m_private(mediaStreamSource) |
| 76 { | 76 { |
| 77 } | 77 } |
| 78 | 78 |
| 79 WebMediaStreamSource& WebMediaStreamSource::operator=(WebCore::MediaStreamSource
* mediaStreamSource) | 79 WebMediaStreamSource& WebMediaStreamSource::operator=(blink::MediaStreamSource*
mediaStreamSource) |
| 80 { | 80 { |
| 81 m_private = mediaStreamSource; | 81 m_private = mediaStreamSource; |
| 82 return *this; | 82 return *this; |
| 83 } | 83 } |
| 84 | 84 |
| 85 void WebMediaStreamSource::assign(const WebMediaStreamSource& other) | 85 void WebMediaStreamSource::assign(const WebMediaStreamSource& other) |
| 86 { | 86 { |
| 87 m_private = other.m_private; | 87 m_private = other.m_private; |
| 88 } | 88 } |
| 89 | 89 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 ASSERT(!m_private.isNull()); | 161 ASSERT(!m_private.isNull()); |
| 162 return m_private->constraints(); | 162 return m_private->constraints(); |
| 163 } | 163 } |
| 164 | 164 |
| 165 bool WebMediaStreamSource::requiresAudioConsumer() const | 165 bool WebMediaStreamSource::requiresAudioConsumer() const |
| 166 { | 166 { |
| 167 ASSERT(!m_private.isNull()); | 167 ASSERT(!m_private.isNull()); |
| 168 return m_private->requiresAudioConsumer(); | 168 return m_private->requiresAudioConsumer(); |
| 169 } | 169 } |
| 170 | 170 |
| 171 class ConsumerWrapper : public WebCore::AudioDestinationConsumer { | 171 class ConsumerWrapper : public blink::AudioDestinationConsumer { |
| 172 public: | 172 public: |
| 173 static PassRefPtr<ConsumerWrapper> create(WebAudioDestinationConsumer* consu
mer) | 173 static PassRefPtr<ConsumerWrapper> create(WebAudioDestinationConsumer* consu
mer) |
| 174 { | 174 { |
| 175 return adoptRef(new ConsumerWrapper(consumer)); | 175 return adoptRef(new ConsumerWrapper(consumer)); |
| 176 } | 176 } |
| 177 | 177 |
| 178 virtual void setFormat(size_t numberOfChannels, float sampleRate) OVERRIDE; | 178 virtual void setFormat(size_t numberOfChannels, float sampleRate) OVERRIDE; |
| 179 virtual void consumeAudio(AudioBus*, size_t numberOfFrames) OVERRIDE; | 179 virtual void consumeAudio(AudioBus*, size_t numberOfFrames) OVERRIDE; |
| 180 | 180 |
| 181 WebAudioDestinationConsumer* consumer() { return m_consumer; } | 181 WebAudioDestinationConsumer* consumer() { return m_consumer; } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 ConsumerWrapper* wrapper = static_cast<ConsumerWrapper*>(it->get()); | 224 ConsumerWrapper* wrapper = static_cast<ConsumerWrapper*>(it->get()); |
| 225 if (wrapper->consumer() == consumer) { | 225 if (wrapper->consumer() == consumer) { |
| 226 m_private->removeAudioConsumer(wrapper); | 226 m_private->removeAudioConsumer(wrapper); |
| 227 return true; | 227 return true; |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 return false; | 230 return false; |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace blink | 233 } // namespace blink |
| OLD | NEW |