cleanup decodebin example

This commit is contained in:
tinyzimmer
2020-10-04 09:44:34 +03:00
parent 4017c9e6d0
commit a2f8ca9e50
2 changed files with 9 additions and 3 deletions

View File

@@ -135,8 +135,11 @@ func handleMessage(msg *gst.Message) error {
return nil
}
func runPipeline(pipeline *gst.Pipeline) error {
func runPipeline(loop *gst.MainLoop, pipeline *gst.Pipeline) error {
defer loop.Quit()
pipeline.SetState(gst.StatePlaying)
defer pipeline.Destroy()
bus := pipeline.GetPipelineBus()
@@ -165,6 +168,6 @@ func main() {
if err != nil {
return err
}
return runPipeline(pipeline)
return runPipeline(loop, pipeline)
})
}