adaptive fps moved to pipeline creation.

This commit is contained in:
Miroslav Šedivý 2023-01-29 17:40:07 +01:00
parent c45a315d9b
commit 4094639ea9
7 changed files with 40 additions and 65 deletions

View file

@ -63,12 +63,13 @@ func (manager *WebRTCManager) Start() {
continue
}
newSample, ok := <-manager.capture.Audio().GetSampleChannel()
sample, ok := <-manager.capture.Audio().GetSampleChannel()
if !ok {
manager.logger.Info().Msg("Audio capture channel was closed")
return
manager.logger.Info().Msg("audio capture channel was closed")
continue // TOOD: Create this goroutine when creating the pipeline.
}
err := manager.audioTrack.WriteSample(media.Sample(newSample))
err := manager.audioTrack.WriteSample(media.Sample(sample))
if err != nil && errors.Is(err, io.ErrClosedPipe) {
manager.logger.Warn().Err(err).Msg("audio pipeline failed to write")
}
@ -93,12 +94,13 @@ func (manager *WebRTCManager) Start() {
continue
}
newSample, ok := <-manager.capture.Video().GetSampleChannel()
sample, ok := <-manager.capture.Video().GetSampleChannel()
if !ok {
manager.logger.Info().Msg("Video capture channel was closed")
return
manager.logger.Info().Msg("video capture channel was closed")
continue // TOOD: Create this goroutine when creating the pipeline.
}
err := manager.videoTrack.WriteSample(media.Sample(newSample))
err := manager.videoTrack.WriteSample(media.Sample(sample))
if err != nil && errors.Is(err, io.ErrClosedPipe) {
manager.logger.Warn().Err(err).Msg("video pipeline failed to write")
}