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