Robert Driller
Robert Driller

Reputation: 87

Gstreamer webrtcbin not connecting with appsrc

I am trying to establish a webrtc videostream with Webrtc. My code works well with videotestsrc. The webrtc handshake is stablished and the video is displayed.

pipeline = gst_parse_launch
       ("videotestsrc ! queue ! "
        "vp8enc ! rtpvp8pay ! "
        "application/x-rtp,media=video,payload=96,encoding-name=VP8 ! "
        "webrtcbin name=webrtcbin_send", &error);

Now i want to move ahead and push my custom video to the pipeline using appsrc.

pipeline = gst_parse_launch
  ( "appsrc name=CaliCam ! video/x-raw, format=BGR, width=640, height=480, framerate=10/1 ! videoconvert !"
  " queue ! vp8enc deadline=1 ! rtpvp8pay ! " 
  " application/x-rtp,media=video, encoding-name=VP8, payload=96 ! "
  " webrtcbin name=webrtcbin_send", &error);

appsrc  = gst_bin_get_by_name( GST_BIN( pipeline), "CaliCam");
g_object_set (G_OBJECT (appsrc),
    "stream-type", GST_APP_STREAM_TYPE_STREAM,
    "format", GST_FORMAT_TIME,
    "max-latency", 0,
    "min-latency", 0,
    "is-live", TRUE,
    "do-timestamp", TRUE,   
    NULL);
g_signal_connect(appsrc, "need-data", G_CALLBACK(on_need_data_cb), (gpointer) this);
g_signal_connect(appsrc, "enough-data", G_CALLBACK(on_enough_data_cb), (gpointer) this);

Problem is now, that when adding the appsrc, the whole webrtc handshake is not initiated. meaning no ice candidates are transmitted. Does anyone have an ides why that might be?

Upvotes: 0

Views: 522

Answers (1)

Robert Driller
Robert Driller

Reputation: 87

Pushing an initial empty frame after the pipeline setup solved the problem and the handshake was performed afterwards

GstBuffer* buffer = gst_buffer_new_and_alloc(1280 * 960 * 3);
GstFlowReturn flow_return = gst_app_src_push_buffer((GstAppSrc*)appsrc, buffer);

Upvotes: 1

Related Questions