mirror of
https://gitlab.crans.org/nounous/ghostream.git
synced 2024-12-23 00:22:19 +00:00
Switch to haivision SRT module
This commit is contained in:
parent
1cba80d53e
commit
622bb42435
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.13
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/go-ldap/ldap/v3 v3.2.3
|
github.com/go-ldap/ldap/v3 v3.2.3
|
||||||
github.com/openfresh/gosrt v0.2.0
|
github.com/haivision/srtgo v0.0.0-20200731151239-e00427ae473a
|
||||||
github.com/pion/webrtc/v3 v3.0.0-beta.5
|
github.com/pion/webrtc/v3 v3.0.0-beta.5
|
||||||
github.com/prometheus/client_golang v1.7.1
|
github.com/prometheus/client_golang v1.7.1
|
||||||
github.com/spf13/viper v1.7.1
|
github.com/spf13/viper v1.7.1
|
||||||
|
4
go.sum
4
go.sum
@ -132,6 +132,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmg
|
|||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpgL2+G+NZTnrVHpWWfpdw=
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||||
|
github.com/haivision/srtgo v0.0.0-20200731151239-e00427ae473a h1:JliMkv/mAqM5+QzG6Hkw1XcVl1crU8yIQGnhppMv7s0=
|
||||||
|
github.com/haivision/srtgo v0.0.0-20200731151239-e00427ae473a/go.mod h1:yVZ4oACfcnUAcxrh+0b6IuIWfkHLK3IAQ99tuuhRx54=
|
||||||
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=
|
||||||
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||||
@ -214,8 +216,6 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k
|
|||||||
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
|
||||||
github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
|
github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
|
||||||
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
|
||||||
github.com/openfresh/gosrt v0.2.0 h1:L8Nq5k9G/88YxdBDorcFi+jxxfJdUmMv0151bCmYBKw=
|
|
||||||
github.com/openfresh/gosrt v0.2.0/go.mod h1:lSCk9gKdRrO0xHbS3LlVgoofxId8QF56jmxGwBX3XlM=
|
|
||||||
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
github.com/openzipkin/zipkin-go v0.1.1/go.mod h1:NtoC/o8u3JlF1lSlyPNswIbeQH9bJTmOf0Erfk+hxe8=
|
||||||
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
|
||||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package srt
|
package srt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
|
||||||
|
|
||||||
"github.com/openfresh/gosrt/srt"
|
"github.com/haivision/srtgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Options holds web package configuration
|
// Options holds web package configuration
|
||||||
@ -15,23 +15,21 @@ type Options struct {
|
|||||||
// Serve SRT server
|
// Serve SRT server
|
||||||
func Serve(cfg *Options) {
|
func Serve(cfg *Options) {
|
||||||
log.Printf("SRT server listening on %s", cfg.ListenAddress)
|
log.Printf("SRT server listening on %s", cfg.ListenAddress)
|
||||||
l, _ := srt.Listen("srt", cfg.ListenAddress)
|
|
||||||
defer l.Close()
|
options := make(map[string]string)
|
||||||
|
options["transtype"] = "file"
|
||||||
|
|
||||||
|
// FIXME: cfg.ListenAddress -> host and port
|
||||||
|
sck := srtgo.NewSrtSocket("0.0.0.0", 9710, options)
|
||||||
|
sck.Listen(1)
|
||||||
|
s, _ := sck.Accept()
|
||||||
|
|
||||||
|
buff := make([]byte, 2048)
|
||||||
for {
|
for {
|
||||||
conn, err := l.Accept()
|
n, _ := s.Read(buff, 10000)
|
||||||
if err != nil {
|
if n == 0 {
|
||||||
log.Println("Error on incoming SRT stream", err)
|
break
|
||||||
}
|
}
|
||||||
log.Printf("New incomming SRT stream from %s", conn.RemoteAddr())
|
fmt.Println("Received %d bytes", n)
|
||||||
|
|
||||||
go func(sc net.Conn) {
|
|
||||||
defer sc.Close()
|
|
||||||
|
|
||||||
for {
|
|
||||||
//mon := conn.(*srt.SRTConn).Stats()
|
|
||||||
//s, _ := json.MarshalIndent(mon, "", "\t")
|
|
||||||
//fmt.Println(string(s))
|
|
||||||
}
|
|
||||||
}(conn)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user