paullouisageneau / libdatachannel

C/C++ WebRTC network library featuring Data Channels, Media Transport, and WebSockets
https://libdatachannel.org/
Mozilla Public License 2.0
1.74k stars 354 forks source link

DataChannel is destroyed,Stop in 10 seconds #1256

Open chenqinggang001 opened 1 day ago

chenqinggang001 commented 1 day ago

I am trying to send an h264 video stream using the DataChannel, but it always automatically terminates after 10 seconds, here is the log, I can add more if need more information

10:10:47.806 15206-15206 PeerConnection           E  DEBUG rtc::impl::Init::doInit@113: Global initialization
10:10:47.806 15206-15206 PeerConnection           E  DEBUG rtc::impl::Init::doInit@123: Spawning 8 threads
10:10:47.809 15206-15476 PeerConnection           E  DEBUG rtc::impl::Certificate::Generate@430: Generating certificate (OpenSSL)
10:10:47.811 15206-15206 PeerConnectionManager    D  init: PeerConnectionManager
10:10:49.326 15206-15487 PeerConnection           E  DEBUG rtc::impl::IceTransport::IceTransport@58: Initializing ICE transport (libjuice)
10:10:49.326 15206-15487 PeerConnection           E  INFO rtc::impl::IceTransport::IceTransport@113: Using STUN server "110.42.182.87:3478"
10:10:49.327 15206-15487 PeerConnection           E  INFO rtc::impl::IceTransport::addIceServer@158: Using TURN server "110.42.182.87:3478"
10:10:49.327 15206-15487 PeerConnection           E  INFO rtc::impl::PeerConnection::changeSignalingState@1269: Changed signaling state to have-remote-offer
10:10:49.327 15206-15487 PeerConnection           E  DEBUG rtc::impl::PeerConnection::processLocalDescription@901: Reciprocating application in local description, mid="0"
10:10:49.327 15206-15487 PeerConnection           E  INFO rtc::impl::PeerConnection::changeSignalingState@1269: Changed signaling state to stable
10:10:49.327 15206-15487 PeerConnection           E  INFO rtc::impl::PeerConnection::changeGatheringState@1256: Changed gathering state to in-progress
10:10:49.327 15206-15487 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1100: Changing state to gathering
10:10:49.328 15206-15480 PeerConnectionManager    E  pc1 onLocalDescription sdp: v=0
                                                     o=rtc 24314792 0 IN IP4 127.0.0.1
                                                     s=-
                                                     t=0 0
                                                     a=group:BUNDLE 0
                                                     a=msid-semantic:WMS *
                                                     a=setup:active
                                                     a=ice-ufrag:FG3t
                                                     a=ice-pwd:tilRp6oPVnv31xGzefDrtz
                                                     a=ice-options:ice2,trickle
                                                     a=fingerprint:sha-256 23:E7:03:65:20:FA:7F:1D:52:ED:F7:D8:FA:92:B9:44:24:27:01:6B:5D:46:F9:48:BA:76:3D:6B:1C:45:63:E7
                                                     m=application 9 UDP/DTLS/SCTP webrtc-datachannel
                                                     c=IN IP4 0.0.0.0
                                                     a=mid:0
                                                     a=sendrecv
                                                     a=sctp-port:5000
                                                     a=max-message-size:1280000
10:10:49.330 15206-15487 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1100: Changing state to connecting
10:10:49.330 15206-15487 PeerConnection           E  INFO rtc::impl::PeerConnection::changeIceState@1238: Changed ICE state to checking
10:10:49.330 15206-15487 PeerConnection           E  INFO rtc::impl::PeerConnection::changeState@1220: Changed state to connecting
10:10:49.330 15206-15487 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:345: Using TURN server 110.42.182.87:3478
10:10:49.330 15206-15487 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:422: Using STUN server 110.42.182.87:3478
10:10:49.339 15206-15482 PeerConnectionManager    E  pc1 onGatheringStateChange: INPROGRESS
10:10:49.339 15206-15482 PeerConnectionManager    E  pc1 onLocalCandidate candidate: candidate:1 1 UDP 2122317823 192.168.8.161 58087 typ host mid: 0
10:10:49.341 15206-15483 PeerConnectionManager    E  pc1 onStateChange: CONNECTING
10:10:49.409 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1378: STUN server binding successful
10:10:49.410 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1397: Got STUN mapped address 159.122.131.88:58087 from server
10:10:49.410 15206-15478 PeerConnectionManager    E  pc1 onLocalCandidate candidate: candidate:2 1 UDP 1686109951 159.122.131.88 58087 typ srflx raddr 0.0.0.0 rport 0 mid: 0
10:10:49.489 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1100: Changing state to connected
10:10:49.489 15206-15503 PeerConnection           E  INFO rtc::impl::PeerConnection::changeIceState@1238: Changed ICE state to connected
10:10:49.489 15206-15503 PeerConnection           E  DEBUG rtc::impl::DtlsTransport::DtlsTransport@733: Initializing DTLS transport (OpenSSL)
10:10:49.492 15206-15503 PeerConnection           E  DEBUG rtc::impl::DtlsTransport::start@836: Starting DTLS transport
10:10:49.493 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1100: Changing state to completed
10:10:49.493 15206-15503 PeerConnection           E  INFO rtc::impl::PeerConnection::changeIceState@1238: Changed ICE state to completed
10:10:49.526 15206-15482 PeerConnection           E  INFO rtc::impl::DtlsTransport::doRecv@959: DTLS handshake finished
10:10:49.526 15206-15482 PeerConnection           E  DEBUG rtc::impl::SctpTransport::SctpTransport@162: Initializing SCTP transport
10:10:49.526 15206-15482 PeerConnection           E  DEBUG rtc::impl::SctpTransport::connect@352: SCTP connecting (local port=5000, remote port=5000)
10:10:49.536 15206-15480 PeerConnection           E  DEBUG rtc::impl::SctpTransport::processNotification@865: SCTP negotiated streams: incoming=1024, outgoing=1024
10:10:49.537 15206-15480 PeerConnection           E  INFO rtc::impl::SctpTransport::processNotification@870: SCTP connected
10:10:49.537 15206-15480 PeerConnection           E  INFO rtc::impl::PeerConnection::changeState@1220: Changed state to connected
10:10:49.537 15206-15481 PeerConnectionManager    E  pc1 onStateChange: CONNECTED
10:10:49.613 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1695: Got STUN mapped address 159.122.131.88:58087 from TURN server
10:10:49.614 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:1713: Allocated TURN relayed address 10.0.16.5:33732
10:10:49.614 15206-15481 PeerConnectionManager    E  pc1 onLocalCandidate candidate: candidate:4 1 UDP 8387839 10.0.16.5 33732 typ relay raddr 0.0.0.0 rport 0 mid: 0
10:10:49.614 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:2428: Candidate gathering done
10:10:49.614 15206-15503 PeerConnection           E  INFO rtc::impl::IceTransport::LogCallback@379: juice: agent.c:2412: Connectivity timer started
10:10:49.614 15206-15503 PeerConnection           E  INFO rtc::impl::PeerConnection::changeGatheringState@1256: Changed gathering state to complete
10:10:49.620 15206-15481 PeerConnectionManager    E  pc1 onGatheringStateChange: COMPLETE
10:11:07.306 15206-15478 PeerConnection           E  DEBUG rtc::impl::SctpTransport::sendReset@722: SCTP resetting stream 1
10:11:07.317 15206-15476 PeerConnection           E  DEBUG rtc::impl::PeerConnection::forwardMessage@500: Ignored message on stream 1, DataChannel is destroyed
10:11:07.324 15206-15480 PeerConnection           E  DEBUG rtc::impl::PeerConnection::forwardMessage@500: Ignored message on stream 1, DataChannel is destroyed
chenqinggang001 commented 1 day ago

What can I do to ensure that I don't disconnect,I am currently keeping the link from breaking by recreating the DataChannel,That doesn't seem like the best way to do it

chenqinggang001 commented 1 day ago

I find that when the receiver sends a "ping" message after receiving the message, the link will keep active. Is this correct?

paullouisageneau commented 17 hours ago

It looks like you destroy the data channel. Are you sure you keep a shared pointer to it? Sending a ping probably has the side effect of forcing you to keep a pointer.