EricssonResearch / openwebrtc

A cross-platform WebRTC client framework based on GStreamer
http://www.openwebrtc.org
BSD 2-Clause "Simplified" License
1.8k stars 537 forks source link

Native support to generate/parse SDP records. #147

Open jrosssavant opened 9 years ago

jrosssavant commented 9 years ago

The JSEP draft spec establishes SDP as the session description format. As far as I can tell, the existing OpenWebRTC SDP record generation & parsing is done in Javascript and is not readily available to native clients. I suggest utilities be added to generate an SDP record from a local session, and parse an sdp record into a remote session.

Thanks, Joe

ikonst commented 9 years ago

Are we sure we want to perform string processing in native code? I thought it rather elegant that it was delegated to JS.

jrosssavant commented 9 years ago

Well, the native client needs to be able to talk to a web client on the other end. They need to exchange the session description in a consistent format. So the native code needs to be able to generate/parse the SDP record. I think it is fine if that is done via a native-invoked eval of the JS code, but it would be great if it were simple to call from the native code. Maybe this is easy to do but if so, it's not obvious to me.

stefanalund commented 9 years ago

Similar discussion here https://github.com/EricssonResearch/openwebrtc/pull/129

jrosssavant commented 9 years ago

There is a similar large volume of Java code included in the Android NativeCall app to assemble the JSON:

https://github.com/Rugvip/openwebrtc-examples/commit/dce2e8e38aff53a856ee3886dc1625840a00d444

sdroege commented 9 years ago

Note that GStreamer has a SDP parsing/generation library already, libgstsdp from gst-plugins-base.

jrosssavant commented 9 years ago

Yes, I spotted that earlier and have added it to my list of things to check out. Thanks!

superdump commented 9 years ago

@stefanalund has now got some code working in iOS that parses the SDP using sdp.js and a JSContext and then gives an NSDictionary back. I expect similar things can be done on other platforms, the main issue is what to do in native C/GObject code.

sdroege commented 9 years ago

What's missing in libgstsdp that would be required or useful here?

superdump commented 9 years ago

We would have to check. It's a possibility...

superdump commented 9 years ago

I think one suggestion for this would be to use the GStreamer SDP parsing code as part of a set of objects in OpenWebRTC that handle creation of those objects that are used by sessions. So for example something that takes an SDP and spits out the payloads and other bits and pieces needed to configure sessions. And then similarly something that can be configured and spit out an SDP.

suganthikarthick commented 9 years ago

We have written our own implementation for sdp pasring to json and vice versa. Now, we need a way to generate SDP offer to be done in C, using openwebrtc.

Thanks.

superdump commented 9 years ago

You should be able to see in the JavaScript bridge code (https://github.com/EricssonResearch/openwebrtc/blob/master/bridge/client/webrtc.js#L449) how this is done. You basically need information about sessions, payloads and ICE candidates that you know that you support.

suganthikarthick commented 9 years ago

Ok. We will have a look into that. Thanks.

suganthikarthick commented 9 years ago

Hi,

I gone through the ios sdk for openWebRTCNativeHandler, where an example is provided for creating the offer. Thank you.