Bug 178860 - [GTK] Make libwebrtc backend buildable for GTK port
Summary: [GTK] Make libwebrtc backend buildable for GTK port
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebRTC (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alejandro G. Castro
URL:
Keywords: InRadar
Depends on: 178855 183080
Blocks:
  Show dependency treegraph
 
Reported: 2017-10-26 05:26 PDT by Alejandro G. Castro
Modified: 2018-04-02 04:30 PDT (History)
7 users (show)

See Also:


Attachments
Patch (2.04 MB, patch)
2017-10-26 06:14 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (2.04 MB, patch)
2018-03-05 04:00 PST, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (2.04 MB, patch)
2018-03-07 08:32 PST, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (1.66 MB, patch)
2018-03-21 08:10 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (814.26 KB, patch)
2018-03-22 01:52 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (814.26 KB, patch)
2018-03-22 02:14 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (814.26 KB, patch)
2018-03-22 02:23 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (813.84 KB, patch)
2018-03-22 05:14 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (813.84 KB, patch)
2018-03-22 07:51 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch (831.21 KB, patch)
2018-03-23 09:20 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff
Patch for landing (831.13 KB, patch)
2018-04-02 03:51 PDT, Alejandro G. Castro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alejandro G. Castro 2017-10-26 05:26:17 PDT
Add the cmake compilation file, required dependencies and options to make it build for the GTK port.
Comment 1 Alejandro G. Castro 2017-10-26 06:14:43 PDT
Created attachment 325000 [details]
Patch
Comment 2 Alejandro G. Castro 2018-03-05 04:00:19 PST
Created attachment 334994 [details]
Patch
Comment 3 Alejandro G. Castro 2018-03-07 08:32:22 PST
Created attachment 335194 [details]
Patch
Comment 4 Michael Catanzaro 2018-03-07 09:56:21 PST
Comment on attachment 335194 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=335194&action=review

> Source/cmake/OptionsGTK.cmake:90
> +WEBKIT_OPTION_DEFINE(USE_LIBWEBRTC "Whether to use libwebrtc for WebRTC support" PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})

I don't think you need a new option, since you set USE_LIBWEBRTC unconditionally below if ENABLE_MEDIA_STREAM or ENABLE_WEB_RTC is enabled. A new build option should only be needed if you were going to allow using ENABLE_MEDIA_STREAM or ENABLE_WEB_RTC with USE_LIBWEBRTC disabled.

> Source/cmake/OptionsGTK.cmake:226
> +    set(USE_LIBWEBRTC TRUE)
> +    SET_AND_EXPOSE_TO_BUILD(USE_LIBWEBRTC TRUE)

I don't think you need both
Comment 5 Alejandro G. Castro 2018-03-08 03:09:45 PST
(In reply to Michael Catanzaro from comment #4)
> Comment on attachment 335194 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=335194&action=review
> 
> > Source/cmake/OptionsGTK.cmake:90
> > +WEBKIT_OPTION_DEFINE(USE_LIBWEBRTC "Whether to use libwebrtc for WebRTC support" PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES})
> 
> I don't think you need a new option, since you set USE_LIBWEBRTC
> unconditionally below if ENABLE_MEDIA_STREAM or ENABLE_WEB_RTC is enabled. A
> new build option should only be needed if you were going to allow using
> ENABLE_MEDIA_STREAM or ENABLE_WEB_RTC with USE_LIBWEBRTC disabled.
> 

We do this for the moment but we could try to use a gstreamer webrtc backend at some point in the future and I guess in that case it makes sense people forcing this backend can keep this option?

> > Source/cmake/OptionsGTK.cmake:226
> > +    set(USE_LIBWEBRTC TRUE)
> > +    SET_AND_EXPOSE_TO_BUILD(USE_LIBWEBRTC TRUE)
> 
> I don't think you need both

Right.

Thanks for the review!
Comment 6 Alejandro G. Castro 2018-03-12 05:16:11 PDT
Comment on attachment 335194 [details]
Patch

