GstPromise on GstWebRTCBin

584 views
Skip to first unread message

vft...@gmail.com

unread,
May 7, 2018, 1:41:30 PM5/7/18
to gstreamer-java
Hi everyone,

I'm trying to replicate this example in Java but I'm stuck on the create-offer action.
For what I understood, I need to emit a signal with a GstPromise param, but I couldn't find this Object ii the Java bindings.

Does anyone have any suggestions?
Thanks!

Jim Carroll

unread,
May 7, 2018, 1:49:54 PM5/7/18
to gstreamer-java

I've been looking for something like this for a while. I got my stuff working with Kurento but it's a real pain and seem pretty fragile with lots of moving parts. I got it working with IceCast but there's a pretty big lag and encoding cost. I'm going to play with this tonight. Thanks.

Neil C Smith

unread,
May 9, 2018, 10:10:07 AM5/9/18
to gstream...@googlegroups.com
On Mon, 7 May 2018 at 18:41 <vft...@gmail.com> wrote:
I'm trying to replicate this example in Java but I'm stuck on the create-offer action.
For what I understood, I need to emit a signal with a GstPromise param, but I couldn't find this Object ii the Java bindings.

No, this isn't mapped and was only introduced in 1,14.  It shouldn't be too hard to add based on other MiniObject types though - PR's and/or sponsorship well received! ;-)

This also really requires finalising an API to support optional features, so we don't break build, test and usage with GStreamer 1.8.  That's something I have started some work on.

Best wishes,

Neil
--
Neil C Smith
Artist & Technologist

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org

Vinicius Tona

unread,
May 9, 2018, 10:14:48 AM5/9/18
to gstream...@googlegroups.com
I've started implementing it but everything is kinda new to me.

Is there any documentation that you recommend me reading and/or a person that I can bother for help? :p

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-java+unsubscribe@googlegroups.com.

To post to this group, send email to gstreamer-java@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.



--
"If we can really understand the problem, the answer will come out of it, 
because the answer is not separate from the problem." - Krishnamurti

Vinícius Faria Toná

Neil C Smith

unread,
May 9, 2018, 10:24:50 AM5/9/18
to gstream...@googlegroups.com
On Wed, 9 May 2018 at 15:14 Vinicius Tona <vft...@gmail.com> wrote:
I've started implementing it but everything is kinda new to me.

Is there any documentation that you recommend me reading and/or a person that I can bother for help? :p

Just ask here and I'll try and help you out, and once a PR is in I'll review.  I can help with the bindings but not testing (at least immediately) as I don't have a machine with 1.14 on it.

Best wishes,

Neil
 

vft...@gmail.com

unread,
May 10, 2018, 10:59:14 AM5/10/18
to gstreamer-java
Basically, this is what I have so far:

Gst.init("SendRecv", new String[] {"--gst-debug-level=2",
"--gst-debug-no-color"});

final String description = "webrtcbin name=sendrecv "

+ "audiotestsrc wave=red-noise ! audioconvert ! audioresample !
queue ! opusenc ! rtpopuspay ! "

+ "queue !
application/x-rtp,media=audio,encoding-name=OPUS,payload=97 ! sendrecv. ";

final Pipeline pipeline = Pipeline.launch(description);


final Element webrtcbin = pipeline.getElementByName("sendrecv");

/*

* This is the gstwebrtc entry point where we create the offer and so on. It
will be called when the pipeline goes to PLAYING.

*/

final Closure negotiationNeeded = new Closure()

{

public void invoke(final Element element)

{

log.info("on-negotiation-needed called!! {}", element);

final GstCallback callback = new GstCallback()

{

public void callback(final Promise promise)

{

log.info("Callback called!! {}", promise);

}

};

log.info("Callback created");

final Promise promise = new Promise(callback);

log.info("Promise created");

element.emit("create-offer", promise);

}

};

webrtcbin.connect("on-negotiation-needed", negotiationNeeded);


/*

* We need to transmit this ICE candidate to the browser via the websockets
signalling server.

* Incoming ice candidates from the browser need to be added by us too, see
on_server_message()

*/

