Commit 4b9a957b authored by tommyw@google.com's avatar tommyw@google.com

MediaStream API: Change the MediaStreamTrackList track added/removed signaling

https://bugs.webkit.org/show_bug.cgi?id=95721

Reviewed by Adam Barth.

Source/Platform:

Adding the signaling to the WebKit interface.

* chromium/public/WebMediaStreamCenter.h:
(WebKit::WebMediaStreamCenter::didAddMediaStreamTrack):
(WebKit::WebMediaStreamCenter::didRemoveMediaStreamTrack):

Source/WebCore:

This allows the platform implementor to throw an NOT_SUPPORTED_ERR exception if it doesn support these methods.

Patch covered by expanded existing test.

* Modules/mediastream/MediaStreamTrackList.cpp:
(WebCore::MediaStreamTrackList::add):
(WebCore::MediaStreamTrackList::remove):
* platform/mediastream/MediaStreamCenter.h:
(MediaStreamCenter):
* platform/mediastream/blackberry/MediaStreamCenterBlackBerry.cpp:
(WebCore::MediaStreamCenterBlackBerry::didAddMediaStreamTrack):
(WebCore):
(WebCore::MediaStreamCenterBlackBerry::didRemoveMediaStreamTrack):
* platform/mediastream/blackberry/MediaStreamCenterBlackBerry.h:
(MediaStreamCenterBlackBerry):
* platform/mediastream/chromium/MediaStreamCenterChromium.cpp:
(WebCore::MediaStreamCenterChromium::didAddMediaStreamTrack):
(WebCore::MediaStreamCenterChromium::didRemoveMediaStreamTrack):
* platform/mediastream/chromium/MediaStreamCenterChromium.h:
(MediaStreamCenterChromium):
* platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp:
(WebCore::MediaStreamCenterGStreamer::didAddMediaStreamTrack):
(WebCore::MediaStreamCenterGStreamer::didRemoveMediaStreamTrack):
* platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h:
(MediaStreamCenterGStreamer):

Tools:

* DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp:
(MockWebMediaStreamCenter::didAddMediaStreamTrack):
(MockWebMediaStreamCenter::didRemoveMediaStreamTrack):
* DumpRenderTree/chromium/MockWebMediaStreamCenter.h:
(MockWebMediaStreamCenter):

LayoutTests:

* fast/mediastream/MediaStreamTrackList.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127485 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c6395da1
2012-09-04 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Change the MediaStreamTrackList track added/removed signaling
https://bugs.webkit.org/show_bug.cgi?id=95721
Reviewed by Adam Barth.
* fast/mediastream/MediaStreamTrackList.html:
2012-09-04 Christophe Dumez <christophe.dumez@intel.com>
Automatic features should work in sandboxed iframes if "allow-scripts" flag is set
......@@ -42,14 +42,25 @@ function onAddTrack(e) {
testPassed('Add track callback succeeded.');
stream1.videoTracks.onremovetrack = onRemoveTrack;
stream1.videoTracks.remove(e.track);
try {
stream1.videoTracks.remove(e.track);
} catch (exception) {
testFailed("remove threw an exception.");
finishJSTest();
}
}
function gotStream2(s) {
stream2 = s;
stream1.videoTracks.onaddtrack = onAddTrack;
stream1.videoTracks.add(stream2.videoTracks[0]);
try {
stream1.videoTracks.add(stream2.videoTracks[0]);
} catch (exception) {
testFailed("add threw an exception.");
finishJSTest();
}
}
function gotStream1(s) {
......
2012-09-04 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Change the MediaStreamTrackList track added/removed signaling
https://bugs.webkit.org/show_bug.cgi?id=95721
Reviewed by Adam Barth.
Adding the signaling to the WebKit interface.
* chromium/public/WebMediaStreamCenter.h:
(WebKit::WebMediaStreamCenter::didAddMediaStreamTrack):
(WebKit::WebMediaStreamCenter::didRemoveMediaStreamTrack):
2012-09-03 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Add Ice-related functionality to RTCPeerConnection
......
......@@ -47,6 +47,8 @@ public:
virtual void queryMediaStreamSources(const WebMediaStreamSourcesRequest&) = 0;
virtual void didEnableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
virtual void didDisableMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) = 0;
virtual bool didAddMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) { return false; };
virtual bool didRemoveMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&) { return false; };
virtual void didStopLocalMediaStream(const WebMediaStreamDescriptor&) = 0;
virtual void didCreateMediaStream(WebMediaStreamDescriptor&) = 0;
virtual WebString constructSDP(const WebICECandidateDescriptor&) = 0;
......
2012-09-04 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Change the MediaStreamTrackList track added/removed signaling
https://bugs.webkit.org/show_bug.cgi?id=95721
Reviewed by Adam Barth.
This allows the platform implementor to throw an NOT_SUPPORTED_ERR exception if it doesn support these methods.
Patch covered by expanded existing test.
* Modules/mediastream/MediaStreamTrackList.cpp:
(WebCore::MediaStreamTrackList::add):
(WebCore::MediaStreamTrackList::remove):
* platform/mediastream/MediaStreamCenter.h:
(MediaStreamCenter):
* platform/mediastream/blackberry/MediaStreamCenterBlackBerry.cpp:
(WebCore::MediaStreamCenterBlackBerry::didAddMediaStreamTrack):
(WebCore):
(WebCore::MediaStreamCenterBlackBerry::didRemoveMediaStreamTrack):
* platform/mediastream/blackberry/MediaStreamCenterBlackBerry.h:
(MediaStreamCenterBlackBerry):
* platform/mediastream/chromium/MediaStreamCenterChromium.cpp:
(WebCore::MediaStreamCenterChromium::didAddMediaStreamTrack):
(WebCore::MediaStreamCenterChromium::didRemoveMediaStreamTrack):
* platform/mediastream/chromium/MediaStreamCenterChromium.h:
(MediaStreamCenterChromium):
* platform/mediastream/gstreamer/MediaStreamCenterGStreamer.cpp:
(WebCore::MediaStreamCenterGStreamer::didAddMediaStreamTrack):
(WebCore::MediaStreamCenterGStreamer::didRemoveMediaStreamTrack):
* platform/mediastream/gstreamer/MediaStreamCenterGStreamer.h:
(MediaStreamCenterGStreamer):
2012-09-04 Joanmarie Diggs <jdiggs@igalia.com>
[GTK] Crash in AccessibilityObject::accessibilityPlatformIncludesObject()
......@@ -88,7 +88,11 @@ void MediaStreamTrackList::add(PassRefPtr<MediaStreamTrack> prpTrack, ExceptionC
return;
m_trackVector.append(track);
MediaStreamCenter::instance().didAddMediaStreamTrack(m_owner->descriptor(), track->component());
if (!MediaStreamCenter::instance().didAddMediaStreamTrack(m_owner->descriptor(), track->component())) {
ec = NOT_SUPPORTED_ERR;
return;
}
dispatchEvent(MediaStreamTrackEvent::create(eventNames().addtrackEvent, false, false, track));
}
......@@ -110,7 +114,11 @@ void MediaStreamTrackList::remove(PassRefPtr<MediaStreamTrack> prpTrack, Excepti
return;
m_trackVector.remove(index);
MediaStreamCenter::instance().didRemoveMediaStreamTrack(m_owner->descriptor(), track->component());
if (!MediaStreamCenter::instance().didRemoveMediaStreamTrack(m_owner->descriptor(), track->component())) {
ec = NOT_SUPPORTED_ERR;
return;
}
dispatchEvent(MediaStreamTrackEvent::create(eventNames().removetrackEvent, false, false, track));
}
......
......@@ -57,8 +57,8 @@ public:
// Calls from the DOM objects to notify the platform
virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) = 0;
virtual void didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) = 0;
virtual void didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) = 0;
virtual bool didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) = 0;
virtual bool didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) = 0;
virtual void didStopLocalMediaStream(MediaStreamDescriptor*) = 0;
virtual void didCreateMediaStream(MediaStreamDescriptor*) = 0;
virtual String constructSDP(IceCandidateDescriptor*) = 0;
......
......@@ -68,6 +68,16 @@ void MediaStreamCenterBlackBerry::didSetMediaStreamTrackEnabled(MediaStreamDescr
{
}
bool MediaStreamCenterBlackBerry::didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
{
return false;
}
bool MediaStreamCenterBlackBerry::didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
{
return false;
}
void MediaStreamCenterBlackBerry::didStopLocalMediaStream(MediaStreamDescriptor*)
{
}
......
......@@ -55,6 +55,8 @@ public:
// MediaStreamCenter
virtual void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>) OVERRIDE;
virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual bool didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual bool didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
virtual void didCreateMediaStream(MediaStreamDescriptor*) OVERRIDE;
virtual String constructSDP(IceCandidateDescriptor*) OVERRIDE;
......
......@@ -86,12 +86,14 @@ void MediaStreamCenterChromium::didSetMediaStreamTrackEnabled(MediaStreamDescrip
}
}
void MediaStreamCenterChromium::didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
bool MediaStreamCenterChromium::didAddMediaStreamTrack(MediaStreamDescriptor* stream, MediaStreamComponent* component)
{
return m_private ? m_private->didAddMediaStreamTrack(stream, component) : false;
}
void MediaStreamCenterChromium::didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
bool MediaStreamCenterChromium::didRemoveMediaStreamTrack(MediaStreamDescriptor* stream, MediaStreamComponent* component)
{
return m_private ? m_private->didRemoveMediaStreamTrack(stream, component) : false;
}
void MediaStreamCenterChromium::didStopLocalMediaStream(MediaStreamDescriptor* stream)
......
......@@ -62,8 +62,8 @@ public:
// MediaStreamCenter
virtual void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>) OVERRIDE;
virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual void didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual void didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual bool didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual bool didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
virtual void didCreateMediaStream(MediaStreamDescriptor*) OVERRIDE;
virtual String constructSDP(IceCandidateDescriptor*) OVERRIDE;
......
......@@ -68,12 +68,14 @@ void MediaStreamCenterGStreamer::didSetMediaStreamTrackEnabled(MediaStreamDescri
{
}
void MediaStreamCenterGStreamer::didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
bool MediaStreamCenterGStreamer::didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
{
return false;
}
void MediaStreamCenterGStreamer::didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
bool MediaStreamCenterGStreamer::didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*)
{
return false;
}
void MediaStreamCenterGStreamer::didStopLocalMediaStream(MediaStreamDescriptor*)
......
......@@ -55,8 +55,8 @@ public:
// MediaStreamCenter
virtual void queryMediaStreamSources(PassRefPtr<MediaStreamSourcesQueryClient>) OVERRIDE;
virtual void didSetMediaStreamTrackEnabled(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual void didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual void didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual bool didAddMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual bool didRemoveMediaStreamTrack(MediaStreamDescriptor*, MediaStreamComponent*) OVERRIDE;
virtual void didStopLocalMediaStream(MediaStreamDescriptor*) OVERRIDE;
virtual void didCreateMediaStream(MediaStreamDescriptor*) OVERRIDE;
virtual String constructSDP(IceCandidateDescriptor*) OVERRIDE;
......
2012-09-04 Tommy Widenflycht <tommyw@google.com>
MediaStream API: Change the MediaStreamTrackList track added/removed signaling
https://bugs.webkit.org/show_bug.cgi?id=95721
Reviewed by Adam Barth.
* DumpRenderTree/chromium/MockWebMediaStreamCenter.cpp:
(MockWebMediaStreamCenter::didAddMediaStreamTrack):
(MockWebMediaStreamCenter::didRemoveMediaStreamTrack):
* DumpRenderTree/chromium/MockWebMediaStreamCenter.h:
(MockWebMediaStreamCenter):
2012-09-04 Tony Chang <tony@chromium.org>
Elide test names when running new-run-webkit-tests
......
......@@ -64,6 +64,16 @@ void MockWebMediaStreamCenter::didDisableMediaStreamTrack(const WebMediaStreamDe
component.source().setReadyState(WebMediaStreamSource::ReadyStateMuted);
}
bool MockWebMediaStreamCenter::didAddMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&)
{
return true;
};
bool MockWebMediaStreamCenter::didRemoveMediaStreamTrack(const WebMediaStreamDescriptor&, const WebMediaStreamComponent&)
{
return true;
};
void MockWebMediaStreamCenter::didStopLocalMediaStream(const WebMediaStreamDescriptor& stream)
{
WebVector<WebMediaStreamComponent> audioComponents;
......
......@@ -45,6 +45,8 @@ public:
virtual void queryMediaStreamSources(const WebKit::WebMediaStreamSourcesRequest&) OVERRIDE;
virtual void didEnableMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE;
virtual void didDisableMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE;
virtual bool didAddMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE;
virtual bool didRemoveMediaStreamTrack(const WebKit::WebMediaStreamDescriptor&, const WebKit::WebMediaStreamComponent&) OVERRIDE;
virtual void didStopLocalMediaStream(const WebKit::WebMediaStreamDescriptor&) OVERRIDE;
virtual void didCreateMediaStream(WebKit::WebMediaStreamDescriptor&) OVERRIDE;
virtual WebKit::WebString constructSDP(const WebKit::WebICECandidateDescriptor&) OVERRIDE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment