Hi i am trying to push data into a webrtcbin of Gstreamer. this is my pipeline which works fine with testdata
pipeline =
gst_parse_launch("webrtcbin "
"name=webrtcbin stun-server=stun://stun.l.google.com:19302 "
"appsrc ! videorate ! "
"video/x-raw,"
"width=1280,"
"height=720,"
"framerate=15/1 "
"! videoconvert ! queue max-size-buffers=1 ! "
"x264enc bitrate=600 speed-preset=ultrafast tune=zerolatency key-int-max=15 ! "
"video/x-h264,profile=constrained-baseline ! queue max-size-time=100000000 ! h264parse ! "
"rtph264pay config-interval=-1 name=payloader ! "
"application/x-rtp,"
"media=video,"
"encoding-name=H264,"
"payload=96 ! webrtcbin. ", &error);
Now i try to push in some camera data based on my reading of https://gstreamer.freedesktop.org/documentation/app/appsrc.html?gi-language=c
GstFlowReturn ret;
memcpy(gst_Imageptr, msg->data.data(), msg->data.size());
gst_ImageBuffer = gst_buffer_new_wrapped((void*)gst_Imageptr, msg->data.size());
g_signal_emit_by_name(webrtcbin, "push-buffer", gst_ImageBuffer, &ret);
if (ret != GST_FLOW_OK) {
/* some error, stop sending data */
GST_DEBUG ("some error");
}
but I get the error
push-buffer' is invalid for instance '0x55bb4cc0f0' of type 'GstWebRTCBin
So my question is, is there a different way to push data into a GstWebRTCBin? the page https://gstreamer.freedesktop.org/documentation/webrtc/index.html?gi-language=c#signals only show signals relevant for setting up a connection.
Thanks for any advice!!
So i found my problem, and as alyways it was very simple but for me hard due to the lack of knowledge in gstreamer
i tried to push the signal against the webrtcbin wbile i should have been pushing against the appsrc. these are different units.
so i gave the appsrc a name:
"webrtcbin name=webrtcbin stun-server=stun://stun.l.google.com:19302 "
"appsrc name=CaliCam !"
"video/x-raw, format=BGR, width=640, height=480, framerate=10/1 !"
And then stored the bin for reference
GstElement *appsrc = gst_bin_get_by_name( GST_BIN( pipeline), "CaliCam");
with that i could push the signal
g_signal_emit_by_name(appsrc, "push-buffer", gst_ImageBuffer, &ret);
the memory copy workes with both versions. I am not sure yet if allocating the memory beforehand (the way i did it) and securing its existance is less CPU and Memory efficient or not compared to the suggestion of tomaszmi. but that was not the point in the post