WebRTC: Update the MediaStream API
authoradam.bergkvist@ericsson.com <adam.bergkvist@ericsson.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jun 2015 19:52:21 +0000 (19:52 +0000)
committeradam.bergkvist@ericsson.com <adam.bergkvist@ericsson.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 29 Jun 2015 19:52:21 +0000 (19:52 +0000)
commitfa78ae03baf162378db260f74c27e5d138b6c527
tree62ea753a151d0f713884566288927779adb9fcca
parent8194a67e878fac6064cd602c266e194fd85b9b3c
WebRTC: Update the MediaStream API
https://bugs.webkit.org/show_bug.cgi?id=146313

Reviewed by Eric Carlson.

Source/WebCore:

Update the MediaStream API (MediaStream, MediaStreamTrack and
RealtimeMediaSource) to match the Media Capture and Stream
specification [1]. Notable changes:

Updated event handling to synchronously update corresponding
state/attributes as events are dispatched.

Removed 'new' state from MediaStreamTrack. A track is either 'live' or
'ended'. As a consequence 'started' event is also removed.

MediaStreamTrack always has a source (disconnected source concept was
removed from the spec). Therefore, more state can be kept at the source
without going away.

Calculate MediaStream.active internally, from the track set, instead of
setting it externally.

Updated RealtimeMediaSource Observer interface.

Replaced MediaStream's separate audio and video track lists with a
single track set (more aligned with spec).

Updated MediaStream constructor to adopt instead of clone track
arguments (or tracks from MediaStream argument).

Removed MediaStreamTrack.getSources() and corresponding test (removed
from spec).

Test status: 3 added, 8 existing enabled (some updated) and 1 removed.

[1] http://w3c.github.io/mediacapture-main/archives/20150523/getusermedia.html

Tests: fast/mediastream/MediaStreamTrack-clone.html
       fast/mediastream/MediaStreamTrack-kind.html
       fast/mediastream/MediaStreamTrack-stop.html

