new new new

This commit is contained in:
legop3
2025-11-14 21:18:35 -05:00
parent 6f6104792b
commit 0d233677f6
10 changed files with 88 additions and 126 deletions
+5 -8
View File
@@ -94,7 +94,7 @@ func LoadConfig(path string) (*Config, error) {
},
},
Media: MediaConfig{
PublishPort: 8889,
PublishPort: 9000,
HealthInterval: Duration{Duration: 30 * time.Second},
VideoWidth: 1280,
VideoHeight: 720,
@@ -142,7 +142,7 @@ func LoadConfig(path string) (*Config, error) {
cfg.Media.VideoBitrate = 3000000
}
if cfg.Media.PublishPort <= 0 {
cfg.Media.PublishPort = 8889
cfg.Media.PublishPort = 9000
}
if cfg.Media.PublishURL == "" {
derived, err := derivePublishURL(cfg.ServerURL, cfg.Name, cfg.Media.PublishPort)
@@ -166,12 +166,9 @@ func derivePublishURL(serverURL, roverName string, port int) (string, error) {
if host == "" {
return "", errors.New("serverUrl missing host")
}
scheme := "http"
if parsed.Scheme == "wss" || parsed.Scheme == "https" {
scheme = "https"
}
if port <= 0 {
port = 8889
port = 9000
}
return fmt.Sprintf("%s://%s:%d/whip/%s", scheme, host, port, url.PathEscape(roverName)), nil
streamName := url.PathEscape(roverName)
return fmt.Sprintf("srt://%s:%d?streamid=#!::r=%s,m=publish&latency=20&mode=caller&transtype=live&pkt_size=1316", host, port, streamName), nil
}
+2 -2
View File
@@ -7,7 +7,7 @@ import (
"path/filepath"
)
const publisherEnvPath = "/var/lib/roverd/whip.env"
const publisherEnvPath = "/var/lib/roverd/video.env"
func UpdatePublisherEnv(cfg MediaConfig) error {
if cfg.PublishURL == "" {
@@ -20,7 +20,7 @@ func UpdatePublisherEnv(cfg MediaConfig) error {
return err
}
var buf bytes.Buffer
fmt.Fprintf(&buf, "WHIP_URL=%s\n", cfg.PublishURL)
fmt.Fprintf(&buf, "PUBLISH_URL=%s\n", cfg.PublishURL)
fmt.Fprintf(&buf, "VIDEO_WIDTH=%d\n", cfg.VideoWidth)
fmt.Fprintf(&buf, "VIDEO_HEIGHT=%d\n", cfg.VideoHeight)
fmt.Fprintf(&buf, "VIDEO_FPS=%d\n", cfg.VideoFPS)
+3 -3
View File
@@ -15,13 +15,13 @@ battery:
urgent: 1650
maxWheelSpeed: 350
media:
publishUrl: http://192.168.0.86:8889/whip/roomba-alpha
publishPort: 8889
publishUrl: srt://192.168.0.86:9000?streamid=#!::r=roomba-alpha,m=publish&latency=20&mode=caller&transtype=live&pkt_size=1316
publishPort: 9000
videoWidth: 1280
videoHeight: 720
videoFps: 30
videoBitrate: 3000000
manage: true
service: whip-publisher.service
service: video-publisher.service
healthUrl: ""
healthInterval: 30s