final Closure iceCandidate = new Closure()

{

public void invoke(final Element element, final Integer line, final String
candidate)

{

log.info("on-ice-candidate called!! {} {} {}", element, line, candidate
);

}

};

webrtcbin.connect("on-ice-candidate", iceCandidate);


/* Incoming streams will be exposed via this signal */

final Element.PAD_ADDED padAdded = new Element.PAD_ADDED()

{

@Override

public void padAdded(final Element element, final Pad pad)

{

log.info("PadAdded called!! {} {}", element, pad);

}

};

webrtcbin.connect(padAdded);


pipeline.play();

And on the GStreamer side, I have this:

public interface GstPromiseAPI extends com.sun.jna.Library

{

GstPromiseAPI GSTPROMISE_API = GstNative.load(GstPromiseAPI.class);

GType gst_promise_get_type();

@CallerOwnsReturn

Promise gst_promise_new_with_change_func(GstCallback callback);


@CallerOwnsReturn

Pointer ptr_gst_promise_new_with_change_func(GstCallback callback);


void gst_promise_wait(Promise promise);

void gst_promise_reply(Promise promise, Structure s);

void gst_promise_interrupt(Promise promise);

void gst_promise_expire(Promise promise);

Structure gst_promise_get_reply(Promise promise);

GType gst_static_promise_get_type();

}

public class Promise extends MiniObject

{

public static final String GTYPE_NAME = "GstPromise";

public Promise(final Initializer init)

{

super(init);

}


public Promise(final GstCallback callback)

{

this(initializer(GSTPROMISE_API.ptr_gst_promise_new_with_change_func(
callback)));

}


protected static Initializer initializer(final Pointer ptr)

{

return new Initializer(ptr, false, true);

}


public void wait(final Promise promise)

{

GSTPROMISE_API.gst_promise_wait(this);

}


public void reply(final Structure s)

{

GSTPROMISE_API.gst_promise_reply(this, s);

}


public void interrupt(final Promise promise)

{

GSTPROMISE_API.gst_promise_interrupt(this);

}


public void expire(final Promise promise)

{

GSTPROMISE_API.gst_promise_expire(this);

}


public Structure getReply(final Promise promise)

{

return GSTPROMISE_API.gst_promise_get_reply(this);

}

}


When I run my example I get the following output:

0:00:00.093398000 8056 0x7fa4c3af4590 WARN GST_ELEMENT_FACTORY
gstelementfactory.c:456:GstElement *gst_element_factory_make(const gchar *,
const gchar *): no such element factory "srtpenc"!

0:00:00.093447000 8056 0x7fa4c3af4590 ERROR dtlssrtpenc
gstdtlssrtpenc.c:178:gst_dtls_srtp_enc_init:<GstDtlsSrtpEnc@0x7fa4c0e080d0>
failed to create srtp encoder, is the srtp plugin registered?

** (SendRecv:8056): WARNING **: 10:25:26.436: tried to set connection-id
after disabling DTLS

0:00:00.093537000 8056 0x7fa4c3af4590 WARN dtlssrtpenc
gstdtlssrtpenc.c:269:gst_dtls_srtp_enc_set_property:<dtlssrtpenc0> tried to
set is-client after disabling DTLS

0:00:00.093628000 8056 0x7fa4c3af4590 WARN GST_ELEMENT_FACTORY
gstelementfactory.c:456:GstElement *gst_element_factory_make(const gchar *,
const gchar *): no such element factory "srtpdec"!

0:00:00.093637000 8056 0x7fa4c3af4590 ERROR dtlssrtpdec
gstdtlssrtpdec.c:171:gst_dtls_srtp_dec_init:<GstDtlsSrtpDec@0x7fa4c0e082b0>
failed to create srtp_dec, is the srtp plugin registered?


** (SendRecv:8056): WARNING **: 10:25:26.436: tried to set connection-id
after disabling DTLS

0:00:00.093681000 8056 0x7fa4c3af4590 WARN GST_ELEMENT_FACTORY
gstelementfactory.c:456:GstElement *gst_element_factory_make(const gchar *,
const gchar *): no such element factory "srtpenc"!

