Fix all lint errors in examples/

Resolves #531 and Resolves #470
This commit is contained in:
Sean DuBois
2019-03-21 01:02:02 -07:00
parent 817ee39f62
commit f174986c74
18 changed files with 108 additions and 87 deletions

View File

@@ -22,11 +22,8 @@ func init() {
// Pipeline is a wrapper for a GStreamer Pipeline
type Pipeline struct {
Pipeline *C.GstElement
track *webrtc.Track
// stop acts as a signal that this pipeline is stopped
// any pending sends to Pipeline.in should be cancelled
stop chan interface{}
Pipeline *C.GstElement
track *webrtc.Track
id int
codecName string
}
@@ -71,17 +68,11 @@ func CreatePipeline(codecName string, track *webrtc.Track, pipelineSrc string) *
// Start starts the GStreamer Pipeline
func (p *Pipeline) Start() {
// This will signal to goHandlePipelineBuffer
// and provide a method for cancelling sends.
p.stop = make(chan interface{})
C.gstreamer_send_start_pipeline(p.Pipeline, C.int(p.id))
}
// Stop stops the GStreamer Pipeline
func (p *Pipeline) Stop() {
// To run gstreamer_send_stop_pipeline we need to make sure
// that appsink isn't being hung by any goHandlePipelineBuffers
close(p.stop)
C.gstreamer_send_stop_pipeline(p.Pipeline)
}
@@ -103,8 +94,6 @@ func goHandlePipelineBuffer(buffer unsafe.Pointer, bufferLen C.int, duration C.i
} else {
samples = uint32(videoClockRate * (float32(duration) / 1000000000))
}
// We need to be able to cancel this function even f pipeline.in isn't being serviced
// When pipeline.stop is closed the sending of data will be cancelled.
if err := pipeline.track.WriteSample(media.Sample{Data: C.GoBytes(buffer, bufferLen), Samples: samples}); err != nil {
panic(err)
}