Skip to content

Commit 0f2ca44

Browse files
committed
rename h26xFormat -> h26xStreamingFormat
1 parent 0206493 commit 0f2ca44

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

cmd/lk/join.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func _deprecatedJoinRoom(ctx context.Context, cmd *cli.Command) error {
170170

171171
if cmd.StringSlice("publish") != nil {
172172
fps := cmd.Float("fps")
173-
h26xFormat := cmd.String("h26x-format")
173+
h26xStreamingFormat := cmd.String("h26x-streaming-format")
174174
for _, pub := range cmd.StringSlice("publish") {
175175
onPublishComplete := func(pub *lksdk.LocalTrackPublication) {
176176
if cmd.Bool("exit-after-publish") {
@@ -182,7 +182,7 @@ func _deprecatedJoinRoom(ctx context.Context, cmd *cli.Command) error {
182182
_ = room.LocalParticipant.UnpublishTrack(pub.SID())
183183
}
184184
}
185-
if err = handlePublish(room, pub, fps, h26xFormat, onPublishComplete); err != nil {
185+
if err = handlePublish(room, pub, fps, h26xStreamingFormat, onPublishComplete); err != nil {
186186
return err
187187
}
188188
}
@@ -195,17 +195,17 @@ func _deprecatedJoinRoom(ctx context.Context, cmd *cli.Command) error {
195195
func handlePublish(room *lksdk.Room,
196196
name string,
197197
fps float64,
198-
h26xFormat string,
198+
h26xStreamingFormat string,
199199
onPublishComplete func(pub *lksdk.LocalTrackPublication),
200200
) error {
201201
if isSocketFormat(name) {
202202
mimeType, socketType, address, err := parseSocketFromName(name)
203203
if err != nil {
204204
return err
205205
}
206-
return publishSocket(room, mimeType, socketType, address, fps, h26xFormat, onPublishComplete)
206+
return publishSocket(room, mimeType, socketType, address, fps, h26xStreamingFormat, onPublishComplete)
207207
}
208-
return publishFile(room, name, fps, h26xFormat, onPublishComplete)
208+
return publishFile(room, name, fps, h26xStreamingFormat, onPublishComplete)
209209
}
210210

211211
func publishDemo(room *lksdk.Room) error {
@@ -237,7 +237,7 @@ func publishDemo(room *lksdk.Room) error {
237237
func publishFile(room *lksdk.Room,
238238
filename string,
239239
fps float64,
240-
h26xFormat string,
240+
h26xStreamingFormat string,
241241
onPublishComplete func(pub *lksdk.LocalTrackPublication),
242242
) error {
243243
// Configure provider
@@ -264,13 +264,13 @@ func publishFile(room *lksdk.Room,
264264
opts = append(opts, lksdk.ReaderTrackWithFrameDuration(frameDuration))
265265
}
266266

267-
switch h26xFormat {
267+
switch h26xStreamingFormat {
268268
case "annex-b":
269269
opts = append(opts, lksdk.ReaderTrackWithH26xStreamingFormat(lksdk.H26xStreamingFormatAnnexB))
270270
case "length-prefixed":
271271
opts = append(opts, lksdk.ReaderTrackWithH26xStreamingFormat(lksdk.H26xStreamingFormatLengthPrefixed))
272272
default:
273-
return fmt.Errorf("unsupported h26x format: %s", h26xFormat)
273+
return fmt.Errorf("unsupported h26x format: %s", h26xStreamingFormat)
274274
}
275275
}
276276

@@ -324,7 +324,7 @@ func publishSocket(room *lksdk.Room,
324324
socketType string,
325325
address string,
326326
fps float64,
327-
h26xFormat string,
327+
h26xStreamingFormat string,
328328
onPublishComplete func(pub *lksdk.LocalTrackPublication),
329329
) error {
330330
var mime string
@@ -346,15 +346,15 @@ func publishSocket(room *lksdk.Room,
346346
}
347347

348348
// Publish to room
349-
err = publishReader(room, sock, mime, fps, h26xFormat, onPublishComplete)
349+
err = publishReader(room, sock, mime, fps, h26xStreamingFormat, onPublishComplete)
350350
return err
351351
}
352352

353353
func publishReader(room *lksdk.Room,
354354
in io.ReadCloser,
355355
mime string,
356356
fps float64,
357-
h26xFormat string,
357+
h26xStreamingFormat string,
358358
onPublishComplete func(pub *lksdk.LocalTrackPublication),
359359
) error {
360360
// Configure provider
@@ -373,13 +373,13 @@ func publishReader(room *lksdk.Room,
373373
opts = append(opts, lksdk.ReaderTrackWithFrameDuration(frameDuration))
374374
}
375375

376-
switch h26xFormat {
376+
switch h26xStreamingFormat {
377377
case "annex-b":
378378
opts = append(opts, lksdk.ReaderTrackWithH26xStreamingFormat(lksdk.H26xStreamingFormatAnnexB))
379379
case "length-prefixed":
380380
opts = append(opts, lksdk.ReaderTrackWithH26xStreamingFormat(lksdk.H26xStreamingFormatLengthPrefixed))
381381
default:
382-
return fmt.Errorf("unsupported h264 format: %s", h26xFormat)
382+
return fmt.Errorf("unsupported h264 format: %s", h26xStreamingFormat)
383383
}
384384
}
385385

@@ -437,7 +437,7 @@ func parseSimulcastURL(url string) (*simulcastURLParts, error) {
437437
}
438438

439439
// createSimulcastVideoTrack creates a simulcast video track from a TCP or Unix socket H.264 streams
440-
func createSimulcastVideoTrack(urlParts *simulcastURLParts, quality livekit.VideoQuality, fps float64, h26xFormat string, onComplete func()) (*lksdk.LocalTrack, error) {
440+
func createSimulcastVideoTrack(urlParts *simulcastURLParts, quality livekit.VideoQuality, fps float64, h26xStreamingFormat string, onComplete func()) (*lksdk.LocalTrack, error) {
441441
conn, err := net.Dial(urlParts.network, urlParts.address)
442442
if err != nil {
443443
return nil, fmt.Errorf("failed to connect to %s://%s: %w", urlParts.network, urlParts.address, err)
@@ -456,13 +456,13 @@ func createSimulcastVideoTrack(urlParts *simulcastURLParts, quality livekit.Vide
456456
opts = append(opts, lksdk.ReaderTrackWithFrameDuration(frameDuration))
457457
}
458458

459-
switch h26xFormat {
459+
switch h26xStreamingFormat {
460460
case "annex-b":
461461
opts = append(opts, lksdk.ReaderTrackWithH26xStreamingFormat(lksdk.H26xStreamingFormatAnnexB))
462462
case "length-prefixed":
463463
opts = append(opts, lksdk.ReaderTrackWithH26xStreamingFormat(lksdk.H26xStreamingFormatLengthPrefixed))
464464
default:
465-
return nil, fmt.Errorf("unsupported h264 format: %s", h26xFormat)
465+
return nil, fmt.Errorf("unsupported h264 format: %s", h26xStreamingFormat)
466466
}
467467

468468
// Configure simulcast layer
@@ -484,7 +484,7 @@ type simulcastLayer struct {
484484
}
485485

486486
// handleSimulcastPublish handles publishing multiple H.264 streams as a simulcast track
487-
func handleSimulcastPublish(room *lksdk.Room, urls []string, fps float64, h26xFormat string, onPublishComplete func(*lksdk.LocalTrackPublication)) error {
487+
func handleSimulcastPublish(room *lksdk.Room, urls []string, fps float64, h26xStreamingFormat string, onPublishComplete func(*lksdk.LocalTrackPublication)) error {
488488
// Parse all URLs
489489
var layers []simulcastLayer
490490
for _, url := range urls {
@@ -547,7 +547,7 @@ func handleSimulcastPublish(room *lksdk.Room, urls []string, fps float64, h26xFo
547547
}
548548

549549
for _, layer := range layers {
550-
track, err := createSimulcastVideoTrack(layer.parts, layer.quality, fps, h26xFormat, signalCompletion)
550+
track, err := createSimulcastVideoTrack(layer.parts, layer.quality, fps, h26xStreamingFormat, signalCompletion)
551551
if err != nil {
552552
// Clean up any tracks we've already created
553553
for _, t := range tracks {

cmd/lk/room.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ var (
173173
Usage: "If video files are published, indicates `FPS` of video",
174174
},
175175
&cli.StringFlag{
176-
Name: "h26x-format",
176+
Name: "h26x-streaming-format",
177177
Usage: "Format to use when reading H.264 from file or socket, \"annex-b\" OR \"length-prefixed\"",
178178
Value: "annex-b",
179179
},
@@ -1000,7 +1000,7 @@ func joinRoom(ctx context.Context, cmd *cli.Command) error {
10001000
if simulcastMode {
10011001
// Handle simulcast publishing
10021002
fps := cmd.Float("fps")
1003-
h26xFormat := cmd.String("h26x-format")
1003+
h26xStreamingFormat := cmd.String("h26x-streaming-format")
10041004
onPublishComplete := func(pub *lksdk.LocalTrackPublication) {
10051005
if exitAfterPublish {
10061006
close(done)
@@ -1012,13 +1012,13 @@ func joinRoom(ctx context.Context, cmd *cli.Command) error {
10121012
}
10131013
}
10141014

1015-
if err = handleSimulcastPublish(room, publishUrls, fps, h26xFormat, onPublishComplete); err != nil {
1015+
if err = handleSimulcastPublish(room, publishUrls, fps, h26xStreamingFormat, onPublishComplete); err != nil {
10161016
return err
10171017
}
10181018
} else {
10191019
// Handle single publish
10201020
fps := cmd.Float("fps")
1021-
h26xFormat := cmd.String("h26x-format")
1021+
h26xStreamingFormat := cmd.String("h26x-streaming-format")
10221022
for _, pub := range publishUrls {
10231023
onPublishComplete := func(pub *lksdk.LocalTrackPublication) {
10241024
if exitAfterPublish {
@@ -1030,7 +1030,7 @@ func joinRoom(ctx context.Context, cmd *cli.Command) error {
10301030
_ = room.LocalParticipant.UnpublishTrack(pub.SID())
10311031
}
10321032
}
1033-
if err = handlePublish(room, pub, fps, h26xFormat, onPublishComplete); err != nil {
1033+
if err = handlePublish(room, pub, fps, h26xStreamingFormat, onPublishComplete); err != nil {
10341034
return err
10351035
}
10361036
}

0 commit comments

Comments
 (0)