0:00:00.093687000 8056 0x7fa4c3af4590 ERROR dtlssrtpenc
gstdtlssrtpenc.c:178:gst_dtls_srtp_enc_init:<GstDtlsSrtpEnc@0x7fa4c0e08490>
failed to create srtp encoder, is the srtp plugin registered?


** (SendRecv:8056): WARNING **: 10:25:26.436: tried to set connection-id
after disabling DTLS

0:00:00.093715000 8056 0x7fa4c3af4590 WARN dtlssrtpenc
gstdtlssrtpenc.c:269:gst_dtls_srtp_enc_set_property:<dtlssrtpenc1> tried to
set is-client after disabling DTLS

0:00:00.093729000 8056 0x7fa4c3af4590 WARN GST_ELEMENT_FACTORY
gstelementfactory.c:456:GstElement *gst_element_factory_make(const gchar *,
const gchar *): no such element factory "srtpdec"!

0:00:00.093735000 8056 0x7fa4c3af4590 ERROR dtlssrtpdec
gstdtlssrtpdec.c:171:gst_dtls_srtp_dec_init:<GstDtlsSrtpDec@0x7fa4c0e08670>
failed to create srtp_dec, is the srtp plugin registered?


** (SendRecv:8056): WARNING **: 10:25:26.436: tried to set connection-id
after disabling DTLS


** (SendRecv:8056): CRITICAL **: 10:25:26.438:
gst_dtls_srtp_enc_request_new_pad: assertion 'self->srtp_enc' failed


** (SendRecv:8056): WARNING **: 10:25:26.438: (transportsendbin.c:372):
transport_send_bin_constructed: code should not be reached


** (SendRecv:8056): CRITICAL **: 10:25:26.438:
gst_dtls_srtp_enc_request_new_pad: assertion 'self->srtp_enc' failed


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportsendbin.c:379):
transport_send_bin_constructed: code should not be reached


(SendRecv:8056): GStreamer-CRITICAL **: 10:25:26.439: gst_ghost_pad_new:
assertion 'GST_IS_PAD (target)' failed


(SendRecv:8056): GStreamer-CRITICAL **: 10:25:26.439: gst_element_add_pad:
assertion 'GST_IS_PAD (pad)' failed


(SendRecv:8056): GStreamer-CRITICAL **: 10:25:26.439: gst_object_unref:
assertion 'object != NULL' failed


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportsendbin.c:402):
transport_send_bin_constructed: code should not be reached


** (SendRecv:8056): CRITICAL **: 10:25:26.439:
gst_dtls_srtp_enc_request_new_pad: assertion 'self->srtp_enc' failed


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportsendbin.c:406):
transport_send_bin_constructed: code should not be reached


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportreceivebin.c:271):
transport_receive_bin_constructed: code should not be reached


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportreceivebin.c:291):
transport_receive_bin_constructed: code should not be reached


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportreceivebin.c:304):
transport_receive_bin_constructed: code should not be reached


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportreceivebin.c:307):
transport_receive_bin_constructed: code should not be reached


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportreceivebin.c:329):
transport_receive_bin_constructed: code should not be reached


** (SendRecv:8056): WARNING **: 10:25:26.439: (transportreceivebin.c:332):
transport_receive_bin_constructed: code should not be reached


** (SendRecv:8056): WARNING **: 10:25:26.440: (gstwebrtcbin.c:1879):
_connect_input_stream: code should not be reached


2018-05-10 14:25:26,584 [INFO ] [Thread-2 ] [c.j.r.w.e.w.
IncomingCallWsTest ] [] - on-negotiation-needed called!!
Bin: [sendrecv]

2018-05-10 14:25:26,588 [INFO ] [Thread-2 ] [c.j.r.w.e.w.
IncomingCallWsTest ] [] - Callback created

2018-05-10 14:25:26,596 [INFO ] [Thread-2 ] [c.j.r.w.e.w.
IncomingCallWsTest ] [] - Promise created

#

# A fatal error has been detected by the Java Runtime Environment:

