RFR: 8357714: AudioClip.play crash on macOS when loading resource from jar
Johan Vos
jvos at openjdk.org
Fri Jul 4 13:06:46 UTC 2025
On Thu, 3 Jul 2025 21:23:47 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
>
> modules/javafx.media/src/main/native/jfxmedia/platform/osx/avf/AVFMediaPlayer.mm line 806:
>
>> 804:
>> 805: NSMutableData* readData = nil;
>> 806: bool isRandomAccess = locatorStream->GetCallbacks()->IsRandomAccess();
>
> `URIConnectionHolder` always return `false` for "jar" or "jrt" protocol. Why it was added?
In case of jar, the ConnectionHolder is a `MemoryConnectionHolder` (because Locator already has a cacheEntry) which has true for isRandomAccess.
In case `readNextBlock` is used on a MemoryConnectionHolder, it seems all chuncks are asked and played simultaneously (bug in MemoryConnectionHolder.readNextBlock?). With `readBlock` the order and sequence seem to be ok.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1839#discussion_r2185323239
More information about the openjfx-dev
mailing list