diff options
author | Val Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-04-18 13:45:37 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2018-04-23 13:53:38 +0000 |
commit | b660ff21c6f07eb08b63ad10946326259353d864 (patch) | |
tree | 48c144873d3d95a9c31c000991583e050ba5cf8b | |
parent | 0bc28be67c2854a4c06cddd536e43ac87c225670 (diff) | |
download | qtmultimedia-b660ff21c6f07eb08b63ad10946326259353d864.tar.gz |
WinRT: Read data in callback to prevent deadlock
When playing mp3 with QMediaPlayer and seeking is performed (IMFMediaEngineEx::SetCurrentTime)
and also IMFByteStream::BeginRead is already done (actual data has not
been read yet) but IMFByteStream::EndRead is not called.
There would be a possibility to get a deadlock when the playback gets stuck.
Possible problem call flow:
1. BeginRead is called
2. Queue finishRead and postpone it
3. SetCurrentTime to new position (is called on event loop)
4. finishRead is called
5. EndRead is called
As a result MF_MEDIA_ENGINE_EVENT_SEEKING is received but
MF_MEDIA_ENGINE_EVENT_SEEKED is never received.
Proposing to read data directly from BeginRead callback and avoid
possibility to seek when data is not read yet.
Task-number: QTBUG-67614
Change-Id: I809e5df1c05de8014ebd0a48fd008a291f39433c
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
-rw-r--r-- | src/plugins/winrt/qwinrtmediaplayercontrol.cpp | 8 | ||||
-rw-r--r-- | src/plugins/winrt/qwinrtmediaplayercontrol.h | 2 |
2 files changed, 1 insertions, 9 deletions
diff --git a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp index de6b3418e..fae8e6bf0 100644 --- a/src/plugins/winrt/qwinrtmediaplayercontrol.cpp +++ b/src/plugins/winrt/qwinrtmediaplayercontrol.cpp @@ -423,7 +423,7 @@ public: HRESULT hr; hr = MFCreateAsyncResult(readResult.Get(), callback, state, &asyncResult); RETURN_HR_IF_FAILED("Failed to create read callback result"); - QMetaObject::invokeMethod(q, "finishRead", Qt::QueuedConnection); + finishRead(); return S_OK; } @@ -906,10 +906,4 @@ QVideoRendererControl *QWinRTMediaPlayerControl::videoRendererControl() return d->videoRenderer; } -void QWinRTMediaPlayerControl::finishRead() -{ - Q_D(QWinRTMediaPlayerControl); - d->streamProvider->finishRead(); -} - QT_END_NAMESPACE diff --git a/src/plugins/winrt/qwinrtmediaplayercontrol.h b/src/plugins/winrt/qwinrtmediaplayercontrol.h index 1e854f5bb..174ba664b 100644 --- a/src/plugins/winrt/qwinrtmediaplayercontrol.h +++ b/src/plugins/winrt/qwinrtmediaplayercontrol.h @@ -93,8 +93,6 @@ public: QVideoRendererControl *videoRendererControl(); private: - Q_INVOKABLE void finishRead(); - QScopedPointer<QWinRTMediaPlayerControlPrivate, QWinRTMediaPlayerControlPrivate> d_ptr; Q_DECLARE_PRIVATE(QWinRTMediaPlayerControl) }; |