summaryrefslogtreecommitdiffstats
path: root/src/plugins/directshow
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2019-04-11 13:54:58 +0200
committerVal Doroshchuk <valentyn.doroshchuk@qt.io>2019-04-11 14:06:58 +0200
commit3bbeae539854c1474844c65025d40b813cec286c (patch)
tree68194b83c263759735ef0cd99c08ece2c8d0d1bb /src/plugins/directshow
parent2b34e3355c8943f41c84f39ad9a838f6edb80429 (diff)
DirectShow: Don't hide returned error when video output was not provided
Since the video output could be set after doRender(), we do not report an error in this case. But need to report the error when the video output has not been submitted at all. Otherwise it hides the error and not possible to determine playback issues. Added a fix to remember an error while rendering without the video output and handle it if playing is requested. That means, if it is required, the video output must be set before play() is called. Not all medias require valid video output, but if there is an error, we need to report about it. Fixes tst_QMediaPlayerBackend::playlist() Task-number: QTBUG-65574 Change-Id: I9faae19c08ad0273545bb7617ea3a11539084f1f Reviewed-by: Andy Shaw <andy.shaw@qt.io>
Diffstat (limited to 'src/plugins/directshow')
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp
index 2eeb06159..78b4be35b 100644
--- a/src/plugins/directshow/player/directshowplayerservice.cpp
+++ b/src/plugins/directshow/player/directshowplayerservice.cpp
@@ -524,9 +524,16 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
} else {
locker->unlock();
HRESULT hr = graph->RenderEx(pin, /*AM_RENDEREX_RENDERTOEXISTINGRENDERERS*/ 1, 0);
- // Do not return an error if no video output is set yet.
- if (SUCCEEDED(hr) || !(m_executedTasks & SetVideoOutput)) {
+ if (SUCCEEDED(hr)) {
rendered = true;
+ m_error = QMediaPlayer::NoError;
+ } else if (!(m_executedTasks & SetVideoOutput)) {
+ // Do not return an error if no video output is set yet.
+ rendered = true;
+ // Remember the error in this case.
+ // Handle it when playing is requested and no video output has been provided.
+ m_error = QMediaPlayer::ResourceError;
+ m_errorString = QString("%1: %2").arg(__FUNCTION__).arg(qt_error_string(hr));
} else if (renderHr == S_OK || renderHr == VFW_E_NO_DECOMPRESSOR){
renderHr = hr;
}
@@ -918,6 +925,16 @@ void DirectShowPlayerService::play()
void DirectShowPlayerService::doPlay(QMutexLocker *locker)
{
+ // Invalidate if there is an error while loading.
+ if (m_error != QMediaPlayer::NoError) {
+ m_graphStatus = InvalidMedia;
+ if (!m_errorString.isEmpty())
+ qWarning("%s", qPrintable(m_errorString));
+ m_errorString = QString();
+ QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
+ return;
+ }
+
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
locker->unlock();
HRESULT hr = control->Run();