webrtc: "on-open" on datachannel emitted before application has been able to connect to signal
If a datachannel is created from an application thread then there is a risk that the "on-open" signal is emitted before the application has had a chance to connect to the signal. In practice this happens only in test setups on localhost where the connection establishment is fast. The important thing to know here is that there is a concurrency model difference here between gstreamer and the JavaScript world for which the WebRTC spec is written. In JavaScript all processing happens in the same thread so there is no possibility of these kinds of races. In a gstreamer application however, the application can invoke functions on webrtcbin from any thread.
I admit I have no real solution to the problem. Somehow the create-datachannel operation and the signal connection operation must be a single atomic operation or both run from the pc thread.