mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
gst - correctly destroy unused pipelines.
This commit is contained in:
parent
96e99955fc
commit
cd769c05d3
@ -68,6 +68,11 @@ GstElement *gstreamer_send_create_pipeline(char *pipeline) {
|
||||
return gst_parse_launch(pipeline, &error);
|
||||
}
|
||||
|
||||
void gstreamer_send_destroy_pipeline(GstElement *pipeline) {
|
||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||
gst_object_unref (pipeline);
|
||||
}
|
||||
|
||||
void gstreamer_send_start_pipeline(GstElement *pipeline, int pipelineId) {
|
||||
SampleHandlerUserData *s = calloc(1, sizeof(SampleHandlerUserData));
|
||||
s->pipelineId = pipelineId;
|
||||
|
@ -231,6 +231,11 @@ func CreatePipeline(pipelineStr string, codecName string, clockRate float32) (*P
|
||||
return p, nil
|
||||
}
|
||||
|
||||
// Destroy GStreamer Pipeline
|
||||
func (p *Pipeline) DestroyPipeline() {
|
||||
C.gstreamer_send_destroy_pipeline(p.Pipeline)
|
||||
}
|
||||
|
||||
// Start starts the GStreamer Pipeline
|
||||
func (p *Pipeline) Start() {
|
||||
C.gstreamer_send_start_pipeline(p.Pipeline, C.int(p.id))
|
||||
|
@ -9,6 +9,7 @@
|
||||
extern void goHandlePipelineBuffer(void *buffer, int bufferLen, int samples, int pipelineId);
|
||||
|
||||
GstElement *gstreamer_send_create_pipeline(char *pipeline);
|
||||
void gstreamer_send_destroy_pipeline(GstElement *pipeline);
|
||||
|
||||
void gstreamer_send_start_pipeline(GstElement *pipeline, int pipelineId);
|
||||
void gstreamer_send_play_pipeline(GstElement *pipeline);
|
||||
|
@ -84,8 +84,8 @@ func (manager *RemoteManager) Start() {
|
||||
|
||||
func (manager *RemoteManager) Shutdown() error {
|
||||
manager.logger.Info().Msgf("remote shutting down")
|
||||
manager.video.Stop()
|
||||
manager.audio.Stop()
|
||||
manager.video.DestroyPipeline()
|
||||
manager.audio.DestroyPipeline()
|
||||
manager.broadcast.Stop()
|
||||
|
||||
manager.cleanup.Stop()
|
||||
@ -170,7 +170,7 @@ func (manager *RemoteManager) ChangeResolution(width int, height int, rate int)
|
||||
return fmt.Errorf("unknown configuration")
|
||||
}
|
||||
|
||||
manager.video.Stop()
|
||||
manager.video.DestroyPipeline()
|
||||
manager.broadcast.Stop()
|
||||
|
||||
defer func() {
|
||||
|
Loading…
Reference in New Issue
Block a user