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