RFR: 8357714: AudioClip.play crash on macOS when loading resource from jar

Johan Vos jvos at openjdk.org
Tue Jul 8 07:26:28 UTC 2025


On Tue, 8 Jul 2025 02:55:37 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

>> After JDK-8287822 (https://bugs.openjdk.org/browse/JDK-8287822), mpeg file content is no longer played via GSTPlatform but via OSXPlatform. 
>> We need to correctly handle data in case the source is a file inside a jar, in which case CJavaInputStreamCallbacks is used.
>> 
>> The 2 changes I made are:
>> 1. Use ConnectionHolder instead of Locator for CJavaInputStreamCallbacks in case a jar resource is used.
>> 2. In case of random access datasource, use readBlock instead of readNextBlock in AVMediaPlayer
>
> [8357714.0.patch](https://github.com/user-attachments/files/21113478/8357714.0.patch)
> - Patch which does not do seek with random access and it will read data starting from `dataRequest.requestedOffset`.
> - For size `requestedLength` is used. I do not see a need to use anything else. It will be limited to requested length or 1 Megabyte.
> - Added `NULL` checks and `callbacks` release.

@sashamatveev Thanks a lot. That all makes sense, and it seems to work indeed with the corrected position/length calculations.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1839#issuecomment-3047688717


More information about the openjfx-dev mailing list