After r229378 we need to update the patch.
Comment 7 Alejandro G. Castro 2018-03-21 08:10:51 PDT
Created attachment 336194 [details]
Patch
Comment 8 Alex Christensen 2018-03-21 10:06:37 PDT
Why are we checking in a bunch of generated assembly instead of making the assembly generation part of the build process?  You also only include x86_64 assembly.  What about other architectures?
Comment 9 Michael Catanzaro 2018-03-21 11:35:31 PDT
There's a configure option to use system OpenSSL instead of BoringSSL... does that not work? Seems like that would be *slightly* less bad.
Comment 10 Michael Catanzaro 2018-03-21 11:50:33 PDT
BTW, I'm talking to GStreamer developers about using GDtlsConnection in GStreamer's WebRTC code, which we'd gain automatically once we dump libwebrtc. Currently it relies on OpenSSL via a wrapper lib. GDtlsConnection is an abstraction that will allow us to switch between different TLS libraries to avoid licensing issues; the default would be GnuTLS, because OpenSSL is unacceptable on desktop Linux, and it can be switched to OpenSSL for embedded systems where GnuTLS is unacceptable. This way, we can delete libwebrtc rather than rewriting its network code to drop the BoringSSL/OpenSSL dependency.
Comment 11 Michael Catanzaro 2018-03-21 12:12:34 PDT
(In reply to Michael Catanzaro from comment #10)
> BTW, I'm talking to GStreamer developers about using GDtlsConnection in
> GStreamer's WebRTC code, which we'd gain automatically once we dump
> libwebrtc.

To be clear: that's a planned near-term enhancement to GStreamer. Currently it relies on OpenSSL via a wrapper lib.
Comment 12 youenn fablet 2018-03-21 20:05:48 PDT
(In reply to Michael Catanzaro from comment #9)
> There's a configure option to use system OpenSSL instead of BoringSSL...
> does that not work? Seems like that would be *slightly* less bad.

It is supposed to work but I heard that this option is not widely used so probably not very well tested.
Comment 13 Alejandro G. Castro 2018-03-22 00:10:24 PDT
(In reply to Alex Christensen from comment #8)
> Why are we checking in a bunch of generated assembly instead of making the
> assembly generation part of the build process?  You also only include x86_64
> assembly.  What about other architectures?

Thanks for the review!

Basically I was assuming you did it this way when you pushed libwebrtc the first time because we are not running a complete compilation process of libwebrtc and all its third parties, it is smaller and simpler compilation, that is one of my goals, it really makes live easier for us when updating the code. In this patch I updated the ones I needed in my current setup and decided to start supporting that architecture in our case to add new ones in the future, this is just the first commit.

But now that you say it I think it could be simpler if we can avoid this setup, so I'll try the option OPENSSL_NO_ASM. And we will add support for the generation if required.

Maybe we should remove all the .S files if you are not using it.
Comment 14 Alejandro G. Castro 2018-03-22 01:52:32 PDT
Created attachment 336265 [details]
Patch
Comment 15 Alejandro G. Castro 2018-03-22 02:14:50 PDT
Created attachment 336267 [details]
Patch
Comment 16 Alejandro G. Castro 2018-03-22 02:23:50 PDT
Created attachment 336268 [details]
Patch
Comment 17 Alejandro G. Castro 2018-03-22 05:14:17 PDT
Created attachment 336273 [details]
Patch
Comment 18 Alejandro G. Castro 2018-03-22 07:51:18 PDT
Created attachment 336282 [details]
Patch
Comment 19 youenn fablet 2018-03-22 10:18:44 PDT
Comment on attachment 336282 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=336282&action=review

> Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp:41
> +Ref<RealtimeIncomingAudioSource> RealtimeIncomingAudioSource::create(rtc::scoped_refptr<webrtc::AudioTrackInterface>&& audioTrack, String&& audioTrackId)

Can we create new files such as RealtimeIncomingAudioSourceGlib.cpp that would contain that implementation and later on other needed stuff, similarly to RealtimeIncomingVideoSourceCocoa.cpp?
You will need to specialize OnFrame anyway at some point.

Ditto for other classes.
Comment 20 Alejandro G. Castro 2018-03-23 00:07:08 PDT
(In reply to youenn fablet from comment #19)
> Comment on attachment 336282 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=336282&action=review
> 
> > Source/WebCore/platform/mediastream/RealtimeIncomingAudioSource.cpp:41
> > +Ref<RealtimeIncomingAudioSource> RealtimeIncomingAudioSource::create(rtc::scoped_refptr<webrtc::AudioTrackInterface>&& audioTrack, String&& audioTrackId)
> 
> Can we create new files such as RealtimeIncomingAudioSourceGlib.cpp that
> would contain that implementation and later on other needed stuff, similarly
> to RealtimeIncomingVideoSourceCocoa.cpp?
> You will need to specialize OnFrame anyway at some point.
> 
> Ditto for other classes.

Right, we have those in follow up commits, I can add a smaller version in this commit already.

Thanks for the review!
Comment 21 Alejandro G. Castro 2018-03-23 09:20:57 PDT
Created attachment 336378 [details]
Patch
Comment 22 youenn fablet 2018-03-23 09:24:13 PDT
Comment on attachment 336378 [details]
Patch

r=me as long as the bots are happy
Comment 23 Michael Catanzaro 2018-03-23 09:47:51 PDT
FWIW, I imagine getting rid of the asm will significantly affect performance on small embedded devices. I doubt it would be noticeable on desktops.
Comment 24 youenn fablet 2018-03-23 09:57:01 PDT
(In reply to Michael Catanzaro from comment #23)
> FWIW, I imagine getting rid of the asm will significantly affect performance
> on small embedded devices. I doubt it would be noticeable on desktops.

Sure, at the same time, when you are doing WebRTC, you are doing so many other things that I am not sure how big the impact will actually be.
Comment 25 Alejandro G. Castro 2018-04-02 03:46:41 PDT
Bots complain when compiling the libvpx dependency, apparently google changes the generated archive files every time you download, so I'll replace that to use the tag in the git repository and try to land.

Just pinged the gtk+ and wpe bot admins anyway, because it adds a couple of dependencies and they can cause issues.

Thanks everyone for the reviews!
Comment 26 Alejandro G. Castro 2018-04-02 03:49:48 PDT
(In reply to Michael Catanzaro from comment #23)
> FWIW, I imagine getting rid of the asm will significantly affect performance
> on small embedded devices. I doubt it would be noticeable on desktops.

Yep, you are right. Anyway we are currently not using the asm in the raspberrry pi and we are doing quite well, we will keep this in mind when checking performance on that device for the next steps.

Thanks for the comment!
Comment 27 Alejandro G. Castro 2018-04-02 03:51:20 PDT
Created attachment 336976 [details]
Patch for landing
Comment 28 WebKit Commit Bot 2018-04-02 04:29:10 PDT
Comment on attachment 336976 [details]
Patch for landing

Clearing flags on attachment: 336976

Committed r230152: <https://trac.webkit.org/changeset/230152>
Comment 29 WebKit Commit Bot 2018-04-02 04:29:12 PDT
All reviewed patches have been landed.  Closing bug.
Comment 30 Radar WebKit Bug Importer 2018-04-02 04:30:38 PDT
<rdar://problem/39102256>