RESOLVED FIXED 167289
[WebRTC] Implement WebRTC PeerConnection backend based on libwebrtc
https://bugs.webkit.org/show_bug.cgi?id=167289
Summary [WebRTC] Implement WebRTC PeerConnection backend based on libwebrtc
youenn fablet
Reported 2017-01-21 23:19:07 PST
Let's implement WebRTC PeerConnection backend based on libwebrtc, behind the flag until we are ready to pass some tests.
Attachments
Patch (136.04 KB, patch)
2017-01-21 23:56 PST, youenn fablet
no flags
Patch (137.34 KB, patch)
2017-01-22 00:16 PST, youenn fablet
no flags
Patch (136.24 KB, patch)
2017-01-22 10:01 PST, youenn fablet
no flags
Patch (52.60 KB, patch)
2017-01-26 14:57 PST, youenn fablet
no flags
Patch (50.98 KB, patch)
2017-01-26 17:58 PST, youenn fablet
no flags
Patch for landing (51.02 KB, patch)
2017-01-26 21:34 PST, youenn fablet
no flags
youenn fablet
Comment 1 2017-01-21 23:56:03 PST
WebKit Commit Bot
Comment 2 2017-01-21 23:57:07 PST
Attachment 299459 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h:55: is_screencast is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h:56: needs_denoising is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp:58: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:117: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:144: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:104: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:117: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:130: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 8 in 26 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 3 2017-01-22 00:00:38 PST
This patch is not functional as is as it is missing WK1/WK2 pieces.
youenn fablet
Comment 4 2017-01-22 00:16:53 PST
WebKit Commit Bot
Comment 5 2017-01-22 00:18:19 PST
Attachment 299464 [details] did not pass style-queue: ERROR: Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h:55: is_screencast is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/mediastream/mac/RealtimeOutgoingVideoSource.h:56: needs_denoising is incorrectly named. Don't use underscores in your identifier names. [readability/naming/underscores] [4] ERROR: Source/WebCore/platform/mediastream/libwebrtc/LibWebRTCUtils.cpp:59: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:117: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:144: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:104: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:117: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:130: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 8 in 28 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 6 2017-01-22 10:01:15 PST
youenn fablet
Comment 7 2017-01-26 14:57:03 PST
WebKit Commit Bot
Comment 8 2017-01-26 15:01:15 PST
Attachment 299859 [details] did not pass style-queue: ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:107: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:121: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:135: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 3 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 9 2017-01-26 15:08:45 PST
Comment on attachment 299859 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299859&action=review > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:284 > + RefPtr<LibWebRTCMediaEndpoint> protectedThis(this); > + callOnMainThread([protectedThis = WTFMove(protectedThis), stream = WTFMove(stream)] { Here's the cool C++14/WTF way of doing things like this. protectedThis = makeRef(*this) > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:107 > + explicit CreateSessionDescriptionObserver(LibWebRTCMediaEndpoint &endpoint) : m_endpoint(endpoint) { } needs to be on more than one line according to stylebot.
Alex Christensen
Comment 10 2017-01-26 16:07:15 PST
Comment on attachment 299859 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299859&action=review > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:13 > + * 3. Neither the name of Apple Inc. nor the names of I think we use a 2-clause copyright header by default for new files now. See Source/WebCore/LICENSE-APPLE > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:64 > + m_backend = client.createPeerConnection(*this); This can be in the initializers. > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:316 > + // ASSERT_NOT_REACHED(); Commented out? Maybe this and the previous one should be notImplemented(); > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:336 > + default: Could we not do a default?
youenn fablet
Comment 11 2017-01-26 16:27:12 PST
Comment on attachment 299859 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299859&action=review >> Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:13 >> + * 3. Neither the name of Apple Inc. nor the names of > > I think we use a 2-clause copyright header by default for new files now. See Source/WebCore/LICENSE-APPLE I'll check that >> Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:64 >> + m_backend = client.createPeerConnection(*this); > > This can be in the initializers. ok >> Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:316 >> + // ASSERT_NOT_REACHED(); > > Commented out? Maybe this and the previous one should be notImplemented(); Sure >> Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp:336 >> + default: > > Could we not do a default? There is a kMax value that we could use instead of default. >> Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:107 >> + explicit CreateSessionDescriptionObserver(LibWebRTCMediaEndpoint &endpoint) : m_endpoint(endpoint) { } > > needs to be on more than one line according to stylebot. I prefer this style when there is only one initialiser.
youenn fablet
Comment 12 2017-01-26 17:58:55 PST
WebKit Commit Bot
Comment 13 2017-01-26 18:01:32 PST
Attachment 299890 [details] did not pass style-queue: ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:103: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:117: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] ERROR: Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:131: Should be indented on a separate line, with the colon or comma first on that line. [whitespace/indent] [4] Total errors found: 3 in 6 files If any of these errors are false positives, please file a bug against check-webkit-style.
youenn fablet
Comment 14 2017-01-26 18:02:06 PST
(In reply to comment #13) > Attachment 299890 [details] did not pass style-queue: > > > ERROR: > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:103: > Should be indented on a separate line, with the colon or comma first on that > line. [whitespace/indent] [4] > ERROR: > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:117: > Should be indented on a separate line, with the colon or comma first on that > line. [whitespace/indent] [4] > ERROR: > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:131: > Should be indented on a separate line, with the colon or comma first on that > line. [whitespace/indent] [4] > Total errors found: 3 in 6 files > > > If any of these errors are false positives, please file a bug against > check-webkit-style. Fixing style and license comments
Alex Christensen
Comment 15 2017-01-26 19:38:29 PST
Comment on attachment 299890 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299890&action=review > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:56 > +class LibWebRTCMediaEndpoint final : public RefCounted<LibWebRTCMediaEndpoint>, private webrtc::PeerConnectionObserver { This should probably be ThreadSafeRefCounted<LibWebRTCMediaEndpoint> since we are ref'ing and deref'ing on different threads. It hurts performance a bit if we ref and deref a lot because it has to clear the instruction pipeline, but it is necessary if we are ref'ing and deref'ing from different threads. > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:47 > +static std::unique_ptr<PeerConnectionBackend> createLibWebRTCPeerConnectionBackend(RTCPeerConnection& peerConnection) > +{ > + return std::unique_ptr<PeerConnectionBackend>(new LibWebRTCPeerConnectionBackend(peerConnection)); > +} This whole function shouldn't be necessary. Just make the constructor public and call std::make_unique > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:53 > + ASSERT(peerConnection.scriptExecutionContext()->isDocument()); It would be nice if we could make every scriptExecutionContext have a LibWebRTCProvider. We would need to make LibWebRTCProvider ThreadSafeRefCounted and pass Ref's around. I might do it later. This is fine for now, though.
youenn fablet
Comment 16 2017-01-26 21:22:35 PST
(In reply to comment #15) > Comment on attachment 299890 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299890&action=review > > > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.h:56 > > +class LibWebRTCMediaEndpoint final : public RefCounted<LibWebRTCMediaEndpoint>, private webrtc::PeerConnectionObserver { > > This should probably be ThreadSafeRefCounted<LibWebRTCMediaEndpoint> since > we are ref'ing and deref'ing on different threads. It hurts performance a > bit if we ref and deref a lot because it has to clear the instruction > pipeline, but it is necessary if we are ref'ing and deref'ing from different > threads. Good point, it is probably the simplest solution. > > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:47 > > +static std::unique_ptr<PeerConnectionBackend> createLibWebRTCPeerConnectionBackend(RTCPeerConnection& peerConnection) > > +{ > > + return std::unique_ptr<PeerConnectionBackend>(new LibWebRTCPeerConnectionBackend(peerConnection)); > > +} > > This whole function shouldn't be necessary. Just make the constructor > public and call std::make_unique Will use make_unique. > > Source/WebCore/Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp:53 > > + ASSERT(peerConnection.scriptExecutionContext()->isDocument()); > > It would be nice if we could make every scriptExecutionContext have a > LibWebRTCProvider. We would need to make LibWebRTCProvider > ThreadSafeRefCounted and pass Ref's around. I might do it later. This is > fine for now, though. There is no planned support for WebRTC in workers so is it really worth it. Having a RefCounted LibWebRTCProvider would be useful for the mock implementation too though.
youenn fablet
Comment 17 2017-01-26 21:34:38 PST
Created attachment 299910 [details] Patch for landing
WebKit Commit Bot
Comment 18 2017-01-26 22:11:01 PST
Comment on attachment 299910 [details] Patch for landing Clearing flags on attachment: 299910 Committed r211255: <http://trac.webkit.org/changeset/211255>
WebKit Commit Bot
Comment 19 2017-01-26 22:11:06 PST
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.