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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 RefPtr<MediaStreamTrack> track = MediaStreamTrack::create(executionContext()
, component); | 320 RefPtr<MediaStreamTrack> track = MediaStreamTrack::create(executionContext()
, component); |
321 switch (component->source()->type()) { | 321 switch (component->source()->type()) { |
322 case MediaStreamSource::TypeAudio: | 322 case MediaStreamSource::TypeAudio: |
323 m_audioTracks.append(track); | 323 m_audioTracks.append(track); |
324 break; | 324 break; |
325 case MediaStreamSource::TypeVideo: | 325 case MediaStreamSource::TypeVideo: |
326 m_videoTracks.append(track); | 326 m_videoTracks.append(track); |
327 break; | 327 break; |
328 } | 328 } |
| 329 track->addObserver(this); |
329 m_descriptor->addComponent(component); | 330 m_descriptor->addComponent(component); |
330 | 331 |
331 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::addtrack
, false, false, track)); | 332 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::addtrack
, false, false, track)); |
332 } | 333 } |
333 | 334 |
334 void MediaStream::removeRemoteTrack(MediaStreamComponent* component) | 335 void MediaStream::removeRemoteTrack(MediaStreamComponent* component) |
335 { | 336 { |
336 if (ended()) | 337 if (ended()) |
337 return; | 338 return; |
338 | 339 |
(...skipping 13 matching lines...) Expand all Loading... |
352 index = i; | 353 index = i; |
353 break; | 354 break; |
354 } | 355 } |
355 } | 356 } |
356 if (index == kNotFound) | 357 if (index == kNotFound) |
357 return; | 358 return; |
358 | 359 |
359 m_descriptor->removeComponent(component); | 360 m_descriptor->removeComponent(component); |
360 | 361 |
361 RefPtr<MediaStreamTrack> track = (*tracks)[index]; | 362 RefPtr<MediaStreamTrack> track = (*tracks)[index]; |
| 363 track->removeObserver(this); |
362 tracks->remove(index); | 364 tracks->remove(index); |
363 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::removetr
ack, false, false, track)); | 365 scheduleDispatchEvent(MediaStreamTrackEvent::create(EventTypeNames::removetr
ack, false, false, track)); |
364 } | 366 } |
365 | 367 |
366 void MediaStream::scheduleDispatchEvent(PassRefPtr<Event> event) | 368 void MediaStream::scheduleDispatchEvent(PassRefPtr<Event> event) |
367 { | 369 { |
368 m_scheduledEvents.append(event); | 370 m_scheduledEvents.append(event); |
369 | 371 |
370 if (!m_scheduledEventTimer.isActive()) | 372 if (!m_scheduledEventTimer.isActive()) |
371 m_scheduledEventTimer.startOneShot(0, FROM_HERE); | 373 m_scheduledEventTimer.startOneShot(0, FROM_HERE); |
(...skipping 13 matching lines...) Expand all Loading... |
385 | 387 |
386 events.clear(); | 388 events.clear(); |
387 } | 389 } |
388 | 390 |
389 URLRegistry& MediaStream::registry() const | 391 URLRegistry& MediaStream::registry() const |
390 { | 392 { |
391 return MediaStreamRegistry::registry(); | 393 return MediaStreamRegistry::registry(); |
392 } | 394 } |
393 | 395 |
394 } // namespace WebCore | 396 } // namespace WebCore |
OLD | NEW |