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

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

Issue 2727583007: HTMLMediaElement capture: teach the captured MStream to follow up source events (Closed)
Patch Set: Made the media element and the MediaStream Members of MediaElementEventListener Created 3 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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 UseCounter::count(getExecutionContext(), UseCounter::MediaStreamOnInactive); 324 UseCounter::count(getExecutionContext(), UseCounter::MediaStreamOnInactive);
325 325
326 return EventTargetWithInlineData::addEventListenerInternal(eventType, 326 return EventTargetWithInlineData::addEventListenerInternal(eventType,
327 listener, options); 327 listener, options);
328 } 328 }
329 329
330 const AtomicString& MediaStream::interfaceName() const { 330 const AtomicString& MediaStream::interfaceName() const {
331 return EventTargetNames::MediaStream; 331 return EventTargetNames::MediaStream;
332 } 332 }
333 333
334 void MediaStream::addRemoteTrack(MediaStreamComponent* component) { 334 void MediaStream::addTrackByComponent(MediaStreamComponent* component) {
335 DCHECK(component); 335 DCHECK(component);
336 if (!getExecutionContext()) 336 if (!getExecutionContext())
337 return; 337 return;
338 338
339 MediaStreamTrack* track = 339 MediaStreamTrack* track =
340 MediaStreamTrack::create(getExecutionContext(), component); 340 MediaStreamTrack::create(getExecutionContext(), component);
341 switch (component->source()->type()) { 341 switch (component->source()->type()) {
342 case MediaStreamSource::TypeAudio: 342 case MediaStreamSource::TypeAudio:
343 m_audioTracks.push_back(track); 343 m_audioTracks.push_back(track);
344 break; 344 break;
345 case MediaStreamSource::TypeVideo: 345 case MediaStreamSource::TypeVideo:
346 m_videoTracks.push_back(track); 346 m_videoTracks.push_back(track);
347 break; 347 break;
348 } 348 }
349 track->registerMediaStream(this); 349 track->registerMediaStream(this);
350 m_descriptor->addComponent(component); 350 m_descriptor->addComponent(component);
351 351
352 scheduleDispatchEvent( 352 scheduleDispatchEvent(
353 MediaStreamTrackEvent::create(EventTypeNames::addtrack, track)); 353 MediaStreamTrackEvent::create(EventTypeNames::addtrack, track));
354 354
355 if (!active() && !track->ended()) { 355 if (!active() && !track->ended()) {
356 m_descriptor->setActive(true); 356 m_descriptor->setActive(true);
357 scheduleDispatchEvent(Event::create(EventTypeNames::active)); 357 scheduleDispatchEvent(Event::create(EventTypeNames::active));
358 } 358 }
359 } 359 }
360 360
361 void MediaStream::removeRemoteTrack(MediaStreamComponent* component) { 361 void MediaStream::removeTrackByComponent(MediaStreamComponent* component) {
haraken 2017/03/06 18:37:29 I'm just curious: What happens if ExecutionContext
mcasas 2017/03/06 19:38:59 I'm not sure what the original developers intended
362 DCHECK(component); 362 DCHECK(component);
363 if (!getExecutionContext()) 363 if (!getExecutionContext())
364 return; 364 return;
365 365
366 MediaStreamTrackVector* tracks = 0; 366 MediaStreamTrackVector* tracks = 0;
367 switch (component->source()->type()) { 367 switch (component->source()->type()) {
368 case MediaStreamSource::TypeAudio: 368 case MediaStreamSource::TypeAudio:
369 tracks = &m_audioTracks; 369 tracks = &m_audioTracks;
370 break; 370 break;
371 case MediaStreamSource::TypeVideo: 371 case MediaStreamSource::TypeVideo:
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 EventTargetWithInlineData::trace(visitor); 430 EventTargetWithInlineData::trace(visitor);
431 ContextClient::trace(visitor); 431 ContextClient::trace(visitor);
432 MediaStreamDescriptorClient::trace(visitor); 432 MediaStreamDescriptorClient::trace(visitor);
433 } 433 }
434 434
435 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor) { 435 MediaStream* toMediaStream(MediaStreamDescriptor* descriptor) {
436 return static_cast<MediaStream*>(descriptor->client()); 436 return static_cast<MediaStream*>(descriptor->client());
437 } 437 }
438 438
439 } // namespace blink 439 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698