Fix video setPosition call on Android#447
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes the Android JNI bridge for AndroidVideoService.setPosition(...) by invoking the correct Dalvik method ID, resolving the reported JNI “bad arguments” crash (Issue #446).
Changes:
- Switch
Java_com_gluonhq_attach_video_impl_AndroidVideoService_setPositionto calljVideoPositionMethodinstead ofjVideoPlaylistMethod. - Update the file header copyright year.
Comments suppressed due to low confidence (1)
modules/video/src/main/native/android/c/video.c:217
GetStringUTFCharsresults forjalignmentH/jalignmentVare never released (theReleaseStringUTFCharscalls are commented out), which can leak/pin memory across repeatedsetPositioncalls. Also, thedalignmentH/dalignmentVlocal refs created on the Dalvik env should be deleted before detaching to avoid growing the local-ref table if the thread stays attached.
const char *alignmentHChars = (*env)->GetStringUTFChars(env, jalignmentH, NULL);
const char *alignmentVChars = (*env)->GetStringUTFChars(env, jalignmentV, NULL);
if (isDebugAttach()) {
ATTACH_LOG_FINE("Video Alignment H: %s, V: %s", alignmentHChars, alignmentVChars);
}
ATTACH_DALVIK();
jstring dalignmentH = (*dalvikEnv)->NewStringUTF(dalvikEnv, alignmentHChars);
jstring dalignmentV = (*dalvikEnv)->NewStringUTF(dalvikEnv, alignmentVChars);
(*dalvikEnv)->CallVoidMethod(dalvikEnv, jDalvikVideoService, jVideoPositionMethod,
dalignmentH, dalignmentV, jtopPadding, jrightPadding, jbottomPadding, jleftPadding);
DETACH_DALVIK();
// (*env)->ReleaseStringUTFChars(env, jalignmentH, alignmentHChars);
// (*env)->ReleaseStringUTFChars(env, jalignmentV, alignmentVChars);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #446