Skip to content

Commit

Permalink
Fix bug when the streaming tuner limit is reached and a custom image …
Browse files Browse the repository at this point in the history
…should be displayed

Signed-off-by: Marcel Goerentz <m.goerentz@t-online.de>
  • Loading branch information
marcelGoerentz committed Jan 24, 2025
1 parent bb50831 commit af3efd4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ FROM base AS beta
RUN go build -tags beta .

FROM ${BUILD_FLAG} AS builder
ARG BRANCH
RUN echo "Build ${BRANCH} version"
ARG BUILD_FLAG
RUN echo "Build ${BUILD_FLAG} version"

# Second stage. Creating an image
# -----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ func (sb *StreamBuffer) writeBytesToPipe(data []byte) error {
sb.Stream.ReportError(err, 0, "", true) // TODO: Add error code
return err
}
time.Sleep(800 * time.Millisecond)
}
}
}
16 changes: 7 additions & 9 deletions src/streamManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,14 @@ func GetStreamLimitContent() ([]byte, bool) {
createContent := ShouldCreateContent(fileList)
if createContent && len(imageFileList) > 0 {
err := CreateAlternativNoMoreStreamsVideo(System.Folder.Custom + imageFileList[0].Name())
if err == nil {
contentOk = true
} else {
ShowError(err, 0)
return nil, false
}
content, err = os.ReadFile(System.Folder.Video + fileList[0].Name())
if err != nil {
ShowError(err, 0)
}
}
content, err = os.ReadFile(System.Folder.Video + fileList[0].Name())
if err != nil {
ShowError(err, 0)
} else {
contentOk = true
}
}
Expand Down Expand Up @@ -474,9 +472,9 @@ func CreateAlternativNoMoreStreamsVideo(pathToFile string) error {
func prepareArguments(pathToFile string) (string, []string) {
switch Settings.Buffer {
case "ffmpeg", "threadfin", "-":
return Settings.FFmpegPath, []string{"--no-audio", "--loop", "--sout", fmt.Sprintf("'#transcode{vcodec=h264,vb=1024,scale=1,width=1920,height=1080,acodec=none,venc=x264{preset=ultrafast}}:standard{access=file,mux=ts,dst=%sstream-limit.ts}'", System.Folder.Video), System.Folder.Video, pathToFile}
return Settings.FFmpegPath, []string{"-loop", "1", "-i", pathToFile, "-c:v", "libx264", "-t", "1", "-pix_fmt", "yuv420p", "-vf", "scale=1920:1080", fmt.Sprintf("%sstream-limit.ts", System.Folder.Video)}
case "vlc":
return Settings.VLCPath, []string{"-loop", "1", "-i", pathToFile, "-c:v", "libx264", "-t", "1", "-pix_fmt", "yuv420p", "-vf", "scale=1920:1080", fmt.Sprintf("%sstream-limit.ts", System.Folder.Video)}
return Settings.VLCPath, []string{"--no-audio", "--loop", "--sout", fmt.Sprintf("'#transcode{vcodec=h264,vb=1024,scale=1,width=1920,height=1080,acodec=none,venc=x264{preset=ultrafast}}:standard{access=file,mux=ts,dst=%sstream-limit.ts}'", System.Folder.Video), System.Folder.Video, pathToFile}
default:
return "", []string{}
}
Expand Down

0 comments on commit af3efd4

Please sign in to comment.