Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8298583

Huge wrong values of duration of mp3 files on macOS using GSTPlatform

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • jfx11
    • javafx
    • os_x

      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



        

            almatvee Alexander Matveev
            jpereda Jose Pereda
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: