meetecho / simple-whip-server

Simple WHIP Server (based on the Janus WebRTC Server)
GNU General Public License v3.0
93 stars 24 forks source link

help with WHIP implementation with gstreamer #8

Closed yair-sh closed 1 year ago

yair-sh commented 1 year ago

Hi, great done with the WHIP, it really makes life easier, thanks. I have the following architecture: IP camera (rtsp) --> gstreamer (whip) <--> web-socket & api server (node&express) <--> web html page I am doing the following steps:

  1. run the node server
  2. connect the web client with ws messages
  3. invoke gstreamer in cli to start the negotiation with the ws-server
  4. the node server receive the POST from gstreame
  5. it passes the SDP to the web client, which return with SDP answer
  6. the node server than response the gstreamer with that info and here I am stuck. it seems that nothing going on. what should be the next step ?

node-server logs:

[22:27:19] ws_server post req: v=0 o=- 2788308326578914698 0 IN IP4 0.0.0.0 s=- t=0 0 a=ice-options:trickle a=group:BUNDLE video0 m=video 9 UDP/TLS/RTP/SAVPF 96 c=IN IP4 0.0.0.0 a=setup:actpass a=ice-ufrag:WSIxLL7NcSegUedTFjCupoRWGZ24FNbG a=ice-pwd:3W0bG1d6ajqV0/OGtQo/hKmUrS7fOLgG a=rtcp-mux a=rtcp-rsize a=sendonly a=rtpmap:96 VP8/90000 a=rtcp-fb:96 nack pli a=rtcp-fb:96 ccm fir a=rtcp-fb:96 transport-cc a=framerate:10 a=ssrc:2450682818 msid:user2758407039@host-74d09c1a webrtctransceiver0 a=ssrc:2450682818 cname:user2758407039@host-74d09c1a a=mid:video0 a=fingerprint:sha-256 D0:A0:BF:E3:F1:2D:F1:3B:72:18:35:3E:78:A5:F6:96:E8:16:DD:CA:3B:1F:BB:A9:D4:7A:05:6C:C7:0E:59:43 a=rtcp-mux-only a=candidate:1 1 UDP 2015363327 10.0.0.146 53511 typ host a=candidate:2 1 TCP 1015021823 10.0.0.146 9 typ host tcptype active a=candidate:3 1 TCP 1010827519 10.0.0.146 1140 typ host tcptype passive a=candidate:4 1 UDP 2015363583 fe80::f7e9:e81d:182d:c551 53512 typ host a=candidate:5 1 TCP 1015022079 fe80::f7e9:e81d:182d:c551 9 typ host tcptype active a=candidate:6 1 TCP 1010827775 fe80::f7e9:e81d:182d:c551 1141 typ host tcptype passive a=candidate:7 1 UDP 2015363839 fe80::8f65:cebc:7f65:dee6 53513 typ host a=candidate:8 1 TCP 1015022335 fe80::8f65:cebc:7f65:dee6 9 typ host tcptype active a=candidate:9 1 TCP 1010828031 fe80::8f65:cebc:7f65:dee6 1142 typ host tcptype passive a=candidate:10 1 UDP 2015364095 192.168.56.1 53514 typ host a=candidate:11 1 TCP 1015022591 192.168.56.1 9 typ host tcptype active a=candidate:12 1 TCP 1010828287 192.168.56.1 1143 typ host tcptype passive

[22:27:19] ws_server ws msg: {"name":"usr","target":"sss","type":"video-answer","sdp":{"type":"answer","sdp":"v=0\r\no=- 960352286870238559 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE video0\r\na=msid-semantic: WMS\r\nm=video 9 UDP/TLS/RTP/SAVPF 96\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:6ihN\r\na=ice-pwd:iYHPZnkQKUfQrPKXfbUi4uwH\r\na=ice-options:trickle\r\na=fingerprint:sha-256 EF:92:2E:79:DD:62:86:7A:11:AA:53:34:B8:E1:01:38:D4:6F:C5:8C:C4:09:EE:2F:D3:45:D9:23:35:DA:14:B6\r\na=setup:active\r\na=mid:video0\r\na=recvonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack pli\r\n"}}

[22:27:19] ws_server ws msg: { "type":"new-ice-candidate","target":"sss","candidate":{"candidate":"candidate:1875195479 1 udp 2122260223 192.168.56.1 53515 typ host generation 0 ufrag 6ihN network-id 1","sdpMid":"video0","sdpMLineIndex":0}}

web-client log: [10:27:15 PM] Connecting to server: ws://localhost:6503 index.js:13 [10:27:15 PM] Starting to prepare an invitation index.js:13 [10:27:15 PM] Inviting user 123456 index.js:13 [10:27:15 PM] Setting up connection to invite user: 123456 index.js:13 [10:27:15 PM] Setting up a connection... index.js:13 [10:27:15 PM] Message received: index.js:48 Object index.js:13 [10:27:19 PM] Message received: index.js:48 Object index.js:13 [10:27:19 PM] Received video chat offer from sss index.js:13 [10:27:19 PM] - Setting remote description index.js:13 [10:27:19 PM] WebRTC signaling state changed to: have-remote-offer index.js:13 [10:27:19 PM] Track event index.js:13 [10:27:19 PM] ---> Creating and sending answer to caller index.js:13 [10:27:19 PM] WebRTC signaling state changed to: stable index.js:13 [10:27:19 PM] Sending 'video-answer' message: {"name":"usr","target":"sss","type":"video-answer","sdp":{"type":"answer","sdp":"v=0\r\no=- 960352286870238559 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE video0\r\na=msid-semantic: WMS\r\nm=video 9 UDP/TLS/RTP/SAVPF 96\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:6ihN\r\na=ice-pwd:iYHPZnkQKUfQrPKXfbUi4uwH\r\na=ice-options:trickle\r\na=fingerprint:sha-256 EF:92:2E:79:DD:62:86:7A:11:AA:53:34:B8:E1:01:38:D4:6F:C5:8C:C4:09:EE:2F:D3:45:D9:23:35:DA:14:B6\r\na=setup:active\r\na=mid:video0\r\na=recvonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack pli\r\n"}} index.js:13 [10:27:19 PM] ICE gathering state changed to: gathering index.js:13 [10:27:19 PM] ICE connection state changed to checking index.js:13 [10:27:19 PM] Outgoing ICE candidate: candidate:1875195479 1 udp 2122260223 192.168.56.1 53515 typ host generation 0 ufrag 6ihN network-id 1 index.js:13 [10:27:19 PM] Sending 'new-ice-candidate' message: {"type":"new-ice-candidate","target":"sss","candidate":{"candidate":"candidate:1875195479 1 udp 2122260223 192.168.56.1 53515 typ host generation 0 ufrag 6ihN network-id 1","sdpMid":"video0","sdpMLineIndex":0}} index.js:13 [10:27:19 PM] Outgoing ICE candidate: candidate:3624709596 1 udp 2122194687 10.0.0.146 53516 typ host generation 0 ufrag 6ihN network-id 2 network-cost 10 index.js:13 [10:27:19 PM] Sending 'new-ice-candidate' message: {"type":"new-ice-candidate","target":"sss","candidate":{"candidate":"candidate:3624709596 1 udp 2122194687 10.0.0.146 53516 typ host generation 0 ufrag 6ihN network-id 2 network-cost 10","sdpMid":"video0","sdpMLineIndex":0}} index.js:13 [10:27:19 PM] ICE connection state changed to connected index.js:13 [10:27:19 PM] ICE gathering state changed to: complete localhost/:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received index.js:13 [10:42:52 PM] WebRTC signaling state changed to: closed index.js:13 [10:42:52 PM] Closing the call index.js:13 [10:42:52 PM] --> Closing the peer connection

yair-sh commented 1 year ago

Sorry, my bad, I didn't send the SDP correctly. it works great !