diff --git a/internal/capture/gst/gst.c b/internal/capture/gst/gst.c index 7c11c8a5..a25f0123 100644 --- a/internal/capture/gst/gst.c +++ b/internal/capture/gst/gst.c @@ -61,11 +61,6 @@ GstFlowReturn gstreamer_send_new_sample_handler(GstElement *object, gpointer use return GST_FLOW_OK; } -GstElement *gstreamer_send_create_pipeline(char *pipeline) { - GError *error = NULL; - return gst_parse_launch(pipeline, &error); -} - void gstreamer_send_start_pipeline(GstElement *pipeline, int pipelineId) { SampleHandlerUserData *s = calloc(1, sizeof(SampleHandlerUserData)); s->pipelineId = pipelineId; diff --git a/internal/capture/gst/gst.go b/internal/capture/gst/gst.go index a2c884b9..b638ad03 100644 --- a/internal/capture/gst/gst.go +++ b/internal/capture/gst/gst.go @@ -197,8 +197,18 @@ func CreatePipeline(pipelineStr string, codecName string, clockRate float32) (*P pipelinesLock.Lock() defer pipelinesLock.Unlock() + var gstPipeline *C.GstElement + var gstError *C.GError + + gstPipeline = C.gst_parse_launch(pipelineStrUnsafe, &gstError) + defer C.g_error_free(gstError) + + if gstPipeline == nil || gstError != nil { + return nil, fmt.Errorf("(pipeline error) %s", C.GoString(gstError.message)) + } + p := &Pipeline{ - Pipeline: C.gstreamer_send_create_pipeline(pipelineStrUnsafe), + Pipeline: gstPipeline, Sample: make(chan types.Sample), CodecName: codecName, ClockRate: clockRate, diff --git a/internal/capture/gst/gst.h b/internal/capture/gst/gst.h index cf274e3e..55037f18 100644 --- a/internal/capture/gst/gst.h +++ b/internal/capture/gst/gst.h @@ -5,8 +5,6 @@ extern void goHandlePipelineBuffer(void *buffer, int bufferLen, int samples, int pipelineId); -GstElement *gstreamer_send_create_pipeline(char *pipeline); - void gstreamer_send_start_pipeline(GstElement *pipeline, int pipelineId); void gstreamer_send_play_pipeline(GstElement *pipeline); void gstreamer_send_stop_pipeline(GstElement *pipeline);