Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Bindings to enable WebRTC #129

Closed

Conversation

a-morales
Copy link

Rebase of #117

* @return the {@link Structure} set on the promise reply.
*/
public Structure getReply() {
return Structure.objectFor(GSTPROMISE_API.gst_promise_get_reply(this), false, false);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return Structure.objectFor(GSTPROMISE_API.gst_promise_get_reply(this), false, false);
return Structure.objectFor(GSTPROMISE_API.ptr_gst_promise_get_reply(this), false, false);

Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roysjosh please add a little more explanation on a code review than "Thanks!", thanks! 😄

@roysjosh
Copy link

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
Copy link
Member

@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
Copy link
Author

@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
Copy link
Member

@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
Copy link
Author

@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
Copy link
Member

@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
Copy link
Member

@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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants