We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a3c0719 commit bed6387Copy full SHA for bed6387
streamd/main.go
@@ -7,7 +7,6 @@ import (
7
"os"
8
"os/signal"
9
"sync"
10
- "time"
11
12
"github.com/go-gst/go-glib/glib"
13
"github.com/go-gst/go-gst/gst"
@@ -167,15 +166,10 @@ func main() {
167
166
// floating around and move outside runPipeline
168
go d.metricsProcess(ctx)
169
170
- // bridge the mainloop with our go context
171
- for {
172
- select {
173
- case <-ctx.Done():
174
- return
175
- default:
176
- // this is essentially what g_main_loop_run does with some locking overhead
177
- d.mainloop.GetContext().Iteration(false)
178
- time.Sleep(time.Millisecond * 50)
179
- }
180
+ go func() {
+ <-ctx.Done() // Wait until the context is cancelled
+ // When the context is cancelled, break out of the main loop
+ d.mainloop.Quit()
+ }()
+ d.mainloop.Run()
181
}
0 commit comments