Gstreamer: avoid lock contention with pipeline

Stop one pipeline from preventing others from sending data
if it wasn't being serviced
This commit is contained in:
rob-deutsch
2019-02-13 23:46:30 +11:00
committed by Rob Deutsch
parent 737516efbd
commit f5e8f0fa4a

View File

@@ -93,9 +93,10 @@ const (
//export goHandlePipelineBuffer //export goHandlePipelineBuffer
func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.int, pipelineID C.int) { func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.int, pipelineID C.int) {
pipelinesLock.Lock() pipelinesLock.Lock()
defer pipelinesLock.Unlock() pipeline, ok := pipelines[int(pipelineID)]
pipelinesLock.Unlock()
if pipeline, ok := pipelines[int(pipelineID)]; ok { if ok {
var samples uint32 var samples uint32
if pipeline.codecName == webrtc.Opus { if pipeline.codecName == webrtc.Opus {
samples = uint32(audioClockRate * (float32(duration) / 1000000000)) samples = uint32(audioClockRate * (float32(duration) / 1000000000))