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.
--
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.
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
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);
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:>>
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
--
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.
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 :/
--
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.
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." - KrishnamurtiVinícius Faria Toná
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
--
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.
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
structure gststructure.c:1832:gboolean priv_gst_structure_append_to_gstring(const GstStructure *, GString *): No value transform to serialize field 'offer' of type 'GstWebRTCSessionDescription'
GstWebRTCSessionDescriptionAPI GSTWEBRTCSESSIONDESCRIPTION_API = GstNative.load("gstreamer-webrtc-1.0", GstWebRTCSessionDescriptionAPI.class);
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 GTypeI'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 SmithArtist & TechnologistPraxis 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.
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." - KrishnamurtiVinícius Faria Toná
To post to this group, send email to gstreamer-java@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.
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.
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." - KrishnamurtiViní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." - KrishnamurtiViní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." - KrishnamurtiViní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." - KrishnamurtiViní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.