WMF: fix some crashes.
Task-number: QTBUG-30827 Change-Id: Iafc53f7095ad9c086b3982afb2af045c54497dc9 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
51b7864bb8
commit
653041db1d
@@ -411,6 +411,8 @@ MFPlayerSession::MFPlayerSession(MFPlayerService *playerService)
|
|||||||
, m_rateSupport(0)
|
, m_rateSupport(0)
|
||||||
, m_volumeControl(0)
|
, m_volumeControl(0)
|
||||||
, m_netsourceStatistics(0)
|
, m_netsourceStatistics(0)
|
||||||
|
, m_duration(0)
|
||||||
|
, m_sourceResolver(0)
|
||||||
, m_hCloseEvent(0)
|
, m_hCloseEvent(0)
|
||||||
, m_closing(false)
|
, m_closing(false)
|
||||||
, m_pendingRate(1)
|
, m_pendingRate(1)
|
||||||
@@ -536,7 +538,7 @@ void MFPlayerSession::load(const QMediaContent &media, QIODevice *stream)
|
|||||||
clear();
|
clear();
|
||||||
QMediaResourceList resources = media.resources();
|
QMediaResourceList resources = media.resources();
|
||||||
|
|
||||||
if (m_status == QMediaPlayer::LoadingMedia)
|
if (m_status == QMediaPlayer::LoadingMedia && m_sourceResolver)
|
||||||
m_sourceResolver->cancel();
|
m_sourceResolver->cancel();
|
||||||
|
|
||||||
if (resources.isEmpty() && !stream) {
|
if (resources.isEmpty() && !stream) {
|
||||||
@@ -581,7 +583,7 @@ void MFPlayerSession::handleSourceError(long hr)
|
|||||||
|
|
||||||
void MFPlayerSession::handleMediaSourceReady()
|
void MFPlayerSession::handleMediaSourceReady()
|
||||||
{
|
{
|
||||||
if (QMediaPlayer::LoadingMedia != m_status)
|
if (QMediaPlayer::LoadingMedia != m_status || !m_sourceResolver)
|
||||||
return;
|
return;
|
||||||
#ifdef DEBUG_MEDIAFOUNDATION
|
#ifdef DEBUG_MEDIAFOUNDATION
|
||||||
qDebug() << "handleMediaSourceReady";
|
qDebug() << "handleMediaSourceReady";
|
||||||
@@ -1786,7 +1788,7 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent)
|
|||||||
{
|
{
|
||||||
HRESULT hrStatus = S_OK;
|
HRESULT hrStatus = S_OK;
|
||||||
HRESULT hr = sessionEvent->GetStatus(&hrStatus);
|
HRESULT hr = sessionEvent->GetStatus(&hrStatus);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr) || !m_session) {
|
||||||
sessionEvent->Release();
|
sessionEvent->Release();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1085,6 +1085,9 @@ namespace
|
|||||||
HRESULT onDispatchWorkItem(IMFAsyncResult* pAsyncResult)
|
HRESULT onDispatchWorkItem(IMFAsyncResult* pAsyncResult)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&m_mutex);
|
QMutexLocker locker(&m_mutex);
|
||||||
|
if (m_shutdown)
|
||||||
|
return MF_E_SHUTDOWN;
|
||||||
|
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IUnknown *pState = NULL;
|
IUnknown *pState = NULL;
|
||||||
hr = pAsyncResult->GetState(&pState);
|
hr = pAsyncResult->GetState(&pState);
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ void SourceResolver::load(QMediaResourceList& resources, QIODevice* stream)
|
|||||||
#ifdef TEST_STREAMING
|
#ifdef TEST_STREAMING
|
||||||
//Testing stream function
|
//Testing stream function
|
||||||
if (url.scheme() == QLatin1String("file")) {
|
if (url.scheme() == QLatin1String("file")) {
|
||||||
stream = new QFile(url.path().mid(1), this);
|
stream = new QFile(url.path().mid(1));
|
||||||
if (stream->open(QIODevice::ReadOnly)) {
|
if (stream->open(QIODevice::ReadOnly)) {
|
||||||
m_stream = new MFStream(stream, true);
|
m_stream = new MFStream(stream, true);
|
||||||
hr = m_sourceResolver->BeginCreateObjectFromByteStream(
|
hr = m_sourceResolver->BeginCreateObjectFromByteStream(
|
||||||
@@ -217,7 +217,7 @@ void SourceResolver::load(QMediaResourceList& resources, QIODevice* stream)
|
|||||||
if (url.scheme() == QLatin1String("qrc")) {
|
if (url.scheme() == QLatin1String("qrc")) {
|
||||||
// If the canonical URL refers to a Qt resource, open with QFile and use
|
// If the canonical URL refers to a Qt resource, open with QFile and use
|
||||||
// the stream playback capability to play.
|
// the stream playback capability to play.
|
||||||
stream = new QFile(QLatin1Char(':') + url.path(), this);
|
stream = new QFile(QLatin1Char(':') + url.path());
|
||||||
if (stream->open(QIODevice::ReadOnly)) {
|
if (stream->open(QIODevice::ReadOnly)) {
|
||||||
m_stream = new MFStream(stream, true);
|
m_stream = new MFStream(stream, true);
|
||||||
hr = m_sourceResolver->BeginCreateObjectFromByteStream(
|
hr = m_sourceResolver->BeginCreateObjectFromByteStream(
|
||||||
|
|||||||
Reference in New Issue
Block a user