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