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

Fix output bin for audio only segmented output #493

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Changes from 1 commit
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
21 changes: 16 additions & 5 deletions pkg/pipeline/builder/segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,17 @@ func BuildSegmentBin(pipeline *gstreamer.Pipeline, p *config.PipelineConfig) (*g
b := pipeline.NewBin("segment")
o := p.GetSegmentConfig()

h264parse, err := gst.NewElement("h264parse")
if err != nil {
return nil, err
var h264parse *gst.Element
var err error
if p.VideoEnabled {
h264parse, err = gst.NewElement("h264parse")
if err != nil {
return nil, err
}

if err = b.AddElements(h264parse); err != nil {
return nil, errors.ErrGstPipelineError(err)
}
}

sink, err := gst.NewElement("splitmuxsink")
Expand Down Expand Up @@ -91,15 +99,18 @@ func BuildSegmentBin(pipeline *gstreamer.Pipeline, p *config.PipelineConfig) (*g
return nil, errors.ErrGstPipelineError(err)
}

if err = b.AddElements(h264parse, sink); err != nil {
if err = b.AddElements(sink); err != nil {
return nil, errors.ErrGstPipelineError(err)
}

b.SetGetSrcPad(func(name string) *gst.Pad {
if name == "audio" {
return sink.GetRequestPad("audio_%u")
} else {
} else if h264parse != nil {
return h264parse.GetStaticPad("sink")
} else {
// Should never happen
return nil
}
})

Expand Down