AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
3.84k stars 315 forks source link

Sigsegv with tapo protocol #923

Open hmlnarik opened 5 months ago

hmlnarik commented 5 months ago

Thank you for the go2rtc product!

I hope you could help me with crash when opening webrtc.html with the following source:

streams:
    rtsp.sha256: 
        - rtsp://x:hash@192.168.a.b/stream1
        - tapo://x:hash@192.168.a.b

Could you please help me to if that could be a configuration issue? Running go2rtc using docker image via podman. Plain rtsp stream works perfectly.

Stacktrace:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x723764]

goroutine 200 [running]:
github.com/AlexxIT/go2rtc/pkg/tapo.(*Client).newConn(0x29103f0)
        github.com/AlexxIT/go2rtc/pkg/tapo/client.go:86 +0x268
github.com/AlexxIT/go2rtc/pkg/tapo.Dial({0x29782a0, 0x5c})
        github.com/AlexxIT/go2rtc/pkg/tapo/client.go:57 +0x5c
main.main.Init.func3({0x29782a0, 0x5c})
        github.com/AlexxIT/go2rtc/internal/tapo/tapo.go:16 +0x24
github.com/AlexxIT/go2rtc/internal/streams.GetProducer({0x29782a0, 0x5c})
        github.com/AlexxIT/go2rtc/internal/streams/handlers.go:49 +0x100
github.com/AlexxIT/go2rtc/internal/streams.(*Producer).Dial(0x29d87d0)
        github.com/AlexxIT/go2rtc/internal/streams/producer.go:62 +0x9c
github.com/AlexxIT/go2rtc/internal/streams.(*Stream).AddConsumer(0x2900870, {0x935b38, 0x2b3c360})
        github.com/AlexxIT/go2rtc/internal/streams/add_consumer.go:26 +0x420
github.com/AlexxIT/go2rtc/internal/webrtc.asyncHandler(0x286cde0, 0x280d740)
        github.com/AlexxIT/go2rtc/internal/webrtc/webrtc.go:171 +0x780
github.com/AlexxIT/go2rtc/internal/api/ws.apiWS.func2()
        github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:130 +0x40
created by github.com/AlexxIT/go2rtc/internal/api/ws.apiWS in goroutine 199
        github.com/AlexxIT/go2rtc/internal/api/ws/ws.go:129 +0x3e0
Trace log I have a number of IP addresses. For simplicity, the relevant ones have been replaced with `192.168.a.` below: `192.168.a.cam` for camera, `192.168.a.browser` for browser, and `192.168.a.go2rtc-host` for the RPi hosting go2rtc.
17:10:10.561 INF go2rtc version 1.8.5 linux/arm
17:10:10.568 INF [api] listen addr=:z
17:10:10.571 INF [rtsp] listen addr=127.0.0.1:8554
17:10:10.578 INF [webrtc] listen addr=:8555
17:10:10.580 DBG [hass] can't import config: open .storage/core.config_entries: no such file or directory
17:10:10.583 INF [api] tls listen addr=:z
17:10:17.897 DBG [webrtc] new consumer src=rtsp.sha256
17:10:17.934 DBG [streams] can't stop none producer
17:10:17.934 DBG [streams] start producer url=rtsp://x:hash@192.168.a.cam/stream1
17:10:18.015 DBG [streams] can't stop none producer
17:10:20.050 DBG [streams] can't stop none producer
17:20:17.125 INF go2rtc version 1.8.5 linux/arm
17:20:17.130 TRC [api] register path path=/
17:20:17.130 TRC [api] register path path=/api
17:20:17.130 TRC [api] register path path=/api/config
17:20:17.130 TRC [api] register path path=/api/exit
17:20:17.131 TRC [api] register path path=/api/restart
17:20:17.131 TRC [api] register path path=/api/log
17:20:17.135 TRC [api] register path path=/api/ws
17:20:17.134 INF [api] listen addr=:z
17:20:17.139 TRC [api] register path path=/api/streams
17:20:17.143 INF [rtsp] listen addr=127.0.0.1:8554
17:20:17.151 INF [webrtc] listen addr=:8555
17:20:17.151 TRC [api] register path path=/api/webrtc
17:20:17.152 TRC [api] register path path=/api/frame.mp4
17:20:17.152 TRC [api] register path path=/api/stream.mp4
17:20:17.152 TRC [api] register path path=/api/stream.m3u8
17:20:17.152 TRC [api] register path path=/api/hls/playlist.m3u8
17:20:17.152 TRC [api] register path path=/api/hls/segment.ts
17:20:17.153 TRC [api] register path path=/api/hls/init.mp4
17:20:17.153 TRC [api] register path path=/api/hls/segment.m4s
17:20:17.153 TRC [api] register path path=/api/frame.jpeg
17:20:17.153 TRC [api] register path path=/api/stream.mjpeg
17:20:17.157 TRC [api] register path path=/static
17:20:17.157 TRC [api] register path path=/streams
17:20:17.158 TRC [api] register path path=/stream/
17:20:17.158 DBG [hass] can't import config: open .storage/core.config_entries: no such file or directory
17:20:17.158 TRC [api] register path path=/api/hass
17:20:17.158 TRC [api] register path path=/onvif/
17:20:17.158 TRC [api] register path path=/api/onvif
17:20:17.162 TRC [api] register path path=/api/webtorrent
17:20:17.166 TRC [api] register path path=/api/stream.flv
17:20:17.172 TRC [api] register path path=/api/ffmpeg/devices
17:20:17.172 TRC [api] register path path=/api/ffmpeg/hardware
17:20:17.172 TRC [api] register path path=/api/stream
17:20:17.173 TRC [api] register path path=/api/dvrip
17:20:17.173 TRC [api] register path path=/api/stream.ts
17:20:17.173 TRC [api] register path path=/api/stream.aac
17:20:17.174 TRC [api] register path path=/api/roborock
17:20:17.176 INF [api] tls listen addr=:z
17:20:17.177 TRC [api] register path path=/api/homekit
17:20:17.177 TRC [api] register path path=/api/nest
17:20:17.178 TRC [api] register path path=/api/gopro
17:20:17.181 TRC [api] register path path=/api/stack
17:20:18.565 TRC [api] GET /api/log 192.168.a.browser:42574
17:20:18.725 TRC [api] GET /editor.html 192.168.a.browser:34368
17:20:18.815 TRC [api] GET /main.js 192.168.a.browser:34368
17:20:18.857 TRC [api] GET /favicon.ico 192.168.a.browser:34368
17:20:18.919 TRC [api] GET /api/config 192.168.a.browser:34378
17:20:20.499 TRC [api] GET /editor.html 192.168.a.browser:34378
17:20:20.587 TRC [api] GET /main.js 192.168.a.browser:34378
17:20:20.677 TRC [api] GET /api/config 192.168.a.browser:34378
17:20:23.527 TRC [api] GET /api/log 192.168.a.browser:42574
17:20:28.064 TRC [api] GET /api/ws?src=rtsp.sha256 192.168.a.browser:58640
17:20:28.074 TRC [api.ws] msg type=mse
17:20:28.075 TRC [mp4] new WS/MSE consumer codecs=avc1.640029,avc1.64002A,avc1.640033,mp4a.40.2,mp4a.40.5,flac,opus
17:20:28.075 TRC [streams] check cons=0 media=video, sendonly, H264
17:20:28.079 TRC [api.ws] msg type=webrtc/offer
17:20:28.080 TRC [api.ws] msg type=webrtc/candidate
17:20:28.080 DBG [webrtc] new consumer src=rtsp.sha256
17:20:28.080 TRC [webrtc] remote candidate="candidate:0 1 UDP 2122121471 192.168.a.browser 48208 typ host"
17:20:28.081 TRC [api.ws] msg type=webrtc/candidate
17:20:28.082 TRC [webrtc] remote candidate="candidate:2 1 UDP 2122187007 192.168.c.c 47626 typ host"
17:20:28.083 TRC [api.ws] msg type=webrtc/candidate
17:20:28.083 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.a.cam/stream1 RTSP/1.0
User-Agent: go2rtc/1.8.5
CSeq: 1
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel

17:20:28.083 TRC [webrtc] remote candidate="candidate:4 1 UDP 2122252543 192.168.b.b 46258 typ host"
17:20:28.084 TRC [api.ws] msg type=webrtc/candidate
17:20:28.085 TRC [api.ws] msg type=webrtc/candidate
17:20:28.085 TRC [webrtc] remote candidate="candidate:6 1 TCP 2105393407 192.168.a.browser 9 typ host tcptype active"
17:20:28.086 TRC [webrtc] remote candidate="candidate:7 1 TCP 2105458943 192.168.c.c 9 typ host tcptype active"
17:20:28.086 TRC [api.ws] msg type=webrtc/candidate
17:20:28.087 TRC [api.ws] msg type=webrtc/candidate
17:20:28.088 TRC [api] GET /api/log 192.168.a.browser:42574
17:20:28.087 TRC [webrtc] remote candidate="candidate:8 1 TCP 2105524479 192.168.b.b 9 typ host tcptype active"
17:20:28.088 TRC [webrtc] remote candidate="candidate:0 2 UDP 2122121470 192.168.a.browser 53676 typ host"
17:20:28.089 TRC [api.ws] msg type=webrtc/candidate
17:20:28.090 TRC [webrtc] remote candidate="candidate:2 2 UDP 2122187006 192.168.c.c 33273 typ host"
17:20:28.091 TRC [rtsp] client response:
RTSP/1.0 401 Unauthorized
Cseq: 1
Date: Sun, Feb 04 2024 16:20:27 GMT
Www-Authenticate: Basic realm="TP-LINK IP-Camera"

17:20:28.091 TRC [rtsp] client request:
DESCRIBE rtsp://192.168.a.cam/stream1 RTSP/1.0
Accept: application/sdp
Require: www.onvif.org/ver20/backchannel
User-Agent: go2rtc/1.8.5
CSeq: 2
Authorization: Basic 

17:20:28.090 TRC [api.ws] msg type=webrtc/candidate
17:20:28.093 TRC [webrtc] remote candidate="candidate:4 2 UDP 2122252542 192.168.b.b 47449 typ host"
17:20:28.093 TRC [api.ws] msg type=webrtc/candidate
17:20:28.094 TRC [api.ws] msg type=webrtc/candidate
17:20:28.094 TRC [webrtc] remote candidate="candidate:6 2 TCP 2105393406 192.168.a.browser 9 typ host tcptype active"
17:20:28.095 TRC [webrtc] remote candidate="candidate:7 2 TCP 2105458942 192.168.c.c 9 typ host tcptype active"
17:20:28.096 TRC [api.ws] msg type=webrtc/candidate
17:20:28.097 TRC [api.ws] msg type=webrtc/candidate
17:20:28.096 TRC [webrtc] remote candidate="candidate:8 2 TCP 2105524478 192.168.b.b 9 typ host tcptype active"
17:20:28.097 TRC [webrtc] remote candidate="candidate:0 1 UDP 2122121471 192.168.a.browser 42990 typ host"
17:20:28.098 TRC [api.ws] msg type=webrtc/candidate
17:20:28.099 TRC [webrtc] remote candidate="candidate:2 1 UDP 2122187007 192.168.c.c 39179 typ host"
17:20:28.099 TRC [api.ws] msg type=webrtc/candidate
17:20:28.100 TRC [webrtc] remote candidate="candidate:4 1 UDP 2122252543 192.168.b.b 51856 typ host"
17:20:28.100 TRC [api.ws] msg type=webrtc/candidate
17:20:28.101 TRC [webrtc] remote candidate="candidate:6 1 TCP 2105393407 192.168.a.browser 9 typ host tcptype active"
17:20:28.102 TRC [api.ws] msg type=webrtc/candidate
17:20:28.102 TRC [rtsp] client response:
RTSP/1.0 200 OK
Date: Sun, Feb 04 2024 16:20:27 GMT
Content-Base: rtsp://192.168.a.cam:554/stream1/
Content-Type: application/sdp
Content-Length: 412
Cseq: 2

v=0
o=- 14665860 31787219 1 IN IP4 192.168.a.cam
s=Session streamed by "TP-LINK RTSP Server"
t=0 0
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:4096
a=range:npt=0-
a=control:track1
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; profile-level-id=640033; sprop-parameter-sets=J2QAM60AzoB4AiflmoCAgPgAAAMAOAAABkG8gfQC7v/+BQ==,KO48sA==
m=audio 0 RTP/AVP 8
a=rtpmap:8 PCMA/8000
a=control:track2

17:20:28.105 TRC [streams] check prod=0 media=video, recvonly, H.264 High 5.1
17:20:28.105 TRC [streams] match prod=0 => cons=0
17:20:28.105 TRC [rtsp] client request:
SETUP rtsp://192.168.a.cam:554/stream1/track1 RTSP/1.0
Authorization: Basic 
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
CSeq: 3

17:20:28.105 TRC [webrtc] remote candidate="candidate:7 1 TCP 2105458943 192.168.c.c 9 typ host tcptype active"
17:20:28.104 TRC [api.ws] msg type=webrtc/candidate
17:20:28.106 TRC [api.ws] msg type=webrtc/candidate
17:20:28.107 TRC [api.ws] msg type=webrtc/candidate
17:20:28.107 TRC [api.ws] msg type=webrtc/candidate
17:20:28.107 TRC [webrtc] remote candidate="candidate:8 1 TCP 2105524479 192.168.b.b 9 typ host tcptype active"
17:20:28.107 TRC [api.ws] msg type=webrtc/candidate
17:20:28.107 TRC [webrtc] remote candidate="candidate:0 2 UDP 2122121470 192.168.a.browser 52905 typ host"
17:20:28.108 TRC [api.ws] msg type=webrtc/candidate
17:20:28.108 TRC [webrtc] remote candidate="candidate:2 2 UDP 2122187006 192.168.c.c 49230 typ host"
17:20:28.108 TRC [api.ws] msg type=webrtc/candidate
17:20:28.108 TRC [webrtc] remote candidate="candidate:4 2 UDP 2122252542 192.168.b.b 45889 typ host"
17:20:28.108 TRC [webrtc] remote candidate="candidate:8 2 TCP 2105524478 192.168.b.b 9 typ host tcptype active"
17:20:28.108 TRC [webrtc] remote candidate="candidate:6 2 TCP 2105393406 192.168.a.browser 9 typ host tcptype active"
17:20:28.109 TRC [webrtc] remote candidate="candidate:7 2 TCP 2105458942 192.168.c.c 9 typ host tcptype active"
17:20:28.112 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 3
Date: Sun, Feb 04 2024 16:20:27 GMT
Transport: RTP/AVP/TCP;unicast;interleaved=0-1
Session: 2193C5E6;timeout=15

17:20:28.113 TRC [streams] check cons=0 media=audio, sendonly, MPEG4-GENERIC, PCMA, PCMU, L16, PCML, OPUS
17:20:28.114 TRC [streams] check prod=0 media=video, recvonly, H.264 High 5.1
17:20:28.114 TRC [streams] check prod=0 media=audio, recvonly, PCMA/8000
17:20:28.114 TRC [streams] match prod=0 => cons=0
17:20:28.114 TRC [rtsp] client request:
SETUP rtsp://192.168.a.cam:554/stream1/track2 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
CSeq: 4
Authorization: Basic 
Session: 2193C5E6

17:20:28.123 TRC [rtsp] client response:
RTSP/1.0 200 OK
Date: Sun, Feb 04 2024 16:20:27 GMT
Transport: RTP/AVP/TCP;unicast;interleaved=2-3
Session: 2193C5E6;timeout=15
Cseq: 4

17:20:28.123 DBG [streams] can't stop none producer
17:20:28.123 DBG [streams] start producer url=rtsp://x:hash@192.168.a.cam/stream1
17:20:28.124 TRC [rtsp] client request:
PLAY rtsp://192.168.a.cam:554/stream1/ RTSP/1.0
CSeq: 5
Authorization: Basic 
Session: 2193C5E6

17:20:28.131 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 5
Date: Sun, Feb 04 2024 16:20:27 GMT
Range: npt=0.000-
Session: 2193C5E6
Rtp-Info: url=rtsp://192.168.a.cam:554/stream1/track1;seq=1;rtptime=0,url=rtsp://192.168.a.cam:554/stream1/track2;seq=1;rtptime=0

17:20:28.137 TRC [api.ws] msg type=webrtc/candidate
17:20:28.137 TRC [webrtc] remote candidate="candidate:1 1 UDP 1685921791  48208 typ srflx raddr 192.168.a.browser rport 48208"
17:20:28.146 TRC [webrtc] offer:
v=0
o=mozilla...THIS_IS_SDPARTA-99.0 1380728078243288674 0 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 B5:3D:FF:DD:9A:54:F9:1E:FF:4B:AD:0F:1F:65:12:1A:41:34:5B:43:9B:75:23:A1:57:51:15:C2:45:36:2F:EB
a=group:BUNDLE 0 1
a=ice-options:trickle
a=msid-semantic:WMS *
m=video 9 UDP/TLS/RTP/SAVPF 120 124 121 125 126 127 97 98
c=IN IP4 0.0.0.0
a=recvonly
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=extmap:6/recvonly http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1
a=fmtp:120 max-fs=12288;max-fr=60
a=fmtp:124 apt=120
a=fmtp:121 max-fs=12288;max-fr=60
a=fmtp:125 apt=121
a=fmtp:127 apt=126
a=fmtp:98 apt=97
a=ice-pwd:2b7d002d5914ea29f990451e8ef03199
a=ice-ufrag:a8538359
a=mid:0
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-fb:120 transport-cc
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=rtcp-fb:121 transport-cc
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb
a=rtcp-fb:126 transport-cc
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=rtcp-fb:97 goog-remb
a=rtcp-fb:97 transport-cc
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:120 VP8/90000
a=rtpmap:124 rtx/90000
a=rtpmap:121 VP9/90000
a=rtpmap:125 rtx/90000
a=rtpmap:126 H264/90000
a=rtpmap:127 rtx/90000
a=rtpmap:97 H264/90000
a=rtpmap:98 rtx/90000
a=setup:actpass
a=ssrc:3975162940 cname:{355acb7e-dbfb-492b-89df-839c93669a9a}
m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 0.0.0.0
a=recvonly
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:2b7d002d5914ea29f990451e8ef03199
a=ice-ufrag:a8538359
a=mid:1
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000/1
a=setup:actpass
a=ssrc:945436959 cname:{355acb7e-dbfb-492b-89df-839c93669a9a}

17:20:28.147 TRC [streams] check cons=0 media=video, sendonly, VP8, RTX, VP9, H264
17:20:28.148 TRC [streams] check prod=0 media=video, recvonly, H.264 High 5.1
17:20:28.148 TRC [streams] match prod=0 => cons=0
17:20:28.148 TRC [streams] check cons=0 media=audio, sendonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000, TELEPHONE-EVENT/8000, L16, PCML
17:20:28.148 TRC [streams] check prod=0 media=video, recvonly, H.264 High 5.1
17:20:28.149 TRC [streams] check prod=0 media=audio, recvonly, PCMA/8000
17:20:28.149 TRC [streams] match prod=0 => cons=0
17:20:28.149 DBG [streams] can't stop none producer
17:20:28.158 TRC [webrtc] answer
v=0
o=- 6987566252487008028 1707063628 IN IP4 0.0.0.0
s=-
t=0 0
a=fingerprint:sha-256 A4:D7:90:31:3C:65:B3:BF:1C:05:D5:8C:0C:5B:4E:B5:61:00:10:BF:A3:54:D1:72:7A:62:71:ED:1D:B1:1F:B5
a=group:BUNDLE 0 1
m=video 9 UDP/TLS/RTP/SAVPF 126
c=IN IP4 0.0.0.0
a=setup:active
a=mid:0
a=ice-ufrag:NomREQULTuVEyXTa
a=ice-pwd:wSUstXSeFPfveSZdyZhUuaMysIxvWIvq
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:126 H264/90000
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=rtcp-fb:126 nack 
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb 
a=rtcp-fb:126 transport-cc 
a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=ssrc:4107487734 cname:go2rtc
a=ssrc:4107487734 msid:go2rtc go2rtc-video
a=ssrc:4107487734 mslabel:go2rtc
a=ssrc:4107487734 label:go2rtc-video
a=msid:go2rtc go2rtc-video
a=sendonly
m=audio 9 UDP/TLS/RTP/SAVPF 109 0 8
c=IN IP4 0.0.0.0
a=setup:active
a=mid:1
a=ice-ufrag:NomREQULTuVEyXTa
a=ice-pwd:wSUstXSeFPfveSZdyZhUuaMysIxvWIvq
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:109 opus/48000/2
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=ssrc:2019517625 cname:go2rtc
a=ssrc:2019517625 msid:go2rtc go2rtc-audio
a=ssrc:2019517625 mslabel:go2rtc
a=ssrc:2019517625 label:go2rtc-audio
a=msid:go2rtc go2rtc-audio
a=sendonly

17:20:28.169 TRC [webrtc] local  candidate="candidate:2878742611 1 udp 2130706431 127.0.0.1 8555 typ host"
17:20:28.170 TRC [webrtc] local  candidate="candidate:1807344382 1 udp 2130706431 192.168.a.go2rtc-host 8555 typ host"
17:20:28.171 TRC [webrtc] local  candidate="candidate:4285218047 1 udp 2130706431 10.0.0.tun 8555 typ host"
17:20:28.174 TRC [api.ws] msg type=webrtc/candidate
17:20:28.174 TRC [webrtc] local  candidate="candidate:58595125 1 udp 2130706431 10.0.0.podman-gw 8555 typ host"
17:20:28.175 TRC [webrtc] remote candidate="candidate:5 1 UDP 1686052863  46258 typ srflx raddr 192.168.b.b rport 46258"
17:20:28.187 TRC [webrtc] local  candidate="candidate:3595211550 1 tcp 1671430143 192.168.a.go2rtc-host 8555 typ host tcptype passive"
17:20:28.188 TRC [webrtc] local  candidate="candidate:1117277471 1 tcp 1671430143 10.0.0.tun 8555 typ host tcptype passive"
17:20:28.189 TRC [api.ws] msg type=webrtc/candidate
17:20:28.189 TRC [webrtc] remote candidate="candidate:1 2 UDP 1685921790  53676 typ srflx raddr 192.168.a.browser rport 53676"
17:20:28.189 TRC [webrtc] local  candidate="candidate:3196937941 1 tcp 1671430143 10.0.0.podman-gw 8555 typ host tcptype passive"
17:20:28.198 TRC [webrtc] local  candidate="candidate:1416211748 1 udp 1694498815  45325 typ srflx raddr 0.0.0.0 rport 45325"
17:20:28.233 TRC [api.ws] msg type=webrtc/candidate
17:20:28.233 TRC [webrtc] remote candidate="candidate:5 2 UDP 1686052862  47449 typ srflx raddr 192.168.b.b rport 47449"
17:20:30.146 DBG [streams] can't stop none producer
17:20:33.207 TRC [api] GET /api/log 192.168.a.browser:42574
17:20:38.233 TRC [api] GET /api/log 192.168.a.browser:42574
17:20:38.238 TRC [rtsp] client request:
OPTIONS rtsp://192.168.a.cam:554/stream1/ RTSP/1.0
Authorization: Basic 
Session: 2193C5E6
CSeq: 6

17:20:38.242 TRC [rtsp] client response:
RTSP/1.0 200 OK
Cseq: 6
Date: Sun, Feb 04 2024 16:20:37 GMT
Public: OPTIONS, DESCRIBE, SETUP, TEARDOWN, PLAY, PAUSE, GET_PARAMETER, SET_PARAMETER

17:20:43.288 TRC [api] GET /api/log 192.168.a.browser:42574
17:20:47.078 TRC [api] GET /webrtc.html?src=rtsp.sha256&media=video+audio+microphone 192.168.a.browser:42574
17:20:47.929 TRC [api] GET /favicon.ico 192.168.a.browser:42574
17:20:47.956 TRC [api] GET /api/ws?src=rtsp.sha256&media=video+audio+microphone 192.168.a.browser:48286
17:20:47.974 TRC [api.ws] msg type=webrtc/offer
17:20:47.975 DBG [webrtc] new consumer src=rtsp.sha256
17:20:47.984 TRC [api.ws] msg type=webrtc/candidate
17:20:47.985 TRC [webrtc] remote candidate="candidate:0 1 UDP 2122121471 192.168.a.browser 38425 typ host"
17:20:47.986 TRC [api.ws] msg type=webrtc/candidate
17:20:47.986 TRC [api.ws] msg type=webrtc/candidate
17:20:47.986 TRC [api.ws] msg type=webrtc/candidate
17:20:47.987 TRC [api.ws] msg type=webrtc/candidate
17:20:47.987 TRC [api.ws] msg type=webrtc/candidate
17:20:47.987 TRC [api.ws] msg type=webrtc/candidate
17:20:47.987 TRC [api.ws] msg type=webrtc/candidate
17:20:47.988 TRC [api.ws] msg type=webrtc/candidate
17:20:47.988 TRC [api.ws] msg type=webrtc/candidate
17:20:47.986 TRC [webrtc] remote candidate="candidate:2 1 UDP 2122187007 192.168.c.c 39201 typ host"
17:20:47.988 TRC [webrtc] remote candidate="candidate:6 2 TCP 2105393406 192.168.a.browser 9 typ host tcptype active"
17:20:47.988 TRC [webrtc] remote candidate="candidate:4 1 UDP 2122252543 192.168.b.b 36071 typ host"
17:20:47.989 TRC [webrtc] remote candidate="candidate:6 1 TCP 2105393407 192.168.a.browser 9 typ host tcptype active"
17:20:47.989 TRC [webrtc] remote candidate="candidate:7 1 TCP 2105458943 192.168.c.c 9 typ host tcptype active"
17:20:47.990 TRC [api.ws] msg type=webrtc/candidate
17:20:47.990 TRC [api.ws] msg type=webrtc/candidate
17:20:47.990 TRC [webrtc] remote candidate="candidate:0 2 UDP 2122121470 192.168.a.browser 53837 typ host"
17:20:47.990 TRC [api.ws] msg type=webrtc/candidate
17:20:47.990 TRC [webrtc] remote candidate="candidate:8 1 TCP 2105524479 192.168.b.b 9 typ host tcptype active"
17:20:47.991 TRC [api.ws] msg type=webrtc/candidate
17:20:47.991 TRC [api.ws] msg type=webrtc/candidate
17:20:47.991 TRC [webrtc] remote candidate="candidate:2 2 UDP 2122187006 192.168.c.c 36943 typ host"
17:20:47.991 TRC [api.ws] msg type=webrtc/candidate
17:20:47.991 TRC [api.ws] msg type=webrtc/candidate
17:20:47.991 TRC [webrtc] remote candidate="candidate:4 2 UDP 2122252542 192.168.b.b 40913 typ host"
17:20:47.992 TRC [api.ws] msg type=webrtc/candidate
17:20:47.992 TRC [api.ws] msg type=webrtc/candidate
17:20:47.992 TRC [webrtc] remote candidate="candidate:8 2 TCP 2105524478 192.168.b.b 9 typ host tcptype active"
17:20:47.992 TRC [api.ws] msg type=webrtc/candidate
17:20:47.992 TRC [api.ws] msg type=webrtc/candidate
17:20:47.992 TRC [webrtc] remote candidate="candidate:7 2 TCP 2105458942 192.168.c.c 9 typ host tcptype active"
17:20:47.992 TRC [api.ws] msg type=webrtc/candidate
17:20:47.993 TRC [api.ws] msg type=webrtc/candidate
17:20:47.993 TRC [webrtc] remote candidate="candidate:0 1 UDP 2122121471 192.168.a.browser 38698 typ host"
17:20:47.993 TRC [api.ws] msg type=webrtc/candidate
17:20:47.993 TRC [webrtc] remote candidate="candidate:4 1 UDP 2122252543 192.168.b.b 57505 typ host"
17:20:47.993 TRC [webrtc] remote candidate="candidate:2 1 UDP 2122187007 192.168.c.c 47678 typ host"
17:20:47.994 TRC [webrtc] remote candidate="candidate:7 1 TCP 2105458943 192.168.c.c 9 typ host tcptype active"
17:20:47.994 TRC [webrtc] remote candidate="candidate:6 1 TCP 2105393407 192.168.a.browser 9 typ host tcptype active"
17:20:47.994 TRC [webrtc] remote candidate="candidate:0 2 UDP 2122121470 192.168.a.browser 47070 typ host"
17:20:47.995 TRC [webrtc] remote candidate="candidate:8 1 TCP 2105524479 192.168.b.b 9 typ host tcptype active"
17:20:47.995 TRC [webrtc] remote candidate="candidate:4 2 UDP 2122252542 192.168.b.b 54480 typ host"
17:20:47.995 TRC [webrtc] remote candidate="candidate:2 2 UDP 2122187006 192.168.c.c 38264 typ host"
17:20:47.996 TRC [webrtc] remote candidate="candidate:7 2 TCP 2105458942 192.168.c.c 9 typ host tcptype active"
17:20:47.996 TRC [webrtc] remote candidate="candidate:6 2 TCP 2105393406 192.168.a.browser 9 typ host tcptype active"
17:20:47.996 TRC [webrtc] remote candidate="candidate:8 2 TCP 2105524478 192.168.b.b 9 typ host tcptype active"
17:20:47.997 TRC [webrtc] offer:
v=0
o=mozilla...THIS_IS_SDPARTA-99.0 4641033347694687882 0 IN IP4 0.0.0.0
s=-
t=0 0
a=sendrecv
a=fingerprint:sha-256 0E:FA:9C:88:FE:96:0A:DC:CD:8E:F4:02:F3:52:27:98:87:D9:DC:8A:2D:A8:57:74:0D:AD:B8:AA:D4:FB:7F:F5
a=group:BUNDLE 0 1 2
a=ice-options:trickle
a=msid-semantic:WMS *
m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 0.0.0.0
a=sendonly
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:a18a6d5ce594fea50e5f42108a186125
a=ice-ufrag:9d4d291c
a=mid:0
a=msid:- {20662a27-6a5c-4fea-9f23-a6b52f00b5c7}
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=setup:actpass
a=ssrc:1618659871 cname:{357f253d-aba5-4fd3-853b-ccb42628603e}
m=video 9 UDP/TLS/RTP/SAVPF 120 124 121 125 126 127 97 98
c=IN IP4 0.0.0.0
a=recvonly
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:5 urn:ietf:params:rtp-hdrext:toffset
a=extmap:6/recvonly http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1
a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1
a=fmtp:120 max-fs=12288;max-fr=60
a=fmtp:124 apt=120
a=fmtp:121 max-fs=12288;max-fr=60
a=fmtp:125 apt=121
a=fmtp:127 apt=126
a=fmtp:98 apt=97
a=ice-pwd:a18a6d5ce594fea50e5f42108a186125
a=ice-ufrag:9d4d291c
a=mid:1
a=rtcp-fb:120 nack
a=rtcp-fb:120 nack pli
a=rtcp-fb:120 ccm fir
a=rtcp-fb:120 goog-remb
a=rtcp-fb:120 transport-cc
a=rtcp-fb:121 nack
a=rtcp-fb:121 nack pli
a=rtcp-fb:121 ccm fir
a=rtcp-fb:121 goog-remb
a=rtcp-fb:121 transport-cc
a=rtcp-fb:126 nack
a=rtcp-fb:126 nack pli
a=rtcp-fb:126 ccm fir
a=rtcp-fb:126 goog-remb
a=rtcp-fb:126 transport-cc
a=rtcp-fb:97 nack
a=rtcp-fb:97 nack pli
a=rtcp-fb:97 ccm fir
a=rtcp-fb:97 goog-remb
a=rtcp-fb:97 transport-cc
a=rtcp-mux
a=rtcp-rsize
a=rtpmap:120 VP8/90000
a=rtpmap:124 rtx/90000
a=rtpmap:121 VP9/90000
a=rtpmap:125 rtx/90000
a=rtpmap:126 H264/90000
a=rtpmap:127 rtx/90000
a=rtpmap:97 H264/90000
a=rtpmap:98 rtx/90000
a=setup:actpass
a=ssrc:4065023383 cname:{357f253d-aba5-4fd3-853b-ccb42628603e}
m=audio 0 UDP/TLS/RTP/SAVPF 109 9 0 8 101
c=IN IP4 0.0.0.0
a=bundle-only
a=recvonly
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:2/recvonly urn:ietf:params:rtp-hdrext:csrc-audio-level
a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:109 maxplaybackrate=48000;stereo=1;useinbandfec=1
a=fmtp:101 0-15
a=ice-pwd:a18a6d5ce594fea50e5f42108a186125
a=ice-ufrag:9d4d291c
a=mid:2
a=rtcp-mux
a=rtpmap:109 opus/48000/2
a=rtpmap:9 G722/8000/1
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=setup:actpass
a=ssrc:2286430023 cname:{357f253d-aba5-4fd3-853b-ccb42628603e}

17:20:47.998 TRC [streams] check cons=0 media=video, sendonly, VP8, RTX, VP9, H264
17:20:47.998 TRC [streams] check prod=0 media=video, recvonly, H.264 High 5.1
17:20:47.999 TRC [streams] match prod=0 => cons=0
17:20:48.000 TRC [streams] check cons=0 media=audio, recvonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000, TELEPHONE-EVENT/8000
17:20:48.002 TRC [streams] check prod=0 media=video, recvonly, H.264 High 5.1
17:20:48.002 TRC [streams] check prod=0 media=audio, recvonly, PCMA/8000
17:20:48.005 TRC [api.ws] msg type=webrtc/candidate
17:20:48.005 TRC [webrtc] remote candidate="candidate:1 1 UDP 1685921791  38425 typ srflx raddr 192.168.a.browser rport 38425"
17:20:48.074 TRC [api.ws] msg type=webrtc/candidate
17:20:48.074 TRC [webrtc] remote candidate="candidate:5 1 UDP 1686052863  36071 typ srflx raddr 192.168.b.b rport 36071"
17:20:48.078 TRC [api.ws] msg type=webrtc/candidate
17:20:48.079 TRC [webrtc] remote candidate="candidate:1 2 UDP 1685921790  53837 typ srflx raddr 192.168.a.browser rport 53837"
17:20:48.101 TRC [api.ws] msg type=webrtc/candidate
17:20:48.102 TRC [webrtc] remote candidate="candidate:5 2 UDP 1686052862  40913 typ srflx raddr 192.168.b.b rport 40913"
17:20:48.115 TRC [api.ws] msg type=webrtc/candidate
17:20:48.115 TRC [webrtc] remote candidate="candidate:1 1 UDP 1685921791  38698 typ srflx raddr 192.168.a.browser rport 38698"

Camera: Tapo C500

AlexxIT commented 5 months ago

Do you have developer skills? I think this is place of problem https://github.com/AlexxIT/go2rtc/blob/b08b88357eb7903bb53506e1cf9f99dd7db24f1a/pkg/tapo/client.go#L284

curl -v --request POST \
  --url http://192.168.1.123:8800/stream \
  --header 'Content-Type: multipart/mixed; boundary=--client-stream-boundary--'
hmlnarik commented 5 months ago

Do you have developer skills? I think this is place of problem

go2rtc/pkg/tapo/client.go

Yup, that might be right as there is no WWW-Authenticate header:

curl -v --request POST \ --url http://192.168.1.123:8800/stream \ --header 'Content-Type: multipart/mixed; boundary=--client-stream-boundary--'

This returns:

*   Trying 192.168.1.123:8800...
* Connected to 192.168.1.123 (192.168.1.123) port 8800 (#0)
> POST /stream HTTP/1.1
> Host: 192.168.1.123:8800
> User-Agent: curl/7.88.1
> Accept: */*
> Content-Type: multipart/mixed; boundary=--client-stream-boundary--
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Server: Streamd
< Date: Mon, 05 Feb 2024 09:35:53 UTC
< Content-Type: multipart/mixed;boundary=--device-stream-boundary--
< Pragma: no-cache
< Cache-Control: no-cache
< Key-Exchange: cipher="AES_128_CBC" username="none" padding="PKCS7_16" algorithm="MD5" nonce="b3988e8cadd1b060e6cc35249d8d0a5c"
< Connection: close
< 

Connection gets closed in about 10 seconds.

AlexxIT commented 5 months ago

Something new without auth and none password. @JurajNyiri have you saw this?

@hmlnarik try to:

  1. Update camera firmware (skip if none)
  2. Reset camera and add it to Tapo app again
  3. Open live stream via Tapo app
  4. Open again via go2rtc
JurajNyiri commented 5 months ago

I haven't seen this yet. If it is something new it will come up for recordings for Tapo integration so we will see. We need to know what is the current firmware user uses.

hmlnarik commented 5 months ago

@AlexxIT I am not using Tapo app, and I tried go2rtc for that reason. Would it be possible to not authorize if the WWW-Authenticate is not present?

JurajNyiri commented 5 months ago

That must be the reason. @hmlnarik never configured the camera through tapo app.

AlexxIT commented 5 months ago

You really didn't connect the camera to the app? Not even once? Where you get user and password (hash)? And how you connect camera to WiFi?

JurajNyiri commented 5 months ago

I think he might have used https://github.com/JurajNyiri/pytapo/issues/24 . I am torn on supporting this in pytapo and tapo integration for many reasons.

hmlnarik commented 5 months ago

I used similar approach to that described in https://github.com/JurajNyiri/pytapo/issues/24 to connect to wifi.

I'll try to just skip adding Authorization header, or craft it somehow. Thanks for the help so far.

AlexxIT commented 5 months ago

Well. You can try to fix this yourself. I don't know when I will have time to do this trick with my camera.