Skip to content

Commit

Permalink
VLive: Fix the re bug for file. v5.13.27
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Feb 6, 2024
1 parent 5d86495 commit 46357e1
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 10 deletions.
3 changes: 2 additions & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,8 @@ The following are the update records for the SRS Stack server.
* Room: Fix the empty room UI sort and secret bug. [v5.13.23](https://github.com/ossrs/srs-stack/releases/tag/v5.13.23)
* FFmpeg: Fix restart bug for abnormal speed. v5.13.24
* FFmpeg: Fix bug for output SRT protocol. v5.13.25
* FFmpeg: Support ingest SRT protocol. [v5.13.26](https://github.com/ossrs/srs-stack/releases/tag/v5.13.26)
* FFmpeg: Support ingest SRT protocol. v5.13.26
* VLive: Fix the re bug for file. [v5.13.27](https://github.com/ossrs/srs-stack/releases/tag/v5.13.27)
* v5.12
* Refine local variable name conf to config. v5.12.1
* Add forced exit on timeout for program termination. v5.12.1
Expand Down
4 changes: 1 addition & 3 deletions platform/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -585,9 +585,7 @@ func (v *ForwardTask) doForward(ctx context.Context, input *SrsStream) error {

// Start FFmpeg process.
args := []string{}
args = append(args, "-re",
"-fflags", "nobuffer", // Reduce the latency introduced by optional buffering.
)
args = append(args, "-re")
// For RTSP stream source, always use TCP transport.
if strings.HasPrefix(inputURL, "rtsp://") {
args = append(args, "-rtsp_transport", "tcp")
Expand Down
1 change: 1 addition & 0 deletions platform/trancode.go
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ func (v *TranscodeTask) doTranscode(ctx context.Context, input *SrsStream) error

// Start FFmpeg process.
args := []string{}
args = append(args, "-re")
// For RTSP stream source, always use TCP transport.
if strings.HasPrefix(inputURL, "rtsp://") {
args = append(args, "-rtsp_transport", "tcp")
Expand Down
12 changes: 11 additions & 1 deletion platform/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,8 @@ func (v *FFmpegHeartbeat) Parse(u *url.URL) {
// Polling the FFmpeg stderr and detect the error.
func (v *FFmpegHeartbeat) Polling(ctx context.Context, stderr io.Reader) {
pollingReadyCtx, cancelPollingReady := context.WithCancel(ctx)
logger.Tf(ctx, "FFmpeg: Start to polling heartbeat, start=%v, msd=%v, afs=%v",
v.starttime, v.MaxStreamDuration, v.AbnormalFastSpeed)

// Print the extra logs when quit.
go func() {
Expand Down Expand Up @@ -1584,6 +1586,7 @@ func (v *FFmpegHeartbeat) Polling(ctx context.Context, stderr io.Reader) {
}()

// Handle the FFmpeg log, detect the error and update the heartbeat.
var firstNormalFrame bool
handleOutputOfFFmpeg := func(ffmpegLog string) {
// Filter the line of log.
line := strings.TrimSpace(ffmpegLog)
Expand All @@ -1603,7 +1606,7 @@ func (v *FFmpegHeartbeat) Polling(ctx context.Context, stderr io.Reader) {
v.extraLogs = append(v.extraLogs, line)
return
}
if strings.Contains(line, "time=N/A") || strings.Contains(line, "time=00:00:00.00") {
if strings.Contains(line, "time=N/A") || strings.Contains(line, "speed=N/A") {
v.extraLogs = append(v.extraLogs, line)
return
}
Expand Down Expand Up @@ -1659,6 +1662,13 @@ func (v *FFmpegHeartbeat) Polling(ctx context.Context, stderr io.Reader) {

v.update, v.parsedCount = time.Now(), v.parsedCount+1
v.line, v.timestamp, v.speed = line, timestamp, speed
if !firstNormalFrame {
firstNormalFrame = true
logger.Tf(ctx, "FFmpeg: First normal frame, parsed=%v, failed=%v,<%v>, speed=%v,%v,%v,<%v>, not-change=%v,<%v>, last=<%v>",
v.parsedCount, v.failedParsedCount, v.lastFailedParsed, v.failedSpeedCount,
v.veryFastSpeedCount, v.verySlowSpeedCount, v.lastFailedSpeed, v.notChangedCount, v.lastNotChanged,
v.line)
}

// Handle the routine heartbeat logs.
select {
Expand Down
2 changes: 1 addition & 1 deletion platform/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
package main

// The version for platform.
const version = "v5.13.26"
const version = "v5.13.27"
3 changes: 2 additions & 1 deletion platform/virtual-live-stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,8 +1032,9 @@ func (v *VLiveTask) doVirtualLiveStream(ctx context.Context, input *FFprobeSourc

// Start FFmpeg process.
args := []string{}
if input.Type != FFprobeSourceTypeStream {
if input.Type == FFprobeSourceTypeFile || input.Type == FFprobeSourceTypeUpload {
args = append(args, "-stream_loop", "-1")
args = append(args, "-re")
}
// For RTSP stream source, always use TCP transport.
if strings.HasPrefix(input.Target, "rtsp://") {
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-aapanel/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "SRS Stack",
"name": "srs_stack",
"ps": "SRS Stack is an all-in-one, out-of-the-box, and open-source video solution for creating online video services, including live streaming and WebRTC, on the cloud or through self-hosting. Built with SRS, FFmpeg, and WebRTC, it supports various protocols and offers features like authentication, multi-platform streaming, recording, transcoding, virtual live events, AI transcription, AI assistant, automatic HTTPS, and HTTP Open API.",
"versions": "5.13.26",
"versions": "5.13.27",
"checks": "/www/server/panel/plugin/srs_stack",
"author": "Winlin",
"home": "https://github.com/ossrs/srs-stack"
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-bt/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "SRS音视频服务器",
"name": "srs_stack",
"ps": "SRS Stack让你一键拥有自己的视频云解决方案,可以在云上或私有化部署,支持丰富的音视频协议,提供鉴权、私人直播间、多平台转播、录制、转码、虚拟直播、AI字幕、直播间AI助手、自动HTTPS、开放API等丰富功能,基于SRS、FFmpeg和WebRTC构建。",
"versions": "5.13.26",
"versions": "5.13.27",
"checks": "/www/server/panel/plugin/srs_stack",
"author": "Winlin",
"home": "https://github.com/ossrs/srs-stack"
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-droplet/srs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"do_token": "{{env `DIGITALOCEAN_TOKEN`}}",
"image_name": "srs-5-snapshot-{{timestamp}}",
"application_name": "SRS",
"application_version": "5.13.26"
"application_version": "5.13.27"
},
"sensitive-variables": ["do_token"],
"builders": [
Expand Down

0 comments on commit 46357e1

Please sign in to comment.