Skip to content

Commit

Permalink
VLive: Fix bug when source codec is not supported. v5.15.13
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jul 10, 2024
1 parent 756af23 commit bc72327
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,7 @@ The following are the update records for the Oryx server.
* Support external redis host and using 127.0.0.1 as default. v5.15.10
* Support setup global OpenAI settings. [v5.15.11](https://github.com/ossrs/oryx/releases/tag/v5.15.11)
* Add youtube-dl binary. v5.15.12
* VLive: Fix bug when source codec is not supported. v5.15.13
* v5.14:
* Merge features and bugfix from releases. v5.14.1
* Dubbing: Support VoD dubbing for multiple languages. [v5.14.2](https://github.com/ossrs/oryx/releases/tag/v5.14.2)
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,17 @@ The features that we're developing:

Oryx is an open-source project, licensed under the [MIT](https://spdx.org/licenses/MIT.html) license.

We also used the following open-source projects:

* [FFmpeg](https://ffmpeg.org/): A complete, cross-platform solution to record, convert and stream audio and video.
* [Redis](https://redis.io/): Redis is an in-memory data store used by millions of developers as a cache, vector database, document database, streaming engine, and message broker.
* [youtube-dl](https://github.com/ytdl-org/youtube-dl): Command-line program to download videos from YouTube.com and other video sites.

Other frameworks we used:

* [Reactjs](https://react.dev/): The library for web and native user interfaces.
* [Go](https://golang.org/): Build simple, secure, scalable systems with Go.

## Developer

For development, please refer to the [Environments](DEVELOPER.md) about the API and architecture.
Expand Down
4 changes: 2 additions & 2 deletions platform/camera-live-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ func (v *CameraTask) Run(ctx context.Context) error {

select {
case <-ctx.Done():
case <-time.After(10 * time.Second):
case <-time.After(4 * time.Second):
}
continue
}
Expand Down Expand Up @@ -948,5 +948,5 @@ func (v *CameraTask) doCameraStreaming(ctx context.Context, input *FFprobeSource
v.Platform, input.Target, v.PID, err,
)

return nil
return err
}
4 changes: 2 additions & 2 deletions platform/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ func (v *ForwardTask) Run(ctx context.Context) error {

select {
case <-ctx.Done():
case <-time.After(10 * time.Second):
case <-time.After(4 * time.Second):
}
continue
}
Expand Down Expand Up @@ -698,5 +698,5 @@ func (v *ForwardTask) doForward(ctx context.Context, input *SrsStream) error {
v.Platform, input.StreamURL(), v.PID, err,
)

return nil
return err
}
2 changes: 1 addition & 1 deletion platform/ocr.go
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ func (v *OCRTask) Run(ctx context.Context) error {

select {
case <-ctx.Done():
case <-time.After(10 * time.Second):
case <-time.After(4 * time.Second):
}
continue
}
Expand Down
4 changes: 2 additions & 2 deletions platform/trancode.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func (v *TranscodeTask) Run(ctx context.Context) error {

select {
case <-ctx.Done():
case <-time.After(10 * time.Second):
case <-time.After(4 * time.Second):
}
continue
}
Expand Down Expand Up @@ -573,7 +573,7 @@ func (v *TranscodeTask) doTranscode(ctx context.Context, input *SrsStream) error
logger.Tf(ctx, "transcode done, stream=%v, pid=%v, err=%v",
input.StreamURL(), v.PID, err,
)
return nil
return err
}

func (v *TranscodeTask) updateFrame(frame string) {
Expand Down
2 changes: 1 addition & 1 deletion platform/transcript.go
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,7 @@ func (v *TranscriptTask) Run(ctx context.Context) error {

select {
case <-ctx.Done():
case <-time.After(10 * time.Second):
case <-time.After(4 * time.Second):
}
continue
}
Expand Down
13 changes: 11 additions & 2 deletions platform/virtual-live-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,15 @@ func (v *VLiveWorker) Handle(ctx context.Context, handler *http.ServeMux) error
}
}

// Only accept common codec for video and audio.
allowedCodec := []string{"h264", "h265", "aac", "mp3"}
if matchVideo != nil && !slicesContains(allowedCodec, matchVideo.CodecName) {
return errors.Errorf("invalid video codec %v, should be %v", matchVideo.CodecName, allowedCodec)
}
if matchAudio != nil && !slicesContains(allowedCodec, matchAudio.CodecName) {
return errors.Errorf("invalid audio codec %v, should be %v", matchAudio.CodecName, allowedCodec)
}

parsedFile := &FFprobeSource{
Name: file.Name, Path: file.Path, Size: uint64(file.Size), UUID: file.UUID,
Target: file.Target,
Expand Down Expand Up @@ -1033,7 +1042,7 @@ func (v *VLiveTask) Run(ctx context.Context) error {

select {
case <-ctx.Done():
case <-time.After(10 * time.Second):
case <-time.After(4 * time.Second):
}
continue
}
Expand Down Expand Up @@ -1160,5 +1169,5 @@ func (v *VLiveTask) doVirtualLiveStream(ctx context.Context, input *FFprobeSourc
v.Platform, input.Target, v.PID, err,
)

return nil
return err
}

0 comments on commit bc72327

Please sign in to comment.