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