build:
- go build -o tv.out .
+ go build -o soliagain.out .
.PHONY: test
servePort: "8080"
maxFileSize: 838860800
stream:
- turnServerAddr: "stun.l.google.com:19302"
+ turnServerAddr: "stun:stun.l.google.com:19302"
rtcpPLIInterval: 3
uploadDest: "./upload/"
extAllowList:
- "mp4"
+ udpBufferByteSize: 300000
signalPort: "8082"
rtpReceivePort: "8084"
utils:
import (
"os"
- "time"
"gopkg.in/yaml.v3"
)
ServePort string `yaml:"servePort"`
MaxFileSize int64 `yaml:"maxFileSize"`
Stream struct {
- TurnServerAddr string `yaml:"turnServerAddr"`
- RtcpPLIInterval time.Duration `yaml:"rtcpPLIInterval"`
- UploadDest string `yaml:"uploadDest"`
- ExtAllowList []string `yaml:"extAllowList"`
- SignalPort string `yaml:"signalPort"`
- RtpReceivePort string `yaml:"rtpReceivePort"`
+ TurnServerAddr string `yaml:"turnServerAddr"`
+ RtcpPLIInterval int `yaml:"rtcpPLIInterval"`
+ UploadDest string `yaml:"uploadDest"`
+ ExtAllowList []string `yaml:"extAllowList"`
+ UdpBufferByteSize int `yaml:"udpBufferByteSize"`
+ SignalPort string `yaml:"signalPort"`
+ RtpReceivePort string `yaml:"rtpReceivePort"`
} `yaml:"stream"`
Utils struct {
UseCompress bool `yaml:"useCompress"`
pkgstream.EXTERNAL_URL = CONF.ExternalUrl
pkgstream.TURN_SERVER_ADDR = CONF.Stream.TurnServerAddr
- pkgstream.RTCP_PLI_INTERVAL = time.Second * CONF.Stream.RtcpPLIInterval
+ pkgstream.RTCP_PLI_INTERVAL = time.Second * time.Duration(CONF.Stream.RtcpPLIInterval)
pkgstream.UPLOAD_DEST = CONF.Stream.UploadDest
pkgstream.EXTENSION_ALLOWLIST = CONF.Stream.ExtAllowList
+ pkgstream.UDP_BUFFER_BYTE_SIZE = CONF.Stream.UdpBufferByteSize
+
pkgstream.SIGNAL_ADDR = CONF.ServeAddr
pkgstream.SIGNAL_PORT = CONF.Stream.SignalPort
pkgutils "github.com/seantywork/sorrylinus-again/pkg/utils"
)
+var UDP_BUFFER_BYTE_SIZE int
+
var RTP_RECEIVE_ADDR string
var RTP_RECEIVE_PORT string
panic(err)
}
- // Open a UDP Listener for RTP Packets on port 5004
-
var udp_port int
fmt.Sscanf(RTP_RECEIVE_PORT, "%d", &udp_port)
// Increase the UDP receive buffer size
// Default UDP buffer sizes vary on different operating systems
- bufferSize := 300000 // 300KB
+ bufferSize := UDP_BUFFER_BYTE_SIZE // 300KB
err = listener.SetReadBuffer(bufferSize)
if err != nil {
panic(err)