| 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, 2012 Ericsson AB. All rights reserved. | 3 * Copyright (C) 2011, 2012 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 return; | 174 return; |
| 175 } | 175 } |
| 176 | 176 |
| 177 if (!prpTrack) { | 177 if (!prpTrack) { |
| 178 es.throwDOMException(TypeMismatchError); | 178 es.throwDOMException(TypeMismatchError); |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 | 181 |
| 182 RefPtr<MediaStreamTrack> track = prpTrack; | 182 RefPtr<MediaStreamTrack> track = prpTrack; |
| 183 | 183 |
| 184 size_t pos = notFound; | 184 size_t pos = kNotFound; |
| 185 switch (track->component()->source()->type()) { | 185 switch (track->component()->source()->type()) { |
| 186 case MediaStreamSource::TypeAudio: | 186 case MediaStreamSource::TypeAudio: |
| 187 pos = m_audioTracks.find(track); | 187 pos = m_audioTracks.find(track); |
| 188 if (pos != notFound) | 188 if (pos != kNotFound) |
| 189 m_audioTracks.remove(pos); | 189 m_audioTracks.remove(pos); |
| 190 break; | 190 break; |
| 191 case MediaStreamSource::TypeVideo: | 191 case MediaStreamSource::TypeVideo: |
| 192 pos = m_videoTracks.find(track); | 192 pos = m_videoTracks.find(track); |
| 193 if (pos != notFound) | 193 if (pos != kNotFound) |
| 194 m_videoTracks.remove(pos); | 194 m_videoTracks.remove(pos); |
| 195 break; | 195 break; |
| 196 } | 196 } |
| 197 | 197 |
| 198 if (pos == notFound) | 198 if (pos == kNotFound) |
| 199 return; | 199 return; |
| 200 | 200 |
| 201 m_descriptor->removeComponent(track->component()); | 201 m_descriptor->removeComponent(track->component()); |
| 202 | 202 |
| 203 if (!m_audioTracks.size() && !m_videoTracks.size()) | 203 if (!m_audioTracks.size() && !m_videoTracks.size()) |
| 204 m_descriptor->setEnded(); | 204 m_descriptor->setEnded(); |
| 205 | 205 |
| 206 MediaStreamCenter::instance().didRemoveMediaStreamTrack(m_descriptor.get(),
track->component()); | 206 MediaStreamCenter::instance().didRemoveMediaStreamTrack(m_descriptor.get(),
track->component()); |
| 207 } | 207 } |
| 208 | 208 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 MediaStreamTrackVector* tracks = 0; | 309 MediaStreamTrackVector* tracks = 0; |
| 310 switch (component->source()->type()) { | 310 switch (component->source()->type()) { |
| 311 case MediaStreamSource::TypeAudio: | 311 case MediaStreamSource::TypeAudio: |
| 312 tracks = &m_audioTracks; | 312 tracks = &m_audioTracks; |
| 313 break; | 313 break; |
| 314 case MediaStreamSource::TypeVideo: | 314 case MediaStreamSource::TypeVideo: |
| 315 tracks = &m_videoTracks; | 315 tracks = &m_videoTracks; |
| 316 break; | 316 break; |
| 317 } | 317 } |
| 318 | 318 |
| 319 size_t index = notFound; | 319 size_t index = kNotFound; |
| 320 for (size_t i = 0; i < tracks->size(); ++i) { | 320 for (size_t i = 0; i < tracks->size(); ++i) { |
| 321 if ((*tracks)[i]->component() == component) { | 321 if ((*tracks)[i]->component() == component) { |
| 322 index = i; | 322 index = i; |
| 323 break; | 323 break; |
| 324 } | 324 } |
| 325 } | 325 } |
| 326 if (index == notFound) | 326 if (index == kNotFound) |
| 327 return; | 327 return; |
| 328 | 328 |
| 329 m_descriptor->removeComponent(component); | 329 m_descriptor->removeComponent(component); |
| 330 | 330 |
| 331 RefPtr<MediaStreamTrack> track = (*tracks)[index]; | 331 RefPtr<MediaStreamTrack> track = (*tracks)[index]; |
| 332 tracks->remove(index); | 332 tracks->remove(index); |
| 333 scheduleDispatchEvent(MediaStreamTrackEvent::create(eventNames().removetrack
Event, false, false, track)); | 333 scheduleDispatchEvent(MediaStreamTrackEvent::create(eventNames().removetrack
Event, false, false, track)); |
| 334 } | 334 } |
| 335 | 335 |
| 336 void MediaStream::scheduleDispatchEvent(PassRefPtr<Event> event) | 336 void MediaStream::scheduleDispatchEvent(PassRefPtr<Event> event) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 355 | 355 |
| 356 events.clear(); | 356 events.clear(); |
| 357 } | 357 } |
| 358 | 358 |
| 359 URLRegistry& MediaStream::registry() const | 359 URLRegistry& MediaStream::registry() const |
| 360 { | 360 { |
| 361 return MediaStreamRegistry::registry(); | 361 return MediaStreamRegistry::registry(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace WebCore | 364 } // namespace WebCore |
| OLD | NEW |