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
6.63k stars 478 forks source link

Incoming sources broken after v1.9.7 #1458

Open lrobot opened 12 hours ago

lrobot commented 12 hours ago

version: go2rtc version 1.8.4 linux/amd64

reproduce issue: I create go2rtc.yaml

streams:
 browser_stream:
    - ""

and start ./go2rtc

producer stream("dst") : http://localhost:1984/webrtc.html?dst=browser_stream&media=camera+microphone consumer stream("src"): http://localhost:1984/webrtc.html?src=browser_stream&media=video+audio

I can notice: http://localhost:1984/api/streams?src=browser_stream, produce work well. but consumer can not hook to producer, error log is: "streams: unknown error"

18:30:57.042 TRC [webrtc] remote candidate="candidate:3152294625 1 udp 2122260223 172.22.85.187 57740 typ host generation 0 ufrag E3AA network-id 2"
18:30:57.042 TRC [streams] check cons=0 media=video, sendonly, VP8, VP9, H264, AV1
18:30:57.042 TRC [streams] skip cons=0 prod=0
18:30:57.042 TRC [streams] check cons=0 media=audio, sendonly, OPUS/48000/2, G722/8000, PCMU/8000, PCMA/8000, L16, PCML
18:30:57.042 TRC [streams] skip cons=0 prod=0
18:30:57.042 TRC [streams] skip stop none producer
18:30:57.042 DBG [webrtc] add consumer error="streams: unknown error"
18:30:57.042 TRC [api] ws msg type=webrtc/candidate
18:30:57.042 TRC [streams] skip stop none producer

I think may be this is because of below loop request check:

prod.url == info.GetSource()

https://github.com/AlexxIT/go2rtc/blob/dbe9e4aadeeae306b2e90a4668f077d405448eff/internal/streams/add_consumer.go#L26 I notice that the producer url is "" empty string. and the consumer source maybe also "" empty string. so that may is the cause of this issue.

lrobot commented 9 hours ago

sorry that, This may not a bug, I found that: below config will cause issue

streams:
 browser_stream:
    - ""

and below config work well with: version: go2rtc version 1.8.4 linux/amd64 this may be the really "empty stream", the error config is a stream with "empty source url". because of documentation not show how to config "empty stream". I create a issued config!!

streams:
 browser_stream:
AlexxIT commented 9 hours ago

Incoming source also may have empty url. So it will be skipped. I needs to test this case.