Skip to content

Commit

Permalink
Fix output bin for audio only segmented output
Browse files Browse the repository at this point in the history
  • Loading branch information
biglittlebigben committed Sep 15, 2023
1 parent 9fcfc2c commit 774c6cd
Showing 1 changed file with 16 additions and 5 deletions.
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

0 comments on commit 774c6cd

Please sign in to comment.