* Modules/mediastream/MediaStream.cpp:
(WebCore::MediaStream::create):
(WebCore::MediaStream::MediaStream):
(WebCore::MediaStream::clone):
(WebCore::MediaStream::addTrack):
(WebCore::MediaStream::removeTrack):
(WebCore::MediaStream::getTrackById):
(WebCore::MediaStream::getAudioTracks):
(WebCore::MediaStream::getVideoTracks):
(WebCore::MediaStream::getTracks):
(WebCore::MediaStream::contextDestroyed):
(WebCore::MediaStream::trackDidEnd):
(WebCore::MediaStream::activeStatusChanged):
(WebCore::MediaStream::didAddTrackToPrivate):
(WebCore::MediaStream::didRemoveTrackFromPrivate):
(WebCore::MediaStream::internalAddTrack):
(WebCore::MediaStream::internalRemoveTrack):
(WebCore::MediaStream::scheduleActiveStateChange):
(WebCore::MediaStream::activityEventTimerFired):
(WebCore::MediaStream::trackVectorForType):
(WebCore::MediaStream::~MediaStream): Deleted.
(WebCore::MediaStream::registry): Deleted.
(WebCore::MediaStream::addObserver): Deleted.
(WebCore::MediaStream::removeObserver): Deleted.
* Modules/mediastream/MediaStream.h:
* Modules/mediastream/MediaStream.idl:
* Modules/mediastream/MediaStreamTrack.cpp:
(WebCore::MediaStreamTrack::MediaStreamTrack):
(WebCore::MediaStreamTrack::~MediaStreamTrack):
(WebCore::MediaStreamTrack::kind):
(WebCore::MediaStreamTrack::id):
(WebCore::MediaStreamTrack::label):
(WebCore::MediaStreamTrack::enabled):
(WebCore::MediaStreamTrack::setEnabled):
(WebCore::MediaStreamTrack::muted):
(WebCore::MediaStreamTrack::readonly):
(WebCore::MediaStreamTrack::remote):
(WebCore::MediaStreamTrack::readyState):
(WebCore::MediaStreamTrack::ended):
(WebCore::MediaStreamTrack::clone):
(WebCore::MediaStreamTrack::stopProducingData):
(WebCore::MediaStreamTrack::states):
(WebCore::MediaStreamTrack::getCapabilities):
(WebCore::MediaStreamTrack::applyConstraints):
(WebCore::MediaStreamTrack::trackEnded):
(WebCore::MediaStreamTrack::trackMutedChanged):
(WebCore::MediaStreamTrack::stop):
(WebCore::MediaStreamTrack::getConstraints): Deleted.
(WebCore::MediaStreamTrack::addObserver): Deleted.
(WebCore::MediaStreamTrack::removeObserver): Deleted.
(WebCore::MediaStreamTrack::configureTrackRendering): Deleted.
(WebCore::MediaStreamTrack::activeDOMObjectName): Deleted.
(WebCore::MediaStreamTrack::canSuspendForPageCache): Deleted.
* Modules/mediastream/MediaStreamTrack.h:
* Modules/mediastream/MediaStreamTrack.idl:
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::didRemoveRemoteStream): Deleted.
* Modules/mediastream/UserMediaRequest.cpp:
(WebCore::UserMediaRequest::didCreateStream):
* platform/mediastream/MediaStreamPrivate.cpp:
(WebCore::MediaStreamPrivate::create):
(WebCore::MediaStreamPrivate::MediaStreamPrivate):
(WebCore::MediaStreamPrivate::tracks):
(WebCore::MediaStreamPrivate::updateActiveState):
(WebCore::MediaStreamPrivate::addTrack):
(WebCore::MediaStreamPrivate::removeTrack):
* platform/mediastream/MediaStreamPrivate.h:
(WebCore::MediaStreamPrivate::active): Deleted.
* platform/mediastream/MediaStreamTrackPrivate.cpp:
(WebCore::MediaStreamTrackPrivate::create):
(WebCore::MediaStreamTrackPrivate::MediaStreamTrackPrivate):
(WebCore::MediaStreamTrackPrivate::~MediaStreamTrackPrivate):
(WebCore::MediaStreamTrackPrivate::label):
(WebCore::MediaStreamTrackPrivate::setEnabled):
(WebCore::MediaStreamTrackPrivate::endTrack):
(WebCore::MediaStreamTrackPrivate::clone):
(WebCore::MediaStreamTrackPrivate::type):
(WebCore::MediaStreamTrackPrivate::applyConstraints):
(WebCore::MediaStreamTrackPrivate::sourceStopped):
(WebCore::MediaStreamTrackPrivate::sourceMutedChanged):
(WebCore::MediaStreamTrackPrivate::preventSourceFromStopping):
(WebCore::MediaStreamTrackPrivate::muted): Deleted.
(WebCore::MediaStreamTrackPrivate::readonly): Deleted.
(WebCore::MediaStreamTrackPrivate::remote): Deleted.
(WebCore::MediaStreamTrackPrivate::constraints): Deleted.
(WebCore::MediaStreamTrackPrivate::states): Deleted.
(WebCore::MediaStreamTrackPrivate::capabilities): Deleted.
* platform/mediastream/MediaStreamTrackPrivate.h:
(WebCore::MediaStreamTrackPrivate::id):
(WebCore::MediaStreamTrackPrivate::ended):
(WebCore::MediaStreamTrackPrivate::enabled):
(WebCore::MediaStreamTrackPrivate::setClient):
(WebCore::MediaStreamTrackPrivate::source): Deleted.
(WebCore::MediaStreamTrackPrivate::client): Deleted.
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::RealtimeMediaSource):
(WebCore::RealtimeMediaSource::reset):
(WebCore::RealtimeMediaSource::setMuted):
(WebCore::RealtimeMediaSource::readonly):
(WebCore::RealtimeMediaSource::stop):
(WebCore::RealtimeMediaSource::requestStop):
(WebCore::RealtimeMediaSource::addObserver): Deleted.
(WebCore::RealtimeMediaSource::removeObserver): Deleted.
* platform/mediastream/RealtimeMediaSource.h:
(WebCore::RealtimeMediaSource::stopped):
(WebCore::RealtimeMediaSource::id): Deleted.
(WebCore::RealtimeMediaSource::muted): Deleted.
(WebCore::RealtimeMediaSource::setReadonly): Deleted.
* platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp:
(WebCore::RealtimeMediaSourceCenterOwr::createMediaStream): Deleted.
* platform/mock/MockRealtimeMediaSourceCenter.cpp:
(WebCore::MockRealtimeMediaSourceCenter::createMediaStream): Deleted.

LayoutTests:

Test status: 3 added, 8 existing enabled (some updated) and 1 removed.

