webrtc-sdk / libwebrtc

A C++ wrapper for binary release, mainly used for flutter-webrtc desktop (windows, linux, embedded).
MIT License
418 stars 84 forks source link

segfault trying to establish audio connection #88

Open selfisekai opened 1 year ago

selfisekai commented 1 year ago

running alpine linux, x86_64

versions: libwebrtc: revision d9ea233ddcfa8ac246b7031bc30d7ba0f3018902 webrtc: revision b0f3927ad1472a3411fed7f5b8cd972907b63feb

my build process: https://gitlab.alpinelinux.org/selfisekai/aports/-/blob/b3bb963ebd296d59fe5405f5df2b2f6d50b98c50/testing/fluffychat/APKBUILD

gdb backtrace:

Thread 1 "fluffychat" received signal SIGSEGV, Segmentation fault.
0x00007ffff4bb55d3 in libwebrtc::scoped_refptr<libwebrtc::RTCVideoCapturer>::scoped_refptr(libwebrtc::scoped_refptr<libwebrtc::RTCVideoCapturer> const&) () at ../libwebrtc/include/base/scoped_ref_ptr.h:82
82  ../libwebrtc/include/base/scoped_ref_ptr.h: No such file or directory.
(gdb) bt
#0  0x00007ffff4bb55d3 in libwebrtc::scoped_refptr<libwebrtc::RTCVideoCapturer>::scoped_refptr(libwebrtc::scoped_refptr<libwebrtc::RTCVideoCapturer> const&) () at ../libwebrtc/include/base/scoped_ref_ptr.h:82
#1  0x00007ffff4bb2e5e in libwebrtc::RTCPeerConnectionFactoryImpl::CreateVideoSource(libwebrtc::scoped_refptr<libwebrtc::RTCVideoCapturer>, portable::string, libwebrtc::scoped_refptr<libwebrtc::RTCMediaConstraints>) ()
    at ../libwebrtc/src/rtc_peerconnection_factory_impl.cc:184
#2  0x00007ffff7e96c5e in flutter_webrtc_plugin::FlutterMediaStream::GetUserAudio(std::map<flutter::EncodableValue, flutter::EncodableValue, std::less<flutter::EncodableValue>, std::allocator<std::pair<flutter::EncodableValue const, flutter::EncodableValue> > > const&, libwebrtc::scoped_refptr<libwebrtc::RTCMediaStream>, std::map<flutter::EncodableValue, flutter::EncodableValue, std::less<flutter::EncodableValue>, std::allocator<std::pair<flutter::EncodableValue const, flutter::EncodableValue> > >&) ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#3  0x00007ffff7e94e7b in flutter_webrtc_plugin::FlutterMediaStream::GetUserMedia(std::map<flutter::EncodableValue, flutter::EncodableValue, std::less<flutter::EncodableValue>, std::allocator<std::pair<flutter::EncodableValue const, flutter::EncodableValue> > > const&, std::unique_ptr<MethodResultProxy, std::default_delete<MethodResultProxy> >) ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#4  0x00007ffff7ef1e15 in flutter_webrtc_plugin::FlutterWebRTC::HandleMethodCall(MethodCallProxy const&, std::unique_ptr<MethodResultProxy, std::default_delete<MethodResultProxy> >) ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#5  0x00007ffff7f0d6db in flutter_webrtc_plugin::FlutterWebRTCPluginImpl::HandleMethodCall(flutter::MethodCall<flutter::EncodableValue> const&, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>, std::default_delete<flutter::MethodResult<flutter::EncodableValue> > >) ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#6  0x00007ffff7f0d5fc in std::_Function_handler<void (flutter::MethodCall<flutter::EncodableValue> const&, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>, std::default_delete<flutter::MethodResult<flutter::EncodableValue> > >), flutter_webrtc_plugin::FlutterWebRTCPluginImpl::RegisterWithRegistrar(flutter::PluginRegistrar*)::{lambda(auto:1 const&, auto:2)#1}>::_M_invoke(std::_Any_data const&, flutter::MethodCall<flutter::EncodableValue> const&, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>, std::default_delete<flutter::MethodResult<flutter::EncodableValue> > >&&) ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#7  0x00007ffff7f0cf47 in flutter::MethodChannel<flutter::EncodableValue>::SetMethodCallHandler(std::function<void (flutter::MethodCall<flutter::EncodableValue> const&, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>, std::default_delete<flutter::MethodResult<flutter::EncodableValue> > >)>) const::{lambda(unsigned char const*, unsigned long, std::function<void (unsigned char con--Type <RET> for more, q to quit, c to continue without paging--
st*, unsigned long)>)#1}::operator()(unsigned char const*, unsigned long, std::function<void (unsigned char const*, unsigned long)>) const ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#8  0x00007ffff7f0cdc9 in std::_Function_handler<void (unsigned char const*, unsigned long, std::function<void (unsigned char const*, unsigned long)>), flutter::MethodChannel<flutter::EncodableValue>::SetMethodCallHandler(std::function<void (flutter::MethodCall<flutter::EncodableValue> const&, std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>, std::default_delete<flutter::MethodResult<flutter::EncodableValue> > >)>) const::{lambda(unsigned char const*, unsigned long, std::function<void (unsigned char const*, unsigned long)>)#1}>::_M_invoke(std::_Any_data const&, unsigned char const*&&, unsigned long&&, std::function<void (unsigned char const*, unsigned long)>&&) ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#9  0x00007ffff7f0dda9 in flutter::(anonymous namespace)::ForwardToHandler(_FlBinaryMessenger*, char const*, _GBytes*, _FlBinaryMessengerResponseHandle*, void*) ()
    at /home/lauren/aports/testing/fluffychat/src/fluffychat-1.13.0/build/linux/x64/release/bundle/lib/libflutter_webrtc_plugin.so
#10 0x00007ffff70eb7bf in  () at /usr/lib/libflutter_linux_gtk.so
#11 0x00007ffff70ed762 in  () at /usr/lib/libflutter_linux_gtk.so
#12 0x00007ffff7126ef7 in  () at /usr/lib/libflutter_linux_gtk.so
#13 0x00007ffff7131a7d in  () at /usr/lib/libflutter_linux_gtk.so
#14 0x00007ffff7131fc5 in  () at /usr/lib/libflutter_linux_gtk.so
#15 0x00007ffff712f1c8 in  () at /usr/lib/libflutter_linux_gtk.so
#16 0x00007ffff711fbab in  () at /usr/lib/libflutter_linux_gtk.so
#17 0x00007ffff7101b16 in  () at /usr/lib/libflutter_linux_gtk.so
#18 0x00007ffff7101c4a in  () at /usr/lib/libflutter_linux_gtk.so
#19 0x00007ffff65461ea in  () at /usr/lib/libglib-2.0.so.0
#20 0x00007ffff6545afa in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#21 0x00007ffff65a5b59 in  () at /usr/lib/libglib-2.0.so.0
#22 0x00007ffff65433ee in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#23 0x00007ffff6709d86 in g_application_run () at /usr/lib/libgio-2.0.so.0
#24 0x00005555555564ce in main ()
cloudwebrtc commented 1 year ago

The issue seems to occur at the flutter-webrtc level. It looks like an empty video track pointer is obtained when getUserMedia. Are there any reproducible steps?

selfisekai commented 1 year ago

trying to start a voice call in fluffychat (built as in the linked repository, that is building the library manually and replacing the provided build in pub cache), reproducibly segfaults as above