#

# SIGSEGV (0xb) at pc=0x0000000132ad7305, pid=8056, tid=0x000000000000d23b

#

# JRE version: Java(TM) SE Runtime Environment (8.0_151-b12) (build
1.8.0_151-b12)

# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.151-b12 mixed mode
bsd-amd64 compressed oops)

# Problematic frame:

# C [libgstreamer-1.0.0.dylib+0x6a305] gst_structure_copy+0x21

#

# Failed to write core dump. Core dumps have been disabled. To enable core
dumping, try "ulimit -c unlimited" before starting Java again

#

# An error report file with more information is saved as:

# /Users/vinicius/dev/java/hs_err_pid8056.log

#

# If you would like to submit a bug report, please visit:

# http://bugreport.java.com/bugreport/crash.jsp

# The crash happened outside the Java Virtual Machine in native code.

# See problematic frame for where to report the bug.

#

I know there's a bunch of Warnings and Errors there but I honestly don't
know if I should focus on fixing them or the crash in the end :/


On Wednesday, May 9, 2018 at 10:24:50 AM UTC-4, Neil C Smith wrote:
>
>
>
> On Wed, 9 May 2018 at 15:14 Vinicius Tona <vft...@gmail.com <javascript:>>

Neil C Smith

unread,
May 10, 2018, 11:37:15 AM5/10/18
to gstream...@googlegroups.com
On Thu, 10 May 2018 at 15:59 <vft...@gmail.com> wrote:
Basically, this is what I have so far

Obvious question, although possibly not obvious enough :-)

Mind you, it looks like it's also failing to find some necessary elements?

Best wishes,

Neil
 

vft...@gmail.com

unread,
May 10, 2018, 1:52:08 PM5/10/18
to gstreamer-java
I did add it to Gst.java :/
Do I need to create a Structure or something?

Regarding the srtpenc/srtpdec thanks for pointing it out, I'm trying to figure out why they are missing since I have srtp installed and I also have gst-plugins-bad --with-srt

Regards

vft...@gmail.com

unread,
May 23, 2018, 1:32:47 PM5/23/18
to gstreamer-java
I did some progress but now I'm getting: 

structure gststructure.c:1832:gboolean priv_gst_structure_append_to_gstring(const GstStructure *, GString *): No value transform to serialize field 'offer' of type 'GstWebRTCSessionDescription'


Can someone explains to me how the Structure mapping works?

I read the documentation but I still don't fully understand how they are mapped :/


Regards

Vinicius Tona

unread,
May 24, 2018, 11:00:35 AM5/24/18
to gstream...@googlegroups.com

--
You received this message because you are subscribed to a topic in the Google Groups "gstreamer-java" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gstreamer-java/qiBYt4X-_Ng/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gstreamer-java+unsubscribe@googlegroups.com.

To post to this group, send email to gstreamer-java@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

Neil C Smith

unread,
May 25, 2018, 5:21:58 AM5/25/18
to gstream...@googlegroups.com
On Wed, 23 May 2018 at 18:32 <vft...@gmail.com> wrote:
I did some progress but now I'm getting: 

structure gststructure.c:1832:gboolean priv_gst_structure_append_to_gstring(const GstStructure *, GString *): No value transform to serialize field 'offer' of type 'GstWebRTCSessionDescription'

I don't think that's a problem.  Googling that error message finds eg. https://lists.freedesktop.org/archives/gstreamer-commits/2016-January/091516.html This is a warning from GStreamer which I think is happening because you're trying to use toString() on the structure, which delegates down to the native GStreamer implementation and can't handle such fields.

Other than that, does your code work?


Can someone explains to me how the Structure mapping works?

I read the documentation but I still don't fully understand how they are mapped :/

That might be the wrong documentation!  That error message comes from GstStructure in GStreamer itself.  See https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/GstStructure.html for the upstream docs.  Haven't looked in depth at the Promise API, but if something needs a GstStructure it doesn't want a JNA Structure.

Best wishes,

Neil

Vinicius Tona

unread,
May 31, 2018, 12:37:02 PM5/31/18
to gstream...@googlegroups.com
Hi Neil,

I finally have updates, sorry I was struggling to debug this.
For what I understood, I did something wrong mapping GstWebRTCSessionDescription or I'm missing something else.

Here is the part of the webrtcbin that I'm not understanding: https://github.com/GStreamer/gst-plugins-bad/blob/master/ext/webrtc/gstwebrtcbin.c#L2211
It creates a structure called "application/x-gst-promise" with a field "offer" (It's the result of gst_webrtc_sdp_type_to_string (data->type)) and supposedly, the session description, but I don't get what GST_TYPE_WEBRTC_SESSION_DESCRIPTION is...

A few lines below, in gst_promise_reply, it replies the promise sending s
But when I receive the promise in Java, I see this in my logs: Reply response [application/x-gst-promise, offer=(GstWebRTCSessionDescription)NULL;]

And I get a NullPointer trying to reply.getValue("offer")

java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
at org.freedesktop.gstreamer.lowlevel.GType.getTypeName(GType.java:146)
at org.freedesktop.gstreamer.lowlevel.GType.toString(GType.java:153)
at java.util.Formatter$FormatSpecifier.printString(Formatter.java:2886)
at java.util.Formatter$FormatSpecifier.print(Formatter.java:2763)
at java.util.Formatter.format(Formatter.java:2520)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at org.freedesktop.gstreamer.lowlevel.NativeObject.objectFor(NativeObject.java:187)
at org.freedesktop.gstreamer.lowlevel.GValueAPI$GValue.getValue(GValueAPI.java:171)
at org.freedesktop.gstreamer.Structure.getValue(Structure.java:167)
at org.freedesktop.gstreamer.examples.WebRTCSendRecvExample$NegotiationClosure$1.callback(WebRTCSendRecvExample.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)


Thanks so much for the help so far

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-java+unsubscribe@googlegroups.com.

To post to this group, send email to gstreamer-java@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

Vinicius Tona

unread,
Jun 1, 2018, 7:53:17 AM6/1/18
to gstream...@googlegroups.com
I might be off, but I think the problem is because Promise returns a Structure and since it is not in GObject or MiniObject hierarchy, it can't find the GType  


To post to this group, send email to gstream...@googlegroups.com.
--
"If we can really understand the problem, the answer will come out of it, 
because the answer is not separate from the problem." - Krishnamurti

Vinícius Faria Toná

Neil C Smith

unread,
Jun 1, 2018, 9:13:05 AM6/1/18
to gstream...@googlegroups.com
Hi,


On Fri, 1 Jun 2018, 12:53 Vinicius Tona, <vft...@gmail.com> wrote:
I might be off, but I think the problem is because Promise returns a Structure and since it is not in GObject or MiniObject hierarchy, it can't find the GType  

 I'm not in a position to look through the actual code for this at the moment, but that's not the reason - if a GType is not found it defaults to calling the constructor. Horrible code, but it's what we inherited ... for now. 

Have a look through at other uses of Structure and see how they're done - Message come to mind as one that's working. Maybe it'll give you an idea what the issue is. 

Vinicius Tona

unread,
Jun 1, 2018, 9:30:04 AM6/1/18
to gstream...@googlegroups.com
Thanks for the example!

I will keep trying and update here if I do some progress

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-java+unsubscribe@googlegroups.com.
To post to this group, send email to gstreamer-java@googlegroups.com.

Vinicius Tona

unread,
Jun 5, 2018, 3:07:50 PM6/5/18
to gstream...@googlegroups.com
Hi again

Regarding the problems I'm having, I just realized that GstWebRTCSessionDescription is not in gstreamer but in gst-plugins-bad, and when I compile the example in C that I'm following, I need to run the following command
gcc webrtc-sendrecv.c $(pkg-config --cflags --libs gstreamer-webrtc-1.0 gstreamer-sdp-1.0 libsoup-2.4 json-glib-1.0) -o webrtc-sendrecv

So, I think the problem I'm having it's because gst1-java-core does not load gstreamer-webrtc-1.0 and gstreamer-sdp-1.0.
structure gststructure.c:1832:gboolean priv_gst_structure_append_to_gstring(const GstStructure *, GString *): No value transform to serialize field 'offer' of type 'GstWebRTCSessionDescription'

I tried to load it with the following code but it didn't work


GstWebRTCSessionDescriptionAPI GSTWEBRTCSESSIONDESCRIPTION_APIGstNative.load("gstreamer-webrtc-1.0", GstWebRTCSessionDescriptionAPI.class);


Any thoughts or ideas?

On Fri, Jun 1, 2018 at 9:30 AM, Vinicius Tona <vft...@gmail.com> wrote:
Thanks for the example!

I will keep trying and update here if I do some progress
On Fri, Jun 1, 2018 at 9:12 AM, Neil C Smith <ne...@neilcsmith.net> wrote:
Hi,

On Fri, 1 Jun 2018, 12:53 Vinicius Tona, <vft...@gmail.com> wrote:
I might be off, but I think the problem is because Promise returns a Structure and since it is not in GObject or MiniObject hierarchy, it can't find the GType  

 I'm not in a position to look through the actual code for this at the moment, but that's not the reason - if a GType is not found it defaults to calling the constructor. Horrible code, but it's what we inherited ... for now. 

Have a look through at other uses of Structure and see how they're done - Message come to mind as one that's working. Maybe it'll give you an idea what the issue is. 

Best wishes, 

Neil


--
Neil C Smith
Artist & Technologist

Praxis LIVE - hybrid visual IDE for creative coding - www.praxislive.org

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-java+unsubscribe@googlegroups.com.
To post to this group, send email to gstream...@googlegroups.com.
--
"If we can really understand the problem, the answer will come out of it, 
because the answer is not separate from the problem." - Krishnamurti

Vinícius Faria Toná

Bin Zhu

unread,
Jun 5, 2018, 6:11:21 PM6/5/18
to gstream...@googlegroups.com
Try GstNative.load("gstwebrtc"GstWebRTCSessionDescriptionAPI.class);

To post to this group, send email to gstreamer-java@googlegroups.com.

Vinicius Tona

unread,
Jun 6, 2018, 9:25:04 AM6/6/18
to gstream...@googlegroups.com
Hi,

Thanks for the help!
I know it's mapping WebRTCSessionDescription in the proper library now, but I still don't understand how this code works: https://github.com/GStreamer/gst-plugins-bad/blob/33c7af8845c9f53c21c0c3f8ca20e26b58346317/ext/webrtc/gstwebrtcbin.c#L2210

I know that it's creating a new WebRTCSessionDescription and wrapping it up around a Structure named "application/x-gst-promise".
gst_webrtc_sdp_type_to_string (data->type) will return the field name if I'm not mistaken. (in my case offer)
I'm not sure what GST_TYPE_WEBRTC_SESSION_DESCRIPTION is, but my understanding is that in the end, the structure will have a field offer with the value being WebRTCSessionDescription.


The problem here is that even though I'm receiving a Structure, somehow GStreamer is not able to map WebRTCSessionDescription and I get the following output:

Callback called with promise [Promise(native@0x7fe971c72450)]
Waited, getting reply...
WARN               structure gststructure.c:1832:gboolean priv_gst_structure_append_to_gstring(const GstStructure *, GString *): No value transform to serialize field 'offer' of type 'GstWebRTCSessionDescription'
Reply response [application/x-gst-promise, offer=(GstWebRTCSessionDescription)NULL;]
JNA: Callback org.freedesktop.gstreamer.examples.WebRTCSendRecvExample$NegotiationClosure$1@6f702632 threw the following exception:
java.lang.NullPointerException
at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
at org.freedesktop.gstreamer.lowlevel.GType.getTypeName(GType.java:146)
at org.freedesktop.gstreamer.lowlevel.GstTypes.classFor(GstTypes.java:54)
at org.freedesktop.gstreamer.lowlevel.NativeObject.classFor(NativeObject.java:217)
at org.freedesktop.gstreamer.lowlevel.NativeObject.objectFor(NativeObject.java:193)
at org.freedesktop.gstreamer.lowlevel.GValueAPI$GValue.getValue(GValueAPI.java:171)
at org.freedesktop.gstreamer.Structure.getValue(Structure.java:148)
at org.freedesktop.gstreamer.examples.WebRTCSendRecvExample$NegotiationClosure$1.callback(WebRTCSendRecvExample.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:520)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:551)

Any thoughts? 

You received this message because you are subscribed to a topic in the Google Groups "gstreamer-java" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gstreamer-java/qiBYt4X-_Ng/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gstreamer-java+unsubscribe@googlegroups.com.

To post to this group, send email to gstreamer-java@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

Bin Zhu

unread,
Jun 6, 2018, 11:35:51 AM6/6/18
to gstream...@googlegroups.com
GstWebRTCSessionDescription's type is GType, but it's a simple C structure, not "GstStructure". I'm guessing you have to create mapping java class for this C structure instead of extending org.freedesktop.gstreamer.Structure.

Vinicius Tona

unread,
Jun 7, 2018, 8:46:08 AM6/7/18
to gstream...@googlegroups.com
But as far as I understand I mapped GstWebRTCSessionDescription as a GType and WebRTCSessionDescriptionStruct extends from com.sun.jna.Structure

GstStructure is the return of the promise that contains GstWebRTCSessionDescription for what I understood 

Bin Zhu

unread,
Jun 7, 2018, 5:54:22 PM6/7/18
to gstream...@googlegroups.com
public class WebRTCSessionDescription extends MiniObject
 +{
 +  public static final String GTYPE_NAME = "GstWebRTCSessionDescription";

So in your code "WebRTCSessionDescription" java class is registered as GType "GstWebRTCSessionDescription". This GType is a C structure, not MiniObject.

Vinicius Tona

unread,
Jun 8, 2018, 4:30:28 PM6/8/18
to gstream...@googlegroups.com
Ahhh ok.

I understand that WebRTCSessionDescription is a C structure instead of a MiniObject, but how would I map it?
As far as I understand, all GType should extend from GObject or MiniObject.

Do you have any example I can use?
Regards

Neil C Smith

unread,
Jun 11, 2018, 10:40:50 AM6/11/18
to gstream...@googlegroups.com


On Fri, 8 Jun 2018 at 21:30 Vinicius Tona <vft...@gmail.com> wrote:
Ahhh ok.

I understand that WebRTCSessionDescription is a C structure instead of a MiniObject, but how would I map it?
As far as I understand, all GType should extend from GObject or MiniObject.

Ahhh, OK, indeed! :-)


So, maybe check out how DateTIme works - it extends NativeObject directly.

Best wishes,

Neil

Antonio Morales

unread,
Oct 30, 2018, 7:54:10 PM10/30/18
to gstreamer-java
Hey Vinicius Tona,

I checked out your branch for the WebRTC work add continued worked on it and was able to get it working with the java (well scala) equivalent of the WebRTC sendrecv demos. you can look at https://github.com/gstreamer-java/gst1-java-core/pull/117 if you are still interested. 
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.

To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.
--
"If we can really understand the problem, the answer will come out of it, 
because the answer is not separate from the problem." - Krishnamurti

Vinícius Faria Toná



--
"If we can really understand the problem, the answer will come out of it, 
because the answer is not separate from the problem." - Krishnamurti

Vinícius Faria Toná

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.

To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "gstreamer-java" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gstreamer-java/qiBYt4X-_Ng/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gstreamer-jav...@googlegroups.com.

To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.



--
"If we can really understand the problem, the answer will come out of it, 
because the answer is not separate from the problem." - Krishnamurti

Vinícius Faria Toná

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.

To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.

To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.



--
"If we can really understand the problem, the answer will come out of it, 
because the answer is not separate from the problem." - Krishnamurti

Vinícius Faria Toná

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.

To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gstreamer-jav...@googlegroups.com.

To post to this group, send email to gstream...@googlegroups.com.
Visit this group at https://groups.google.com/group/gstreamer-java.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages