Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Live AI - remove studio output stream push #3429

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions server/ai_live_video.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,6 @@
func startTrickleSubscribe(ctx context.Context, url *url.URL, params aiRequestParams, onFistSegment func()) {
// subscribe to the outputs and send them into LPMS
subscriber := trickle.NewTrickleSubscriber(url.String())
r, w, err := os.Pipe()
if err != nil {
params.liveParams.stopPipeline(fmt.Errorf("error getting pipe for trickle-ffmpeg. url=%s %w", url, err))
return
}
rMediaMTX, wMediaMTX, err := os.Pipe()
if err != nil {
params.liveParams.stopPipeline(fmt.Errorf("error getting pipe for MediaMTX trickle-ffmpeg. url=%s %w", url, err))
Expand All @@ -184,14 +179,11 @@
ctx = clog.AddVal(ctx, "outputRTMPURL", params.liveParams.outputRTMPURL)
ctx = clog.AddVal(ctx, "mediaMTXOutputRTMPURL", params.liveParams.mediaMTXOutputRTMPURL)

multiWriter := &multiWriter{ctx: ctx, writers: []io.Writer{w, wMediaMTX}}

// read segments from trickle subscription
go func() {
var err error
firstSegment := true

defer w.Close()
defer wMediaMTX.Close()
retries := 0
// we're trying to keep (retryPause x maxRetries) duration to fall within one output GOP length
Expand Down Expand Up @@ -231,7 +223,7 @@
seq := trickle.GetSeq(segment)
clog.V(8).Infof(ctx, "trickle subscribe read data received seq=%d", seq)

n, err := copySegment(segment, multiWriter)
n, err := copySegment(segment, wMediaMTX)

Check warning on line 226 in server/ai_live_video.go

View check run for this annotation

Codecov / codecov/patch

server/ai_live_video.go#L226

Added line #L226 was not covered by tests
if err != nil {
params.liveParams.stopPipeline(fmt.Errorf("trickle subscribe error copying: %w", err))
return
Expand All @@ -244,9 +236,6 @@
}
}()

// Studio Output ffmpeg process
go ffmpegOutput(ctx, params.liveParams.outputRTMPURL, r, params)

// MediaMTX Output ffmpeg process
go ffmpegOutput(ctx, params.liveParams.mediaMTXOutputRTMPURL, rMediaMTX, params)
}
Expand Down
Loading