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