Define streams in main.go
This commit is contained in:
parent
88dfc22d81
commit
1469bd8759
16
main.go
16
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 {}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue