Archived
2
0

remove wait timer from goroutine

This commit is contained in:
mbattista
2023-01-29 18:49:40 +01:00
committed by Miroslav Šedivý
parent 79a1c41938
commit 628c6a1b77
4 changed files with 11 additions and 23 deletions

View File

@ -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))