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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 , m_isIteratingRegisteredMediaStreams(false) | 52 , m_isIteratingRegisteredMediaStreams(false) |
53 , m_stopped(false) | 53 , m_stopped(false) |
54 , m_component(component) | 54 , m_component(component) |
55 { | 55 { |
56 ScriptWrappable::init(this); | 56 ScriptWrappable::init(this); |
57 m_component->source()->addObserver(this); | 57 m_component->source()->addObserver(this); |
58 } | 58 } |
59 | 59 |
60 MediaStreamTrack::~MediaStreamTrack() | 60 MediaStreamTrack::~MediaStreamTrack() |
61 { | 61 { |
| 62 m_component->source()->removeObserver(this); |
62 } | 63 } |
63 | 64 |
64 String MediaStreamTrack::kind() const | 65 String MediaStreamTrack::kind() const |
65 { | 66 { |
66 DEFINE_STATIC_LOCAL(String, audioKind, ("audio")); | 67 DEFINE_STATIC_LOCAL(String, audioKind, ("audio")); |
67 DEFINE_STATIC_LOCAL(String, videoKind, ("video")); | 68 DEFINE_STATIC_LOCAL(String, videoKind, ("video")); |
68 | 69 |
69 switch (m_component->source()->type()) { | 70 switch (m_component->source()->type()) { |
70 case MediaStreamSource::TypeAudio: | 71 case MediaStreamSource::TypeAudio: |
71 return audioKind; | 72 return audioKind; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return; | 140 return; |
140 | 141 |
141 m_readyState = MediaStreamSource::ReadyStateEnded; | 142 m_readyState = MediaStreamSource::ReadyStateEnded; |
142 MediaStreamCenter::instance().didStopMediaStreamTrack(component()); | 143 MediaStreamCenter::instance().didStopMediaStreamTrack(component()); |
143 dispatchEvent(Event::create(EventTypeNames::ended)); | 144 dispatchEvent(Event::create(EventTypeNames::ended)); |
144 propagateTrackEnded(); | 145 propagateTrackEnded(); |
145 } | 146 } |
146 | 147 |
147 MediaStreamTrack* MediaStreamTrack::clone(ExecutionContext* context) | 148 MediaStreamTrack* MediaStreamTrack::clone(ExecutionContext* context) |
148 { | 149 { |
149 MediaStreamComponent* clonedComponent = MediaStreamComponent::create(compone
nt()->source()); | 150 RefPtr<MediaStreamComponent> clonedComponent = MediaStreamComponent::create(
component()->source()); |
150 MediaStreamTrack* clonedTrack = MediaStreamTrack::create(context, clonedComp
onent); | 151 MediaStreamTrack* clonedTrack = MediaStreamTrack::create(context, clonedComp
onent.get()); |
151 MediaStreamCenter::instance().didCreateMediaStreamTrack(clonedComponent); | 152 MediaStreamCenter::instance().didCreateMediaStreamTrack(clonedComponent.get(
)); |
152 return clonedTrack; | 153 return clonedTrack; |
153 } | 154 } |
154 | 155 |
155 bool MediaStreamTrack::ended() const | 156 bool MediaStreamTrack::ended() const |
156 { | 157 { |
157 return m_stopped || (m_readyState == MediaStreamSource::ReadyStateEnded); | 158 return m_stopped || (m_readyState == MediaStreamSource::ReadyStateEnded); |
158 } | 159 } |
159 | 160 |
160 void MediaStreamTrack::sourceChangedState() | 161 void MediaStreamTrack::sourceChangedState() |
161 { | 162 { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 } | 223 } |
223 | 224 |
224 ExecutionContext* MediaStreamTrack::executionContext() const | 225 ExecutionContext* MediaStreamTrack::executionContext() const |
225 { | 226 { |
226 return ActiveDOMObject::executionContext(); | 227 return ActiveDOMObject::executionContext(); |
227 } | 228 } |
228 | 229 |
229 void MediaStreamTrack::trace(Visitor* visitor) | 230 void MediaStreamTrack::trace(Visitor* visitor) |
230 { | 231 { |
231 visitor->trace(m_registeredMediaStreams); | 232 visitor->trace(m_registeredMediaStreams); |
232 visitor->trace(m_component); | |
233 EventTargetWithInlineData::trace(visitor); | 233 EventTargetWithInlineData::trace(visitor); |
234 MediaStreamSource::Observer::trace(visitor); | |
235 } | 234 } |
236 | 235 |
237 } // namespace blink | 236 } // namespace blink |
OLD | NEW |