Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1071)

Side by Side Diff: Source/modules/mediastream/MediaStream.cpp

Issue 201353002: MediaStream API: Adding missing observer calls for remote tracks (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test added Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/mediastream/MediaStream-stop-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « LayoutTests/fast/mediastream/MediaStream-stop-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698