RFR: 8240694: [macos 10.15] JavaFX Media hangs on some video files on Catalina

Kevin Rushforth kcr at openjdk.java.net
Wed Apr 8 22:54:43 UTC 2020

On Tue, 7 Apr 2020 23:44:17 GMT, Alexander Matveev <almatvee at openjdk.org> wrote:

> https://bugs.openjdk.java.net/browse/JDK-8240694
> - Original fix JDK-8236832 was reverted.
> - Timestamp will be queried on event loop thread when spectrum event is received by event loop.
> - FIx only enabled for macOS when using OSXPlatform.

Can you add a root cause / evaluation either in JBS or to this PR?

I also noted a few places where it might be helpful to add a comment in the code, so anyone looking at it later will
know why you are querying the timestamp later from the event thread.

I'll finish my testing in parallel with your addressing those comments and adding the evaluation.

modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/NativeMediaPlayer.java line 722:

> 721:                 if (listener != null) {
> 722:                     if (evt.queryTimestamp()) {
> 723:                         double timestamp = playerGetPresentationTime();

A short (one-line) comment would be useful here.

modules/javafx.media/src/main/native/jfxmedia/platform/osx/avf/AVFAudioSpectrumUnit.cpp line 194:

> 193:         double duration = (double) mSamplesPerInterval / (double) 44100;
> 194:         // Timestamp is ignored and it will be queried from event loop
> 195:         mSpectrumCallbackProc(mSpectrumCallbackContext, duration, -1.0);

You might also note that the reason it is ignored is because it will deadlock if you read it from the media thread.

modules/javafx.media/src/main/native/jfxmedia/platform/osx/avf/AVFMediaPlayer.mm line 656:

> 655:     if (eventHandler) {
> 656:         // Always true for queryTimestamp do to JDK-8240694
> 657:         eventHandler->SendAudioSpectrumEvent(timestamp, duration, true);

that should be "due" to... you might also mention that we need to query on the event thread to avoid a deadlock.


PR: https://git.openjdk.java.net/jfx/pull/163

More information about the openjfx-dev mailing list