Open keroserene opened 8 years ago
This would drastically reduce the size of the archive.
Probably a hard requirement for distributing with Tor Browser.
Have you also tried building against libjingle_peerconnection_so.so
? This would more likely to be in the future to be standardised as an actual system shared library. (But this doesn't include the test/fake*.h
headers that you're including.)
Have you also tried building against libjingle_peerconnection_so.so?
Yes - though at least when I tried in October, this resulted in a bunch of undefined references (The current working libwebrtc_magic.a
is about 28M, while the libjingle_peerconnection_so.so
is only 9.5M) but that's probably because I didn't concat correctly. Have you had success with it?
Looking at peerconnection_client.ninja
and libjingle_peerconnection_so.ninja
though, it appears they have essentially the same dependencies:
obj/webrtc/system_wrappers/libfield_trial_default.a $
obj/talk/libjingle_peerconnection.a obj/webrtc/base/librtc_base.a $
obj/webrtc/libwebrtc_common.a obj/webrtc/base/librtc_base_approved.a $
obj/chromium/src/third_party/jsoncpp/libjsoncpp.a $
obj/chromium/src/third_party/boringssl/libboringssl.a $
obj/talk/libjingle_media.a obj/webrtc/modules/libvideo_render_module.a $
obj/webrtc/modules/libwebrtc_utility.a $
obj/webrtc/modules/libaudio_coding_module.a obj/webrtc/modules/libcng.a $
obj/webrtc/common_audio/libcommon_audio.a $
obj/webrtc/system_wrappers/libsystem_wrappers.a $
obj/chromium/src/third_party/openmax_dl/dl/libopenmax_dl.a $
obj/webrtc/common_audio/libcommon_audio_sse2.a $
obj/webrtc/modules/libaudio_encoder_interface.a $
obj/webrtc/modules/libg711.a obj/webrtc/modules/libpcm16b.a $
obj/webrtc/modules/libwebrtc_opus.a $
obj/chromium/src/third_party/opus/libopus.a $
obj/webrtc/modules/libg722.a obj/webrtc/modules/libisac.a $
obj/webrtc/modules/libaudio_decoder_interface.a $
obj/webrtc/modules/libisac_common.a obj/webrtc/modules/libilbc.a $
obj/webrtc/modules/libred.a obj/webrtc/librtc_event_log.a $
obj/webrtc/librtc_event_log_proto.a $
obj/chromium/src/third_party/protobuf/libprotobuf_lite.a $
obj/webrtc/modules/libneteq.a obj/webrtc/modules/librent_a_codec.a $
obj/webrtc/modules/libmedia_file.a $
obj/webrtc/common_video/libcommon_video.a libyuv.a $
obj/chromium/src/third_party/libjpeg_turbo/libjpeg_turbo.a $
obj/webrtc/libwebrtc.a obj/webrtc/voice_engine/libvoice_engine.a $
obj/webrtc/modules/libaudio_conference_mixer.a $
obj/webrtc/modules/libaudio_processing.a $
obj/webrtc/modules/libaudioproc_debug_proto.a $
obj/webrtc/modules/libaudio_processing_sse2.a $
obj/webrtc/modules/libaudio_device.a $
obj/webrtc/modules/libbitrate_controller.a $
obj/webrtc/modules/libpaced_sender.a obj/webrtc/modules/librtp_rtcp.a $
obj/webrtc/modules/libremote_bitrate_estimator.a $
obj/webrtc/modules/libvideo_capture_module.a $
obj/webrtc/modules/libvideo_processing.a $
obj/webrtc/modules/libvideo_processing_sse2.a $
obj/webrtc/modules/libwebrtc_video_coding.a $
obj/webrtc/modules/libwebrtc_h264.a obj/webrtc/modules/libwebrtc_i420.a $
obj/webrtc/modules/video_coding/utility/libvideo_coding_utility.a $
obj/webrtc/modules/video_coding/codecs/vp8/libwebrtc_vp8.a $
obj/chromium/src/third_party/libvpx_new/libvpx_new.a $
obj/chromium/src/third_party/libvpx_new/libvpx_intrinsics_mmx.a $
obj/chromium/src/third_party/libvpx_new/libvpx_intrinsics_sse2.a $
obj/chromium/src/third_party/libvpx_new/libvpx_intrinsics_ssse3.a $
obj/chromium/src/third_party/libvpx_new/libvpx_intrinsics_sse4_1.a $
obj/chromium/src/third_party/libvpx_new/libvpx_intrinsics_avx.a $
obj/chromium/src/third_party/libvpx_new/libvpx_intrinsics_avx2.a $
obj/webrtc/modules/video_coding/codecs/vp9/libwebrtc_vp9.a $
obj/webrtc/sound/librtc_sound.a $
obj/webrtc/system_wrappers/libmetrics_default.a $
obj/webrtc/libjingle/xmllite/librtc_xmllite.a $
obj/webrtc/libjingle/xmpp/librtc_xmpp.a obj/webrtc/p2p/librtc_p2p.a $
obj/chromium/src/third_party/usrsctp/libusrsctplib.a $
obj/webrtc/modules/libvideo_capture_module_internal_impl.a $
obj/webrtc/modules/libvideo_render_module_internal_impl.a $
obj/talk/libjingle_p2p.a obj/chromium/src/third_party/libsrtp/libsrtp.a $
The current FakeContraint*
requirements will probably disappear in the near future, so that should be okay. However, the process of eliminating all the audio/video codecs, voice_engine, etc. could be very involved.
Alright I just managed to get this to work. You need to set CXXFLAGS=-fvisibility=default
when running the gyp_webrtc
configure script, then build libjingle_peerconnection_so
. Obvious, right(?) This also increases the size of the .so
to 14MB unstripped, 11MB stripped. Then to run the chat demo you need to set LD_LIBRARY_PATH=lib
, or install the .so
into /usr/lib
or one of its friends. (The fake*.h
headers you're using, can be used without building the unittest objects - they are header-only includes.)
Taking a step back, the libjingle_peerconnection_so
was designed for JNI, and without my CXXFLAGS
hack, it only makes the JNI webrtc functions visible externally, which is why you were getting undefined reference
errors. This appears to be gyp's default setting, and I'm not sure if the webrtc authors consciously chose this. It works out well for them because libjingle_peerconnection
is not really stable. Even so, it may be worth adding a tweaked target like libjingle_peerconnection_private.so
without the JNI stuff, for developers like us that don't mind the bleeding edge.
One awkward thing is that we set -fvisibility
when building the .o
files, so we wouldn't be able to simultaneously create two .so
files that each have different visibilities for their symbols.
(edited to correct the CXXFLAGS
hack)
That's awesome. Thanks so much for figuring this out!
This CXXFLAGS
tweak definitely seems easy enough to include in the build script, and preparing a custom gyp or ninja file and then copying it over to the webrtc checkout also seems automate-able. I can get started on this soon -- unless you're planning a pull request? :)
Hey, yes I was planning to eventually submit a pull request, but have some issues to think through first. I'll write these up over the next few days. As far as I understand "best practises" to be, at least on GNU/Linux the (or one) ideal situation would be that:
libjingle_peerconnection.so
which would be the shared-library form of libjingle_peerconnection.a
(currently built as a thin archive) but with only certain symbols exported. (then we wouldn't need the CXXFLAGS
hack.)libjingle_peerconnection_jni.so
and it can link against (1)But getting there from the current situation will involve some thinking, so I'd like to do that first before committing a "quick fix" too hastily. I hear some of the webRTC people will be at FOSDEM this weekend so I'll try to talk to them about this also.
Awesome! :+1:
In our use case, only PeerConnection DataChannels are required. RTP media stream stuff is not.
It would be great to build a version of libwebrtc without all the video/audio functionality & codecs, etc. included. This would drastically reduce the size of the archive.
This would require something like:
Although...