Skip to content

Commit

Permalink
VLive: Fix rebuild URL bug. v5.12.20
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jan 7, 2024
1 parent fec1eea commit b4e505f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,7 @@ The following are the update records for the SRS Stack server.
* Transcript: Check the base url for OpenAI. [v5.12.17](https://github.com/ossrs/srs-stack/releases/tag/v5.12.17)
* HLS: Support low latency mode about 5s. v5.12.18
* RTSP: Rebuild the URL with escaped user info. v5.12.19
* VLive: Fix rebuild URL bug. [v5.12.20](https://github.com/ossrs/srs-stack/releases/tag/v5.12.20)
* v5.11
* VLive: Decrease the latency for virtual live. v5.11.1
* Live: Refine multiple language. v5.11.2
Expand Down
20 changes: 14 additions & 6 deletions platform/virtual-live-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,14 @@ func (v *VLiveWorker) Handle(ctx context.Context, handler *http.ServeMux) error
args = append(args, "-rtsp_transport", "tcp")
}
// Rebuild the stream url, because it may contain special characters.
if u, err := RebuildStreamURL(file.Target); err != nil {
return errors.Wrapf(err, "rebuild %v", file.Target)
if strings.Contains(file.Target, "://") {
if u, err := RebuildStreamURL(file.Target); err != nil {
return errors.Wrapf(err, "rebuild %v", file.Target)
} else {
args = append(args, "-i", u.String())
}
} else {
args = append(args, "-i", u.String())
args = append(args, "-i", file.Target)
}

stdout, err := exec.CommandContext(toCtx, "ffprobe", args...).Output()
Expand Down Expand Up @@ -1084,10 +1088,14 @@ func (v *VLiveTask) doVLive(ctx context.Context, input *VLiveSourceFile) error {
args = append(args, "-rtsp_transport", "tcp")
}
// Rebuild the stream url, because it may contain special characters.
if u, err := RebuildStreamURL(input.Target); err != nil {
return errors.Wrapf(err, "rebuild %v", input.Target)
if strings.Contains(input.Target, "://") {
if u, err := RebuildStreamURL(input.Target); err != nil {
return errors.Wrapf(err, "rebuild %v", input.Target)
} else {
args = append(args, "-i", u.String())
}
} else {
args = append(args, "-i", u.String())
args = append(args, "-i", input.Target)
}
args = append(args, "-c", "copy", "-f", "flv", outputURL)
cmd := exec.CommandContext(ctx, "ffmpeg", args...)
Expand Down

0 comments on commit b4e505f

Please sign in to comment.