gstreamer-java / gst1-java-core

Java bindings for GStreamer 1.x
GNU Lesser General Public License v3.0
194 stars 72 forks source link

Create Bindings to enable WebRTC #129

Closed a-morales closed 5 years ago

a-morales commented 5 years ago

Rebase of #117

roysjosh commented 5 years ago

Bug.

;)

I've been using this PR (and the last) for a few weeks now. I see mixed success on getting the create-offer Promise callback to fire at all. Sometimes when it fires I get this shortly after:

free(): invalid pointer
Aborted (core dumped)

Finally, sometimes after my app has been running for a while and has an active WebRTC session up I am getting:

double free or corruption (out)
Aborted (core dumped)

Any tips on debugging these issues? I tried valgrind earlier but it doesn't seem to play well with java.

neilcsmith-net commented 5 years ago

@roysjosh please open an issue with minimal code required to reproduce this please and we can discuss there. You can use environment variables to set native GStreamer logging and/or step through in the Java debugger to see if there's a specific line point this problem. It's almost certainly an ownership issue somewhere.

a-morales commented 5 years ago

@roysjosh as @neilcsmith-net stated this is likely an ownership issue and I would like to see a code example showing the issue you see. I've been able to run WebRTC sessions for 30 minutes without issues (after which I just manually stopped it) so I'm interested in how you are doing things.

As for debugging I've just enabled logging for NativeObject.java mainly for the constructor and dispose method. This is to show which objects are being created/disposed and more importantly get their addresses. The logs should show the object causing the issue and the address of that object. From there you can do foo.getNativeAddress() in your code to know the exact object throwing the error, where foo are instances of the object in the logs. From there I've been lucky enough to just look at the ownership rules of the object in the gstreamer documentation and realizing that I wasn't implementing those rules correctly. I image you can probably do a System.gc() somewhere in your code to force the garbage collector to run and throw the error you have. From there you can attach a debugger at the System.gc() and go from there.

neilcsmith-net commented 5 years ago

@a-morales thanks! How feasible is a small PR for https://github.com/gstreamer-java/gst1-java-examples that covers usage of this code that matches up with how you're using it? Would like to pull this in to release very soon in 0.9.4 before I do some refactoring that might interface with the PR.

a-morales commented 5 years ago

@neilcsmith-net I've been pretty busy the past couple of weeks, but once I have some spare time I can create a PR in the examples repo.

neilcsmith-net commented 5 years ago

@a-morales no problem! I'm away at a conference this week anyway. My plan is to try and release 0.9.4 by the end of next week (Jan 25th), ideally with this PR included.

neilcsmith-net commented 5 years ago

@a-morales apologies for the noise - needed to close and reopen to trigger Travis. Now need to work out the best strategy for the test failing - needs to be optional on earlier versions of GStreamer.

neilcsmith-net commented 5 years ago

Thank you @a-morales and @vinicius-tona for working on this. Squashed and merged via #135 because of a couple of test issues I needed to fix.