I'm trying to add a gstreamer pipeline to my program. My program produces a video-stream that I would like to be processed by gstreamer. This basically works only timing is way off: there are huge delays between each frame showed. Also after a couple of seconds, it completely stalls.
Here's the code to start the stream:
GstCaps *video_caps = gst_caps_new_simple("video/x-raw",
"format", G_TYPE_STRING, "RGB",
"width", G_TYPE_INT, w,
"height", G_TYPE_INT, h,
"block", G_TYPE_BOOLEAN, TRUE,
"do-timestamp", G_TYPE_BOOLEAN, TRUE,
"framerate", GST_TYPE_FRACTION, fps, 1, nullptr);
gst_app_src_set_caps(GST_APP_SRC(appsrc), video_caps);
gst_app_src_set_max_bytes((GstAppSrc *)appsrc, 1 * w * h * 3);
gst_element_set_state(gpipeline, GST_STATE_PLAYING);
and then for each frame I do:
GstBuffer *buffer = gst_buffer_new_and_alloc(w * h * 3);
gst_buffer_fill(buffer, 0, my_frame, w * h * 3);
if (gst_app_src_push_buffer(GST_APP_SRC(appsrc), buffer) != GST_FLOW_OK)
log(LL_WARNING, "Problem queing frame");
Complete source: complete source