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
8238755: allow to create static lib for javafx.media on linux #109
Conversation
* add support for the "resource" protocol (which is used in the GraalVM URLs pointing to statically bundled resources) * avoid duplicate symbols with different gst plugins * statically register gst plugins
👋 Welcome back jvos! A progress list of the required criteria for merging this PR into |
Webrevs
|
/reviewers 2 |
@kevinrushforth |
I'll review this and also ask @sashamatveev to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a comment about using an ifdef for GSTREAMER_LITE
in one of the modified files (the others are fine, since those files are entirely FX_specific).
One other question: do you need any changes in ConnectionHolder.java? That class checks for URL scheme to determine whether a URL is seekable.
modules/javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gst.c
Show resolved
Hide resolved
@@ -62,7 +62,8 @@ | |||
"file", | |||
"http", | |||
"https", | |||
"jrt" | |||
"jrt", | |||
"resource" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not support "resource" protocol in non-static build, so it is better to only enable it for static build. Not sure how to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an alternative, the "iPod" strategy can be used.
For some reasons, the "ipod-library" protocol is supported in the code (Locator), and if that is found, most connection code is bypassed.
That strategy seems to be much more difficult to maintain though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ipod-library" is only supported if IOSPlatform is loaded, but it will not be loaded on all platform due to check for HostUtils.isIOS(). Do you know what happens if user tries "resource" protocol on not supported platform? and same for some "unknown" protocol. If error message makes sense we can probably keep it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is not 100% correct. ipod-library is supported in case System.getProperty("os.name")
starts with "ios" (which we do in GraalVM and OpenJDK/mobile) (which does not guarantee at all that we're on ios).
We can encapsulate the "resource" protocol using the same approach (with a System.getProperty check). In that case, it might make sense to use a wide property that indicates we're running on a statically linked image. That would then be useful for all Java code, not just javafx.media. But that is a bigger change, so I'd like @kevinrushforth opinion on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make sense to add an isStaticallyLinked
method to PlatformUtil, which is where similar platform methods are kept.
As for the ConnectionHolder: the URIConnectionHolder will be used. This indeed will by default return false for EDIT: with 1c7a4eb this is now working as intended (support for seek has been added, since the lower layers support it) |
Does "resource" protocol allows random access? If yes, we should update isSeekable() to return true for resource protocol. seek() should also be updated. I think same should work as for "if ((urlConnection instanceof JarURLConnection) || isJRT())" |
Good suggestion, committed. |
…38755-staticmedia
…38755-staticmedia
…ly linked image (which has resources linked into the executable)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I ran a full test on Linux with the default dynamic libraries and all looks good. I also tested that the resource
protocol throws an informative exception:
MediaException: MEDIA_INACCESSIBLE : unknown protocol: resource
I asked one question, but whatever you decide is fine with me.
@@ -71,6 +71,7 @@ | |||
private static final boolean LINUX = os.startsWith("Linux") && !ANDROID; | |||
private static final boolean SOLARIS = os.startsWith("SunOS"); | |||
private static final boolean IOS = os.startsWith("iOS"); | |||
private static final boolean STATIC_BUILD = "Substrate VM".equals(System.getProperty("java.vm.name")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it always going to be the case that STATIC_BUILD == is SubStrate VM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good question. At this moment, there is a 1-1 link between statically linked images and Substrate VM.
In case there will be more VM's that are statically linked with the applications and resources, I assume it will be beneficial to add a property in the "java." space to reflect this. There are more parts in OpenJDK that can benefit from different treatment in case of a statically linked image.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
@johanvos This change now passes all automated pre-integration checks. When the change also fulfills all project specific requirements, type
Since the source branch of this PR was last updated there have been 9 commits pushed to the ➡️ To integrate this PR with the above commit message, type |
/integrate |
@johanvos The following commits have been pushed to master since your change was applied:
Your commit was automatically rebased without conflicts. Pushed as commit ef2f9ce. |
Mailing list message from Johan Vos on openjfx-dev: Changeset: ef2f9ce 8238755: allow to create static lib for javafx.media on linux Reviewed-by: kcr, almatvee ! modules/javafx.base/src/main/java/com/sun/javafx/PlatformUtil.java |
Progress
Issue
Reviewers
Download
$ git fetch https://git.openjdk.java.net/jfx pull/109/head:pull/109
$ git checkout pull/109