sourcey / libsourcey

C++14 evented IO libraries for high performance networking and media based applications
https://sourcey.com/libsourcey
GNU Lesser General Public License v2.1
1.31k stars 344 forks source link

crashed when webrtcstreamer have a new connection #279

Open vrqin opened 4 years ago

vrqin commented 4 years ago

first run the node app, and run webrtcstreamer, and webrtcstreamer will crashed after open http://localhost:4499.

I found the crashed point at webrtc/src/webpacketsource.cpp, do Start and SetCaptureFormat that will make crashed:

cricket::CaptureState VideoPacketSource::Start(const cricket::VideoFormat& format) { LDebug("Start")

// NOTE: The requested format must match the input format until
// we implememnt pixel format conversion and resizing inside
// this class.
RTC_CHECK(_captureFormat == format);
if (capture_state() == cricket::CS_RUNNING) {
    LWarn("Start called when it's already started.")
    return capture_state();
}

if (_source)
    _source->attach(packetSlot(this, &VideoPacketSource::onVideoCaptured));

SetCaptureFormat(&format);
return cricket::CS_RUNNING;

}

this is strange, I don't known where's wrong, please help me.

and more env details:

libsourcey: master/head libwebrtc: webrtc-22215-ab42706-linux-x64.tar.gz os: Debian 9.1

$ lsb_release -a No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 9.1 (stretch) Release: 9.1 Codename: stretch

$ ./webrtcstreamer                                                                                       130 ↵
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/bb/workspace/cpp/libsourcey/src/av/samples/data/test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1
    creation_time   : 2010-02-09T01:55:39.000000Z
  Duration: 00:01:00.10, start: 0.000000, bitrate: 733 kb/s
    Stream #0:0(eng): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, stereo, fltp, 65 kb/s (default)
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : Apple Sound Media Handler
    Stream #0:1(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360, 612 kb/s, 23.96 fps, 24 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : Apple Video Media Handler
    Stream #0:2(eng): Data: none (rtp  / 0x20707472), 45 kb/s
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : hint media handler
    Stream #0:3(eng): Data: none (rtp  / 0x20707472), 5 kb/s
    Metadata:
      creation_time   : 2010-02-09T01:55:39.000000Z
      handler_name    : hint media handler
*** Error in `./webrtcstreamer': free(): invalid pointer: 0x000055a2b68148c8 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x70bcb)[0x7ff636e6bbcb]
/lib/x86_64-linux-gnu/libc.so.6(+0x76f96)[0x7ff636e71f96]
/lib/x86_64-linux-gnu/libc.so.6(+0x777de)[0x7ff636e727de]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(_ZNKSt14default_deleteIN7cricket11VideoFormatEEclEPS1_+0x1e)[0x7ff63e30fb98]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(_ZNSt10unique_ptrIN7cricket11VideoFormatESt14default_deleteIS1_EE5resetEPS1_+0x51)[0x7ff63e30f771]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(_ZN7cricket13VideoCapturer16SetCaptureFormatEPKNS_11VideoFormatE+0x58)[0x7ff63e30e732]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(_ZN3scy4wrtc17VideoPacketSource5StartERKN7cricket11VideoFormatE+0x2b6)[0x7ff63e30edb0]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(+0x140c53)[0x7ff63e34ac53]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(+0x4699ca)[0x7ff63e6739ca]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(+0x1570b2)[0x7ff63e3610b2]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(+0x171106)[0x7ff63e37b106]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(+0x1572fb)[0x7ff63e3612fb]
/home/bb/workspace/cpp/libsourcey/build/lib/libscy_webrtc.so.1.1(+0x156b4c)[0x7ff63e360b4c]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7494)[0x7ff6371a1494]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x3f)[0x7ff636ee3aff]