Rantanen/node-peerconnection

node-peerconnection does not work against the latest source for libjingle

Opened this issue · 3 comments

There are several hurdles when trying to use the latest source for libjingle and following the instructions in the README.

  • The node-gyp rebuild module looks for libvoice_engine_core.a, but this file is no more built. This can be solved by looking for ibvoice_engine.a instead in the binding.gyp file.
  • The new source for peerConnectionFactory implements constructors that require atleast four arguments. This bug can be temporarily solved(Not sure if this is the right way to do this by changing line 145 in peerconnection.cc to
    _peerConnectionFactory->CreatePeerConnection( _iceServers, NULL, NULL, this );
  • Finally, when the new peerconnection.node is built and used, the node server crashes on a new connection with the error:
    node: symbol lookup error: /path/to/node-peerclient/compiled/linux/x64/peerconnection.node: undefined symbol: XOpenDisplay
    This can be solved(again, temporarily) by commenting out line 186 in libjingle/trunk/third_party/webrtc/modules/audio_device/linux/audio_device_alsa_linux.cc
    Once this is done, node crashes again with:
    node: symbol lookup error: /path/to/node-peerclient/compiled/linux/x64/peerconnection.node: undefined symbol: _ZN6webrtc13SincResampler12Convolve_SSEEPKfS2_S2_d
    This seems to be function in the V8 engine, but apart from recompiling node from source(which I've tried already), there seems to be no other solution.

Figures...not the first time! Thanks for the fixes. I'll try to take a look at this later but below some comments.

  • libvoice_engine_core.a -> libvoice_engine.a looks correct
  • The extra NULL parameter in CreatePeerConnection looks correct
  • For the XOpenDisplay the correct solution should be to prevent the whole audio_device_alsa_linux from loading. Not sure what this takes. Previously registering the CallbackAudioDevice manually did this I think, but seems like there's something else now.
  • The undefined Convolve symbol should be fixable by linking ...:/third_party/webrtc/common_audio/resampler/common_audio_sse2.sinc_resampler_sse.o into the peerconnection.node.

I guess there would be a better way to fix the undefined symbols, but the procedure I've used is:

  1. Try running the example app
  2. Check which undefined symbol it crashes to
  3. Try to find the symbol from the source files (In this case, I'd grep the sources for Convolve_SSEEPK
  4. Figure which lib that source belongs to by the path to the source file.
  5. Check the library with nm. (nm common_audio_sse2.sinc_resampler_sse.o in this case)
  6. Once you find the library which includes the symbol as shown by nm, include that in the bindings.gyp
  7. Recompile and try again.

You could skip 4. by looking in the build files to see which file gets compiled where, but usually it's faster to just guess the path since most of the time it's pretty clear.

The libraries need to be included in bindings.gyp in such a way that library A depending on library B is before B in the list. Adding the libraries at the bottom of the list is always safe - but I've tried sorting them somehow based on their paths.

Thank you! I will try out these fixes soon and look deeper into the XOpenDisplay issue!

Good luck! I'll keep this one open until it's fixed in the repository.