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

Alexander Matveev almatvee at openjdk.org
Thu Jul 3 21:30:46 UTC 2025


On Thu, 3 Jul 2025 14:41:01 GMT, Andy Goryachev <angorya 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 812:
> 
>> 810:             unsigned int blockSize = -1;
>> 811:             if (isRandomAccess) {
>> 812:                 blockSize = locatorStream->GetCallbacks()->ReadBlock(pos, size);
> 
> would it make sense to declare a local variable for `locatorStream->GetCallbacks()` ?
> or do we assume the compiler is smart enough to do that?

Not sure, but do not see a need from performance point view.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1839#discussion_r2183777438


More information about the openjfx-dev mailing list