Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.2.0
-
None
-
Windows 10
Qt 6.2
-
-
9285ad4a87c47d2744124f14aebe710e1ee55517 (qt/qtmultimedia/dev) ade14c3b2db9fe5e03e12c3052f0c6ead77b1481 (qt/qtmultimedia/6.2)
Description
Summary
As per attached code, using QMediaPlayer and (in my case) QVideoWidget:
- Start app and video autoplays
- Pause at e.g. 3s
- setPosition(0.5s)
- Play
EXPECTED: Video plays from setPosition location i.e. 0.5s
ACTUAL: Video plays from pause position i.e. 3s - visually it jerks forward.
Further Details from MFPlayerSession.cpp
When a IMFMediaSession pause() completes, the callback MFPlayerSession::handleSessionEvent caches the current WMF clock time as m_position:
case MESessionPaused:
m_position = position() * 10000;
Clearly, this would allow a consecutive start() to resume at m_position which makes sense.
If instead, setPosition() is called after pause(), a slightly different situation arises. setPositionInternal() calls setScrub(true) which correctly sets the frame rate to 0 and flags a scrub as taking place (m_scrubbing=true).
However, when start() is called the following happens (elided):
if (m_scrubbing) scrub(false); //...elided PROPVARIANT varStart; InitPropVariantFromInt64(m_position, &varStart); if (SUCCEEDED(m_session->Start(&GUID_NULL, &varStart))) { //...}
Thus start() always resumes from the cached m_position.
Perhaps, after turning off scrubbing state, start() could somehow adjust the cached m_position to the seek location:
if (m_scrubbing) { set m_position to current seek position. Possibly using 'm_state.start'? scrub(false) } //...elided PROPVARIANT varStart; InitPropVariantFromInt64(m_position, &varStart); if (SUCCEEDED(m_session->Start(&GUID_NULL, &varStart))) { //...}
Then it would resume playback from wherever the seek ended.
Attachments
Issue Links
- is duplicated by
-
QTBUG-96881 Seeking is impossible after pausing video
-
- Closed
-