* TestExpectations:
* fast/mediastream/MediaStream-add-ended-tracks-expected.txt:
* fast/mediastream/MediaStream-add-ended-tracks.html:
* fast/mediastream/MediaStream-add-remove-tracks-expected.txt:
* fast/mediastream/MediaStream-add-remove-tracks.html:
* fast/mediastream/MediaStream-add-tracks-to-inactive-stream.html:
* fast/mediastream/MediaStream-clone-expected.txt: Added.
* fast/mediastream/MediaStream-clone.html:
* fast/mediastream/MediaStream-construct-with-ended-tracks-expected.txt: Added.
* fast/mediastream/MediaStream-construct-with-ended-tracks.html:
* fast/mediastream/MediaStream-getTracks-expected.txt:
* fast/mediastream/MediaStream-getTracks.html:
* fast/mediastream/MediaStreamConstructor.html:
* fast/mediastream/MediaStreamTrack-clone-expected.txt: Added.
* fast/mediastream/MediaStreamTrack-clone.html: Added.
* fast/mediastream/MediaStreamTrack-getSources-expected.txt: Removed.
* fast/mediastream/MediaStreamTrack-getSources.html: Removed. Tested method removed from spec.
* fast/mediastream/MediaStreamTrack-kind-expected.txt: Added.
* fast/mediastream/MediaStreamTrack-kind.html: Added.
* fast/mediastream/MediaStreamTrack-stop-expected.txt: Added.
* fast/mediastream/MediaStreamTrack-stop.html: Added.
* fast/mediastream/MediaStreamTrackEvent-constructor-expected.txt:
* fast/mediastream/MediaStreamTrackEvent-constructor.html:
* fast/mediastream/resources/getUserMedia-helper.js: Added.
(.reject):
(getUserMedia):
(defaultRejectOrCatch):
* platform/gtk/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@186081 268f45cc-cd09-0410-ab3c-d52691b4dbfc
43 files changed:
LayoutTests/ChangeLog
LayoutTests/TestExpectations
LayoutTests/fast/mediastream/MediaStream-add-ended-tracks-expected.txt
LayoutTests/fast/mediastream/MediaStream-add-ended-tracks.html
LayoutTests/fast/mediastream/MediaStream-add-remove-tracks-expected.txt
LayoutTests/fast/mediastream/MediaStream-add-remove-tracks.html
LayoutTests/fast/mediastream/MediaStream-add-tracks-to-inactive-stream.html
LayoutTests/fast/mediastream/MediaStream-clone-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStream-clone.html
LayoutTests/fast/mediastream/MediaStream-construct-with-ended-tracks-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStream-construct-with-ended-tracks.html
LayoutTests/fast/mediastream/MediaStream-getTracks-expected.txt
LayoutTests/fast/mediastream/MediaStream-getTracks.html
LayoutTests/fast/mediastream/MediaStreamConstructor.html
LayoutTests/fast/mediastream/MediaStreamTrack-clone-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrack-clone.html [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrack-getSources-expected.txt [deleted file]
LayoutTests/fast/mediastream/MediaStreamTrack-getSources.html [deleted file]
LayoutTests/fast/mediastream/MediaStreamTrack-kind-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrack-kind.html [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrack-stop-expected.txt [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrack-stop.html [new file with mode: 0644]
LayoutTests/fast/mediastream/MediaStreamTrackEvent-constructor-expected.txt
LayoutTests/fast/mediastream/MediaStreamTrackEvent-constructor.html
LayoutTests/fast/mediastream/resources/getUserMedia-helper.js [new file with mode: 0644]
LayoutTests/platform/gtk/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediastream/MediaStream.cpp
Source/WebCore/Modules/mediastream/MediaStream.h
Source/WebCore/Modules/mediastream/MediaStream.idl
Source/WebCore/Modules/mediastream/MediaStreamTrack.cpp
Source/WebCore/Modules/mediastream/MediaStreamTrack.h
Source/WebCore/Modules/mediastream/MediaStreamTrack.idl
Source/WebCore/Modules/mediastream/RTCPeerConnection.cpp
Source/WebCore/Modules/mediastream/UserMediaRequest.cpp
Source/WebCore/platform/mediastream/MediaStreamPrivate.cpp
Source/WebCore/platform/mediastream/MediaStreamPrivate.h
Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.cpp
Source/WebCore/platform/mediastream/MediaStreamTrackPrivate.h
Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSource.h
Source/WebCore/platform/mediastream/openwebrtc/RealtimeMediaSourceCenterOwr.cpp
Source/WebCore/platform/mock/MockRealtimeMediaSourceCenter.cpp