| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011 Ericsson AB. 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 | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "config.h" | 26 #include "config.h" |
| 27 #include "modules/mediastream/MediaStreamTrack.h" | 27 #include "modules/mediastream/MediaStreamTrack.h" |
| 28 | 28 |
| 29 #include "core/dom/Event.h" | 29 #include "core/dom/Event.h" |
| 30 #include "core/dom/ScriptExecutionContext.h" | 30 #include "core/dom/ScriptExecutionContext.h" |
| 31 #include "core/platform/chromium/support/WebMediaStreamClient.h" | |
| 32 #include "core/platform/mediastream/MediaStreamCenter.h" | 31 #include "core/platform/mediastream/MediaStreamCenter.h" |
| 33 #include "core/platform/mediastream/MediaStreamComponent.h" | 32 #include "core/platform/mediastream/MediaStreamComponent.h" |
| 34 #include "public/platform/WebSourceInfo.h" | 33 #include "public/platform/WebSourceInfo.h" |
| 35 #include "weborigin/SecurityOrigin.h" | 34 #include "weborigin/SecurityOrigin.h" |
| 36 | 35 |
| 37 namespace WebCore { | 36 namespace WebCore { |
| 38 | 37 |
| 39 PassRefPtr<MediaStreamTrack> MediaStreamTrack::create(ScriptExecutionContext* co
ntext, MediaStreamComponent* component) | 38 PassRefPtr<MediaStreamTrack> MediaStreamTrack::create(ScriptExecutionContext* co
ntext, MediaStreamComponent* component) |
| 40 { | 39 { |
| 41 RefPtr<MediaStreamTrack> track = adoptRef(new MediaStreamTrack(context, comp
onent)); | 40 RefPtr<MediaStreamTrack> track = adoptRef(new MediaStreamTrack(context, comp
onent)); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return m_component->enabled(); | 87 return m_component->enabled(); |
| 89 } | 88 } |
| 90 | 89 |
| 91 void MediaStreamTrack::setEnabled(bool enabled) | 90 void MediaStreamTrack::setEnabled(bool enabled) |
| 92 { | 91 { |
| 93 if (m_stopped || enabled == m_component->enabled()) | 92 if (m_stopped || enabled == m_component->enabled()) |
| 94 return; | 93 return; |
| 95 | 94 |
| 96 m_component->setEnabled(enabled); | 95 m_component->setEnabled(enabled); |
| 97 | 96 |
| 98 if (m_component->stream().ended()) | 97 if (m_component->stream()->ended()) |
| 99 return; | 98 return; |
| 100 | 99 |
| 101 MediaStreamCenter::instance().didSetMediaStreamTrackEnabled(m_component->str
eam(), m_component.get()); | 100 MediaStreamCenter::instance().didSetMediaStreamTrackEnabled(m_component->str
eam(), m_component.get()); |
| 102 } | 101 } |
| 103 | 102 |
| 104 String MediaStreamTrack::readyState() const | 103 String MediaStreamTrack::readyState() const |
| 105 { | 104 { |
| 106 if (m_stopped) | 105 if (m_stopped) |
| 107 return ASCIILiteral("ended"); | 106 return ASCIILiteral("ended"); |
| 108 | 107 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 break; | 153 break; |
| 155 case MediaStreamSource::ReadyStateEnded: | 154 case MediaStreamSource::ReadyStateEnded: |
| 156 dispatchEvent(Event::create(eventNames().endedEvent, false, false)); | 155 dispatchEvent(Event::create(eventNames().endedEvent, false, false)); |
| 157 didEndTrack(); | 156 didEndTrack(); |
| 158 break; | 157 break; |
| 159 } | 158 } |
| 160 } | 159 } |
| 161 | 160 |
| 162 void MediaStreamTrack::didEndTrack() | 161 void MediaStreamTrack::didEndTrack() |
| 163 { | 162 { |
| 164 WebKit::WebMediaStreamClient* client = m_component->stream().client(); | 163 MediaStreamDescriptorClient* client = m_component->stream()->client(); |
| 165 if (!client) | 164 if (!client) |
| 166 return; | 165 return; |
| 167 | 166 |
| 168 client->trackEnded(); | 167 client->trackEnded(); |
| 169 } | 168 } |
| 170 | 169 |
| 171 MediaStreamComponent* MediaStreamTrack::component() | 170 MediaStreamComponent* MediaStreamTrack::component() |
| 172 { | 171 { |
| 173 return m_component.get(); | 172 return m_component.get(); |
| 174 } | 173 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 192 { | 191 { |
| 193 return &m_eventTargetData; | 192 return &m_eventTargetData; |
| 194 } | 193 } |
| 195 | 194 |
| 196 EventTargetData* MediaStreamTrack::ensureEventTargetData() | 195 EventTargetData* MediaStreamTrack::ensureEventTargetData() |
| 197 { | 196 { |
| 198 return &m_eventTargetData; | 197 return &m_eventTargetData; |
| 199 } | 198 } |
| 200 | 199 |
| 201 } // namespace WebCore | 200 } // namespace WebCore |
| OLD | NEW |