mirror of
https://github.com/m1k1o/neko.git
synced 2025-07-23 11:39:04 +02:00
remove wait timer from goroutine
This commit is contained in:
parent
79a1c41938
commit
628c6a1b77
4 changed files with 11 additions and 23 deletions
|
@ -57,16 +57,10 @@ func (manager *WebRTCManager) Start() {
|
|||
|
||||
go func() {
|
||||
for {
|
||||
if manager.capture.Audio().GetSampleChannel() == nil {
|
||||
// Pipeline not yet initialized
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
continue
|
||||
}
|
||||
|
||||
sample, ok := <-manager.capture.Audio().GetSampleChannel()
|
||||
if !ok {
|
||||
manager.logger.Debug().Msg("audio capture channel is closed")
|
||||
continue // TOOD: Create this goroutine when creating the pipeline.
|
||||
continue
|
||||
}
|
||||
|
||||
err := manager.audioTrack.WriteSample(media.Sample(sample))
|
||||
|
@ -88,16 +82,10 @@ func (manager *WebRTCManager) Start() {
|
|||
|
||||
go func() {
|
||||
for {
|
||||
if manager.capture.Video().GetSampleChannel() == nil {
|
||||
// Pipeline not yet initialized
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
continue
|
||||
}
|
||||
|
||||
sample, ok := <-manager.capture.Video().GetSampleChannel()
|
||||
if !ok {
|
||||
manager.logger.Debug().Msg("video capture channel is closed")
|
||||
continue // TOOD: Create this goroutine when creating the pipeline.
|
||||
continue
|
||||
}
|
||||
|
||||
err := manager.videoTrack.WriteSample(media.Sample(sample))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue