Skip to content

Commit

Permalink
allow passing port, latency via cmdline
Browse files Browse the repository at this point in the history
  • Loading branch information
iSchluff committed Nov 11, 2020
1 parent ff83cca commit d15f44b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,34 @@
package main

import (
"flag"
"log"
"strconv"

"github.com/haivision/srtgo"
"github.com/voc/srtrelay/server"
)

func main() {
var port = flag.Int("port", 1337, "relay port (default 1337)")
var latency = flag.Int("latency", 300, "srt latency in ms (default 300)")
flag.Parse()

options := make(map[string]string)
options["blocking"] = "0"
options["transtype"] = "live"
options["latency"] = "300"
options["latency"] = strconv.Itoa(*latency)

address := "0.0.0.0"
port := uint16(8090)
buffersize := uint(384000) // 1s @ 3Mbits/

sck := srtgo.NewSrtSocket(address, port, options)
sck := srtgo.NewSrtSocket(address, uint16(*port), options)
err := sck.Listen(1)
defer sck.Close()
if err != nil {
log.Fatalln("listen failed", err)
}
log.Printf("Listening on %s:%d\n", address, port)
log.Printf("Listening on %s:%d\n", address, *port)

server := server.NewServer(buffersize)
for {
Expand Down

0 comments on commit d15f44b

Please sign in to comment.