Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81804

macOS 10.15 QMediaPlayer setPosition() has 10 second granularity

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.14.2, 5.15.0 Beta1
    • 5.14.0
    • Multimedia
    • None
    • macOS 10.15
    • macOS
    • 545d4aedc2af40182cd9141d014a02f919592cd9 (qt/qtmultimedia/5.14)

    Description

      1. Description

      macOS 10.15 QMediaPlayer setPosition() has 10 second granularity. The millisecond value is rounded to nearest 10000ms. Example:

      setPosition(1000) -> position set to 0s
      setPosition(2000) -> position set to 0s
      setPosition(8000) -> position set to 10s

      This makes setPosition() unusable for many applications.

      2. Possible root causes

      See line 687-689 of qtmultimedia/src/plugins/avfoundation/mediaplayer/avfmediaplayersession.mm from code.woboq.org:

      687 CMTime newTime = [playerItem currentTime];
      688 newTime.value = (pos / 1000.0f) * newTime.timescale;
      689 [playerItem seekToTime:newTime];

      On 689, there is a call to a now-deprecated variant of AVPlayerItem seekToTime method. This might be causing the problem.

      Also, there might be a numerical issue on line 688 (should this be done in double precision?).

      3. Proposed fix

      I think it should suffice to replace the existing call to seekToTime with the following (non-deprecated) variant:

      seekToTime:toleranceBefore:toleranceAfter:completionHandler:

      toleranceBefore and toleranceAfter should be set to kCMTimeZero to request sample accurate seeking.

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-81804
          # Subject Branch Project Status CR V

          Activity

            People

              valentyn.doroshchuk Valentyn Doroshchuk
              qtuser20000 Qt Qt
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes