webrtcbin: assertion failure when data channel is created before linking
I am observing a failed assertion when I attempt to create a data channel before linking the webrtcbin
to a source:
ERROR:../subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c:2291:sdp_media_from_transceiver: assertion failed: (trans->mline == -1 || trans->mline == media_idx)
I am encountering this issue in a situation where I am dynamically adding instances of webrtcbin
to a pipeline. I believe this should be possible like it is in the JavaScript API, e.g.:
var pc = new RTCPeerConnection();
var channel = pc.createDataChannel('channel');
pc.addTrack(track);
Even if this is a known limitation, this error should be detected and reported.
I have uploaded test code that is simply a version of the basic webrtc example that is modified to reproduce the bug. If you change these lines:
g_signal_emit_by_name (webrtc1, "create-data-channel", "channel", NULL, &channel);
gst_element_link (rtp_caps_filter, webrtc1);
to these:
gst_element_link (rtp_caps_filter, webrtc1);
g_signal_emit_by_name (webrtc1, "create-data-channel", "channel", NULL, &channel);
then everything works as expected.
Here is the output with GST_DEBUG=4
: debug_log_0.txt
For now, the work-around is to (obviously) defer data channel creation until after the element has been linked.
I am using version GStreamer 1.17.0.1.