WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
158940
WebRTC: Add support for RTCPeerConnection legacy MediaStream-based API
https://bugs.webkit.org/show_bug.cgi?id=158940
Summary
WebRTC: Add support for RTCPeerConnection legacy MediaStream-based API
Adam Bergkvist
Reported
2016-06-20 06:42:47 PDT
The MediaStream-based API on RTCPeerConnection (addStream, removeStream, getLocalStreams, getRemoteStreams, getStreamById) has been removed from the WebRTC 1.0 specification, but is widely implemented and used. We should be able to support it with JS built-ins and some hooks down in native code.
Attachments
Proposed patch
(24.22 KB, patch)
2016-06-20 12:02 PDT
,
Adam Bergkvist
no flags
Details
Formatted Diff
Diff
Updated patch
(24.79 KB, patch)
2016-06-22 23:28 PDT
,
Adam Bergkvist
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Adam Bergkvist
Comment 1
2016-06-20 12:02:14 PDT
Created
attachment 281658
[details]
Proposed patch
Adam Bergkvist
Comment 2
2016-06-20 12:04:02 PDT
(In reply to
comment #1
)
> Created
attachment 281658
[details]
> Proposed patch
This won't build until the JS constructor is in place (
http://webkit.org/b/158832
).
youenn fablet
Comment 3
2016-06-20 14:56:22 PDT
Comment on
attachment 281658
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=281658&action=review
> Source/WebCore/Modules/mediastream/RTCPeerConnection.js:57 > + return
this.@localStreams.slice
();
Array.slice may be corrupted by user scripts. The same applies to find findIndex, push, forEach, splice methods. This should be robustified.
> Source/WebCore/Modules/mediastream/RTCPeerConnection.js:94 > + stream.getTracks().forEach(track => this.@addTrack(track, stream));
Potentially, we know that this, track and stream are of the right type. So we could replace if statements by assert statements in the binding generated code. That said, this might be too early to do so.
> Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:87 > + JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().MediaStreamPrivateName(), JSMediaStream::getConstructor(vm, this), DontDelete | ReadOnly),
It might be good to add a keyword similar to PrivateAlso for exposing DOM constructors safely to JS builtins. Ideally, we should not need to create the constructor but just pass a getter function that would create it if needed
Adam Bergkvist
Comment 4
2016-06-21 00:37:51 PDT
(In reply to
comment #3
)
> Comment on
attachment 281658
[details]
> Proposed patch
Thanks for reviewing Youenn.
> View in context: >
https://bugs.webkit.org/attachment.cgi?id=281658&action=review
> > > Source/WebCore/Modules/mediastream/RTCPeerConnection.js:57 > > + return
this.@localStreams.slice
(); > > Array.slice may be corrupted by user scripts. > The same applies to find findIndex, push, forEach, splice methods. > This should be robustified.
Looking at the array prototype implementation, we seem to have a private name for push, but the rest needs fixing. New bug: [1]. [1]
http://webkit.org/b/158978
> > Source/WebCore/Modules/mediastream/RTCPeerConnection.js:94 > > + stream.getTracks().forEach(track => this.@addTrack(track, stream)); > > Potentially, we know that this, track and stream are of the right type. > So we could replace if statements by assert statements in the binding > generated code. > That said, this might be too early to do so.
MediaStream.getTracks is actually part of the public API so we need a safe way to call it. New bug [2]. [2]
webkit.org/b/158979
I agree that assertions would be sufficient for [PrivateOnly] bindings. The bug [3] suggests that one might want to use the type checking of a [PrivateOnly] function as part of a public API call, but that might be unlikely now when we have [PrivateAlso]. I wouldn't mind closing [3] as a WONTFIX. [3]
webkit.org/b/158778
> > > Source/WebCore/bindings/js/JSDOMGlobalObject.cpp:87 > > + JSDOMGlobalObject::GlobalPropertyInfo(clientData.builtinNames().MediaStreamPrivateName(), JSMediaStream::getConstructor(vm, this), DontDelete | ReadOnly), > > It might be good to add a keyword similar to PrivateAlso for exposing DOM > constructors safely to JS builtins. > Ideally, we should not need to create the constructor but just pass a getter > function that would create it if needed
That would be useful indeed.
Adam Bergkvist
Comment 5
2016-06-21 00:39:18 PDT
Clickable links for the previous post [2]
http://webkit.org/b/158979
[3]
http://webkit.org/b/158778
Adam Bergkvist
Comment 6
2016-06-21 23:17:36 PDT
***
Bug 158979
has been marked as a duplicate of this bug. ***
Adam Bergkvist
Comment 7
2016-06-22 23:28:46 PDT
Created
attachment 281899
[details]
Updated patch
Adam Bergkvist
Comment 8
2016-06-22 23:30:09 PDT
(In reply to
comment #4
)
> MediaStream.getTracks is actually part of the public API so we need a safe > way to call it. New bug [2]. > > [2]
webkit.org/b/158979
This is included in the updated patch (closed bug:158979).
Adam Bergkvist
Comment 9
2016-06-23 06:30:11 PDT
Comment on
attachment 281899
[details]
Updated patch Thank you Eric and Youenn for reviewing
WebKit Commit Bot
Comment 10
2016-06-23 06:52:26 PDT
Comment on
attachment 281899
[details]
Updated patch Clearing flags on attachment: 281899 Committed
r202376
: <
http://trac.webkit.org/changeset/202376
>
WebKit Commit Bot
Comment 11
2016-06-23 06:52:29 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug