diff --git a/main.go b/main.go index e82d055..957b702 100644 --- a/main.go +++ b/main.go @@ -10,6 +10,7 @@ import ( "gitlab.crans.org/nounous/ghostream/auth" "gitlab.crans.org/nounous/ghostream/internal/config" "gitlab.crans.org/nounous/ghostream/internal/monitoring" + "gitlab.crans.org/nounous/ghostream/stream" "gitlab.crans.org/nounous/ghostream/stream/forwarding" "gitlab.crans.org/nounous/ghostream/stream/srt" "gitlab.crans.org/nounous/ghostream/stream/telnet" @@ -43,17 +44,16 @@ func main() { }) localSdpChan := make(chan webrtc.SessionDescription) - // SRT channel for forwarding and webrtc - forwardingChannel := make(chan srt.Packet, 64) - webrtcChannel := make(chan srt.Packet, 64) + // Init streams messaging + streams := make(map[string]*stream.Stream) // Start routines - go forwarding.Serve(forwardingChannel, cfg.Forwarding) + go forwarding.Serve(streams, cfg.Forwarding) go monitoring.Serve(&cfg.Monitoring) - go srt.Serve(&cfg.Srt, authBackend, forwardingChannel, webrtcChannel) - go telnet.Serve(&cfg.Telnet) - go web.Serve(remoteSdpChan, localSdpChan, &cfg.Web) - go webrtc.Serve(remoteSdpChan, localSdpChan, webrtcChannel, &cfg.WebRTC) + go srt.Serve(streams, authBackend, &cfg.Srt) + go telnet.Serve(streams, &cfg.Telnet) + go web.Serve(streams, remoteSdpChan, localSdpChan, &cfg.Web) + go webrtc.Serve(streams, remoteSdpChan, localSdpChan, &cfg.WebRTC) // Wait for routines select {} diff --git a/stream/telnet/telnet.go b/stream/telnet/telnet.go index bb51482..3a4ca54 100644 --- a/stream/telnet/telnet.go +++ b/stream/telnet/telnet.go @@ -59,7 +59,8 @@ func autoStartConversion(streams map[string]*stream.Stream, textStreams map[stri } // Start conversion - log.Print("Starting text conversion of %s", name) + log.Printf("Starting text conversion of %s", name) + // FIXME that is not how to use a pointer textStream = &[]byte{} textStreams[name] = textStream go streamToTextStream(stream, textStream, cfg)