Simplifying MediaStream and MediStreamDescriptor creation
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2013 01:15:20 +0000 (01:15 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 31 Oct 2013 01:15:20 +0000 (01:15 +0000)
commit1bc80b0f665ffb1747ed2ebd4d2a841f35202dc8
tree22230d08665a932771568dc18f00cc13a41231c5
parentf67af95412f1572d8e8345e6bb735017214afa44
Simplifying MediaStream and MediStreamDescriptor creation
https://bugs.webkit.org/show_bug.cgi?id=123443

Patch by Thiago de Barros Lacerda <thiago.lacerda@openbossa.org> on 2013-10-30
Reviewed by Eric Carlson.

The internal process of creating a MediaStream and MediaStreamDescriptor was quite confusing and spread.
We can take advantage of the platform implementation of MediaStreamTrack (aka MediaStreamTrackPrivate)
and simplify the whole process.
A new constructor that receives vectors of MediaStreamTrackPrivate objects were added, then the check
if a source already exists or if the tracks are all ended are now made in MediaStreamDescriptor.

No new tests needed.

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::create): Removed unnecessary variables in one create method and using new
MediaStreamDescriptor::create method that receives vector of MediaStreamTrackPrivate objects as parameter.

* Modules/webaudio/MediaStreamAudioDestinationNode.cpp:
(WebCore::MediaStreamAudioDestinationNode::MediaStreamAudioDestinationNode): Removed passing flag to
MediaStreamDescriptor create.

* platform/mediastream/MediaStreamDescriptor.cpp:
(WebCore::MediaStreamDescriptor::create): Removed EndedAtCreationFlag parameter, because this is being
handled inside constructor by analyzing the tracks or sources passed.
(WebCore::MediaStreamDescriptor::MediaStreamDescriptor): Adding new constructor that receives vector of
MediaStreamTrackPrivate as parameter.

(WebCore::MediaStreamDescriptor::addTrack): Changed to store the track's source in the object.

(WebCore::MediaStreamDescriptor::removeTrack):
* platform/mediastream/MediaStreamDescriptor.h:
(WebCore::MediaStreamDescriptor::numberOfAudioTracks):
(WebCore::MediaStreamDescriptor::audioTracks):
(WebCore::MediaStreamDescriptor::numberOfVideoTracks):
(WebCore::MediaStreamDescriptor::videoTracks):
* platform/mock/MockMediaStreamCenter.cpp:
(WebCore::MockMediaStreamCenter::createMediaStream): Removing flag that is being passed to
MediaStreamDescriptor's create method.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158337 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/Modules/webaudio/MediaStreamAudioDestinationNode.cpp
Source/WebCore/platform/mediastream/MediaStreamDescriptor.cpp
Source/WebCore/platform/mediastream/MediaStreamDescriptor.h
Source/WebCore/platform/mock/MockMediaStreamCenter.cpp