Skip to content

Commit 32cb317

Browse files
Rename ohost to media-host
1 parent 9aa56f0 commit 32cb317

File tree

5 files changed

+19
-16
lines changed

5 files changed

+19
-16
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Usage:
2929
Params:
3030

3131
- `-host` Host name of broadcaster to stream to
32+
- `-media-host` Host name to read transcoded stream from. If not specified, `-host` will be used
3233
- `-rtmp` Port number to stream RTMP stream to
3334
- `-media` Port number to download media from
3435
- `-profiles` How many transcoding profiles broadcaster configured with
@@ -136,6 +137,7 @@ Accepts object:
136137
```json
137138
{
138139
"host": "localhost",
140+
"media_host": "",
139141
"file_name": "official_test_source_2s_keys_24pfs.mp4",
140142
"rtmp": 1935,
141143
"media": 8935,

cmd/streamtester/streamtester.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ func main() {
3030
sim := flag.Uint("sim", 1, "Number of simulteneous streams to stream")
3131
repeat := flag.Uint("repeat", 1, "Number of time to repeat")
3232
profiles := flag.Int("profiles", 2, "Number of transcoding profiles configured on broadcaster")
33-
bhost := flag.String("host", "localhost", "Broadcaster's host name")
34-
ohost := flag.String("orch", "", "Orchestrator's host name - Broadcaster host will be used by default if not specified")
33+
bhost := flag.String("host", "localhost", "Host name (usually broadcaster's) to stream RTMP stream to")
34+
mhost := flag.String("media-host", "", "Host name to read transcoded segments back from. -host will be used by default if not specified")
3535
rtmp := flag.String("rtmp", "1935", "RTMP port number")
3636
media := flag.String("media", "8935", "Media port number")
3737
stime := flag.String("time", "", "Time to stream streams (40s, 4m, 24h45m). Not compatible with repeat option.")
@@ -126,9 +126,9 @@ func main() {
126126
return
127127
}
128128

129-
oHost := *ohost
130-
if oHost == "" {
131-
oHost = *bhost
129+
mHost := *mhost
130+
if mHost == "" {
131+
mHost = *bhost
132132
}
133133

134134
var streamDuration time.Duration
@@ -150,7 +150,7 @@ func main() {
150150
} else {
151151
sr = testers.NewHTTPLoadTester()
152152
}
153-
err = sr.StartStreams(fn, *bhost, *rtmp, oHost, *media, *sim, *repeat, streamDuration, false, *latency, *noBar, 3, 5*time.Second, waitForDur)
153+
err = sr.StartStreams(fn, *bhost, *rtmp, mHost, *media, *sim, *repeat, streamDuration, false, *latency, *noBar, 3, 5*time.Second, waitForDur)
154154
if err != nil {
155155
glog.Fatal(err)
156156
}

internal/model/models.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type Streamer2 interface {
3131

3232
// Streamer interface
3333
type Streamer interface {
34-
StartStreams(sourceFileName, bhost, rtmpPort, ohost, mediaPort string, simStreams, repeat uint, streamDuration time.Duration,
34+
StartStreams(sourceFileName, bhost, rtmpPort, mhost, mediaPort string, simStreams, repeat uint, streamDuration time.Duration,
3535
notFinal, measureLatency, noBar bool, groupStartBy int, startDelayBetweenGroups, waitForTarget time.Duration) error
3636
Stats() *Stats
3737
StatsFormatted() string
@@ -80,8 +80,8 @@ type Stats struct {
8080
// StartStreamsReq start streams request
8181
type StartStreamsReq struct {
8282
FileName string `json:"file_name"`
83-
BHost string `json:"host"`
84-
OHost string `json:"ohost"`
83+
Host string `json:"host"`
84+
MHost string `json:"media_host"`
8585
RTMP int `json:"rtmp"`
8686
Media int `json:"media"`
8787
Repeat uint `json:"repeat"`

internal/server/server.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,13 @@ func (ss *StreamerServer) handleStartStreams(w http.ResponseWriter, r *http.Requ
122122
return
123123
}
124124
glog.Infof("Start streams request %+v", *ssr)
125-
if ssr.BHost == "" {
125+
if ssr.Host == "" {
126126
w.WriteHeader(http.StatusBadRequest)
127127
w.Write([]byte("Should specify 'host' field"))
128128
return
129129
}
130-
if ssr.OHost == "" {
131-
ssr.OHost = ssr.BHost
130+
if ssr.MHost == "" {
131+
ssr.MHost = ssr.Host
132132
}
133133
if ssr.Repeat <= 0 {
134134
ssr.Repeat = 1
@@ -170,7 +170,7 @@ func (ss *StreamerServer) handleStartStreams(w http.ResponseWriter, r *http.Requ
170170
}
171171
}
172172

173-
ss.streamer.StartStreams(ssr.FileName, ssr.BHost, strconv.Itoa(ssr.RTMP), ssr.OHost, strconv.Itoa(ssr.Media), ssr.Simultaneous,
173+
ss.streamer.StartStreams(ssr.FileName, ssr.Host, strconv.Itoa(ssr.RTMP), ssr.MHost, strconv.Itoa(ssr.Media), ssr.Simultaneous,
174174
ssr.Repeat, streamDuration, true, ssr.MeasureLatency, true, 3, 5*time.Second, 0)
175175

176176
w.Header().Set("Content-Type", "application/json")

internal/testers/streamer.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,12 @@ func (sr *streamer) StartStreams(sourceFileName, bhost, rtmpPort, ohost, mediaPo
114114
return nil
115115
}
116116

117-
func (sr *streamer) startStreams(sourceFileName, bhost, ohost string, nRtmpPort, nMediaPort int, simStreams uint, showProgress,
117+
func (sr *streamer) startStreams(sourceFileName, bhost, mhost string, nRtmpPort, nMediaPort int, simStreams uint, showProgress,
118118
measureLatency bool, totalSegments int, groupStartBy int, startDelayBetweenGroups, waitForTarget time.Duration) error {
119119

120120
// fmt.Printf("Starting streaming %s to %s:%d, number of streams is %d\n", sourceFileName, bhost, nRtmpPort, simStreams)
121-
msg := fmt.Sprintf("Starting streaming %s to %s:%d, number of streams is %d\n", sourceFileName, bhost, nRtmpPort, simStreams)
121+
msg := fmt.Sprintf("Starting streaming %s to %s:%d, number of streams is %d, reading back from %s:%d\n", sourceFileName, bhost, nRtmpPort, simStreams,
122+
mhost, nMediaPort)
122123
messenger.SendMessage(msg)
123124
fmt.Println(msg)
124125
rtmpURLTemplate := "rtmp://%s:%d/%s"
@@ -140,7 +141,7 @@ func (sr *streamer) startStreams(sourceFileName, bhost, ohost string, nRtmpPort,
140141
}
141142
manifesID := fmt.Sprintf("%s_%d", baseManfistID, i)
142143
rtmpURL := fmt.Sprintf(rtmpURLTemplate, bhost, nRtmpPort, manifesID)
143-
mediaURL := fmt.Sprintf(mediaURLTemplate, ohost, nMediaPort, manifesID)
144+
mediaURL := fmt.Sprintf(mediaURLTemplate, mhost, nMediaPort, manifesID)
144145
glog.Infof("RTMP: %s", rtmpURL)
145146
glog.Infof("MEDIA: %s", mediaURL)
146147
var bar *uiprogress.Bar

0 commit comments

Comments
 (0)