Playing different mp3 audio files on macOS (intel or apple silicon) works, but in many times, it reports wrong durations, with huge values like 9.74E7 ms.
This can be reproduced with JavaFX 11 to latest.
On Linux or Windows duration values are the correct ones.
Adding debug info with System.setProperty("jfxmedia.loglevel", "debug"), all Ma, Windows and Linux show:
Debug (0:00:00:027): Initializing GSTPlatform
For instance, running the attached test with this mp3 audio file: https://quicksounds.com/uploads/tracks/2063911170_353268591_1245381971.mp3
on Linux: Duration: 59742.040816 ms
on Windows: Duration: 59742.040816 ms
on Mac: Duration: 9.739150240362799E7 ms
The track for this file shows:
javafx.scene.media.AudioTrack[ track id = 0, name = audio/mpeg, encoding = MPEG1LAYER3, enabled = false]
I've tested many other mp3 files, that show the same issue in most of the times.
The wrong duration value seems to come from gst_element_query_duration in javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstutils.c,
For instance,
fprintf(stderr, "gst_query_parse_duration: %d\n", *duration);
shows:
gst_query_parse_duration: -1176000468,
which is then converted into 9.739150240362799E7 ms.
When the duration is correct, gst_query gives the correct value in ns, like:
gst_query_parse_duration: 1697937500 -> Duration: 1697.9375 ms
This can be reproduced with JavaFX 11 to latest.
On Linux or Windows duration values are the correct ones.
Adding debug info with System.setProperty("jfxmedia.loglevel", "debug"), all Ma, Windows and Linux show:
Debug (0:00:00:027): Initializing GSTPlatform
For instance, running the attached test with this mp3 audio file: https://quicksounds.com/uploads/tracks/2063911170_353268591_1245381971.mp3
on Linux: Duration: 59742.040816 ms
on Windows: Duration: 59742.040816 ms
on Mac: Duration: 9.739150240362799E7 ms
The track for this file shows:
javafx.scene.media.AudioTrack[ track id = 0, name = audio/mpeg, encoding = MPEG1LAYER3, enabled = false]
I've tested many other mp3 files, that show the same issue in most of the times.
The wrong duration value seems to come from gst_element_query_duration in javafx.media/src/main/native/gstreamer/gstreamer-lite/gstreamer/gst/gstutils.c,
For instance,
fprintf(stderr, "gst_query_parse_duration: %d\n", *duration);
shows:
gst_query_parse_duration: -1176000468,
which is then converted into 9.739150240362799E7 ms.
When the duration is correct, gst_query gives the correct value in ns, like:
gst_query_parse_duration: 1697937500 -> Duration: 1697.9375 ms
- relates to
-
JDK-8287822 [macos] Remove support of duplicated formats from macOS
-
- Resolved
-