Lyn-Tech / gstreamer-java

Automatically exported from code.google.com/p/gstreamer-java
0 stars 0 forks source link

Structure(String) crashes. #88

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This C programs works fine.

#include <gst/gst.h>
int main(int argc, char** argv) {
  g_type_init();
  gst_init(&argc, &argv);
  gchar const* str = "application/x-rtp-source-stats,"
                   "ssrc=(uint)2642542853,"
                   "internal=(boolean)true,"
                   "validated=(boolean)true,"
                   "received-bye=(boolean)false,"
                   "is-csrc=(boolean)false,"
                   "is-sender=(boolean)false,"
                   "seqnum-base=(int)-1,"
                   "clock-rate=(int)-1,"
                   "octets-sent=(guint64)0,"
                   "packets-sent=(guint64)0,"
                   "octets-received=(guint64)0,"
                   "packets-received=(guint64)0,"
                   "bitrate=(guint64)0,"
                   "packets-lost=(int)0,"
                   "jitter=(uint)0,"
                   "have-sr=(boolean)false,"
                   "sr-ntptime=(guint64)0,"
                   "sr-rtptime=(uint)0,"
                   "sr-octet-count=(uint)0,"
                   "sr-packet-count=(uint)0;";
    gchar* end;
    gst_structure_from_string(str, &end);
    return 0;
}

This Java program crashes.

import org.gstreamer.Gst;
import org.gstreamer.Structure;

public class CrashTest {
    static public void main(String[] argv) {
        String a = "application/x-rtp-source-stats," +
                "ssrc=(uint)2642542853," + 
                "internal=(boolean)true," +
                "validated=(boolean)true," +
                "received-bye=(boolean)false," +
                "is-csrc=(boolean)false," +
                "is-sender=(boolean)false," +
                "seqnum-base=(int)-1," +
                "clock-rate=(int)-1," +
                "octets-sent=(guint64)0," +
                "packets-sent=(guint64)0," +
                "octets-received=(guint64)0," +
                "packets-received=(guint64)0," +
                "bitrate=(guint64)0," + 
                "packets-lost=(int)0," +
                "jitter=(uint)0," +
                "have-sr=(boolean)false," +
                "sr-ntptime=(guint64)0," +
                "sr-rtptime=(uint)0," + 
                "sr-octet-count=(uint)0," +
                "sr-packet-count=(uint)0;";
        Gst.init();
        Structure b = new Structure(a);
    }
}

The standard error states:
(unknown:32068): GStreamer-CRITICAL **: gst_structure_empty_new: assertion 
`gst_structure_validate_name (name)' failed
Exception in thread "main" java.lang.IllegalArgumentException: Invalid native 
pointer
(backtrace omitted)

Original issue reported on code.google.com by paolo.bo...@studenti.unipr.it on 28 Nov 2011 at 6:36

GoogleCodeExporter commented 8 years ago
I would like to comment on this issue in a different situation.

When calling this kind of code repetadly like in a loop of singleton.

foo () {
 Gst.init("GstreamerTranscoding", new String[] {});
 final Pipeline pipe = new Pipeline("Gstreamer");

 // add elements to pipeline
 Gst.deinit();
}

Invalid native pointer Exception is thrown while calling Pipeline constructor.
However the same doesn't happen if the Gst.deinit() is removed.

Not sure if this is an issue or an already known bug. Any idea?

gstreamer-java  --> 1.4
gstreamer-0.10 --> 0.10.35

Original comment by sw360...@gmail.com on 23 Dec 2011 at 11:49

GoogleCodeExporter commented 8 years ago
The Gst.init() / Gst.deinit() crash should probably be reported as a separate 
issue. 

Original comment by tsha...@gmail.com on 24 Dec 2011 at 4:09

GoogleCodeExporter commented 8 years ago
the constructor you use:
Structure b = new Structure(a);
is just a name for the structure:
http://gstreamer-java.googlecode.com/svn/trunk/javadoc/1.5/org/gstreamer/Structu
re.html#Structure(java.lang.String)
you should use this fucttion:
http://gstreamer-java.googlecode.com/svn/trunk/javadoc/1.5/org/gstreamer/Structu
re.html#fromString(java.lang.String)
if it's still not working reopen this bug.

Original comment by lfar...@lfarkas.org on 4 Jan 2012 at 2:04