-
Notifications
You must be signed in to change notification settings - Fork 530
crashing when trying to open an RTMP stream several times #125
Description
test case:
device in airplane mode.
code path:
- try opening the connection with
startRtmpSessionWithURL: andStreamKey: - get a
VCSessionStateErrorfollowed byVCSessionStateEndedthrough the session delegate - as soon as we get
VCSessionStateEndedwe schedule a selector to retry connecting the session, after 1 second, on the main thread
let the above run for a while and the app will crash out in some C++ code (not always at the same place).
I also tried before each reconnect to call endRtmpSession and create a new instance of the VCSimpleSession class, but the result was the same. Crashes somewhere in C++ land.
Example of the call stack of the last scenario I described:
#0 0x00000001000aa96c in std::__1::enable_if<(is_move_constructiblevideocore::IOutputSession*::value) && (is_move_assignablevideocore::IOutputSession*::value), void>::type std::1::swapvideocore::IOutputSession*(videocore::IOutputSession&, videocore::IOutputSession&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:3205
#1 0x00000001000aa94c in std::__1::shared_ptrvideocore::IOutputSession::shared_ptr() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4568
#2 0x00000001000aa934 in std::__1::shared_ptrvideocore::IOutputSession::reset() [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4577
#3 0x00000001000aa934 in -[VCSimpleSession startSessionInternal:streamKey:]::$_0::operator()(videocore::RTMPSession&, ClientState_t) const at VideoCore/api/iOS/VCSimpleSession.mm:508
#4 0x00000001000aa5a0 in decltype(std::__1::forward<-[VCSimpleSession startSessionInternal:streamKey:]::$_0&>(fp)(std::__1::forward<videocore::RTMPSession&, ClientState_t>(fp0))) std::__1::__invoke<-[VCSimpleSession startSessionInternal:streamKey:]::$_0&, videocore::RTMPSession&, ClientState_t>(-[VCSimpleSession startSessionInternal:streamKey:]::$_0&&&, videocore::RTMPSession&&&, ClientState_t&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base:413
#5 0x00000001000aa574 in std::__1::__function::__func<-[VCSimpleSession startSessionInternal:streamKey:]::$_0, std::__1::allocator<-[VCSimpleSession startSessionInternal:streamKey:]::$_0>, void (videocore::RTMPSession&, ClientState_t)>::operator()(videocore::RTMPSession&, ClientState_t&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1370
#6 0x00000001000847d8 in std::__1::function<void (videocore::RTMPSession&, ClientState_t)>::operator()(videocore::RTMPSession&, ClientState_t) const at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1755
#7 0x0000000100072d40 in videocore::RTMPSession::setClientState(ClientState_t) at VideoCore/rtmp/RTMPSession.cpp:322
#8 0x0000000100074590 in videocore::RTMPSession::streamStatusChanged(long) at VideoCore/rtmp/RTMPSession.cpp:350
#9 0x000000010007fdf8 in videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>)::$_1::operator()(videocore::IStreamSession&, long) const at VideoCore/rtmp/RTMPSession.cpp:81
#10 0x000000010007fc6c in std::__1::__invoke<videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>)::$_1&, videocore::IStreamSession&, long>(decltype(std::__1::forward<videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>)::$_1&>(fp)(std::__1::forward<videocore::IStreamSession&, long>(fp0))), videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>)::$_1&&&, videocore::IStreamSession&&&, long&&) [inlined] at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__functional_base:413
#11 0x000000010007fc40 in std::__1::__function::__func<videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>)::$_1, std::__1::allocator<videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>)::$_1>, void (videocore::IStreamSession&, long)>::operator()(videocore::IStreamSession&, long&&) at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1370
#12 0x0000000100091b34 in std::__1::function<void (videocore::IStreamSession&, long)>::operator()(videocore::IStreamSession&, long) const at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:1755
#13 0x0000000100091974 in videocore::Apple::StreamSession::setStatus(long, bool) at VideoCore/stream/Apple/StreamSession.mm:178
#14 0x0000000100090e7c in videocore::Apple::StreamSession::nsStreamCallback(void*, unsigned int) VideoCore/stream/Apple/StreamSession.mm:202
#15 0x0000000100090c78 in -[NSStreamCallback stream:handleEvent:] at VideoCore/stream/Apple/StreamSession.mm:49
#16 0x0000000181c5f030 in _signalEventSync ()
#17 0x0000000181c5ef4c in _cfstream_shared_signalEventSync ()
#18 0x0000000181cbed34 in CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION ()
#19 0x0000000181cbdfd8 in __CFRunLoopDoSources0 ()
#20 0x0000000181cbc088 in __CFRunLoopRun ()
#21 0x0000000181be91f4 in CFRunLoopRunSpecific ()
#22 0x0000000182b160b8 in -NSRunLoop(NSRunLoop) runMode:beforeDate:
#23 0x0000000182b705d8 in -NSRunLoop(NSRunLoop) run
#24 0x0000000100091590 in videocore::Apple::StreamSession::startNetwork() at VideoCore/stream/Apple/StreamSession.mm:221
#25 0x0000000100091428 in ___ZN9videocore5Apple13StreamSession7connectENSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEiNS2_8functionIFvRNS_14IStreamSessionElEEE_block_invoke at VideoCore/stream/Apple/StreamSession.mm:90
#26 0x0000000100480fd4 in _dispatch_call_block_and_release ()
#27 0x0000000100480f94 in _dispatch_client_callout ()
#28 0x000000010048bdb8 in _dispatch_queue_drain ()
#29 0x00000001004842c4 in _dispatch_queue_invoke ()
#30 0x000000010048e5d4 in _dispatch_root_queue_drain ()
#31 0x0000000100490248 in _dispatch_worker_thread3 ()
#32 0x000000019351522c in _pthread_wqthread ()
Enqueued from com.videocore.session.graph (Thread 7)Queue : com.videocore.session.graph (serial)
#0 0x000000010048a0bc in _dispatch_barrier_async_f ()
#1 0x00000001000913dc in videocore::Apple::StreamSession::connect(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, int, std::__1::function<void (videocore::IStreamSession&, long)>) at VideoCore/stream/Apple/StreamSession.mm:89
#2 0x000000010007048c in videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>) at VideoCore/rtmp/RTMPSession.cpp:80
#3 0x000000010007146c in videocore::RTMPSession::RTMPSession(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::function<void (videocore::RTMPSession&, ClientState_t)>) at VideoCore/rtmp/RTMPSession.cpp:84
#4 0x00000001000a2070 in -[VCSimpleSession startSessionInternal:streamKey:] at VideoCore/api/iOS/VCSimpleSession.mm:482
#5 0x00000001000a1a04 in __56-[VCSimpleSession startRtmpSessionWithURL:andStreamKey:]_block_invoke at VideoCore/api/iOS/VCSimpleSession.mm:473
#6 0x0000000100480fd4 in _dispatch_call_block_and_release ()
#7 0x0000000100480f94 in _dispatch_client_callout ()
#8 0x000000010048bdb8 in _dispatch_queue_drain ()
#9 0x00000001004842c4 in _dispatch_queue_invoke ()
#10 0x000000010048e5d4 in _dispatch_root_queue_drain ()
#11 0x0000000100490248 in _dispatch_worker_thread3 ()
#12 0x000000019351522c in _pthread_wqthread ()
#13 0x0000000193514ef0 in start_wqthread ()
Enqueued from com.apple.main-thread (Thread 1)Queue : com.apple.main-thread (serial)
#0 0x000000010048ff80 in _dispatch_barrier_async_f_slow ()
#1 0x00000001000a19a4 in -[VCSimpleSession startRtmpSessionWithURL:andStreamKey:] at VCSimpleSession.mm:472
#2 0x00000001000123bc in -[ViewController startBroadcast] at ViewController.mm:179
I am using code I got through cocoapods.