How to build audio only webrtc library

1,002 views
Skip to first unread message

pt...@twilio.com

unread,
Aug 13, 2018, 5:00:03 PM8/13/18
to discuss-webrtc
Hello all,

Our used case is building an SDK for bi-directional audio calls on top of WebRTC. We are building WebRTC 67 for iOS, android, linux and macOS platforms.

By default, the `BUILD.gn` build script adds Video and DataChannels into the built `libwebrtc.a`. We do not need Video or DataChannels to be added in `libwebrtc.a` as increases the size of the built library. 

Is there a way to build audio only `libwebrtc.a`? If not, any workaround or suggestion will be appreciated to solve this problem.

Thanks,
Piyush

Jonathan A.

unread,
Aug 14, 2018, 10:11:35 AM8/14/18
to discuss-webrtc
Just build the targets you want when you invoke the makefile. You'll have to figure out which ones iteratively, but the comman 'ninja -t targets all' will list all the targets.

Jonathan A.

unread,
Aug 21, 2018, 9:09:09 AM8/21/18
to discuss-webrtc
Okay, I've been trying to take my own advice with this and it hasn't been going well. I really don't want to be checking in a 180mb webrtc library for each platform into our source code control, when all we are using are the audio libraries.

I have tried lots of things. While using ninja to just build the libraries of interest, and just using those instead of the monolithic webrtc static library, sounds like it should work, in practice it fails miserably. I run into many undefined symbols. I think this is because all the necessary object files are not included in this "sub" libraries, but rather pulled in when the main webrtc library is created. 

I spent a lot of time yesterday trying to tweak the webrtc build.gn file to just get the things I want, but it pulls in things from all over the place and I was never able to thin it out at all that way. I also tried working with the build.ninja file, but that too never seemed to have any effect.

Any other ideas for creating a streamlined webrtc.lib file?

On Monday, August 13, 2018 at 5:00:03 PM UTC-4, pt...@twilio.com wrote:

Patrik Höglund

unread,
Aug 22, 2018, 6:54:23 AM8/22/18
to discuss-webrtc
Building an audio-only WebRTC will be difficult. There is a target that strips out audio and video for Android, but that's all. That target uses some fairly complex machinery to cut out audio and video code (the null_video_jni target for example). That target is quite prone to breaking when build files are refactored though.

We're slowly inching our way towards making WebRTC more modular so that (in theory) you would be able to build any permutation of audio, video and data channels according to your needs. There's at least an effort well underway to make codecs optional, which means you don't have to pay binary size for codecs you don't use.

Also, 180 MB sounds like you're building with symbols. A release WebRTC should be about 4 MB on Android ARM. Try

$ gn gen out/Release "--args=is_debug=false target_os=\"android\" target_cpu=\"arm\""
$ ninja -C out/Release libjingle_peerconnection_so
$ ll out/Release/libjingle_peerconnection.so
... 4.0MB ...

It's 7.3MB for 64-bit arm, and I think desktop sizes should be in that ballpark as well.

/ P

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/596ad9cf-2020-4e88-9f55-52f116f3f14d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

JD Arnold

unread,
Aug 22, 2018, 11:27:15 AM8/22/18
to discuss-webrtc
Thanks for the answer. I am building on Windows using this gn line:

gn gen out/release --args="is_debug=false target_winuwp_version=\"8.1\" target_cpu=\"x86\" target_winuwp_family=\"desktop\" use_rtti=true is_clang=false rtc_build_ssl=false rtc_ssl_root=\"d:/iocommain/External/openssl/insors/include\""
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

JD Arnold

unread,
Aug 22, 2018, 11:56:24 AM8/22/18
to discuss-webrtc
Oh, and on MacOSX, the size of libwebrtc.a is a whopping 307mb! Yeesh.


On Monday, August 13, 2018 at 5:00:03 PM UTC-4, pt...@twilio.com wrote:
Reply all
Reply to author
Forward
0 new messages