fix: normalize WHIP placeholder format in address resolution

This commit is contained in:
Cesar Mendivil 2026-03-14 12:40:00 -07:00
parent 7a8073eedd
commit c761b4e9b8

View File

@ -28,6 +28,11 @@ import (
"github.com/Masterminds/semver/v3"
)
// whipPlaceholderRe matches the {whip:name=<streamKey>} format emitted by the
// Restreamer UI. The replacer engine expects {whip,name=<streamKey>} (comma
// separated params), so we normalize before expansion.
var whipPlaceholderRe = regexp.MustCompile(`\{whip:name=([^}]+)\}`)
// The Restreamer interface
type Restreamer interface {
ID() string // ID of this instance
@ -1546,6 +1551,8 @@ func resolvePlaceholders(config *app.Config, r replace.Replacer) {
input.Address = r.Replace(input.Address, "fs:*", "", vars, config, "input")
input.Address = r.Replace(input.Address, "rtmp", "", vars, config, "input")
input.Address = r.Replace(input.Address, "srt", "", vars, config, "input")
// Normalize {whip:name=X} (UI format) → {whip,name=X} (replacer format)
input.Address = whipPlaceholderRe.ReplaceAllString(input.Address, "{whip,name=$1}")
input.Address = r.Replace(input.Address, "whip", "", vars, config, "input")
// WHIP SDP relay URLs (http://…/whip/…/sdp) require FFmpeg to open nested